/* =========================================================
   Alzahrani Mail Admin — design system
   ========================================================= */
:root {
  --font: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --bg: #f4f5f2; --surface: #ffffff; --surface-2: #f1f3ef; --surface-3: #e7eae5;
  --border: #e1e5de; --border-strong: #cdd3c9;
  --text: #17201b; --text-2: #3b4640; --muted: #69736d;
  --brand: #0d7a67; --brand-hover: #0a6656; --brand-soft: #e1f1ec; --brand-ink: #09594b; --on-brand: #ffffff;
  --ok: #1a7f45; --ok-soft: #e4f3e9; --warn: #9a5705; --warn-soft: #fbf0dc; --danger: #c3352b; --danger-soft: #fbe8e6;
  --info: #2455c3; --info-soft: #e6edfc; --purple: #6a3dc4; --purple-soft: #eee7fb;
  --shadow-sm: 0 1px 2px rgb(16 24 20 / .06);
  --shadow: 0 1px 2px rgb(16 24 20 / .04), 0 6px 20px -8px rgb(16 24 20 / .10);
  --shadow-lg: 0 24px 64px -16px rgb(16 24 20 / .28);
  --r: 14px; --r-sm: 10px; --side: 260px; --top: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1311; --surface: #151b18; --surface-2: #1b2320; --surface-3: #232d29; --border: #25302b; --border-strong: #34413a;
    --text: #e6ece8; --text-2: #c2cbc6; --muted: #8a958f; --brand: #2fb59b; --brand-hover: #3fc9ae; --brand-soft: #143229; --brand-ink: #86ddc9; --on-brand: #04201a;
    --ok: #4cc27a; --ok-soft: #15301f; --warn: #e2a64a; --warn-soft: #33270f; --danger: #f06a5f; --danger-soft: #3a1a17;
    --info: #74a1f6; --info-soft: #18243d; --purple: #ab8cf2; --purple-soft: #271d3d;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px -10px rgb(0 0 0 / .5); --shadow-lg: 0 24px 64px -16px rgb(0 0 0 / .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1311; --surface: #151b18; --surface-2: #1b2320; --surface-3: #232d29; --border: #25302b; --border-strong: #34413a;
  --text: #e6ece8; --text-2: #c2cbc6; --muted: #8a958f; --brand: #2fb59b; --brand-hover: #3fc9ae; --brand-soft: #143229; --brand-ink: #86ddc9; --on-brand: #04201a;
  --ok: #4cc27a; --ok-soft: #15301f; --warn: #e2a64a; --warn-soft: #33270f; --danger: #f06a5f; --danger-soft: #3a1a17;
  --info: #74a1f6; --info-soft: #18243d; --purple: #ab8cf2; --purple-soft: #271d3d;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px -10px rgb(0 0 0 / .5); --shadow-lg: 0 24px 64px -16px rgb(0 0 0 / .7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.55 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; opacity: .5; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.ic { width: 18px; height: 18px; flex: none; }
.ltr { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] .ltr { text-align: right; }
[dir="rtl"] .flip svg, [dir="rtl"] .flip-ic { transform: scaleX(-1); }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.min0 { min-width: 0; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-block { display: block; }
.txt-warn { color: var(--warn); }
.txt-danger { color: var(--danger); }
.link { color: var(--brand); font-weight: 500; }
.link:hover { text-decoration: underline; }
.clickable { cursor: pointer; }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; margin-inline-start: 6px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 11.5px; font-weight: 600; vertical-align: middle; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); font-weight: 500; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s; }
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); box-shadow: 0 1px 2px rgb(13 122 103 / .25); }
.btn.primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover:not(:disabled) { filter: brightness(1.06); background: var(--danger); }
.btn.ghost { background: transparent; }
.btn.danger-ghost { color: var(--danger); border-color: transparent; background: var(--danger-soft); }
.btn.danger-ghost:hover:not(:disabled) { background: var(--danger-soft); filter: brightness(.97); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.sm .ic { width: 16px; height: 16px; }
.btn.block { width: 100%; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--on-brand) transparent var(--on-brand) transparent; animation: spin .7s linear infinite; }
.btn.ghost.loading::after { border-color: var(--text) transparent var(--text) transparent; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; color: var(--text-2); transition: background .15s, color .15s; }
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 8px; }
.icon-btn.sm .ic { width: 16px; height: 16px; }
.icon-btn.xs { width: 24px; height: 24px; border-radius: 6px; vertical-align: middle; }
.icon-btn.xs .ic { width: 14px; height: 14px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---------- Chips / pills ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.chips.center { justify-content: center; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.chip .ic { width: 12px; height: 12px; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.purple { background: var(--purple-soft); color: var(--purple); }
.chip.brand { background: var(--brand-soft); color: var(--brand-ink); }
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; font-weight: 600; white-space: nowrap; }
a.pill:hover { border-color: var(--brand); color: var(--brand); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-end: 6px; vertical-align: 1px; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); }
.ou-tag { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); white-space: nowrap; }

