/* مركز تسويق بصير — الهوية: كحلي #11132A، أزرق #649DB5، برتقالي #FAA648، سماوي #BCE4F8 */
/* خط احتياطي مستضاف محلياً (OFL) */
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("plex/ibm-plex-sans-arabic-arabic-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("plex/ibm-plex-sans-arabic-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("plex/ibm-plex-sans-arabic-arabic-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("plex/ibm-plex-sans-arabic-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("plex/ibm-plex-sans-arabic-arabic-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("plex/ibm-plex-sans-arabic-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("plex/ibm-plex-sans-arabic-arabic-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("plex/ibm-plex-sans-arabic-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --font: "Thmanyah Sans", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --display: "Thmanyah Serif Display", "Thmanyah Sans", "IBM Plex Sans Arabic", serif;
  --navy: #11132A;
  --bg: #EEF3F6;
  --surface: #FFFFFF;
  --surface-2: #F6F9FB;
  --ink: #11132A;
  --ink-2: #3D4560;
  --muted: #646C88;
  --line: #DCE3EA;
  --line-2: #C9D3DD;
  --brand: #2B7799;
  --brand-ink: #1F5F7C;
  --brand-soft: #E2F0F6;
  --attn: #FAA648;
  --attn-ink: #8A4E05;
  --attn-soft: #FFF1DE;
  --good: #2C7A4B;
  --good-soft: #E3F3E9;
  --bad: #B3261E;
  --bad-soft: #FBE7E5;
  --s-meta: #1C86B0;
  --s-tiktok: #5B4BB7;
  --s-snap: #C8731A;
  --s-salla: #11132A;
  --radius: 14px;
  --radius-s: 9px;
  --shadow: 0 1px 2px rgba(17, 19, 42, .06), 0 6px 20px -12px rgba(17, 19, 42, .18);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1320; --surface: #161D2B; --surface-2: #1B2333; --ink: #E9EEF4; --ink-2: #C3CCD9; --muted: #8E98AD;
    --line: #273146; --line-2: #34405A; --brand: #4FA8CB; --brand-ink: #7CC2DE; --brand-soft: #1A3242;
    --attn-ink: #FFC27A; --attn-soft: #3A2A14; --good: #5BC285; --good-soft: #17301F; --bad: #FF8A80; --bad-soft: #3A1B1A;
    --s-meta: #169AC8; --s-tiktok: #7F63E0; --s-snap: #C2701A; --s-salla: #E9EEF4;
    --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1320; --surface: #161D2B; --surface-2: #1B2333; --ink: #E9EEF4; --ink-2: #C3CCD9; --muted: #8E98AD;
  --line: #273146; --line-2: #34405A; --brand: #4FA8CB; --brand-ink: #7CC2DE; --brand-soft: #1A3242;
  --attn-ink: #FFC27A; --attn-soft: #3A2A14; --good: #5BC285; --good-soft: #17301F; --bad: #FF8A80; --bad-soft: #3A1B1A;
  --s-meta: #169AC8; --s-tiktok: #7F63E0; --s-snap: #C2701A; --s-salla: #E9EEF4;
  --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.6; color: var(--ink); background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
img, video { max-width: 100%; display: block; }
a { color: var(--brand-ink); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.num, .kpi-value, td.n, .cal-day-n { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.skip { position: absolute; inset-inline-start: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 9; }
.skip:focus { inset-inline-start: 8px; }
code { font-size: .9em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; direction: ltr; unicode-bidi: isolate; }

/* ---------- الإطار ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; background: var(--navy); color: #C8D2DF; display: flex; flex-direction: column; padding: 20px 14px; }
.rail-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 17px; padding: 0 8px 22px; }
.rail-brand img { border-radius: 9px; }
.rail-nav { display: flex; flex-direction: column; gap: 2px; }
.rail-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: inherit; text-decoration: none; font-weight: 500; }
.rail-nav a:hover { background: rgba(188, 228, 248, .07); color: #fff; }
.rail-nav a[aria-current="page"] { background: rgba(188, 228, 248, .13); color: #fff; }
.rail-nav svg, .tabbar svg { width: 20px; height: 20px; flex: none; }
.count { margin-inline-start: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--attn); color: #3B2300; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.rail-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.08); padding: 14px 8px 0; font-size: 13px; }
.rail-foot strong { display: block; color: #fff; font-weight: 600; }
.rail-foot a { color: #9FB2C6; }

.main { padding: 28px clamp(16px, 3vw, 40px) 64px; max-width: 1320px; width: 100%; outline: none; }
.tabbar { display: none; }

/* ---------- العناوين ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-family: var(--display); font-size: 30px; line-height: 1.25; margin: 0; font-weight: 700; letter-spacing: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
h2 { font-size: 17px; margin: 0 0 12px; font-weight: 600; }
h3 { font-size: 15px; margin: 0; font-weight: 600; }

/* ---------- الأدوات ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.approve { background: var(--good); border-color: var(--good); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .55; cursor: progress; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 8px; cursor: pointer; color: var(--ink-2); font-weight: 500; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; color: var(--ink-2); font-weight: 500; }
input:not([type="checkbox"]), select, textarea { width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); }
textarea { min-height: 96px; resize: vertical; line-height: 1.7; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.alert { background: var(--bad-soft); color: var(--bad); padding: 10px 14px; border-radius: 10px; margin: 0; }

/* ---------- البطاقات ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; }
.panel-head a, .panel-head .muted { font-size: 13px; }
.grid { display: grid; gap: 16px; }
.grid > *, .main { min-width: 0; }
.g-2 { grid-template-columns: 1.6fr 1fr; }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

/* ---------- الواجهة الرئيسية: شروق بصير ---------- */
.dawn { position: relative; overflow: hidden; border-radius: 20px; color: #fff; padding: 28px clamp(20px, 3vw, 36px) 30px; min-height: 220px;
  background: radial-gradient(ellipse 110% 130% at 50% 118%, #FCB558 0%, #FDC789 9%, #E8CDB0 16%, #C7C9BD 21%, #9BBCC4 27%, #1A90BF 40%, #127CB8 50%, #035292 64%, #182651 82%, #071532 100%);
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end; margin-bottom: 20px; }
.dawn-hello { font-size: 15px; color: rgba(255,255,255,.82); margin: 0 0 6px; }
.dawn h1 { font-family: var(--display); font-size: clamp(30px, 4.4vw, 46px); line-height: 1.15; margin: 0; font-weight: 700; text-wrap: balance; }
.dawn-list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 6px; max-width: 560px; }
.dawn-list a { display: flex; gap: 10px; align-items: baseline; color: #fff; text-decoration: none; background: rgba(7, 21, 50, .38); backdrop-filter: blur(6px); padding: 9px 14px; border-radius: 10px; }
.dawn-list a:hover { background: rgba(7, 21, 50, .55); }
.dawn-list small { color: rgba(255,255,255,.7); white-space: nowrap; }
.dawn-list span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dawn-count { font-family: var(--display); font-size: clamp(84px, 11vw, 132px); line-height: .85; font-weight: 700; color: #fff; text-shadow: 0 2px 24px rgba(7,21,50,.35); font-variant-numeric: tabular-nums; }
.dawn-count small { display: block; font-family: var(--font); font-size: 14px; font-weight: 500; text-align: center; margin-top: 10px; color: rgba(255,255,255,.85); text-shadow: none; }
.dawn.clear .dawn-count { display: none; }
.dawn .btn { background: #fff; color: var(--navy); border-color: #fff; margin-top: 18px; }

/* ---------- الأرقام ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.fresh { font-size: 13px; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; box-shadow: var(--shadow); }
.kpi { padding: 18px 20px; border-inline-start: 1px solid var(--line); }
.kpi:first-child { border-inline-start: 0; }
.kpi-label { font-size: 13px; color: var(--muted); }
.kpi-value { font-size: 28px; font-weight: 700; line-height: 1.3; margin-top: 2px; }
.kpi-value small { font-size: 14px; font-weight: 500; color: var(--muted); margin-inline-start: 4px; }
.kpi-delta { font-size: 13px; margin-top: 2px; color: var(--muted); }
.kpi-delta .up { color: var(--good); font-weight: 600; }
.kpi-delta .down { color: var(--bad); font-weight: 600; }
.chart-box { position: relative; height: 260px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
.split-note { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; }

/* ---------- الجداول ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: start; font-weight: 500; font-size: 12.5px; color: var(--muted); padding: 0 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: end; }
.src { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.src i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.cname { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

/* ---------- الاعتماد ---------- */
.inbox-list { display: grid; gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card.pending { border-inline-start: 4px solid var(--attn); }
.card-top { display: flex; gap: 12px; align-items: center; padding: 16px 20px 0; flex-wrap: wrap; }
.agent { font-size: 13px; font-weight: 600; color: var(--brand-ink); background: var(--brand-soft); padding: 2px 10px; border-radius: 20px; }
.when { font-size: 13px; color: var(--muted); margin-inline-start: auto; }
.card h3 { padding: 10px 20px 0; font-size: 17px; }
.card-body { padding: 8px 20px 4px; white-space: pre-wrap; color: var(--ink-2); max-height: 340px; overflow: auto; line-height: 1.8; }
.card-body.open { max-height: none; }
.card-media { margin: 10px 20px 0; border-radius: 12px; overflow: hidden; background: var(--surface-2); max-width: 420px; }
.quote { margin: 10px 20px 0; padding: 10px 14px; background: var(--surface-2); border-radius: 10px; color: var(--ink-2); }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 16px 20px; align-items: center; }
.card-actions .btn.approve { min-width: 120px; }
.revise-box { padding: 0 20px 16px; display: grid; gap: 8px; }
.status-pill { font-size: 12.5px; font-weight: 600; padding: 2px 10px; border-radius: 20px; background: var(--surface-2); color: var(--muted); }
.status-pill.approved, .status-pill.published { background: var(--good-soft); color: var(--good); }
.status-pill.rejected, .status-pill.hidden { background: var(--bad-soft); color: var(--bad); }
.status-pill.revised, .status-pill.pending { background: var(--attn-soft); color: var(--attn-ink); }
.history .card { box-shadow: none; }
.history .card h3 { font-size: 15px; }

/* ---------- المحتوى ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--line); gap: 1px; }
.cal-h { background: var(--surface-2); text-align: center; font-size: 12.5px; color: var(--muted); padding: 8px 0; }
.cal-day { background: var(--surface); min-height: 118px; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.cal-day.out { background: var(--surface-2); }
.cal-day.out .cal-day-n { color: var(--line-2); }
.cal-day.today .cal-day-n { background: var(--brand); color: #fff; }
.cal-day-n { font-size: 12.5px; color: var(--muted); width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.chip { text-align: start; border: 0; border-inline-start: 3px solid var(--c, var(--brand)); background: var(--surface-2); padding: 4px 7px; border-radius: 6px; font-size: 12.5px; line-height: 1.45; cursor: pointer; color: var(--ink); width: 100%; }
.chip:hover { background: var(--brand-soft); }
.chip.done { opacity: .55; text-decoration: line-through; }
.cal-list { display: none; }

/* ---------- المجتمع ---------- */
.cmt { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cmt:last-child { border-bottom: 0; }
.cmt-who { font-weight: 600; direction: ltr; unicode-bidi: isolate; }
.cmt-text { grid-column: 1 / -1; }
.cmt-reply { grid-column: 1 / -1; color: var(--ink-2); padding-inline-start: 14px; border-inline-start: 2px solid var(--line-2); font-size: 14px; }
.cat-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; min-width: 96px; }
.cat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.cat span { font-size: 13px; color: var(--muted); }

/* ---------- اطلب ---------- */
.chat { display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 460px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.chat-log { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 76%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; line-height: 1.75; }
.msg.user { align-self: flex-start; background: var(--brand); color: #fff; border-end-start-radius: 4px; }
.msg.assistant { align-self: flex-end; background: var(--surface-2); border: 1px solid var(--line); border-end-end-radius: 4px; }
.msg.thinking { color: var(--muted); }
.msg.err { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); align-items: flex-end; }
.chat-form textarea { min-height: 44px; max-height: 160px; }
.suggest { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 20px 12px; }
.suggest button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 20px; padding: 6px 14px; font-size: 13.5px; cursor: pointer; color: var(--ink-2); }
.suggest button:hover { border-color: var(--brand); color: var(--brand-ink); }

/* ---------- الإعدادات ---------- */
.set-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.conn { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.conn:last-child { border-bottom: 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-inline-end: 8px; background: var(--line-2); }
.dot.ok { background: var(--good); }
.dot.bad { background: var(--bad); }
.qr { background: #fff; padding: 12px; border-radius: 12px; width: fit-content; }

/* ---------- الدرج ---------- */
.drawer-wrap { position: fixed; inset: 0; z-index: 20; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(7, 12, 28, .45); }
.drawer { position: absolute; inset-block: 0; inset-inline-end: 0; width: min(560px, 100%); background: var(--surface); padding: 22px 24px 40px; overflow-y: auto; box-shadow: -10px 0 40px rgba(0,0,0,.2); animation: slide .22s ease-out; }
@keyframes slide { from { transform: translateX(-24px); opacity: 0; } }
.drawer h2 { font-size: 20px; }
.drawer dl { margin: 14px 0 0; display: grid; gap: 14px; }
.drawer dt { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.drawer dd { margin: 4px 0 0; white-space: pre-wrap; line-height: 1.8; }
.toast { position: fixed; bottom: 24px; inset-inline-start: 50%; transform: translateX(50%); background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 30; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; }
.toast.err { background: var(--bad); }

/* ---------- صفحات الدخول ---------- */
.gate { display: grid; place-items: center; min-height: 100vh; padding: 20px;
  background: radial-gradient(ellipse 140% 90% at 50% 120%, #FCB558 0%, #E8CDB0 12%, #9BBCC4 22%, #1A90BF 38%, #035292 58%, #182651 80%, #071532 100%); }
.gate-card { width: min(420px, 100%); background: var(--surface); border-radius: 20px; padding: 30px 28px; box-shadow: 0 20px 60px rgba(7, 21, 50, .35); }
.gate-card h1 { font-family: var(--display); font-size: 26px; margin: 14px 0 4px; }
.gate-card > p { margin: 0 0 18px; }
.gate-mark img { border-radius: 12px; }
.code-input { font-size: 24px; letter-spacing: .3em; text-align: center; }

/* ---------- الجوال ---------- */
@media (max-width: 1080px) {
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi:nth-child(3) { border-inline-start: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
  .set-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .main { padding: 18px 16px calc(84px + env(safe-area-inset-bottom)); }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset-inline: 0; bottom: 0; z-index: 10; background: var(--navy); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; color: #AFC0D2; text-decoration: none; font-size: 11px; padding: 4px 0; position: relative; }
  .tabbar a[aria-current="page"] { color: #fff; }
  .tabbar .count { position: absolute; top: 0; inset-inline-start: calc(50% + 4px); min-width: 18px; height: 18px; font-size: 11px; padding: 0 5px; }
  .page-head h1 { font-size: 24px; }
  .dawn { grid-template-columns: 1fr; padding: 22px 18px; }
  .dawn-count { order: -1; font-size: 72px; }
  .dawn-count small { text-align: start; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 22px; }
  .cal { display: none; }
  .cal-list { display: grid; gap: 14px; }
  .cal-list h3 { font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 6px; }
  .cal-list .chip { padding: 10px 12px; font-size: 14px; }
  .msg { max-width: 90%; }
  .chat { height: calc(100vh - 170px); }
  .drawer { padding: 18px 16px 40px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
