/* ============================================================
   رواج — App styles (onboarding wizard + dashboard)
   Requires style.css tokens
   ============================================================ */

/* ================= Auth pages (login / signup) ================= */
.auth-page {
  min-height: 100vh;
  background: var(--grad-soft);
  display: flex;
  flex-direction: column;
}
.auth-top {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 32px 0;
}
.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px 60px;
}
.auth-card {
  width: min(440px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
}
.auth-card h1 { font-size: 1.5rem; margin-bottom: 8px; text-align: center; }
.auth-card > p.hint { color: var(--ink-soft); text-align: center; margin-bottom: 28px; font-size: .95rem; }
.auth-card .btn-brand,
.auth-card .btn-ghost { width: 100%; }
.auth-error {
  display: none;
  align-items: center;
  gap: 8px;
  background: var(--accent-soft);
  color: #BE123C;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: .88rem;
  font-weight: 600;
  margin-bottom: 18px;
}
.auth-error.show { display: flex; }
.auth-error svg { width: 17px; height: 17px; flex-shrink: 0; }
.gsi-wrap { display: flex; justify-content: center; margin-bottom: 18px; min-height: 44px; }
.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #1F1F1F;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: .95rem;
  transition: background-color .2s ease, box-shadow .2s ease;
}
.btn-google:hover { background: #F7F7F7; box-shadow: var(--shadow-sm); }
.gsi-note {
  text-align: center;
  color: var(--muted);
  font-size: .82rem;
  background: #FAFAF8;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 18px;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 600;
  margin-bottom: 18px;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-switch { text-align: center; margin-top: 22px; font-size: .92rem; color: var(--ink-soft); }
.auth-switch a { color: var(--primary); font-weight: 700; }
.auth-switch a:hover { text-decoration: underline; }

/* ================= Onboarding ================= */
.ob-page {
  min-height: 100vh;
  background: var(--grad-soft);
  display: flex;
  flex-direction: column;
}
.ob-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 32px;
}
.ob-top .skip { color: var(--muted); font-weight: 600; font-size: .9rem; transition: color .2s ease; }
.ob-top .skip:hover { color: var(--ink); }

.ob-progress {
  width: min(560px, 90%);
  margin: 0 auto 8px;
}
.ob-progress-track {
  height: 8px;
  background: rgba(30, 27, 46, .08);
  border-radius: 999px;
  overflow: hidden;
}
.ob-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--grad-brand);
  border-radius: 999px;
  transition: width .45s ease;
}
.ob-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: .82rem;
  color: var(--muted);
  font-weight: 600;
  margin-top: 8px;
}