/* ---------- Avatars ---------- */
.av { --h: 160; width: 36px; height: 36px; border-radius: 50%; flex: none; display: inline-grid; place-items: center; font-size: 13px; font-weight: 600; background: hsl(var(--h) 42% 88%); color: hsl(var(--h) 45% 26%); object-fit: cover; letter-spacing: .02em; }
:root[data-theme="dark"] .av { background: hsl(var(--h) 28% 24%); color: hsl(var(--h) 55% 82%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .av { background: hsl(var(--h) 28% 24%); color: hsl(var(--h) 55% 82%); } }
.av.sm { width: 28px; height: 28px; font-size: 11px; }
.av.lg { width: 48px; height: 48px; font-size: 16px; }
.av.xl { width: 64px; height: 64px; font-size: 22px; }
.av.grp { border-radius: 12px; }
.av.grp .ic { width: 55%; height: 55%; }
.av.xl.grp { border-radius: 18px; }
.av.purple { background: var(--purple-soft); color: var(--purple); }

/* ---------- App shell ---------- */
.app { min-height: 100vh; }
.sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--side); background: var(--surface); border-inline-end: 1px solid var(--border); display: flex; flex-direction: column; z-index: 40; }
.brand { display: flex; align-items: center; gap: 11px; height: var(--top); padding: 0 18px; border-bottom: 1px solid var(--border); }
.logo-svg { width: 34px; height: 34px; flex: none; }
.brand-name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.brand-sub { font-size: 12px; color: var(--muted); }
.nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.nav-sec { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 16px 10px 6px; }
[dir="rtl"] .nav-sec { letter-spacing: 0; text-transform: none; font-size: 12px; }
.nav-item { display: flex; align-items: center; gap: 11px; height: 40px; padding: 0 12px; border-radius: 10px; color: var(--text-2); font-weight: 500; margin-bottom: 2px; transition: background .15s, color .15s; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.on { background: var(--brand-soft); color: var(--brand-ink); }
.nav-item.on .ic { color: var(--brand); }
.side-foot { padding: 10px; border-top: 1px solid var(--border); }
.demo-pill { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding: 8px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 12.5px; font-weight: 600; }
.demo-pill .ic { width: 16px; height: 16px; }
.sidebar-back { display: none; }
.shell { margin-inline-start: var(--side); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--top); display: flex; align-items: center; gap: 12px; padding: 0 24px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.only-mobile { display: none; }
.gsearch { position: relative; flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 11px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); transition: border-color .15s, box-shadow .15s; }
.gsearch:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.gsearch input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); }
.gsearch kbd { font: 11px var(--mono); padding: 1px 6px; border: 1px solid var(--border-strong); border-radius: 5px; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 4px; margin-inline-start: auto; }
.lang-btn { width: auto; padding: 0 10px; gap: 6px; display: inline-flex; align-items: center; font-weight: 600; font-size: 13px; }
.me-wrap { position: relative; margin-inline-start: 6px; }
.me-btn { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-weight: 500; }
[dir="rtl"] .me-btn { padding: 4px 4px 4px 8px; }
.me-btn .av { width: 30px; height: 30px; font-size: 12px; }
.me-btn:hover { border-color: var(--border-strong); }
.pop { position: absolute; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; animation: pop .14s ease-out; }
.me-pop { inset-inline-end: 0; width: 280px; }
.gs-pop { inset-inline: 0; max-height: 70vh; overflow-y: auto; color: var(--text); }
.me-head { display: flex; gap: 12px; align-items: center; padding: 10px 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.pop-sec { font-size: 11px; font-weight: 600; color: var(--muted); padding: 8px 10px 4px; text-transform: uppercase; letter-spacing: .05em; }
.pop-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 9px; text-align: start; color: var(--text); }
.pop-item:hover { background: var(--surface-2); }
.pop-item.danger { color: var(--danger); }
.pop-item.foot { border-top: 1px solid var(--border); margin-top: 4px; border-radius: 0 0 9px 9px; color: var(--brand); font-weight: 500; }
.pop-empty { padding: 16px; text-align: center; color: var(--muted); }
.main { flex: 1; }
.page { max-width: 1320px; margin: 0 auto; padding: 28px 28px 64px; animation: fade .2s ease-out; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 26px; font-weight: 700; }
.page-head p { margin-top: 4px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-sm); padding: 20px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card-head h3 .ic { color: var(--muted); }
.card-head.pad { padding: 18px 20px 0; margin-bottom: 12px; }
.pad { padding: 18px 20px; }

