/* Layout: fixed sidebar + scrolling work area; dense, scannable tables and boards. */
:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #eef2f0;
  --line: #dde3e0;
  --ink: #17201c;
  --ink-2: #56635d;
  --ink-3: #85918b;
  --accent: #1d6f52;          /* cedar green */
  --accent-ink: #ffffff;
  --accent-soft: #e2f0ea;
  --good: #198754; --good-soft: #e3f4ea;
  --warn: #b26b00; --warn-soft: #fbf0dc;
  --bad: #c0392b;  --bad-soft: #fbe6e3;
  --info: #2563a8; --info-soft: #e3edf8;
  --shadow: 0 1px 2px rgba(20,35,28,.06), 0 4px 16px rgba(20,35,28,.06);
  --font: 'IBM Plex Sans', 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-ar: 'IBM Plex Sans Arabic', 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  --r: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101513; --surface: #171e1b; --surface-2: #1e2723; --line: #2b3632;
    --ink: #e7eeea; --ink-2: #a3b1aa; --ink-3: #74827b;
    --accent: #4cb48a; --accent-ink: #0b1310; --accent-soft: #1c3329;
    --good: #4cc38a; --good-soft: #17301f; --warn: #e3a64a; --warn-soft: #33270f;
    --bad: #ef7a6d; --bad-soft: #3a1c18; --info: #79aef0; --info-soft: #172739;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; text-wrap: balance; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num, td.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.ar, [lang="ar"] { font-family: var(--font-ar); }