.ob-main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 28px 20px 60px;
}
.ob-card {
  width: min(720px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 44px 48px;
}
.ob-step { display: none; }
.ob-step.active { display: block; animation: obIn .4s ease; }
@keyframes obIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.ob-step h2 { font-size: 1.55rem; margin-bottom: 10px; }
.ob-step > p.hint { color: var(--ink-soft); margin-bottom: 28px; font-size: .98rem; }

/* option cards */
.opt-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.opt-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.opt-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.opt-card {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
  font-weight: 600;
  font-size: .95rem;
  color: var(--ink);
  text-align: start;
  min-height: 58px;
  background: #fff;
  width: 100%;
}
.opt-card:hover { border-color: #C7C2F5; background: #FCFBFF; }
.opt-card.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 4px 14px rgba(91, 77, 245, .15);
}
.opt-card .opt-icon {
  width: 40px; height: 40px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  transition: background-color .2s ease, color .2s ease;
}
.opt-card.selected .opt-icon { background: var(--primary); color: #fff; }
.opt-card .opt-icon svg { width: 21px; height: 21px; }
.opt-card small { display: block; color: var(--muted); font-weight: 500; font-size: .8rem; }
.opt-card .check {
  margin-inline-start: auto;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--line);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: transparent;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.opt-card.selected .check { background: var(--primary); border-color: var(--primary); color: #fff; }
.opt-card .check svg { width: 13px; height: 13px; }

/* compact option cards (video generation settings, etc.) */
.opt-card.sm { padding: 10px 12px; min-height: 46px; gap: 9px; font-size: .82rem; border-radius: 12px; }
.opt-card.sm .opt-icon { width: 32px; height: 32px; border-radius: 9px; }
.opt-card.sm .opt-icon svg { width: 17px; height: 17px; }
.opt-card.sm small { font-size: .72rem; }

.vid-opt-group { margin-bottom: 18px; }
.vid-opt-label { font-weight: 700; font-size: .88rem; margin-bottom: 10px; }

.tool-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* channel options */
.opt-card.channel .opt-icon { background: #F6F5FB; }

/* text inputs */
.ob-field { margin-bottom: 18px; }
.ob-field label { display: block; font-weight: 700; font-size: .92rem; margin-bottom: 8px; }
.ob-field input, .ob-field textarea, .ob-field select {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  font-size: .95rem;
  color: var(--ink);
  background: #fff;
  transition: border-color .2s ease;
}
.ob-field input:focus, .ob-field textarea:focus, .ob-field select:focus {
  outline: none;
  border-color: var(--primary);
}
.ob-field textarea { min-height: 110px; resize: vertical; }

/* frequency slider */
.freq-wrap { margin: 10px 0 24px; }
.freq-value {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--primary);
  text-align: center;
  margin-bottom: 12px;
}
input[type="range"].freq {
  width: 100%;
  accent-color: var(--primary);
  height: 34px;
  cursor: pointer;
}
.freq-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: .8rem; font-weight: 600; }

/* autopilot choice */
.pilot-choice { display: grid; gap: 12px; }
.pilot-choice .opt-card { align-items: flex-start; padding: 20px; }
.pilot-choice .opt-card b { font-family: var(--font-head); display: block; margin-bottom: 3px; }

/* wizard nav */
.ob-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 34px;
}
.ob-nav .btn[disabled] { opacity: .45; cursor: not-allowed; pointer-events: none; }

/* training screen */
.train-wrap { text-align: center; padding: 30px 0 10px; }
.train-orb {
  width: 110px; height: 110px;
  margin: 0 auto 28px;
  border-radius: 50%;
  background: var(--grad-brand);
  display: grid;
  place-items: center;
  color: #fff;
  animation: orbPulse 1.8s ease-in-out infinite;
  box-shadow: 0 0 0 16px rgba(91, 77, 245, .12);
}
.train-orb svg { width: 48px; height: 48px; }
@keyframes orbPulse {
  50% { transform: scale(1.07); box-shadow: 0 0 0 28px rgba(91, 77, 245, .05); }
}
.train-list { max-width: 380px; margin: 0 auto; display: grid; gap: 12px; text-align: start; }
.train-item {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-weight: 600;
  font-size: .93rem;
  opacity: .45;
  transition: opacity .3s ease, color .3s ease;
}
.train-item.doing { opacity: 1; color: var(--ink); }
.train-item.done { opacity: 1; color: var(--ink); }
.train-item .ti-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--line);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: transparent;
  transition: background-color .3s ease, border-color .3s ease, color .3s ease;
}
.train-item.doing .ti-icon { border-color: var(--primary); }
.train-item.doing .ti-icon::after {
  content: "";
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  border-top-color: transparent;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.train-item.done .ti-icon { background: var(--teal); border-color: var(--teal); color: #fff; }
.train-item.done .ti-icon::after { display: none; }
.train-item .ti-icon svg { width: 14px; height: 14px; }

/* ================= Dashboard ================= */
.dash-body {
  background: #F4F3FA;
  min-height: 100vh;
}
.dash-layout {
  display: grid;
  grid-template-columns: 264px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.side {
  background: #fff;
  border-inline-end: 1px solid var(--line);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.side .logo { margin-bottom: 20px; padding-inline: 8px; }
.side-account {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #F6F5FB;
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 16px;
}
.side-account-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--grad-brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-head);
  font-weight: 800;
  flex-shrink: 0;
  background-position: center;
}
.side-account-info { min-width: 0; flex: 1; }
.side-account-info b {
  display: block;
  font-size: .87rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-account-info span { display: block; font-size: .74rem; color: var(--muted); }
.side-account-logout {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--muted);
  flex-shrink: 0;
  transition: background-color .2s ease, color .2s ease;
}
.side-account-logout svg { width: 17px; height: 17px; }
.side-account-logout:hover { background: var(--accent-soft); color: var(--accent); }
.side-label {
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .04em;
  padding: 14px 12px 6px;
}
.side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  font-weight: 600;
  font-size: .93rem;
  color: var(--ink-soft);
  transition: background-color .2s ease, color .2s ease;
  cursor: pointer;
  width: 100%;
  text-align: start;
}
.side-link svg { width: 20px; height: 20px; flex-shrink: 0; }
.side-link:hover { background: #F6F5FB; color: var(--ink); }
.side-link.active { background: var(--primary-soft); color: var(--primary-dark); }
.side-link .badge {
  margin-inline-start: auto;
  background: var(--accent);
  color: #fff;
  font-size: .68rem;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding-inline: 6px;
}
.side-pilot {
  margin-top: auto;
  background: var(--dark);
  border-radius: var(--radius);
  padding: 18px;
  color: #fff;
}
.side-pilot b { font-family: var(--font-head); font-size: .95rem; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.side-pilot b svg { width: 17px; height: 17px; color: var(--amber); }
.side-pilot p { color: #B9B4D6; font-size: .8rem; line-height: 1.6; margin-bottom: 12px; }

/* Toggle switch */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-weight: 700;
  font-size: .85rem;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 48px; height: 27px;
  border-radius: 999px;
  background: rgba(255,255,255,.2);
  position: relative;
  transition: background-color .25s ease;
  flex-shrink: 0;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 21px; height: 21px;
  border-radius: 50%;
  background: #fff;
  transition: transform .25s ease;
}
.switch input:checked + .track { background: var(--teal); }
.switch input:checked + .track::after { transform: translateX(-21px); }
html[dir="ltr"] .switch input:checked + .track::after { transform: translateX(21px); }
.switch input:focus-visible + .track { outline: 3px solid var(--primary); outline-offset: 2px; }

/* Main area */
.dash-main { padding: 28px 32px 60px; min-width: 0; }
.dash-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.dash-head h1 { font-size: 1.5rem; }
.dash-head p { color: var(--muted); font-size: .9rem; }
.dash-head-actions { display: flex; gap: 10px; align-items: center; }

.pilot-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(120deg, #17142A, #2A2450);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}
.pilot-banner .pb-icon {
  width: 46px; height: 46px;
  border-radius: 14px;
  background: var(--grad-brand);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.pilot-banner .pb-icon svg { width: 24px; height: 24px; }
.pilot-banner b { font-family: var(--font-head); display: block; font-size: 1.02rem; }
.pilot-banner span.desc { color: #B9B4D6; font-size: .85rem; }
.pilot-banner .switch { margin-inline-start: auto; }

/* stat cards */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 26px;
}
.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.kpi-top span { color: var(--muted); font-size: .82rem; font-weight: 600; }
.kpi-top .kpi-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
}
.kpi-top .kpi-icon svg { width: 18px; height: 18px; }
.kpi b { font-family: var(--font-head); font-size: 1.6rem; font-weight: 800; display: block; }
.kpi .delta { font-size: .78rem; font-weight: 700; }
.kpi .delta.up { color: #0F766E; }
.kpi .delta.down { color: var(--accent); }

/* panels */
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 26px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.panel-head h2 { font-size: 1.1rem; display: flex; align-items: center; gap: 9px; }
.panel-head h2 svg { width: 20px; height: 20px; color: var(--primary); }

/* Composer */
.composer-grid { display: grid; grid-template-columns: 1fr 340px; gap: 22px; }
.composer textarea {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 130px;
  resize: vertical;
  font-size: .95rem;
  transition: border-color .2s ease;
}
.composer textarea:focus { outline: none; border-color: var(--primary); }
.composer-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: .84rem;
  font-weight: 600;
  color: var(--ink-soft);
  transition: border-color .2s ease, color .2s ease, background-color .2s ease;
  cursor: pointer;
  background: #fff;
}
.tool-chip:hover { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-soft); }
.tool-chip svg { width: 16px; height: 16px; }
.composer-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* hashtag generation */
.hashtag-block { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); }
.hashtag-block-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.hashtag-block-head > span { font-weight: 700; font-size: .92rem; }
.hashtag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.hashtag-empty { color: var(--muted); font-size: .85rem; margin: 0; }
.hashtag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: #fff;
  font-size: .85rem;
  font-weight: 600;
  color: var(--primary-dark);
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}
.hashtag-chip:hover { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-1px); }
.hashtag-chip.copied { background: var(--teal-soft); border-color: transparent; color: #0F766E; }

/* preview card */
.post-preview {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #FCFBFF;
}
.post-preview .pp-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
}
.pp-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--grad-brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-head);
  font-weight: 800;
  flex-shrink: 0;
}
.post-preview .pp-head b { font-size: .88rem; display: block; }
.post-preview .pp-head span { font-size: .74rem; color: var(--muted); }
.pp-img {
  aspect-ratio: 16/9;
  background: linear-gradient(140deg, #C4B5FD, #F43F5E 80%);
  display: grid;
  place-items: center;
  color: rgba(255,255,255,.9);
  position: relative;
}
.pp-img svg { width: 40px; height: 40px; }
.pp-img.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%);
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer {
  from { transform: translateX(100%); }
  to { transform: translateX(-100%); }
}
.pp-body { padding: 14px 16px; font-size: .88rem; color: var(--ink-soft); min-height: 74px; white-space: pre-line; }
.pp-meta {
  display: flex;
  gap: 16px;
  padding: 10px 16px 14px;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 600;
}
.pp-meta span { display: inline-flex; align-items: center; gap: 5px; }
.pp-meta svg { width: 15px; height: 15px; }