/* ---------- Dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
@media (max-width: 1280px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stat { --c: var(--brand); --cs: var(--brand-soft); display: flex; flex-direction: column; gap: 12px; align-items: flex-start; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s, border-color .15s; }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.stat.tone-danger { --c: var(--danger); --cs: var(--danger-soft); } .stat.tone-info { --c: var(--info); --cs: var(--info-soft); }
.stat.tone-purple { --c: var(--purple); --cs: var(--purple-soft); } .stat.tone-warn { --c: var(--warn); --cs: var(--warn-soft); } .stat.tone-ok { --c: var(--ok); --cs: var(--ok-soft); }
.stat-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--cs); color: var(--c); flex: none; }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat-val { font-size: 28px; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12px; color: var(--muted); }
.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.dash-grid .card { margin: 0; }
.span2 { grid-column: span 2; } .span3 { grid-column: 1 / -1; }
.chart { min-height: 230px; }
.chart-kpis { display: flex; gap: 28px; margin-bottom: 8px; }
.chart-kpis b { font-size: 22px; display: block; line-height: 1.2; font-variant-numeric: tabular-nums; }
.chart-kpis span { font-size: 12px; color: var(--muted); }
.vbars { display: flex; align-items: flex-end; gap: 10px; height: 170px; padding-top: 18px; border-bottom: 1px solid var(--border); }
.vcol { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; position: relative; }
.vcol b { font-size: 11.5px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.vstack { width: min(42px, 100%); min-height: 3px; display: flex; flex-direction: column; border-radius: 7px 7px 3px 3px; overflow: hidden; transition: height .5s cubic-bezier(.2, .8, .2, 1); }
.vstack i { display: block; }
.vstack .ok, .legend .ok { background: var(--brand); }
.vstack .bad, .legend .bad { background: var(--danger); }
.vcol span { position: absolute; bottom: -24px; font-size: 12px; color: var(--muted); }
.legend { display: flex; gap: 16px; margin-top: 32px; font-size: 12px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.ring-wrap { display: grid; place-items: center; margin: 4px 0 14px; }
.ring { --p: 0; --c: var(--brand); width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-3) 0); }
.ring.low { --c: var(--warn); }
.ring > div { width: 104px; height: 104px; border-radius: 50%; background: var(--surface); display: grid; place-content: center; text-align: center; }
.ring b { font-size: 26px; line-height: 1.1; }
.ring span { font-size: 11.5px; color: var(--muted); }
.health { list-style: none; margin: 0; padding: 0; }
.health li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 4px; border-top: 1px solid var(--border); font-size: 13.5px; }
.health li.clickable:hover { color: var(--brand); }
.health b { font-variant-numeric: tabular-nums; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(70px, 120px) 1fr auto; align-items: center; gap: 10px; font-size: 13px; }
.hbar-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.hbar-track { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.hbar-track i { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.hbar b { font-variant-numeric: tabular-nums; min-width: 22px; text-align: end; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); }
.feed li:first-child { border-top: 0; padding-top: 0; }
.feed-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.feed-ic .ic { width: 15px; height: 15px; }
.feed-t { font-size: 13.5px; font-weight: 500; }
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; }
.quick-item { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); text-align: start; font-weight: 500; transition: border-color .15s, background .15s; }
.quick-item .ic { color: var(--brand); width: 22px; height: 22px; }
.quick-item:hover { border-color: var(--brand); background: var(--brand-soft); }

/* ---------- Toolbar / tables ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.search-field { flex: 1; min-width: 220px; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); }
.search-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.search-field input { flex: 1; border: 0; outline: 0; background: none; min-width: 0; color: var(--text); }
select { height: 38px; padding: 0 32px 0 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2369736d' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center; appearance: none; -webkit-appearance: none; max-width: 100%; }
[dir="rtl"] select { padding: 0 12px 0 32px; background-position: left 11px center; }
select.sm { height: 30px; font-size: 12.5px; border-radius: 8px; }
select:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.seg-row { padding: 12px 16px 0; overflow-x: auto; scrollbar-width: none; }
.seg-row::-webkit-scrollbar { display: none; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.seg button { height: 30px; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--muted); }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg-row + .toolbar, .seg-row + #bulkBar { margin-top: 0; }
.card.flush .seg-row:first-child { padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.toolbar + .seg-row { padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.bulk { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 10px 16px; background: var(--brand-soft); border-bottom: 1px solid var(--border); color: var(--brand-ink); animation: fade .15s; }
.bulk-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: start; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tr.clickable:hover td { background: var(--surface-2); }
.tbl tr.sel td { background: var(--brand-soft); }
.tbl.compact td, .tbl.compact th { padding: 7px 10px; font-size: 12.5px; }
.w-chk { width: 44px; padding-inline-end: 0 !important; }
.w-act { width: 1%; text-align: end; white-space: nowrap; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; vertical-align: middle; }
.th-sort { display: inline-flex; gap: 4px; align-items: center; font-weight: 600; color: inherit; }
.th-sort.on, .th-sort:hover { color: var(--text); }
.cell-user { display: flex; align-items: center; gap: 11px; min-width: 0; }
.row-acts { display: inline-flex; gap: 2px; opacity: 0; transition: opacity .15s; }
tr:hover .row-acts, .row-acts.show, .row-acts:focus-within { opacity: 1; }
@media (hover: none) { .row-acts { opacity: 1; } }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border); }
.pager-ctl { display: flex; align-items: center; gap: 6px; }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 48px 20px; color: var(--muted); }
.empty > .ic { width: 36px; height: 36px; color: var(--border-strong); margin-bottom: 4px; }
.empty h4 { color: var(--text); font-size: 15px; }
.empty .btn { margin-top: 10px; }
.ev { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; font-size: 13px; white-space: nowrap; }
.ev .ic { width: 15px; height: 15px; color: var(--muted); }
.ev.bad .ic { color: var(--danger); }
.details { max-width: 380px; }
.kvp { display: inline-flex; gap: 4px; margin-inline-end: 10px; }
.kvp i { font-style: normal; color: var(--muted); }

/* ---------- Notes / misc ---------- */
.note { display: flex; gap: 9px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; margin-top: 10px; }
.note .ic { width: 16px; height: 16px; margin-top: 2px; }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.danger { background: var(--danger-soft); color: var(--danger); }
.note ul { margin: 6px 0 0; padding-inline-start: 18px; }
.hint { display: flex; gap: 8px; align-items: center; }
.hint .ic { width: 16px; height: 16px; }
.spin-wrap { display: grid; place-items: center; padding: 36px; }
.spinner { width: 24px; height: 24px; border-radius: 50%; border: 2.5px solid var(--surface-3); border-top-color: var(--brand); animation: spin .7s linear infinite; }
.sk { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 12px; }
.sk-title { height: 32px; width: 260px; margin-bottom: 24px; }
.sk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.sk-card { height: 104px; }
.sk-block { height: 320px; }
.err-card { text-align: center; padding: 48px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 560px; margin: 40px auto; }
.err-card > .ic { width: 40px; height: 40px; color: var(--danger); }
.err-card .btn { margin-top: 8px; }

