@font-face { font-family: 'IBM Plex Sans Arabic'; src: url('../assets/fonts/IBMPlexSansArabic-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans Arabic'; src: url('../assets/fonts/IBMPlexSansArabic-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans Arabic'; src: url('../assets/fonts/IBMPlexSansArabic-SemiBold.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans Arabic'; src: url('../assets/fonts/IBMPlexSansArabic-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }
/* Madar POC — design system. Logical properties everywhere so RTL/LTR flip from one source. */
:root {
  --font: 'IBM Plex Sans Arabic', 'IBM Plex Sans', system-ui, sans-serif;
  --bg: #F5F5F2; --surface: #FFFFFF; --surface-2: #FAFAF7; --surface-3: #F1F0EC;
  --line: #E6E4DE; --line-2: #EFEDE8; --text: #15171C; --text-2: #484D57; --text-3: #7A7F89;
  --ink: #15171C; --ink-text: #FFFFFF; --accent: #2B59F0; --accent-soft: #EAF0FF; --accent-text: #1E46D1;
  --brand: #E8892B;
  --ok: #127A4A; --ok-bg: #E5F4EC; --info: #0A6AAE; --info-bg: #E5F0F9; --warn: #A15C00; --warn-bg: #FDF1DC;
  --bad: #BE2F1A; --bad-bg: #FCEBE6; --muted: #656A73; --muted-bg: #EFEEEA;
  --shadow-1: 0 1px 2px rgba(20,22,28,.05), 0 1px 1px rgba(20,22,28,.03);
  --shadow-2: 0 8px 28px -8px rgba(20,22,28,.18), 0 2px 6px rgba(20,22,28,.06);
  --shadow-3: 0 24px 64px -16px rgba(20,22,28,.32);
  --r-1: 6px; --r-2: 10px; --r-3: 14px; --side: 248px; --top: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --dark: 1; } }
:root[data-theme="dark"], :root:not([data-theme="light"]):where([data-auto-dark]) {
  --bg: #0D0E11; --surface: #15171B; --surface-2: #191B20; --surface-3: #1F2228;
  --line: #262931; --line-2: #1F2228; --text: #ECEDEF; --text-2: #B3B7BF; --text-3: #868B94;
  --ink: #ECEDEF; --ink-text: #111216; --accent: #6E8BFF; --accent-soft: #1B2240; --accent-text: #9DB0FF;
  --ok: #4CC58A; --ok-bg: #12291E; --info: #5AAEEA; --info-bg: #10233A; --warn: #F0B04A; --warn-bg: #2E2312;
  --bad: #FF7A63; --bad-bg: #351A16; --muted: #9A9FA8; --muted-bg: #22252B;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 10px 30px -10px rgba(0,0,0,.7); --shadow-3: 0 24px 64px -16px rgba(0,0,0,.8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; line-height: 1.55; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: 0; }
.ic { width: 18px; height: 18px; flex: none; }
.pg { flex: none; display: block; }
bdi { unicode-bidi: isolate; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--text-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-soft); }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.app.rail { --side: 68px; }
.side { position: sticky; top: 0; height: 100vh; background: var(--surface); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 12px; gap: 6px; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 12px; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--ink); display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 20px; height: 20px; }
.brand b { font-size: 17px; font-weight: 700; }
.brand small { display: block; font-size: 12px; color: var(--text-3); margin-top: -3px; }
.new-btn { display: flex; align-items: center; justify-content: center; gap: 8px; height: 40px; border-radius: var(--r-2); background: var(--ink); color: var(--ink-text); font-weight: 600; border: 0; cursor: pointer; margin-bottom: 8px; transition: transform .12s ease, opacity .12s; }
.new-btn:hover { opacity: .92; } .new-btn:active { transform: scale(.98); }
.nav-group { font-size: 12px; color: var(--text-3); padding: 12px 10px 4px; font-weight: 500; }
.nav a { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 8px; color: var(--text-2); font-weight: 500; position: relative; }
.nav a:hover { background: var(--surface-3); color: var(--text); }
.nav a.on { background: var(--surface-3); color: var(--text); font-weight: 600; }
.nav a.on::before { content: ''; position: absolute; inset-inline-start: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--brand); }
.nav .badge { margin-inline-start: auto; }
.side-foot { margin-top: auto; display: grid; gap: 8px; }
.quota-mini { border: 1px solid var(--line); border-radius: var(--r-2); padding: 10px 12px; font-size: 12.5px; color: var(--text-2); }
.quota-mini .bar { margin-top: 6px; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 10px; }
.me .face { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #E8892B, #C2410C); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.me small { display: block; color: var(--text-3); font-size: 12px; }
.app.rail .side .brand b, .app.rail .side .brand small, .app.rail .nav-group, .app.rail .nav a span, .app.rail .nav .badge, .app.rail .new-btn span, .app.rail .quota-mini, .app.rail .me div { display: none; }
.app.rail .nav a { justify-content: center; padding: 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; height: var(--top); display: flex; align-items: center; gap: 10px; padding: 0 24px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line-2); }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); min-width: 0; }
.crumbs b { color: var(--text); font-weight: 600; }
.search { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; height: 36px; width: min(340px, 34vw); padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--text-3); cursor: text; }
.search span { flex: 1; font-size: 13px; }
kbd { font-family: var(--font); font-size: 11.5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; color: var(--text-3); background: var(--surface-2); direction: ltr; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .dot { position: absolute; top: 7px; inset-inline-end: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 2px var(--bg); }
.lang-btn { font-weight: 600; font-size: 12.5px; width: auto; padding: 0 10px; border: 1px solid var(--line); }
.page { padding: 24px; max-width: 1480px; width: 100%; margin: 0 auto; }
.page.full { max-width: none; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 700; line-height: 1.3; }
.page-head p { margin: 4px 0 0; color: var(--text-3); }
.page-head .actions { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Primitives ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, opacity .12s, transform .1s; }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.985); }
.btn.primary { background: var(--ink); color: var(--ink-text); border-color: var(--ink); font-weight: 600; }
.btn.primary:hover { opacity: .9; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.danger { color: var(--bad); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.lg { height: 44px; padding: 0 20px; font-size: 15px; border-radius: 11px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn .ic { width: 16px; height: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--shadow-1); }
.card-h { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.card-h h3 { font-size: 15px; }
.card-h .sub { color: var(--text-3); font-size: 12.5px; }
.card-h .r { margin-inline-start: auto; display: flex; gap: 6px; align-items: center; }
.card-b { padding: 16px; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12.5px; font-weight: 500; white-space: nowrap; background: var(--muted-bg); color: var(--muted); }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.info { background: var(--info-bg); color: var(--info); }
.pill.warn { background: var(--warn-bg); color: var(--warn); } .pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn i { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 11.5px; font-weight: 600; display: inline-grid; place-items: center; background: var(--surface-3); color: var(--text-2); direction: ltr; }
.badge.bad { background: var(--bad); color: #fff; } .badge.warn { background: var(--warn-bg); color: var(--warn); }
.tag { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 7px; border-radius: 6px; font-size: 12px; font-weight: 500; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.tag.lang { font-weight: 600; font-size: 11.5px; letter-spacing: .02em; direction: ltr; }
.tag.cat { background: hsl(var(--h) 70% 95%); color: hsl(var(--h) 55% 32%); }
:root[data-theme="dark"] .tag.cat { background: hsl(var(--h) 35% 18%); color: hsl(var(--h) 70% 76%); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; color: var(--text-2); cursor: pointer; white-space: nowrap; transition: all .12s; }
.chip:hover { border-color: var(--text-3); color: var(--text); }
.chip.on { background: var(--ink); color: var(--ink-text); border-color: var(--ink); }
.chip .badge { height: 18px; min-width: 18px; font-size: 11px; }
.chip.on .badge { background: rgba(255,255,255,.18); color: inherit; }
:root[data-theme="dark"] .chip.on .badge { background: rgba(0,0,0,.15); }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--line-2); }
.seg button { white-space: nowrap; height: 30px; padding: 0 12px; border: 0; background: transparent; border-radius: 7px; color: var(--text-2); font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); font-weight: 600; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs button { height: 40px; padding: 0 12px; border: 0; background: none; color: var(--text-3); font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }
.input, .select, textarea.input { width: 100%; height: 38px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text); outline: none; transition: border-color .12s, box-shadow .12s; }
textarea.input { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.65; }
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label, .lbl { font-size: 13px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.field .hint { font-size: 12.5px; color: var(--text-3); }
.counter { margin-inline-start: auto; font-weight: 500; font-size: 12px; color: var(--text-3); direction: ltr; }
.counter.over { color: var(--bad); font-weight: 600; }
.toggle { position: relative; width: 36px; height: 21px; flex: none; }
.toggle input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.toggle span { position: absolute; inset: 0; border-radius: 99px; background: var(--line); transition: .15s; }
.toggle span::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: .15s; }
.toggle input:checked + span { background: var(--ok); }
.toggle input:checked + span::after { inset-inline-start: 18px; }
.toggle input:disabled + span { opacity: .5; }
.cb { appearance: none; width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--text-3); background: var(--surface); display: inline-grid; place-items: center; cursor: pointer; flex: none; margin: 0; transition: .1s; }
.cb:checked, .cb.mixed { background: var(--ink); border-color: var(--ink); }
.cb:checked::after { content: ''; width: 9px; height: 5px; border: 2px solid var(--ink-text); border-top: 0; border-inline-end: 0; transform: translateY(-1px) rotate(-45deg); }
[dir="rtl"] .cb:checked::after { transform: translateY(-1px) rotate(-45deg) scaleX(-1); }
.cb.mixed::after { content: ''; width: 9px; height: 2px; background: var(--ink-text); border-radius: 2px; }
.cb:disabled { opacity: .35; cursor: not-allowed; }
.bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--ink); }
.bar.ok > i { background: var(--ok); } .bar.warn > i { background: var(--warn); } .bar.bad > i { background: var(--bad); }
.av { --s: 32px; position: relative; width: var(--s); height: var(--s); border-radius: 50%; flex: none; display: inline-block; background: hsl(var(--h) 45% 88%); }
:root[data-theme="dark"] .av { background: hsl(var(--h) 30% 24%); }
.av img, .av-i { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.av-i { display: grid; place-items: center; font-size: calc(var(--s) * .36); font-weight: 700; color: hsl(var(--h) 50% 30%); }
:root[data-theme="dark"] .av-i { color: hsl(var(--h) 60% 80%); }
.av-p { position: absolute; bottom: -2px; inset-inline-end: -3px; border-radius: 6px; background: var(--surface); padding: 1px; line-height: 0; }
.media { --h: 200; position: relative; display: block; overflow: hidden; background: linear-gradient(135deg, hsl(var(--h) 40% 78%), hsl(calc(var(--h) + 30) 45% 62%)); }
:root[data-theme="dark"] .media { background: linear-gradient(135deg, hsl(var(--h) 25% 26%), hsl(calc(var(--h) + 30) 30% 18%)); }
.media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: 12.5px; font-weight: 600; }
.delta .ic { width: 13px; height: 13px; stroke-width: 2.4; }
.delta.up { color: var(--ok); } .delta.down { color: var(--bad); }
.spark { color: var(--text-3); display: block; }
.spark.ok { color: var(--ok); } .spark.bad { color: var(--bad); } .spark.ink { color: var(--text); }
.empty { text-align: center; padding: 40px 16px; color: var(--text-3); }
.hr { height: 1px; background: var(--line-2); margin: 14px 0; }
.row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.stack { display: grid; gap: 4px; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-2); background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.callout .ic { margin-top: 2px; }
.callout.warn { background: var(--warn-bg); border-color: transparent; color: var(--warn); }
.callout.info { background: var(--info-bg); border-color: transparent; color: var(--info); }
.callout.bad { background: var(--bad-bg); border-color: transparent; color: var(--bad); }
.callout b { color: inherit; }
.tip { position: relative; display: inline-grid; place-items: center; color: var(--text-3); cursor: help; }
.tip .ic { width: 15px; height: 15px; }
/* user-written text (comments, replies, captions) takes its direction from its own first letter */
.cm p, .bubble p, .xcard p, .ov p, .dir-auto { unicode-bidi: plaintext; text-align: start; }
/* black X/TikTok tiles vanish on a dark surface: give them a hairline edge */
[data-theme="dark"] .pg-ink { stroke: rgba(255, 255, 255, .32); stroke-width: 1; }
.tip > span { position: absolute; bottom: calc(100% + 8px); inset-inline-start: -10px; width: 280px; padding: 10px 12px; border-radius: 10px; background: var(--ink); color: var(--ink-text); font-size: 12.5px; font-weight: 400; line-height: 1.6; box-shadow: var(--shadow-2); display: none; max-width: min(280px, 72vw); pointer-events: none; z-index: 50; text-align: start; }
.tip:hover > span, .tip:focus > span { display: block; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.t th { text-align: start; font-weight: 500; font-size: 12.5px; color: var(--text-3); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); position: sticky; top: 0; z-index: 1; }
.t th.sortable { cursor: pointer; user-select: none; } .t th.sortable:hover { color: var(--text); }
.t th .ic { width: 13px; height: 13px; vertical-align: -2px; }
.t td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr { transition: background .1s; }
.t tbody tr:hover { background: var(--surface-2); }
.t tbody tr.sel { background: var(--accent-soft); }
.t tr.click { cursor: pointer; }
.t .n { text-align: end; font-variant-numeric: tabular-nums; }
.t .who { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.t .who b { font-weight: 600; display: block; }
.t .who small { color: var(--text-3); font-size: 12.5px; direction: ltr; display: inline-block; }

/* ---------- Dashboard ---------- */
.grid { display: grid; gap: 16px; }
.grid > *, .with-facets > * { min-width: 0; }
.search input { min-width: 0; }
.rep-grid { grid-template-columns: 280px minmax(0, 1fr); align-items: start; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.filters .select { width: auto; height: 34px; font-size: 13px; padding-inline-end: 28px; }
.status-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-3); background: var(--surface); overflow: hidden; box-shadow: var(--shadow-1); margin-bottom: 16px; }
.status-strip a { padding: 14px 16px; display: grid; gap: 2px; border-inline-end: 1px solid var(--line-2); transition: background .12s; position: relative; }
.status-strip a:last-child { border-inline-end: 0; }
.status-strip a:hover { background: var(--surface-2); }
.status-strip a .k { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.status-strip a .k i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-strip a .v { font-size: 24px; font-weight: 700; line-height: 1.25; direction: ltr; text-align: start; }
.status-strip a .go { font-size: 12px; color: var(--text-3); opacity: 0; transition: opacity .12s; }
.status-strip a:hover .go { opacity: 1; }
.status-strip .sep { background: var(--surface-2); }
.kpi { padding: 16px; display: grid; gap: 8px; }
.kpi .k { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); font-weight: 500; }
.kpi .v { font-size: 26px; font-weight: 700; line-height: 1.15; direction: ltr; text-align: start; }
.kpi .meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); }
.kpi .spark { width: 100%; height: 36px; }
.attn { display: grid; }
.attn-item { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.attn-item:last-child { border-bottom: 0; }
.attn-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.attn-ic.bad { background: var(--bad-bg); color: var(--bad); } .attn-ic.warn { background: var(--warn-bg); color: var(--warn); } .attn-ic.info { background: var(--info-bg); color: var(--info); }
.attn-item .stack b { font-weight: 600; font-size: 13.5px; }
.attn-item .stack span { font-size: 12.5px; color: var(--text-3); }
.attn-item .btn { margin-inline-start: auto; }
.week { display: grid; padding: 6px 0; }
.week .d { display: grid; grid-template-columns: 112px 1fr; gap: 10px; align-items: center; padding: 8px 16px; border-bottom: 1px solid var(--line-2); }
.week .d:last-child { border-bottom: 0; }
.week .d:hover { background: var(--surface-2); }
.week .d.today { background: var(--accent-soft); }
.week .d.we .h span { color: var(--text-3); }
.week .d .h { display: flex; align-items: baseline; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.week .d .h b { font-size: 16px; color: var(--text); }
.week .items { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.week .mini { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 6px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); direction: ltr; }
.week .mini.bad { border-color: var(--bad); color: var(--bad); }
.week .stackp { gap: 2px; }
.week .stackp .pg { margin: 0; box-shadow: none; }
.week .more { font-size: 12px; color: var(--text-3); align-self: center; }
.top-videos { display: grid; }
.tv { display: grid; grid-template-columns: 22px 92px 1fr auto; gap: 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line-2); }
.tv:last-child { border-bottom: 0; }
.tv .rank { font-weight: 700; color: var(--text-3); text-align: center; }
.tv .media { width: 92px; aspect-ratio: 16/9; border-radius: 8px; }
.tv .stack b { font-size: 13.5px; font-weight: 600; }
.tv .stack span { font-size: 12.5px; color: var(--text-3); }
.tv .v { text-align: end; font-weight: 700; direction: ltr; }
.tv .v small { display: block; font-weight: 500; color: var(--text-3); font-size: 12px; }

/* ---------- Charts ---------- */
.chart { width: 100%; display: block; overflow: visible; direction: ltr; } /* svg ignores dir=; RTL would flip text-anchor */
.chart .grid-l { stroke: var(--line-2); }
.chart .axis { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.hbar { display: grid; grid-template-columns: 110px 1fr 70px; gap: 10px; align-items: center; font-size: 13px; padding: 5px 0; }
.hbar .bar { height: 8px; }
.hbar .v { text-align: end; font-weight: 600; direction: ltr; }

/* ---------- Composer ---------- */
.composer { display: grid; grid-template-columns: 320px minmax(0, 1fr) 380px; height: calc(100vh - var(--top)); background: var(--surface); }
.composer > section { min-width: 0; min-height: 0; display: flex; flex-direction: column; border-inline-end: 1px solid var(--line); }
.composer > section:last-child { border-inline-end: 0; background: var(--surface-2); }
.pane-h { padding: 14px 16px 10px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; border-bottom: 1px solid var(--line-2); }
.pane-h h2 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.pane-h h2 .step { width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--ink-text); font-size: 12px; display: grid; place-items: center; }
.pane-b { flex: 1; overflow-y: auto; min-height: 0; }
.dest-count { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line-2); font-size: 13px; }
.dest-count b { font-size: 15px; }
.dest-count .plats { display: flex; gap: 4px; margin-inline-start: auto; }
.dest-count .plats span { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; color: var(--text-2); direction: ltr; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips-label { font-size: 12px; color: var(--text-3); margin: 2px 0 -2px; }
.grp { border-bottom: 1px solid var(--line-2); }
.grp-h { display: flex; align-items: center; gap: 10px; padding: 9px 16px; cursor: pointer; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.grp-h:hover { background: var(--surface-2); }
.grp-h b { font-size: 13.5px; }
.grp-h .n { margin-inline-start: auto; font-size: 12.5px; color: var(--text-3); direction: ltr; }
.grp-h .chev { transition: transform .15s; color: var(--text-3); }
.grp.closed .chev { transform: rotate(-90deg); }
[dir="rtl"] .grp.closed .chev { transform: rotate(90deg); }
.grp.closed .grp-list { display: none; }
.acc-row { display: flex; align-items: center; gap: 10px; padding: 7px 16px 7px 16px; cursor: pointer; padding-inline-start: 26px; }
.acc-row:hover { background: var(--surface-2); }
.acc-row.dis { opacity: .55; cursor: not-allowed; }
.acc-row .stack b { font-size: 13px; font-weight: 500; }
.acc-row .stack small { font-size: 12px; color: var(--text-3); direction: ltr; text-align: start; }
.acc-row .end { margin-inline-start: auto; display: flex; gap: 6px; align-items: center; }
.sdot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.sdot.expiring { background: var(--warn); } .sdot.error { background: var(--bad); } .sdot.disconnected { background: var(--muted); }
.cmp-media { padding: 16px 20px 0; }
.drop { border: 1.5px dashed var(--line); border-radius: var(--r-3); padding: 18px; display: grid; gap: 12px; justify-items: center; text-align: center; color: var(--text-3); background: var(--surface-2); }
.drop > * { max-width: 100%; min-width: 0; }
.drop.has { display: flex; text-align: start; justify-items: initial; align-items: center; padding: 12px; gap: 14px; border-style: solid; background: var(--surface); }
.drop .media { width: 132px; aspect-ratio: 16/9; border-radius: 9px; flex: none; }
.drop .media.v { width: 60px; aspect-ratio: 9/16; }
.drop .stack b { color: var(--text); font-size: 14px; }
.recent { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.recent button { border: 1px solid var(--line); border-radius: 9px; padding: 0; background: none; cursor: pointer; overflow: hidden; flex: none; transition: transform .12s, border-color .12s; }
.recent button:hover { transform: translateY(-2px); border-color: var(--text-3); }
.recent .media { width: 104px; aspect-ratio: 16/9; }
.recent .media.v { width: 44px; height: 58px; aspect-ratio: auto; }
.ptabs { display: flex; gap: 2px; padding: 14px 20px 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.ptabs button { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 12px; border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--text-3); font-weight: 500; cursor: pointer; white-space: nowrap; }
.ptabs button.on { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }
.ptabs .badge { height: 18px; font-size: 11px; }
.ptabs .warnd { width: 7px; height: 7px; border-radius: 50%; background: var(--bad); }
.cmp-body { padding: 18px 20px 24px; }
.inherit { font-size: 12px; color: var(--text-3); display: inline-flex; align-items: center; gap: 4px; margin-inline-start: 8px; font-weight: 400; }
.inherit.own { color: var(--accent-text); }
.ai-btn { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.ai-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.ai-btn .ic { width: 14px; height: 14px; color: var(--accent); }
.tagbox { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 38px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.tagbox .tag { background: var(--surface-3); }
.tagbox .tag button { border: 0; background: none; padding: 0; cursor: pointer; color: var(--text-3); line-height: 0; }
.tagbox .tag button .ic { width: 12px; height: 12px; }
.tagbox input { border: 0; outline: 0; background: none; flex: 1; min-width: 90px; height: 26px; }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; }
.thumbs button { position: relative; border: 2px solid transparent; border-radius: 10px; padding: 0; background: none; cursor: pointer; overflow: hidden; }
.thumbs button.on { border-color: var(--accent); }
.thumbs button.on::after { content: ''; position: absolute; top: 6px; inset-inline-end: 6px; width: 18px; height: 18px; border-radius: 50%; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center/11px no-repeat; }
.thumbs .media { width: 128px; aspect-ratio: 16/9; }
.thumbs .add { width: 128px; aspect-ratio: 16/9; border: 1.5px dashed var(--line); border-radius: 10px; display: grid; place-items: center; color: var(--text-3); font-size: 12.5px; }
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opt { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.opt .stack b { font-size: 13px; font-weight: 600; }
.opt .stack span { font-size: 12px; color: var(--text-3); }
.opt .toggle { margin-inline-start: auto; }
.xrow { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: var(--surface); }
.xrow.dup { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
.xrow .row { margin-bottom: 8px; }
.xrow textarea { min-height: 74px; }
.sim { font-size: 12px; font-weight: 600; direction: ltr; }
.sim.bad { color: var(--bad); } .sim.ok { color: var(--ok); } .sim.warn { color: var(--warn); }
.cmp-foot { display: flex; align-items: center; flex-wrap: wrap; row-gap: 8px; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface); }
.cmp-foot .when { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-inline-start: auto; }
.cmp-foot .input { height: 36px; width: auto; }
.pv-head { padding: 14px 16px 10px; display: grid; gap: 10px; }
.pv-plats { display: flex; gap: 6px; }
.pv-plats button { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; }
.pv-plats button.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface-2), 0 0 0 3.5px var(--text); }
.pv-stage { padding: 4px 16px 16px; display: grid; justify-items: center; }
.yt { width: 100%; background: var(--surface); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.yt .media { aspect-ratio: 16/9; }
.yt .media .len { position: absolute; bottom: 8px; inset-inline-end: 8px; background: rgba(0,0,0,.8); color: #fff; font-size: 11.5px; padding: 1px 5px; border-radius: 4px; direction: ltr; }
.yt .meta { display: flex; gap: 10px; padding: 10px 12px 12px; }
.yt .meta b { font-size: 14px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.yt .meta span { font-size: 12.5px; color: var(--text-3); }
.phone { width: 236px; aspect-ratio: 9/18.5; border-radius: 30px; background: #000; padding: 8px; box-shadow: var(--shadow-2); position: relative; }
.phone .screen { position: relative; width: 100%; height: 100%; border-radius: 23px; overflow: hidden; background: #222; }
.phone .media { position: absolute; inset: 0; }
.phone .ov { position: absolute; inset: auto 0 0 0; padding: 12px 52px 14px 12px; background: linear-gradient(transparent, rgba(0,0,0,.72)); color: #fff; font-size: 12.5px; line-height: 1.5; }
[dir="rtl"] .phone .ov { padding: 12px 12px 14px 52px; }
.phone .ov b { display: block; margin-bottom: 3px; font-size: 13px; }
.phone .ov p { margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; opacity: .92; }
.phone .rail { position: absolute; inset-inline-end: 8px; bottom: 70px; display: grid; gap: 14px; color: #fff; justify-items: center; font-size: 11px; direction: ltr; }
.phone .rail .ic { width: 24px; height: 24px; stroke-width: 2; }
.phone .chipp { position: absolute; top: 12px; inset-inline-start: 12px; background: rgba(0,0,0,.5); color: #fff; font-size: 11.5px; padding: 3px 8px; border-radius: 99px; display: flex; gap: 5px; align-items: center; }
.phone .chipp .ic { width: 13px; height: 13px; }
.xcard { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 8px; }
.xcard .media { aspect-ratio: 16/9; border-radius: 12px; }
.xcard p { margin: 0; font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
.checks { margin: 0 16px 16px; border: 1px solid var(--line); border-radius: var(--r-3); background: var(--surface); }
.checks h4 { font-size: 13.5px; padding: 11px 14px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 8px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 9px 14px; font-size: 13px; border-bottom: 1px solid var(--line-2); }
.check:last-child { border-bottom: 0; }
.check .ic { width: 16px; height: 16px; margin-top: 2px; }
.check.ok .ic { color: var(--ok); } .check.bad .ic { color: var(--bad); } .check.warn .ic { color: var(--warn); }
.check.bad { background: color-mix(in srgb, var(--bad-bg) 55%, transparent); }
.check a { color: var(--accent-text); font-weight: 600; margin-inline-start: auto; white-space: nowrap; cursor: pointer; }
.ai-panel { position: fixed; top: var(--top); bottom: 0; inset-inline-end: 0; width: 400px; background: var(--surface); border-inline-start: 1px solid var(--line); box-shadow: var(--shadow-3); z-index: 25; transform: translateX(105%); transition: transform .22s cubic-bezier(.2,.7,.2,1); display: flex; flex-direction: column; }
[dir="rtl"] .ai-panel { transform: translateX(-105%); }
.ai-panel.open { transform: none !important; }
.ai-sug { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 8px; margin-bottom: 10px; }
.ai-sug p { margin: 0; font-size: 13.5px; line-height: 1.65; }
.ai-sug .row .btn { margin-inline-start: auto; }

/* ---------- Batch ---------- */
.batch-hero { display: grid; grid-template-columns: 220px 1fr; gap: 20px; padding: 18px; }
.batch-hero .media { aspect-ratio: 16/9; border-radius: 12px; }
.prog { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--surface-3); gap: 2px; }
.prog i { display: block; height: 100%; transition: width .5s ease; }
.prog .ok { background: var(--ok); } .prog .warn { background: var(--warn); } .prog .bad { background: var(--bad); } .prog .info { background: var(--info); opacity: .5; }
.counts { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 12px; }
.counts div { display: grid; }
.counts b { font-size: 22px; direction: ltr; text-align: start; }
.counts span { font-size: 12.5px; color: var(--text-3); display: flex; gap: 6px; align-items: center; }
.counts span i { width: 7px; height: 7px; border-radius: 50%; }
.step-prog { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.step-prog .bar { flex: 1; height: 5px; }
.log { margin: 0; padding: 10px 14px 12px; list-style: none; font-size: 12.5px; color: var(--text-2); background: var(--surface-2); border-radius: 10px; display: grid; gap: 5px; }
.log li { display: flex; gap: 10px; }
.log time { color: var(--text-3); direction: ltr; min-width: 64px; font-variant-numeric: tabular-nums; }
.idem { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: var(--r-2); background: var(--surface-2); border: 1px dashed var(--line); font-size: 13px; color: var(--text-2); }
.idem code { font-size: 12px; background: var(--surface-3); padding: 2px 6px; border-radius: 5px; direction: ltr; display: inline-block; }

/* ---------- Calendar ---------- */
.cal-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-bar h2 { font-size: 18px; min-width: 170px; }
.cal-bar .sp { flex: 1; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-3); overflow: hidden; background: var(--line-2); gap: 1px; }
.month .dow { background: var(--surface-2); padding: 8px 10px; font-size: 12.5px; color: var(--text-3); font-weight: 500; }
.month .cell { background: var(--surface); min-height: 128px; padding: 6px; display: grid; align-content: start; gap: 4px; position: relative; transition: background .1s; }
.month .cell.out { background: var(--surface-2); }
.month .cell.out .dn { opacity: .45; }
.month .cell.we { background: color-mix(in srgb, var(--surface-3) 50%, var(--surface)); }
.month .cell.drop-on { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.month .cell .dn { font-size: 12.5px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; padding: 2px 4px; }
.month .cell.today .dn b { background: var(--ink); color: var(--ink-text); border-radius: 99px; min-width: 24px; height: 24px; display: inline-grid; place-items: center; }
.month .cell .add { opacity: 0; border: 0; background: var(--surface-3); border-radius: 6px; width: 22px; height: 22px; display: grid; place-items: center; cursor: pointer; color: var(--text-2); }
.month .cell:hover .add { opacity: 1; }
.bcard { display: grid; gap: 3px; padding: 5px 7px 6px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); border-inline-start: 3px solid var(--info); cursor: pointer; font-size: 12px; box-shadow: var(--shadow-1); transition: transform .1s, box-shadow .1s; }
.bcard:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.bcard.published { border-inline-start-color: var(--ok); }
.bcard.partial { border-inline-start-color: var(--bad); }
.bcard .r1 { display: flex; align-items: center; gap: 5px; }
.bcard .r1 time { font-weight: 600; direction: ltr; }
.bcard .r1 .x { margin-inline-start: auto; color: var(--text-3); font-weight: 600; direction: ltr; }
.bcard .r1 .fail { color: var(--bad); font-weight: 700; display: inline-flex; align-items: center; gap: 2px; }
.bcard .r1 .fail .ic { width: 12px; height: 12px; }
.bcard .t { font-weight: 500; color: var(--text); overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.45; font-size: 12.5px; }
.stackp { display: inline-flex; direction: ltr; }
.stackp .pg { margin-inline-end: -4px; border-radius: 4px; box-shadow: 0 0 0 1.5px var(--surface); }
.morelink { font-size: 12px; color: var(--text-3); padding: 0 4px; cursor: pointer; }
.weekv { display: grid; grid-template-columns: 56px repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-3); overflow: hidden; background: var(--surface); }
.weekv .hd { padding: 8px; font-size: 12.5px; text-align: center; border-bottom: 1px solid var(--line); background: var(--surface-2); color: var(--text-3); }
.weekv .hd b { display: block; font-size: 17px; color: var(--text); }
.weekv .hd.today b { color: var(--accent-text); }
.weekv .hr-l { font-size: 11.5px; color: var(--text-3); padding: 4px 6px; border-top: 1px solid var(--line-2); text-align: center; direction: ltr; }
.weekv .slot { border-top: 1px solid var(--line-2); border-inline-start: 1px solid var(--line-2); min-height: 58px; padding: 3px; display: grid; gap: 3px; align-content: start; }
.weekv .slot.we { background: var(--surface-2); }
.weekv .slot.now { box-shadow: inset 0 2px 0 var(--bad); }
.listv { display: grid; gap: 18px; }
.listv h3 { font-size: 14px; margin-bottom: 8px; color: var(--text-2); }
.lrow { display: grid; grid-template-columns: 64px 108px minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 6px; cursor: pointer; }
.lrow:hover { box-shadow: var(--shadow-2); }
.lrow time { font-weight: 700; direction: ltr; }
.lrow .media { width: 108px; aspect-ratio: 16/9; border-radius: 8px; }
.dayv { display: grid; gap: 8px; }
.dayv .slotrow { display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: start; }
.dayv .slotrow time { padding-top: 10px; font-weight: 700; direction: ltr; text-align: center; }
.dayv .slotbox { border: 1px dashed var(--line); border-radius: 12px; padding: 8px; min-height: 52px; display: grid; gap: 6px; }
.dayv .slotbox.empty { display: flex; align-items: center; color: var(--text-3); font-size: 13px; cursor: pointer; }
.dayv .slotbox.empty:hover { border-color: var(--text-3); color: var(--text); }

/* ---------- Accounts ---------- */
.with-facets { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 18px; align-items: start; }
.facets { position: sticky; top: calc(var(--top) + 16px); display: grid; gap: 18px; }
.facet h4 { font-size: 12.5px; color: var(--text-3); font-weight: 500; margin-bottom: 6px; }
.facet label { display: flex; align-items: center; gap: 9px; padding: 5px 6px; border-radius: 7px; cursor: pointer; font-size: 13.5px; }
.facet label:hover { background: var(--surface-3); }
.facet label .badge { margin-inline-start: auto; background: transparent; color: var(--text-3); font-weight: 500; }
.bulk { position: sticky; top: calc(var(--top) + 8px); z-index: 5; display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; border-radius: 12px; background: var(--ink); color: var(--ink-text); margin-bottom: 10px; box-shadow: var(--shadow-2); animation: rise .18s ease; }
.bulk b { margin-inline-end: 6px; }
.bulk .btn { background: transparent; border-color: rgba(255,255,255,.22); color: inherit; }
:root[data-theme="dark"] .bulk .btn { border-color: rgba(0,0,0,.2); }
.bulk .btn:hover { background: rgba(255,255,255,.12); }
@keyframes rise { from { transform: translateY(6px); opacity: 0; } }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .input { max-width: 320px; height: 36px; }
.exp { direction: ltr; font-weight: 600; font-size: 12.5px; }
.exp.warn { color: var(--warn); } .exp.bad { color: var(--bad); }

/* drawer */
#drawer { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
#drawer.open { pointer-events: auto; }
.drawer-bg { position: absolute; inset: 0; background: rgba(10,12,16,.32); animation: fade .15s; }
.drawer-card { position: absolute; top: 0; bottom: 0; inset-inline-end: 0; width: min(520px, 100%); background: var(--surface); box-shadow: var(--shadow-3); overflow-y: auto; animation: slideIn .22s cubic-bezier(.2,.7,.2,1); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } }
[dir="rtl"] .drawer-card { animation-name: slideInR; }
@keyframes slideInR { from { transform: translateX(-30px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.dr-h { padding: 18px 20px; border-bottom: 1px solid var(--line-2); display: flex; gap: 12px; align-items: center; position: sticky; top: 0; background: var(--surface); z-index: 2; }
.dr-h h3 { font-size: 17px; }
.dr-h .icon-btn { margin-inline-start: auto; }
.dr-b { padding: 18px 20px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 14px; font-size: 13.5px; }
.kv dt { color: var(--text-3); } .kv dd { margin: 0; font-weight: 500; }
.sect { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }

/* modal */
#modal { position: fixed; inset: 0; z-index: 70; display: none; place-items: center; padding: 20px; }
#modal.open { display: grid; }
.modal-bg { position: absolute; inset: 0; background: rgba(10,12,16,.42); animation: fade .15s; }
.modal-card { position: relative; width: min(560px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-3); animation: pop .18s cubic-bezier(.2,.7,.2,1); }
.modal-card.wide { width: min(880px, 100%); }
@keyframes pop { from { transform: scale(.97) translateY(6px); opacity: 0; } }
.m-h { padding: 18px 20px 6px; display: flex; gap: 12px; align-items: flex-start; }
.m-h h3 { font-size: 18px; } .m-h p { margin: 4px 0 0; color: var(--text-3); font-size: 13.5px; }
.m-h .icon-btn { margin-inline-start: auto; }
.m-b { padding: 14px 20px; }
.m-f { padding: 14px 20px 18px; display: flex; gap: 8px; justify-content: flex-end; }
.sum-plats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 6px 0 14px; }
.sum-plats div { border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: grid; gap: 4px; justify-items: start; }
.sum-plats b { font-size: 20px; direction: ltr; }
.sum-plats span { font-size: 12px; color: var(--text-3); }
.plat-choose { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plat-choose button { display: grid; gap: 8px; padding: 14px; text-align: start; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; }
.plat-choose button:hover { border-color: var(--text); }
.plat-choose b { font-size: 15px; }
.plat-choose span { font-size: 12.5px; color: var(--text-3); line-height: 1.6; }

/* toast */
.toast { position: fixed; bottom: 22px; inset-inline-start: 50%; transform: translate(-50%, 20px); background: var(--ink); color: var(--ink-text); padding: 11px 16px; border-radius: 12px; display: flex; gap: 10px; align-items: center; box-shadow: var(--shadow-3); opacity: 0; pointer-events: none; transition: .2s; z-index: 90; font-weight: 500; max-width: calc(100vw - 32px); }
[dir="rtl"] .toast { transform: translate(50%, 20px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
[dir="rtl"] .toast.show { transform: translate(50%, 0); }
.toast .ic { color: #4CC58A; } .toast.bad .ic { color: #FF7A63; }

/* ---------- Library ---------- */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.asset { border: 1px solid var(--line); border-radius: var(--r-3); background: var(--surface); overflow: hidden; cursor: pointer; transition: box-shadow .12s, transform .12s; display: flex; flex-direction: column; }
.asset:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.asset .media { aspect-ratio: 16/10; }
.asset .media .k { position: absolute; top: 8px; inset-inline-start: 8px; display: flex; gap: 5px; }
.asset .media .k span { background: rgba(0,0,0,.62); color: #fff; font-size: 11.5px; padding: 2px 7px; border-radius: 6px; display: inline-flex; gap: 4px; align-items: center; backdrop-filter: blur(4px); }
.asset .media .k .ic { width: 12px; height: 12px; }
.asset .media .len { position: absolute; bottom: 8px; inset-inline-end: 8px; background: rgba(0,0,0,.72); color: #fff; font-size: 11.5px; padding: 1px 6px; border-radius: 5px; direction: ltr; }
.asset .media.vert img { object-fit: cover; object-position: center 30%; }
.asset .media.file { display: grid; place-items: center; color: hsl(var(--h) 40% 30%); }
:root[data-theme="dark"] .asset .media.file { color: hsl(var(--h) 60% 80%); }
.asset .media.file .ic { width: 38px; height: 38px; stroke-width: 1.4; }
.asset .ab { padding: 10px 12px 12px; display: grid; gap: 7px; }
.asset .ab b { font-size: 13.5px; font-weight: 600; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 39px; }
.asset .ab .row { font-size: 12px; color: var(--text-3); gap: 6px; flex-wrap: wrap; }
.upl { position: fixed; bottom: 20px; inset-inline-end: 20px; width: 340px; z-index: 40; animation: rise .2s; }
.upl .card-b { display: grid; gap: 10px; }

/* ---------- Inbox ---------- */
.inbox { display: grid; grid-template-columns: 250px 400px minmax(0, 1fr); height: calc(100vh - var(--top)); background: var(--surface); }
.inbox > section { min-width: 0; border-inline-end: 1px solid var(--line); overflow-y: auto; min-height: 0; }
.inbox > section:last-child { border-inline-end: 0; background: var(--surface-2); display: flex; flex-direction: column; }
.q { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; border-radius: 9px; cursor: pointer; color: var(--text-2); font-weight: 500; margin: 0 8px; }
.q:hover { background: var(--surface-3); }
.q.on { background: var(--surface-3); color: var(--text); font-weight: 600; }
.q .badge { margin-inline-start: auto; }
.cm { display: grid; grid-template-columns: 36px 1fr; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); cursor: pointer; position: relative; }
.cm:hover { background: var(--surface-2); }
.cm.on { background: var(--accent-soft); }
.cm.unread::before { content: ''; position: absolute; top: 18px; inset-inline-start: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.cm .who { display: flex; gap: 6px; align-items: center; font-size: 13px; }
.cm .who b { font-weight: 600; }
.cm .who time { margin-inline-start: auto; font-size: 12px; color: var(--text-3); }
.cm p { margin: 3px 0 5px; font-size: 13.5px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cm .on-post { font-size: 12px; color: var(--text-3); display: flex; gap: 6px; align-items: center; }
.face2 { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; }
.thread-h { padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--surface); display: flex; gap: 12px; align-items: center; }
.thread-b { flex: 1; overflow-y: auto; padding: 18px; display: grid; gap: 14px; align-content: start; }
.post-ref { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.post-ref .media { aspect-ratio: 16/9; border-radius: 8px; }
.bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; max-width: 560px; }
.bubble p { margin: 4px 0 0; font-size: 14px; line-height: 1.7; }
.bubble.me { justify-self: end; background: var(--ink); color: var(--ink-text); border-color: var(--ink); }
.reply-box { border-top: 1px solid var(--line); background: var(--surface); padding: 12px 18px 14px; display: grid; gap: 10px; }
.sugs { display: flex; gap: 6px; flex-wrap: wrap; }
.sugs button { text-align: start; border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 7px 10px; font-size: 13px; cursor: pointer; max-width: 100%; display: flex; gap: 6px; align-items: flex-start; line-height: 1.5; }
.sugs button:hover { border-color: var(--accent); }
.sugs .ic { width: 14px; height: 14px; color: var(--accent); margin-top: 3px; }

/* ---------- Reports ---------- */
.rep-list { display: grid; gap: 8px; }
.rep-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.rep-item.on { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.rep-item .ic-box { width: 38px; height: 38px; border-radius: 10px; background: var(--surface-3); display: grid; place-items: center; }
.paper { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-2); padding: 34px 38px; }
.paper h2 { font-size: 22px; }
.paper .sec { margin-top: 26px; }
.paper .sec h3 { font-size: 15px; margin-bottom: 10px; display: flex; gap: 8px; align-items: center; }
.paper .sec h3::before { content: ''; width: 4px; height: 16px; border-radius: 2px; background: var(--brand); }
.changes { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.changes li { display: flex; gap: 10px; font-size: 13.5px; line-height: 1.6; }
.changes li .ic { width: 16px; height: 16px; margin-top: 3px; flex: none; }

/* ---------- Health ---------- */
.sev { width: 4px; align-self: stretch; border-radius: 3px; }
.sev.bad { background: var(--bad); } .sev.warn { background: var(--warn); } .sev.info { background: var(--info); }
.prob { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.prob:last-child { border-bottom: 0; }
.prob .stack b { font-size: 14px; }
.prob .stack span { font-size: 12.5px; color: var(--text-3); }
.prob .impact { font-size: 12.5px; color: var(--text-2); background: var(--surface-3); border-radius: 7px; padding: 3px 8px; white-space: nowrap; }
.prob .btn { margin-inline-start: auto; }
.quota { display: grid; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.quota:last-child { border-bottom: 0; }
.quota .row span:last-child { margin-inline-start: auto; font-size: 12.5px; color: var(--text-3); direction: ltr; }
.quota .bar { height: 8px; }

/* notifications drawer list */
.nt { display: flex; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line-2); }
.nt:hover { background: var(--surface-2); }
.nt .stack span { font-size: 13.5px; line-height: 1.6; }
.nt .stack time { font-size: 12px; color: var(--text-3); }

/* command palette */
.cmdk { padding: 0; }
.cmdk input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; height: 54px; font-size: 15px; padding: 0 18px; box-shadow: none !important; }
.cmdk .res { max-height: 380px; overflow-y: auto; padding: 6px; }
.cmdk .res a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 9px; }
.cmdk .res a:hover, .cmdk .res a.on { background: var(--surface-3); }
.cmdk .res h5 { margin: 8px 12px 4px; font-size: 12px; color: var(--text-3); font-weight: 500; }

/* ---------- Mobile ---------- */
.mnav { display: none; }
.only-m { display: none; }
.pane-steps { display: none; }
@media (max-width: 1280px) {
  .hide-l { display: none; }
  .composer { grid-template-columns: 290px minmax(0, 1fr) 340px; }
  .inbox { grid-template-columns: 210px 340px minmax(0, 1fr); }
}
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main, .g3 { grid-template-columns: 1fr; }
  .status-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .status-strip a:nth-child(4) { border-inline-end: 0; }
  .status-strip a:nth-child(-n+4) { border-bottom: 1px solid var(--line-2); }
  .composer { grid-template-columns: 280px minmax(0, 1fr); }
  .composer > section.pv { display: none; }
  .composer.show-pv > section.pv { display: flex; position: fixed; inset: var(--top) 0 0 auto; width: 380px; z-index: 22; box-shadow: var(--shadow-3); }
  .inbox { grid-template-columns: 300px minmax(0, 1fr); }
  .inbox > section.queues { display: none; }
  .with-facets { grid-template-columns: 1fr; }
  .facets { position: static; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); }
  .rep-grid { grid-template-columns: 1fr; }
  .rep-col { position: static !important; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .mnav { display: flex; position: fixed; bottom: 0; inset-inline: 0; z-index: 40; height: 62px; background: var(--surface); border-top: 1px solid var(--line); justify-content: space-around; align-items: center; padding-bottom: env(safe-area-inset-bottom); }
  .mnav a { display: grid; justify-items: center; gap: 2px; font-size: 11.5px; color: var(--text-3); padding: 6px 4px; min-width: 56px; }
  .mnav a.on { color: var(--text); font-weight: 600; }
  .mnav a.plus { width: 46px; height: 46px; min-width: 0; border-radius: 14px; background: var(--ink); color: var(--ink-text); place-items: center; display: grid; margin-top: -18px; box-shadow: var(--shadow-2); }
  .mnav a.plus .ic { width: 22px; height: 22px; }
  .main { padding-bottom: 70px; }
  .top { padding: 0 16px; }
  .search { width: auto; flex: none; } .search span, .search kbd { display: none; }
  .page { padding: 16px; }
  .page-head h1 { font-size: 21px; }
  .g4, .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .status-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-strip a { border-bottom: 1px solid var(--line-2); }
  .status-strip a:nth-child(2n) { border-inline-end: 0; }
  .kpi .v { font-size: 21px; }
  .tv { grid-template-columns: 18px 72px 1fr auto; padding: 10px 12px; }
  .tv .media { width: 72px; }
  .composer { grid-template-columns: 1fr; height: auto; min-height: calc(100vh - var(--top) - 62px); }
  .composer > section { display: none; border: 0; }
  .composer > section.cur { display: flex; }
  .composer.show-pv > section.pv { position: static; width: auto; box-shadow: none; }
  .pane-steps { display: flex; position: sticky; top: var(--top); z-index: 6; background: var(--surface); border-bottom: 1px solid var(--line); }
  .pane-steps button { flex: 1; height: 44px; border: 0; background: none; font-weight: 600; color: var(--text-3); border-bottom: 2px solid transparent; }
  .pane-steps button.on { color: var(--text); border-bottom-color: var(--text); }
  .cmp-foot { position: sticky; bottom: 62px; flex-wrap: wrap; }
  .cmp-foot .when { margin-inline-start: 0; width: 100%; }
  .opt-grid { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: 1fr; height: auto; }
  .inbox > section.thread { display: none; }
  .inbox.reading > section.list { display: none; }
  .inbox.reading > section.thread { display: flex; min-height: calc(100vh - var(--top) - 62px); }
  .batch-hero { grid-template-columns: 1fr; }
  .month .cell { min-height: 76px; }
  .month .bcard .t, .month .bcard .stackp { display: none; }
  .weekv { grid-template-columns: 44px repeat(7, 132px); overflow-x: auto; }
  .lrow { grid-template-columns: 52px 1fr auto; }
  .lrow .media, .lrow .hide-m { display: none; }
  .paper { padding: 20px; }
  .ai-panel { width: 100%; }
  .hide-m { display: none !important; }
  .only-m { display: inline-flex; }
  .with-facets:not(.show-f) .facets { display: none; }
  .with-facets { gap: 12px; }
  .with-facets.show-f .facets { position: fixed; inset: auto 0 62px 0; max-height: 62vh; overflow-y: auto; z-index: 30; background: var(--surface); padding: 16px; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; box-shadow: var(--shadow-3); }
  .toolbar { flex-wrap: nowrap; }
  .toolbar .search { width: auto !important; flex: 1; min-width: 0; }
  .status-strip a:last-child:nth-child(odd) { grid-column: span 2; border-inline-end: 0; }
  .sum-plats { grid-template-columns: repeat(2, 1fr); }
  .upl { inset-inline: 12px; width: auto; bottom: 74px; }
}
@media (max-width: 420px) {
  .g4, .g2 { grid-template-columns: minmax(0, 1fr); }
  .plat-choose { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print {
  .side, .top, .mnav, .rep-col, .no-print { display: none !important; }
  .app { display: block; } .page { padding: 0; } .paper { border: 0; box-shadow: none; padding: 0; }
  body { background: #fff; }
}