/* Calendar */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}
.cal-day-name {
  text-align: center;
  font-size: .78rem;
  font-weight: 700;
  color: var(--muted);
  padding-bottom: 6px;
}
.cal-cell {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  min-height: 118px;
  padding: 8px;
  background: #FCFCFE;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.cal-cell:hover { border-color: #C7C2F5; box-shadow: var(--shadow-sm); }
.cal-cell.today { border-color: var(--primary); background: var(--primary-soft); }
.cal-date { font-size: .78rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.cal-cell.today .cal-date { color: var(--primary-dark); }
.cal-post {
  border-radius: 8px;
  padding: 6px 8px;
  font-size: .72rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: opacity .2s ease;
}
.cal-post:hover { opacity: .85; }
.cal-post svg { width: 12px; height: 12px; flex-shrink: 0; }
.cal-post time { margin-inline-start: auto; font-weight: 500; opacity: .85; font-size: .66rem; }
.cal-post.c-ig { background: #D6338F; }
.cal-post.c-x { background: #1E1B2E; }
.cal-post.c-tt { background: #4B4763; }
.cal-post.c-yt { background: #DC2626; }
.cal-post.c-li { background: #0A66C2; }
.cal-post.c-fb { background: #1877F2; }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .78rem; color: var(--muted); font-weight: 600; }
.cal-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-inline-end: 5px; }

/* activity feed */
.feed { display: grid; gap: 12px; }
.feed-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 12px;
  background: #FAFAFE;
  border: 1px solid var(--line);
  font-size: .88rem;
}
.feed-item .fi-icon {
  width: 34px; height: 34px;
  flex-shrink: 0;
  border-radius: 10px;
  display: grid;
  place-items: center;
}
.feed-item .fi-icon svg { width: 17px; height: 17px; }
.feed-item b { display: block; font-size: .88rem; }
.feed-item span { color: var(--muted); font-size: .78rem; }

.two-col { display: grid; grid-template-columns: 1.5fr 1fr; gap: 26px; align-items: start; }

/* toast */
/* AI assistant chat widget */
.ai-chat-fab {
  position: fixed;
  bottom: 24px;
  inset-inline-end: 24px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: var(--grad-brand);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(91, 77, 245, .38);
  z-index: 95;
  transition: transform .18s ease, box-shadow .18s ease;
}
.ai-chat-fab:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(91, 77, 245, .45); }
.ai-chat-fab svg { width: 26px; height: 26px; }

.ai-chat-panel {
  position: fixed;
  bottom: 94px;
  inset-inline-end: 24px;
  width: 372px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 150px);
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 95;
  opacity: 0;
  transform: translateY(16px) scale(.97);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.ai-chat-panel.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.ai-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--primary-soft);
  flex-shrink: 0;
}
.ai-chat-head b { display: block; font-size: .95rem; }
.ai-chat-head span { display: block; font-size: .75rem; color: var(--muted); margin-top: 2px; }
.ai-chat-close {
  border: none;
  background: transparent;
  color: var(--ink);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.ai-chat-close:hover { background: #fff; }
.ai-chat-close svg { width: 16px; height: 16px; }

.ai-chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-chat-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: .87rem;
  line-height: 1.6;
  word-break: break-word;
}
.ai-chat-msg.bot { align-self: flex-start; background: #F3F2FA; color: var(--ink); border-end-start-radius: 4px; }
.ai-chat-msg.user { align-self: flex-end; background: var(--primary); color: #fff; border-end-end-radius: 4px; white-space: pre-wrap; }
.ai-chat-msg.typing { color: var(--muted); font-style: italic; }

/* Markdown rendered inside bot bubbles */
.ai-chat-msg.bot p { margin: 0 0 8px; }
.ai-chat-msg.bot p:last-child { margin-bottom: 0; }
.ai-chat-msg.bot h2, .ai-chat-msg.bot h3, .ai-chat-msg.bot h4 {
  font-size: .9rem;
  font-weight: 700;
  margin: 10px 0 4px;
  color: var(--primary);
}
.ai-chat-msg.bot h2:first-child, .ai-chat-msg.bot h3:first-child, .ai-chat-msg.bot h4:first-child { margin-top: 0; }
.ai-chat-msg.bot ul, .ai-chat-msg.bot ol {
  margin: 6px 0 8px;
  padding-inline-start: 20px;
}
.ai-chat-msg.bot li { margin-bottom: 3px; }
.ai-chat-msg.bot a { color: var(--primary); text-decoration: underline; word-break: break-all; }
.ai-chat-msg.bot a:hover { opacity: .8; }
.ai-chat-msg.bot strong { font-weight: 700; }
.ai-chat-msg.bot em { font-style: italic; }
.ai-chat-msg.bot code {
  background: rgba(91,77,245,.1);
  color: var(--primary);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: .82rem;
  font-family: monospace;
}
.ai-chat-msg.bot hr { border: none; border-top: 1px solid var(--line); margin: 8px 0; }

.ai-chat-input {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.ai-chat-input input {
  flex: 1;
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: .87rem;
  font-family: inherit;
  min-width: 0;
}
.ai-chat-input input:focus { outline: none; border-color: var(--primary); }
.ai-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.ai-chat-send svg { width: 18px; height: 18px; }
@media (max-width: 640px) {
  .ai-chat-panel { inset-inline-end: 16px; bottom: 88px; }
  .ai-chat-fab { inset-inline-end: 16px; bottom: 16px; }
}

.toast {
  position: fixed;
  bottom: 24px;
  inset-inline-start: 50%;
  transform: translateX(50%) translateY(90px);
  background: var(--ink);
  color: #fff;
  padding: 14px 24px;
  border-radius: 999px;
  font-weight: 600;
  font-size: .92rem;
  box-shadow: var(--shadow-lg);
  z-index: var(--z-toast);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: transform .35s ease;
  max-width: calc(100vw - 40px);
}
html[dir="ltr"] .toast { transform: translateX(-50%) translateY(90px); }
.toast.show { transform: translateX(50%) translateY(0); }
html[dir="ltr"] .toast.show { transform: translateX(-50%) translateY(0); }
.toast svg { width: 19px; height: 19px; color: #34D399; flex-shrink: 0; }

/* ================= Inner pages ================= */

/* page toolbar (calendar nav, filters) */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.toolbar .month-label { font-family: var(--font-head); font-weight: 800; font-size: 1.05rem; min-width: 140px; text-align: center; }
.icon-btn {
  width: 40px; height: 40px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease;
}
.icon-btn:hover { border-color: var(--primary); background: var(--primary-soft); }
.icon-btn svg { width: 19px; height: 19px; }

/* filter chips */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: .84rem;
  font-weight: 700;
  color: var(--ink-soft);
  background: #fff;
  cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease, color .2s ease, opacity .2s ease;
}
.filter-chip i { width: 10px; height: 10px; border-radius: 3px; }
.filter-chip.off { opacity: .38; }
.filter-chip:hover { border-color: var(--primary); }

/* month calendar */
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.month-grid .cal-cell { min-height: 104px; }
.cal-cell.dim { opacity: .45; background: #F7F7FB; }
.cal-cell .more { font-size: .68rem; color: var(--primary-dark); font-weight: 700; cursor: pointer; }

/* tabs */
.tabs {
  display: inline-flex;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px;
  flex-wrap: wrap;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: .9rem;
  color: var(--muted);
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}
.tab svg { width: 17px; height: 17px; }
.tab:hover { color: var(--ink); }
.tab.active { background: var(--ink); color: #fff; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: obIn .35s ease; }

/* studio asset gallery */
.asset-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.asset-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  transition: box-shadow .2s ease, transform .2s ease;
  cursor: pointer;
}
.asset-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); }
.asset-thumb {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: rgba(255,255,255,.92);
  position: relative;
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
  overflow: hidden;
}
.asset-thumb svg { width: 34px; height: 34px; }
.asset-thumb .dur {
  position: absolute;
  bottom: 8px;
  inset-inline-start: 8px;
  background: rgba(23,20,42,.75);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}
.asset-info { padding: 10px 12px 12px; }
.asset-info b { font-size: .82rem; display: block; font-family: var(--font-head); }
.asset-info span { font-size: .72rem; color: var(--muted); }

.asset-actions { display: flex; gap: 6px; margin-top: 9px; }
.asset-action-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
.asset-action-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.asset-action-btn svg { width: 15px; height: 15px; }
.asset-share-wrap { position: relative; }
.asset-share-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  inset-inline-start: 0;
  min-width: 190px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 20;
  display: grid;
  gap: 2px;
}
.share-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  text-align: start;
}
.share-item:hover { background: var(--primary-soft); }
.share-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.share-empty { font-size: .8rem; color: var(--muted); padding: 8px 10px; margin: 0; }
.share-empty a { color: var(--primary); font-weight: 600; }

/* generation placeholder: blurred "جارٍ التوليد…" card while a real asset is on its way */
.skeleton-card { animation: skeleton-enter .35s ease both; pointer-events: none; cursor: default; }
@keyframes skeleton-enter {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
.skeleton-thumb {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #EFEDFB;
}
.skeleton-thumb::before {
  content: "";
  position: absolute;
  inset: -20%;
  background: linear-gradient(120deg, #C4B5FD, #5B4DF5, #F0ABFC, #5B4DF5);
  background-size: 300% 300%;
  filter: blur(18px);
  opacity: .6;
  animation: skeleton-blur-move 3s ease-in-out infinite;
}
@keyframes skeleton-blur-move {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.skeleton-spinner {
  position: relative;
  z-index: 1;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  animation: skeleton-spin .8s linear infinite;
}
@keyframes skeleton-spin { to { transform: rotate(360deg); } }
.skeleton-text {
  position: relative;
  z-index: 1;
  font-size: .78rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.35);
  text-align: center;
  padding: 0 10px;
}
.skeleton-card .asset-info b, .skeleton-card .asset-info span { opacity: .35; }
@media (prefers-reduced-motion: reduce) {
  .skeleton-card, .skeleton-thumb::before, .skeleton-spinner { animation: none !important; }
  .skeleton-thumb::before { opacity: .35; }
}

/* prompt bar */
.prompt-bar { display: flex; gap: 10px; flex-wrap: wrap; }
.prompt-bar input, .prompt-bar textarea {
  flex: 1;
  min-width: 220px;
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 13px 20px;
  font-size: .95rem;
  font-family: inherit;
  transition: border-color .2s ease;
}
.prompt-bar textarea {
  border-radius: 16px;
  resize: none;
}
.prompt-bar input:focus, .prompt-bar textarea:focus { outline: none; border-color: var(--primary); }

.ai-enhance-btn {
  background: rgba(91,77,245,0.1);
  color: var(--primary);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}
.ai-enhance-btn:hover { background: var(--primary); color: #fff; transform: scale(1.05); }
.ai-enhance-btn svg { width: 16px; height: 16px; }
.ai-enhance-btn.enhancing { animation: pulse 1s infinite; pointer-events: none; opacity: 0.7; }
@keyframes pulse { 0% { opacity: .7; transform: scale(1); } 50% { opacity: 1; transform: scale(1.1); } 100% { opacity: .7; transform: scale(1); } }

/* inbox */
.inbox-list { display: grid; gap: 12px; }
.msg-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  transition: box-shadow .2s ease;
}
.msg-card:hover { box-shadow: var(--shadow-sm); }
.msg-card.done { opacity: .55; }
.msg-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.msg-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-family: var(--font-head);
  font-weight: 800;
  flex-shrink: 0;
}
.msg-head b { display: block; font-size: .92rem; }
.msg-head .msg-meta { font-size: .76rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.msg-meta svg { width: 13px; height: 13px; }
.msg-text { color: var(--ink-soft); font-size: .93rem; margin-bottom: 12px; }
.ai-reply {
  background: var(--primary-soft);
  border: 1px dashed #C7C2F5;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: .88rem;
  color: var(--ink);
  margin-bottom: 12px;
}
.ai-reply b {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .76rem;
  color: var(--primary-dark);
  margin-bottom: 5px;
  font-family: var(--font-head);
}
.ai-reply b svg { width: 13px; height: 13px; }
.msg-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* analytics */
.chart-panel .chart-wrap { overflow-x: auto; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg text { font-family: var(--font-body); }
.legend-row { display: flex; gap: 16px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); font-weight: 600; }
.legend-row i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-inline-end: 5px; }

.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th {
  text-align: start;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 700;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.data-table td { padding: 12px; border-bottom: 1px solid var(--line); }
.data-table tr:last-child td { border-bottom: none; }
.data-table .cell-post { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.cell-thumb { width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .74rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
}
.pill.green { background: var(--teal-soft); color: #0F766E; }
.pill.violet { background: var(--primary-soft); color: var(--primary-dark); }
.pill.rose { background: var(--accent-soft); color: #BE123C; }
.pill.gray { background: #EFEEF6; color: var(--muted); }

.insight-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: linear-gradient(120deg, #FCFBFF, #FFF6F7);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  font-size: .9rem;
  color: var(--ink-soft);
}
.insight-card .in-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--grad-brand);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.insight-card .in-icon svg { width: 18px; height: 18px; }
.insight-card b { color: var(--ink); }

/* channels */
.chan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.chan-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: box-shadow .2s ease;
}
.chan-card:hover { box-shadow: var(--shadow-sm); }
.chan-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.chan-logo {
  width: 46px; height: 46px;
  border-radius: 14px;
  background: #F6F5FB;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.chan-logo svg { width: 24px; height: 24px; }
.chan-head b { font-family: var(--font-head); display: block; font-size: 1rem; }
.chan-head span { font-size: .78rem; color: var(--muted); direction: ltr; unicode-bidi: embed; }
.chan-stats { display: flex; gap: 18px; margin-bottom: 16px; font-size: .8rem; color: var(--muted); }
.chan-stats b { display: block; font-family: var(--font-head); font-size: 1.05rem; color: var(--ink); }

/* settings */
.settings-grid { display: grid; grid-template-columns: 220px 1fr; gap: 26px; align-items: start; }
.set-nav { display: grid; gap: 4px; position: sticky; top: 24px; }
.set-section { scroll-margin-top: 20px; }
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.set-row:last-child { border-bottom: none; }
.set-row b { display: block; font-size: .95rem; }
.set-row span.hint { color: var(--muted); font-size: .82rem; }
.switch.dark-track .track { background: #D9D6E8; }
.switch.dark-track input:checked + .track { background: var(--teal); }

@media (max-width: 1100px) {
  .asset-grid { grid-template-columns: repeat(2, 1fr); }
  .chan-grid { grid-template-columns: 1fr 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .set-nav { position: static; display: flex; flex-wrap: wrap; }
}
@media (max-width: 860px) {
  .month-grid { grid-template-columns: repeat(2, 1fr); }
  .month-grid .cal-day-name { display: none; }
  .month-grid .cal-cell.dim { display: none; }
  .chan-grid { grid-template-columns: 1fr; }
  .asset-grid { grid-template-columns: 1fr 1fr; }
}

/* mobile topbar */
.dash-topbar { display: none; }

@media (max-width: 1100px) {
  .composer-grid { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .dash-layout { grid-template-columns: 1fr; }
  .side { display: none; }
  .side.open {
    display: flex;
    position: fixed;
    inset: 0 auto 0 25%;
    width: 75%;
    max-width: 300px;
    z-index: var(--z-modal);
    box-shadow: var(--shadow-lg);
  }
  .dash-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 12px 18px;
    position: sticky;
    top: 0;
    z-index: var(--z-nav);
  }
  .dash-topbar button { width: 44px; height: 44px; display: grid; place-items: center; color: var(--ink); }
  .dash-topbar button svg { width: 24px; height: 24px; }
  .dash-main { padding: 20px 16px 50px; }
  .cal-grid { grid-template-columns: repeat(2, 1fr); }
  .cal-grid .cal-day-name { display: none; }
  .cal-cell { min-height: auto; }
  .cal-cell:empty { display: none; }
  .cal-date::before { content: attr(data-day) " "; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .ob-card { padding: 30px 22px; }
  .opt-grid, .opt-grid.cols-3 { grid-template-columns: 1fr; }
  .opt-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