/* ---------- Drawer ---------- */
.drawer-back { position: fixed; inset: 0; background: rgb(10 16 13 / .35); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60; }
.drawer-back.show { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; inset-block: 0; inset-inline-end: 0; width: min(560px, 100vw); background: var(--surface); box-shadow: var(--shadow-lg); z-index: 61; transform: translateX(100%); transition: transform .26s cubic-bezier(.2, .8, .2, 1); overflow-y: auto; visibility: hidden; }
[dir="rtl"] .drawer { transform: translateX(-100%); }
.drawer.open { transform: none !important; visibility: visible; }
.dr-head { position: relative; padding: 26px 24px 0; background: linear-gradient(180deg, var(--brand-soft), var(--surface) 140px); border-bottom: 1px solid var(--border); }
.dr-close { position: absolute; top: 14px; inset-inline-end: 14px; }
.dr-hero { display: flex; gap: 16px; align-items: center; padding-inline-end: 40px; }
.dr-hero h2 { font-size: 20px; }
.dr-hero .chips { margin-top: 8px; }
.dr-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 20px 0 16px; }
.act { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); font-size: 12px; font-weight: 500; color: var(--text-2); text-align: center; transition: border-color .15s, color .15s; }
.act .ic { color: var(--brand); }
.act:hover { border-color: var(--brand); color: var(--text); }
.act.danger .ic, .act.danger:hover { color: var(--danger); }
.act.danger:hover { border-color: var(--danger); }
.dr-head > .note, .dr-head > .btn-row { margin-bottom: 18px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs button { display: inline-flex; align-items: center; gap: 7px; padding: 10px 12px; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--brand-ink); border-bottom-color: var(--brand); }
.page-tabs { padding: 4px 16px 0; border-bottom: 1px solid var(--border); }
.dr-body { padding: 8px 24px 40px; }
.dsec { padding: 18px 0; border-bottom: 1px solid var(--border); }
.dsec:last-child { border-bottom: 0; }
.dsec h4 { font-size: 13.5px; margin-bottom: 10px; }
.dsec > p.small { margin-bottom: 10px; }
.desc { padding: 16px 0 0; color: var(--text-2); }
.kv { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 9px 14px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.alias-list, .list { list-style: none; margin: 0 0 12px; padding: 0; }
.alias-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 9px; background: var(--surface-2); margin-bottom: 5px; font-size: 13.5px; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.app-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.app-ic.purple { background: var(--purple-soft); color: var(--purple); }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form > input { flex: 1; min-width: 180px; }
.inline-form > select { flex: 1; min-width: 140px; }
.sec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sec-tile { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.sec-tile .ic { width: 22px; height: 22px; color: var(--muted); margin-bottom: 4px; }
.sec-tile span { font-size: 12px; color: var(--muted); }
.sec-tile.ok { background: var(--ok-soft); border-color: transparent; } .sec-tile.ok .ic, .sec-tile.ok b { color: var(--ok); }
.sec-tile.warn { background: var(--warn-soft); border-color: transparent; } .sec-tile.warn .ic, .sec-tile.warn b { color: var(--warn); }

/* ---------- Forms ---------- */
input[type="text"], input[type="email"], input[type="password"], input:not([type]), textarea, .inline-form > input {
  height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); outline: 0; width: 100%; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; }
input:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.search-field input, .gsearch input, .email-in input, .pw-in input { height: auto; border: 0; padding: 0; box-shadow: none !important; background: none; border-radius: 0; }
.fld { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.fld > span { font-size: 13px; font-weight: 500; color: var(--text-2); }
.fld em { color: var(--danger); font-style: normal; }
.fld small { color: var(--muted); font-size: 12px; }
.fld select { width: 100%; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.email-in, .pw-in { display: flex; align-items: center; height: 40px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); padding-inline-start: 12px; overflow: hidden; }
.email-in:focus-within, .pw-in:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.email-in input, .pw-in input { flex: 1; min-width: 0; height: 100%; }
.email-in .at { padding: 0 8px; color: var(--muted); font-weight: 600; }
.email-in select { height: 100%; border: 0; border-inline-start: 1px solid var(--border); border-radius: 0; background-color: var(--surface-2); max-width: 55%; box-shadow: none !important; }
.email-in.sm { height: 34px; flex: 1; min-width: 240px; }
.pw-in { padding-inline-end: 4px; gap: 2px; }
.pw-meter { height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.pw-meter i { display: block; height: 100%; width: 0; transition: width .25s, background .25s; background: var(--danger); }
.pw-meter[data-s="1"] i { width: 20%; } .pw-meter[data-s="2"] i { width: 40%; background: var(--warn); }
.pw-meter[data-s="3"] i { width: 60%; background: var(--warn); } .pw-meter[data-s="4"] i { width: 80%; background: var(--ok); } .pw-meter[data-s="5"] i { width: 100%; background: var(--ok); }
.tgl { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; margin: 4px 0 6px; }
.tgl input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tgl-track { position: relative; width: 38px; height: 22px; border-radius: 99px; background: var(--border-strong); flex: none; transition: background .2s; margin-top: 1px; }
.tgl-track::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s; }
.tgl input:checked + .tgl-track { background: var(--brand); }
.tgl input:checked + .tgl-track::after { transform: translateX(16px); }
[dir="rtl"] .tgl input:checked + .tgl-track::after { transform: translateX(-16px); }
.tgl input:focus-visible + .tgl-track { outline: 2px solid var(--brand); outline-offset: 2px; }
.tgl-label { font-size: 13.5px; display: flex; flex-direction: column; }
.tgl-label small { color: var(--muted); font-size: 12px; }
.form-err { display: none; margin-top: 10px; padding: 9px 12px; border-radius: 9px; background: var(--danger-soft); color: var(--danger); font-size: 13px; }
.form-err.show { display: block; }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgb(10 16 13 / .45); opacity: 0; transition: opacity .18s; }
.modal-back.show { opacity: 1; }
.modal { width: min(480px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); transform: translateY(10px) scale(.98); transition: transform .2s cubic-bezier(.2, .8, .2, 1); }
.modal.wide { width: min(640px, 100%); }
.modal-back.show .modal { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 12px 22px; }
[dir="rtl"] .modal-head { padding: 18px 22px 12px 20px; }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 4px 22px 8px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 20px; }
.confirm-text { color: var(--text-2); line-height: 1.6; }
.created { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 12px; background: var(--ok-soft); color: var(--ok); margin-bottom: 12px; }
.created .ic { width: 24px; height: 24px; }
.cred { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; }
.cred span { display: block; font-size: 12px; color: var(--muted); }
.csv-cols { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); margin: 10px 0 4px; overflow-x: auto; }
.csv-cols code { font: 12px var(--mono); white-space: nowrap; }
.drop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px; border: 2px dashed var(--border-strong); border-radius: 14px; color: var(--muted); text-align: center; cursor: pointer; margin: 12px 0; transition: border-color .15s, background .15s; }
.drop:hover, .drop:focus-within { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop .ic { width: 28px; height: 28px; }
.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin: 10px 0 6px; }
.progress i { display: block; height: 100%; background: var(--brand); transition: width .2s; }