.boot { display: grid; place-items: center; height: 100vh; color: var(--ink-3); }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; }
.brand b { font-size: 15px; letter-spacing: -.01em; }
.brand small { display: block; color: var(--ink-3); font-size: 11.5px; }
.nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
.nav-group { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.on { background: var(--accent-soft); color: var(--accent); }
.nav svg { width: 17px; height: 17px; flex: none; }
.nav .count { margin-left: auto; background: var(--bad); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 6px; min-width: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.me { border-top: 1px solid var(--line); padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.me .who { min-width: 0; flex: 1; }
.me .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.me .who span { font-size: 11.5px; color: var(--ink-3); text-transform: capitalize; }
.main { min-width: 0; overflow-y: auto; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 18px 28px 6px; flex-wrap: wrap; }
.topbar h1 { font-size: 20px; letter-spacing: -.015em; }
.topbar .sub { color: var(--ink-3); font-size: 13px; }
.topbar .spacer { flex: 1; }
.content { padding: 14px 28px 40px; min-width: 0; }
.btn.menu-btn { display: none; }

/* ---------- Primitives ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 6px 12px; cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 3px 9px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg { width: 15px; height: 15px; }
.input, select.input, textarea.input { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 7px 10px; width: 100%; min-width: 0; }
textarea.input { resize: vertical; min-height: 70px; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field.check { flex-direction: row; align-items: center; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 14px; }
.full { grid-column: 1 / -1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.card-h { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.card-h h3 { font-size: 13.5px; }
.card-h .spacer { flex: 1; }
.card-b { padding: 14px 16px; }
.empty { padding: 28px 16px; text-align: center; color: var(--ink-3); }
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 20px; padding: 1px 9px; font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 1px 8px; border-radius: 4px; border: 1px solid var(--line); color: var(--ink-2); background: var(--surface); }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 11.5px; font-weight: 600; flex: none; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.plat { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; color: #fff; font-size: 10px; font-weight: 700; flex: none; }
.plat.facebook { background: #1877f2; } .plat.instagram { background: linear-gradient(135deg,#f58529,#dd2a7b 55%,#8134af); }
.plat.whatsapp { background: #25d366; } .plat.tiktok { background: #111; } .plat.x { background: #222; }
.plat.linkedin { background: #0a66c2; } .plat.webchat { background: #6b7c74; } .plat.email { background: #8a6d3b; }
.plat.phone { background: #5c6bc0; } .plat.other { background: #999; }

/* Toolbar + tables */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .input { width: auto; }
.toolbar .search { width: 240px; max-width: 100%; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 6px 11px; cursor: pointer; color: var(--ink-2); font-weight: 500; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent-soft); color: var(--accent); }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: start; font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.t td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr.click { cursor: pointer; }
.t tbody tr.click:hover td { background: var(--surface-2); }
.t .num, .t th.num { text-align: right; }
.cell-main { font-weight: 500; }
.cell-sub { font-size: 12px; color: var(--ink-3); }
tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--bad); }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.kpi .k { font-size: 12px; color: var(--ink-2); font-weight: 500; }
.kpi .v { font-size: 24px; font-weight: 600; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .d { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.kpi.alert .v { color: var(--bad); }
.cols2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.cols2 > * { min-width: 0; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 90px; gap: 10px; align-items: center; font-size: 13px; }
.bar-track { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 5px; }
.bar-row .num { text-align: right; }
.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 10px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); cursor: pointer; min-width: 0; }
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--surface-2); }
.list-item .grow { flex: 1; min-width: 0; }
.ellip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Inbox ---------- */
.inbox { display: grid; grid-template-columns: 320px 1fr 300px; height: calc(100vh - 66px); border-top: 1px solid var(--line); }
.inbox > * { min-width: 0; min-height: 0; }
.ib-list { border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; }
.ib-filters { padding: 10px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--line); }
.ib-items { overflow-y: auto; flex: 1; }
.ib-item { display: flex; gap: 10px; padding: 11px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.ib-item:hover { background: var(--surface-2); }
.ib-item.on { background: var(--accent-soft); }
.ib-item .grow { flex: 1; min-width: 0; }
.ib-item .top { display: flex; gap: 6px; align-items: baseline; }
.ib-item .top b { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.ib-item .when { font-size: 11.5px; color: var(--ink-3); flex: none; }
.ib-item .prev { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-item.unread .prev { color: var(--ink); font-weight: 500; }
.unread-dot { background: var(--accent); color: var(--accent-ink); border-radius: 10px; font-size: 11px; padding: 0 6px; font-weight: 600; }
.ib-thread { display: flex; flex-direction: column; background: var(--bg); }
.th-head { display: flex; gap: 10px; align-items: center; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.th-head .grow { flex: 1; min-width: 140px; }
.th-head select.input { width: auto; padding: 4px 8px; }
.msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 72%; padding: 8px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); white-space: pre-wrap; word-wrap: break-word; }
.msg.out { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.msg.note { align-self: center; background: var(--warn-soft); color: var(--ink); border: 1px dashed var(--warn); max-width: 85%; font-size: 13px; }
.msg .meta { display: block; font-size: 11px; opacity: .7; margin-top: 3px; }
.composer { background: var(--surface); border-top: 1px solid var(--line); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.composer textarea { min-height: 64px; }
.composer.note-mode textarea { background: var(--warn-soft); }
.ib-side { border-left: 1px solid var(--line); background: var(--surface); overflow-y: auto; }
.side-sec { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.side-sec h4 { margin: 0 0 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.kv { display: grid; grid-template-columns: 90px 1fr; gap: 4px 8px; font-size: 13px; }
.kv dt { color: var(--ink-3); } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.mini { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.mini:last-child { border-bottom: 0; }

/* ---------- Pipeline ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 10px; }
.col { background: var(--surface-2); border-radius: var(--r); display: flex; flex-direction: column; min-height: 300px; }
.col-h { padding: 10px 12px; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.col-h .sum { margin-left: auto; font-weight: 500; color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.col-b { padding: 0 8px 8px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.col.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.deal { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 10px 11px; cursor: grab; box-shadow: var(--shadow); }
.deal:active { cursor: grabbing; }
.deal b { display: block; font-weight: 600; font-size: 13px; }
.deal .r { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; color: var(--ink-2); }
.deal .val { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- Modal, drawer, toasts ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10,18,14,.45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: var(--surface); border-radius: 10px; width: 100%; max-width: 620px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { max-width: 860px; }
.modal-h { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); gap: 8px; }
.modal-h h2 { font-size: 16px; flex: 1; }
.modal-b { padding: 16px 18px; overflow-y: auto; }
.modal-f { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.modal-f .spacer { flex: 1; }
.drawer-overlay { position: fixed; inset: 0; background: rgba(10,18,14,.35); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); z-index: 41; box-shadow: -10px 0 40px rgba(0,0,0,.2); display: flex; flex-direction: column; }
.drawer-h { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: center; }
.drawer-b { overflow-y: auto; flex: 1; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 18px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 10px 12px; cursor: pointer; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
#toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 360px; font-size: 13.5px; }
.toast.bad { background: var(--bad); color: #fff; }
.items-table td { padding: 6px 6px; } .items-table .input { padding: 5px 8px; }
.timeline { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; }
.tl { display: grid; grid-template-columns: 14px 1fr; gap: 10px; font-size: 13px; }
.tl .dot { margin-top: 6px; background: var(--accent); }
.note-banner { background: var(--info-soft); color: var(--info); border-radius: 6px; padding: 9px 12px; font-size: 13px; }
.settings-grid { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; }
.settings-nav button { text-align: start; border: 0; background: transparent; padding: 8px 10px; border-radius: 6px; cursor: pointer; color: var(--ink-2); font-weight: 500; }
.settings-nav button.on { background: var(--accent-soft); color: var(--accent); }
.swatch { width: 18px; height: 18px; border-radius: 4px; border: 1px solid var(--line); display: inline-block; vertical-align: middle; }
input[type="color"].input { padding: 2px; height: 34px; width: 52px; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-art { background: var(--accent); color: var(--accent-ink); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art h2 { font-size: 34px; line-height: 1.1; letter-spacing: -.025em; max-width: 14ch; }
.auth-art p { opacity: .85; max-width: 42ch; }
.auth-art .chan { display: flex; gap: 8px; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; }
.auth-form form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; }
.auth-form h1 { font-size: 22px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .inbox { grid-template-columns: 290px 1fr; }
  .ib-side { display: none; }
  .inbox.show-side .ib-side { display: block; position: fixed; right: 0; top: 0; bottom: 0; width: 320px; z-index: 30; box-shadow: var(--shadow); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 250px; z-index: 45; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .side { transform: none; box-shadow: var(--shadow); }
  .btn.menu-btn { display: inline-flex; }
  .cols2, .grid3, .settings-grid { grid-template-columns: 1fr; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .inbox { grid-template-columns: 1fr; height: auto; }
  .inbox .ib-thread { display: none; min-height: 70vh; }
  .inbox.thread-open .ib-list { display: none; }
  .inbox.thread-open .ib-thread { display: flex; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { padding: 28px 20px; }
  .auth-art h2 { font-size: 26px; }
}
@media (max-width: 560px) {
  .grid2 { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 90px 1fr 70px; }
  .msg { max-width: 88%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.ib-filters .seg { display: flex; }
.ib-filters .seg button { flex: 1; padding: 6px 4px; font-size: 13px; }

/* ---------- Cedarise additions ---------- */
.banner { display: flex; align-items: center; gap: 12px; padding: 9px 22px; font-size: 13.5px; border-bottom: 1px solid var(--line); }
.banner.support { background: var(--info-soft); color: var(--info); }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner.good { background: var(--good-soft); color: var(--good); }
.modal .banner { border: 0; border-radius: var(--r); padding: 9px 12px; }
.banner .btn { margin-inline-start: auto; }
.bell { position: relative; }
.bell .count { position: absolute; top: 0; inset-inline-end: 0; background: var(--bad); color: #fff; border-radius: 10px; font-size: 10.5px; line-height: 16px; min-width: 16px; padding: 0 4px; text-align: center; }
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.plan-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.plan-card.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.plan-card h3 { font-size: 16px; }
.plan-card ul { margin: 0; padding-inline-start: 18px; color: var(--ink-2); font-size: 13px; display: grid; gap: 4px; flex: 1; }
.plan-price { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.plan-price span { font-size: 13px; font-weight: 500; color: var(--ink-3); }
.lock-ico { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-3); flex: none; }
.lock-ico.on { background: var(--accent-soft); color: var(--accent); }
.lock-ico svg { width: 18px; height: 18px; }
.card.locked { border-style: dashed; }
.unread-note { background: var(--accent-soft); }
.coach { display: flex; gap: 10px; align-items: flex-start; margin: 0 16px 6px; padding: 9px 12px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-size: 13px; }
.coach svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.auth-lang { position: absolute; top: 18px; inset-inline-end: 18px; }
.brand small { display: block; font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Right-to-left (Arabic) */
[dir="rtl"] body { font-family: var(--font-ar); }
[dir="rtl"] .side { border-right: 0; border-left: 1px solid var(--line); }
[dir="rtl"] .ib-list { border-right: 0; border-left: 1px solid var(--line); }
[dir="rtl"] .ib-side { border-left: 0; border-right: 1px solid var(--line); }
[dir="rtl"] .seg button + button { border-left: 0; border-right: 1px solid var(--line); }
[dir="rtl"] .nav .count, [dir="rtl"] .col-h .sum { margin-left: 0; margin-right: auto; }
[dir="rtl"] .drawer { right: auto; left: 0; box-shadow: 10px 0 40px rgba(0,0,0,.2); }
[dir="rtl"] #toasts { right: auto; left: 18px; }
[dir="rtl"] .num, [dir="rtl"] .mono, [dir="rtl"] input[type=email], [dir="rtl"] input[type=number] { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] td.num, [dir="rtl"] th.num { text-align: left; }
[dir="rtl"] .nav-group, [dir="rtl"] .t th, [dir="rtl"] .side-sec h4 { letter-spacing: 0; text-transform: none; }
[dir="rtl"] svg.flip, [dir="rtl"] #thBack svg { transform: scaleX(-1); }
@media (max-width: 900px) {
  .plans { grid-template-columns: 1fr; }
  [dir="rtl"] .side { left: auto; right: 0; transform: translateX(100%); }
  [dir="rtl"] .shell.nav-open .side { transform: none; }
  [dir="rtl"] .inbox.show-side .ib-side { right: auto; left: 0; }
  .banner { padding: 9px 16px; flex-wrap: wrap; }
}
.auth-form { position: relative; }
.me { flex-wrap: wrap; row-gap: 6px; }
.me .who { flex: 1 1 140px; }
.me .who span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-actions { display: flex; gap: 4px; width: 100%; justify-content: space-between; }
[dir="rtl"] .kv dd, [dir="rtl"] .cell-sub, [dir="rtl"] .ellip { unicode-bidi: plaintext; }
.plan-card ul { align-content: start; }
a.btn { text-decoration: none; }
.modal .banner { border-bottom: 0; border-radius: 8px; padding: 9px 12px; }
.modal .banner:not(.bad):not(.warn) { background: var(--good-soft); color: var(--good); }
/* Smart AI card in the inbox */
.ai-card { margin: 0 16px 8px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: linear-gradient(180deg, var(--accent-soft), var(--surface)); display: grid; gap: 8px; font-size: 13px; }
.ai-card.slim { display: flex; align-items: center; gap: 8px; padding: 7px 12px; background: var(--surface); }
.ai-card .ai-text { white-space: pre-wrap; line-height: 1.5; color: var(--ink); }
.stock-warn { margin-top: 8px; padding: 7px 10px; border-radius: 8px; background: var(--bad-soft); color: var(--bad); font-size: 13px; font-weight: 600; }
/* Ask Cedarise */
.ask { display: grid; gap: 12px; max-width: 860px; }
.ask-msgs { display: grid; gap: 10px; max-height: calc(100vh - 330px); min-height: 200px; overflow-y: auto; padding: 4px; }
.ask-msg { position: relative; white-space: pre-wrap; line-height: 1.55; padding: 12px 14px; border-radius: 12px; font-size: 14px; max-width: 92%; }
.ask-msg.user { justify-self: end; background: var(--accent); color: var(--accent-ink); }
.ask-msg.assistant { justify-self: start; background: var(--surface); border: 1px solid var(--line); padding-inline-end: 40px; }
.ask-msg.thinking { color: var(--ink-3); font-style: italic; }
.ask-copy { position: absolute; top: 6px; inset-inline-end: 6px; }
.ask-ideas { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 20px; padding: 7px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.chip-btn:hover { border-color: var(--accent); color: var(--accent); }
.ask-box { display: grid; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.card.digest { margin-bottom: 16px; border-color: var(--accent); background: linear-gradient(180deg, var(--accent-soft), var(--surface)); }
/* Growth Advisor */
.adv { display: grid; gap: 16px; }
.cols-adv { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .cols-adv { grid-template-columns: 1fr; } }
.cols-adv .list-item.active { background: var(--accent-soft); }
.adv-text { white-space: pre-wrap; line-height: 1.65; font-size: 14px; }
.adv-text a, .adv-src a { color: var(--accent); word-break: break-word; }
.adv-src { margin: 6px 0 0; padding-inline-start: 20px; font-size: 13px; line-height: 1.6; }
.adv-wait { color: var(--ink-3); font-style: italic; }