/* ---------- Org units ---------- */
.ou-tree, .ou-tree ul { list-style: none; margin: 0; padding: 0; }
.ou-tree ul { padding-inline-start: 26px; position: relative; }
.ou-tree ul::before { content: ""; position: absolute; inset-block: 0 22px; inset-inline-start: 13px; border-inline-start: 1.5px solid var(--border-strong); }
.ou-tree ul > li { position: relative; }
.ou-tree ul > li::before { content: ""; position: absolute; top: 28px; inset-inline-start: -13px; width: 11px; border-top: 1.5px solid var(--border-strong); }
.ou-node { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; margin: 4px 0; border: 1px solid transparent; transition: background .15s, border-color .15s; }
.ou-node:hover { background: var(--surface-2); border-color: var(--border); }
.ou-node.root { background: var(--brand-soft); }
.ou-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--brand); flex: none; }
.ou-node.root .ou-ic { background: var(--brand); color: var(--on-brand); }
.ou-main { flex: 1; }

/* ---------- Domains ---------- */
.dom-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.dom-card { margin: 0; display: flex; flex-direction: column; gap: 14px; }
.dom-top { display: flex; gap: 12px; align-items: flex-start; }
.dom-top .chips { margin-top: 6px; }
.dom-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--info-soft); color: var(--info); flex: none; }
.dom-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dom-stats > * { padding: 10px; border-radius: 10px; background: var(--surface-2); text-align: center; }
.dom-stats a:hover { background: var(--brand-soft); }
.dom-stats b { display: block; font-size: 15px; }
.dom-stats span { font-size: 11.5px; color: var(--muted); }
.dom-card .note { margin-top: 0; }

/* ---------- Roles ---------- */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.admin-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); text-align: center; min-width: 0; transition: border-color .15s, transform .15s; }
.admin-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.admin-card .av { margin-bottom: 6px; }
.admin-card > div { max-width: 100%; }
.admin-card .chips { margin-top: 8px; }
.chips.wrap .chip { white-space: normal; height: auto; padding: 3px 9px; }

/* ---------- Settings ---------- */
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 18px; align-items: start; }
.set-grid .card { margin: 0; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.set-row:first-of-type { border-top: 0; padding-top: 0; }
.scopes { margin-top: 14px; font-size: 13px; }
.scopes summary { cursor: pointer; color: var(--brand); font-weight: 500; }
.scopes ul { margin: 8px 0 0; padding-inline-start: 18px; color: var(--text-2); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 20px; inset-inline-end: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; pointer-events: none; }
.toast { display: flex; gap: 10px; align-items: center; max-width: 380px; padding: 12px 16px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-size: 13.5px; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: none; }
.toast .ic { width: 18px; height: 18px; color: var(--brand); }
.toast.err .ic { color: var(--danger); }
:root[data-theme="dark"] .toast .ic { color: var(--brand-hover); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.login-art { position: relative; overflow: hidden; padding: 44px 56px; display: flex; flex-direction: column; justify-content: space-between; color: #eaf6f2; background: radial-gradient(120% 90% at 0% 0%, #13957d 0%, #0b6b5a 45%, #073f36 100%); }
.login-brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 17px; position: relative; z-index: 1; }
.login-brand .logo-svg { --brand: #ffffff; --on-brand: #0b6b5a; }
.login-copy { position: relative; z-index: 1; max-width: 480px; margin: 48px 0; }
.login-copy h1 { font-size: clamp(30px, 3.4vw, 44px); font-weight: 700; line-height: 1.12; letter-spacing: -.025em; }
.login-copy p { margin-top: 16px; font-size: 16px; color: #bfe3d9; line-height: 1.6; }
.login-feats { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-direction: column; gap: 12px; }
.login-feats li { display: flex; gap: 12px; align-items: center; font-size: 14.5px; }
.login-feats .ic { width: 22px; height: 22px; padding: 4px; border-radius: 50%; background: rgb(255 255 255 / .14); }
.login-deco span { position: absolute; border-radius: 50%; border: 1px solid rgb(255 255 255 / .12); }
.login-deco span:nth-child(1) { width: 520px; height: 520px; inset-inline-end: -200px; bottom: -220px; }
.login-deco span:nth-child(2) { width: 360px; height: 360px; inset-inline-end: -120px; bottom: -140px; background: rgb(255 255 255 / .04); }
.login-deco span:nth-child(3) { width: 200px; height: 200px; inset-inline-end: -40px; bottom: -60px; background: rgb(255 255 255 / .05); }
.login-panel { display: flex; flex-direction: column; padding: 24px 32px; background: var(--bg); }
.login-top { display: flex; justify-content: flex-end; gap: 6px; }
.login-card { width: min(400px, 100%); margin: auto; display: flex; flex-direction: column; gap: 12px; }
.login-card h2 { font-size: 28px; font-weight: 700; }
.login-card > p.muted { margin-bottom: 14px; }
.btn.google { height: 48px; border-radius: 12px; font-size: 15px; font-weight: 600; gap: 12px; background: var(--surface); box-shadow: var(--shadow-sm); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; margin: 6px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login-card .btn.ghost.block { height: 46px; border-radius: 12px; }
.login-card .note { margin: 0; }
.login-foot { text-align: center; font-size: 12px; color: var(--muted); }
.login-foot a { color: var(--brand); }

/* ---------- Animations ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .span2 { grid-column: 1 / -1; }
  .hide-md { display: none; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow-lg); }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  .side-open .sidebar { transform: none; }
  .side-open .sidebar-back { display: block; position: fixed; inset: 0; z-index: 39; background: rgb(10 16 13 / .35); }
  .shell { margin-inline-start: 0; }
  .only-mobile { display: inline-grid; }
  .topbar { padding: 0 12px; gap: 8px; }
  .gsearch kbd { display: none; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { padding: 28px 24px 32px; }
  .login-copy { margin: 28px 0 0; }
  .login-feats { display: none; }
  .login-panel { padding: 20px 16px 24px; }
  .login-card { margin: 24px auto; }
}
@media (max-width: 640px) {
  .page { padding: 18px 16px 48px; }
  .page-head h1 { font-size: 22px; }
  .dash-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px; flex-direction: column; gap: 8px; }
  .stat-val { font-size: 24px; }
  .hide-sm { display: none; }
  .grid2, .sec-grid { grid-template-columns: 1fr; }
  .dr-actions { grid-template-columns: repeat(4, 1fr); }
  .act span { font-size: 11px; }
  .dr-head, .dr-body { padding-inline: 16px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .toolbar { padding: 12px; }
  .search-field { min-width: 100%; }
  .toolbar select { flex: 1; }
  .set-grid, .dom-grid { grid-template-columns: 1fr; }
  .lang-btn span { display: none; }
  .lang-btn { width: 38px; padding: 0; justify-content: center; }
  .me-btn { padding: 3px; border: 0; }
  .toasts { inset-inline: 12px; bottom: 12px; }
  .toast { max-width: none; }
}

/* ---------- Print (user details) ---------- */
@media print {
  body.print-drawer > *:not(#drawer) { display: none !important; }
  body.print-drawer #drawer { position: static; transform: none; width: 100%; box-shadow: none; visibility: visible; overflow: visible; }
  body.print-drawer .dr-actions, body.print-drawer .tabs, body.print-drawer .dr-close, body.print-drawer .inline-form, body.print-drawer .icon-btn, body.print-drawer .btn { display: none !important; }
  body.print-drawer .dr-head { background: none; }
}

/* ---------- Permission-limited controls ---------- */
input:disabled, select:disabled, textarea:disabled { background-color: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.email-in.dis { background: var(--surface-2); }
.tgl.dis { opacity: .55; cursor: not-allowed; }
.tabs.hide-tabs { display: none; }
.dr-head:has(.tabs.hide-tabs) { padding-bottom: 2px; }

/* =========================================================
   Insights pages
   ========================================================= */
.stat.static:hover { transform: none; box-shadow: var(--shadow-sm); border-color: var(--border); }
.tile-note { margin: -8px 0 10px; }
.hint { margin-top: 14px; }
.page-head .seg { align-self: center; }

/* Storage */
.stor-hero { display: flex; gap: 28px; align-items: center; }
.stor-hero h2 { font-size: 22px; margin-bottom: 4px; }
.stor-hero .ring { flex: none; }
.sbar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--surface-3); margin: 16px 0 10px; }
.sbar i { display: block; height: 100%; }
.sbar .g, .legend .g { background: var(--brand); }
.sbar .d, .legend .d { background: var(--info); }
.sbar .p, .legend .p { background: var(--purple); }
.legend .f { background: var(--surface-3); border: 1px solid var(--border-strong); }
.legend.wrap { flex-wrap: wrap; gap: 8px 18px; margin-top: 0; }
.w-q { width: 170px; }
.qcell { display: flex; align-items: center; gap: 8px; }
.qbar { flex: 1; height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; min-width: 60px; }
.qbar i { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.qbar.warn i { background: var(--warn); }
.qbar.bad i { background: var(--danger); }
#dashStorage .ring-wrap { margin-top: 0; }

/* Day charts */
.ichart { padding-bottom: 8px; }
.ibars { display: flex; align-items: flex-end; gap: 4px; height: 170px; border-bottom: 1px solid var(--border); margin-bottom: 30px; }
.icol { flex: 1; height: 100%; position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; }
.igrp { height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.igrp i { display: block; width: min(16px, 42%); min-height: 2px; border-radius: 4px 4px 1px 1px; transition: height .5s cubic-bezier(.2, .8, .2, 1); }
.igrp i:only-child { width: min(22px, 70%); }
.igrp .s0, .legend .s0 { background: var(--brand); }
.igrp .s1, .legend .s1 { background: var(--info); }
.icol span { position: absolute; bottom: -22px; inset-inline: -10px; text-align: center; font-size: 11px; color: var(--muted); white-space: nowrap; }
.icol span.odd { visibility: hidden; }
.icol:hover .igrp i { filter: brightness(1.12); }

/* Severity colors */
.app-ic.sev-high, .feed-ic.sev-high, .av.sev-high { background: var(--danger-soft); color: var(--danger); }
.app-ic.sev-medium, .feed-ic.sev-medium, .av.sev-medium { background: var(--warn-soft); color: var(--warn); }
.app-ic.sev-low, .feed-ic.sev-low, .av.sev-low { background: var(--info-soft); color: var(--info); }
button.link { font-weight: 600; color: var(--brand); text-decoration: underline; }

/* Email health */
.hc-intro .inline-form { margin-top: 12px; max-width: 520px; }
.hc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); gap: 18px; align-items: start; }
.hc-grid .card { margin: 0; }
.hc-score { display: flex; align-items: baseline; gap: 2px; padding: 6px 12px; border-radius: 12px; font-variant-numeric: tabular-nums; }
.hc-score b { font-size: 24px; line-height: 1; }
.hc-score span { font-size: 12px; opacity: .8; }
.hc-score.ok { background: var(--ok-soft); color: var(--ok); }
.hc-score.warn { background: var(--warn-soft); color: var(--warn); }
.hc-score.bad { background: var(--danger-soft); color: var(--danger); }
.hc-list { list-style: none; margin: 0; padding: 0; }
.hc-row { display: flex; gap: 12px; padding: 14px 0; border-top: 1px solid var(--border); }
.hc-row p { color: var(--text-2); margin-top: 2px; }
.hc-ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.hc-ic .ic { width: 15px; height: 15px; }
.hc-row.pass .hc-ic { background: var(--ok-soft); color: var(--ok); }
.hc-row.warn .hc-ic { background: var(--warn-soft); color: var(--warn); }
.hc-row.fail .hc-ic { background: var(--danger-soft); color: var(--danger); }
.hc-row.info .hc-ic { background: var(--surface-3); color: var(--muted); }
.rec { margin-top: 8px; }
.rec pre { margin: 4px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font: 12px/1.5 var(--mono); white-space: pre-wrap; word-break: break-all; }
.rec.fix pre { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); flex: 1; }
.rec-row { display: flex; gap: 6px; align-items: flex-start; }

@media (max-width: 640px) {
  .stor-hero { flex-direction: column; align-items: stretch; text-align: center; }
  .stor-hero .ring { margin: 0 auto; }
  .hc-grid { grid-template-columns: 1fr; }
  .w-q { width: 110px; }
  .ibars { gap: 2px; }
  .icol span { display: none; }
  .ibars { margin-bottom: 8px; }
  .page-head .seg { order: -1; }
}

.stats.dense { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); }
.stats.dense .stat-val { font-size: 24px; }
.span2 .list, .span3 .list { columns: 2; column-gap: 28px; }
.span2 .list li, .span3 .list li { break-inside: avoid; }
@media (max-width: 1280px) { .stats.dense { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 900px) { .span2 .list, .span3 .list { columns: 1; } }
@media (max-width: 640px) { .stats.dense { grid-template-columns: 1fr 1fr; } }
.dash-grid > * { min-width: 0; }
@media (max-width: 640px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }

.span3 .feed { columns: 2; column-gap: 32px; }
.span3 .feed li { break-inside: avoid; }
.span3 .feed li:nth-child(4) { border-top: 0; padding-top: 0; }
@media (max-width: 900px) { .span3 .feed { columns: 1; } .span3 .feed li:nth-child(4) { border-top: 1px solid var(--border); padding-top: 9px; } }
