:root {
  color-scheme: light;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --ink: #142033;
  --ink-2: #3c4b62;
  --muted: #6b7a90;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --brand: #2f6fed;
  --brand-strong: #1f54bf;
  --brand-soft: #eaf1ff;
  --nav: #0d172a;
  --nav-2: #13223c;
  --nav-ink: #dbe6fb;
  --nav-muted: #8fa3c3;
  --good: #15803d;
  --good-soft: #e9f8ef;
  --warn: #b45309;
  --warn-soft: #fff6e6;
  --danger: #b42318;
  --danger-soft: #fef0ee;
  --purple: #6d4aff;
  --shadow-sm: 0 1px 2px rgba(15, 27, 51, .05);
  --shadow: 0 12px 30px rgba(15, 27, 51, .08);
  --shadow-lg: 0 26px 70px rgba(15, 27, 51, .18);
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1220;
  --surface: #111c2f;
  --surface-2: #0e1828;
  --surface-3: #17243a;
  --ink: #eef4ff;
  --ink-2: #c2cee2;
  --muted: #91a2ba;
  --line: #22314a;
  --line-strong: #344663;
  --brand: #78a9ff;
  --brand-strong: #5b97ff;
  --brand-soft: #162a4d;
  --nav: #08101e;
  --nav-2: #0e1b30;
  --nav-ink: #e6eeff;
  --nav-muted: #7f93b3;
  --good: #6ee7a0;
  --good-soft: #10291d;
  --warn: #f5c56b;
  --warn-soft: #2d2313;
  --danger: #ff8b84;
  --danger-soft: #331716;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .25);
  --shadow: 0 18px 40px rgba(0, 0, 0, .35);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, .55);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
select, input, textarea { background-color: var(--surface); color: var(--ink); }
select { border: 1px solid var(--line-strong); border-radius: 7px; padding: 5px 7px; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.eyebrow { display: block; font-size: 10.5px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; color: rgba(219, 230, 251, .58); margin-bottom: 7px; }
.eyebrow.dark { color: var(--brand); }
.brand-lockup { display: flex; align-items: center; gap: 11px; color: #fff; font-size: 17px; letter-spacing: -.02em; }
.brand-lockup b { font-weight: 760; color: #b9d1ff; }
.brand-lockup.compact { font-size: 15.5px; }
.brand-mark { width: 33px; height: 33px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(145deg, #2f6fed, #4f8dff); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 7px 16px rgba(47,111,237,.3); }
.brand-mark svg { width: 22px; height: 22px; }
.brand-mark.light { background: var(--brand-soft); color: var(--brand); box-shadow: none; }

/* Login */
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr); background: var(--surface); }
.login-brand {
  position: relative; overflow: hidden; padding: 44px clamp(32px, 6vw, 88px); display: flex; flex-direction: column;
  background: radial-gradient(900px 500px at 16% 0%, rgba(64,126,255,.28), transparent 60%), radial-gradient(700px 480px at 90% 90%, rgba(82,58,180,.32), transparent 62%), linear-gradient(145deg, #091222, #0d1a30 58%, #101b34);
  color: #fff;
}
.login-brand::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px); background-size: 46px 46px; mask-image: linear-gradient(to bottom, black, transparent 78%); pointer-events: none; }
.login-brand > * { position: relative; z-index: 1; }
.login-hero-copy { margin: auto 0; max-width: 560px; padding: 50px 0; }
.login-hero-copy h1 { font-size: clamp(38px, 4.4vw, 61px); line-height: 1.02; letter-spacing: -.045em; margin: 0 0 22px; font-weight: 720; max-width: 590px; }
.login-hero-copy p { font-size: 17px; line-height: 1.6; color: #a9bad4; max-width: 500px; margin: 0 0 38px; }
.login-proof { display: grid; gap: 12px; max-width: 500px; }
.login-proof > div { display: flex; align-items: center; gap: 13px; padding: 13px 15px; border: 1px solid rgba(178, 204, 255, .12); background: rgba(255,255,255,.025); border-radius: 12px; backdrop-filter: blur(12px); }
.login-proof .icon { width: 20px; height: 20px; color: #7fb1ff; }
.login-proof b { display: block; font-size: 13px; font-weight: 650; }
.login-proof small { display: block; color: #8fa5c7; font-size: 11.5px; margin-top: 1px; }
.login-foot { color: #6f86a8; font-size: 11.5px; margin: 0; letter-spacing: .02em; }
.login-panel { display: grid; place-items: center; padding: 34px 28px; background: var(--surface); }
.login-card { width: min(390px, 100%); }
.login-card h2 { margin: 3px 0 9px; font-size: 31px; letter-spacing: -.035em; font-weight: 700; }
.login-card > div > p.muted { margin: 0 0 28px; font-size: 13.5px; line-height: 1.6; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 11.5px; font-weight: 680; letter-spacing: .02em; margin-bottom: 7px; color: var(--ink-2); }
.field input, .field select, .field textarea, .input {
  width: 100%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  border-radius: 9px; padding: 10px 12px; font-size: 13.5px; outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent); }
.field textarea { resize: vertical; min-height: 78px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.field-hint { display: block; margin-top: 6px; color: var(--muted); font-size: 10.5px; line-height: 1.45; font-weight: 500; }
.field-hint a { color: var(--brand); font-weight: 650; text-decoration: none; }
.field-hint a:hover { text-decoration: underline; }
.email-builder { display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.email-builder:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent); }
.email-builder input { border: 0 !important; border-radius: 0 !important; box-shadow: none !important; flex: 1 1 110px; min-width: 0; }
.email-builder select { border: 0 !important; border-radius: 0 !important; box-shadow: none !important; width: auto; max-width: 52%; flex: 0 1 auto; border-left: 1px solid var(--line) !important; background: var(--surface-2); font-weight: 620; color: var(--ink-2); }
.email-builder .email-at { display: flex; align-items: center; padding: 0 3px 0 8px; color: var(--muted); font-weight: 650; font-size: 13px; background: var(--surface); }
.field-hint.error { color: var(--danger); }
.btn { border: 1px solid transparent; border-radius: 9px; padding: 9px 14px; font-size: 12.5px; font-weight: 650; background: var(--surface); color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: background .15s, border-color .15s, transform .12s, box-shadow .15s; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .icon-button:focus-visible, .nav-link:focus-visible, .tenant-picker:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 26%, transparent); }
.btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn.secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink-2); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-3); }
.btn.danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 22%, transparent); }
.btn.small { padding: 6px 10px; font-size: 11.5px; border-radius: 8px; }
.btn.wide { width: 100%; padding: 11px 14px; margin-top: 4px; font-size: 13px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn .icon { width: 16px; height: 16px; }
.text-button { border: 0; background: none; color: var(--brand); padding: 0; font-size: 12.5px; font-weight: 600; }
.text-button:hover { text-decoration: underline; }
.form-error { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 22%, transparent); border-radius: 8px; padding: 9px 11px; font-size: 12.5px; margin: 4px 0 12px; }
.legal { font-size: 11px; color: var(--muted); margin: 21px 0 0; line-height: 1.6; }
.back-link { border: 0; background: none; padding: 0; color: var(--muted); font-size: 12px; margin-bottom: 27px; }
.back-link:hover { color: var(--ink); }
#mfaStep { text-align: left; }
#useRecoveryBtn { display: block; margin: 16px auto 0; }

/* App shell */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 246px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: linear-gradient(180deg, var(--nav), var(--nav-2)); color: var(--nav-ink); padding: 20px 14px 14px; z-index: 30; border-right: 1px solid rgba(140, 170, 220, .08); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 0 7px 20px; }
.sidebar-close { display: none !important; color: var(--nav-ink); }
.tenant-mini { display: flex; align-items: center; gap: 9px; padding: 9px; border: 1px solid rgba(159, 186, 234, .13); background: rgba(255,255,255,.035); border-radius: 11px; margin-bottom: 20px; }
.tenant-avatar { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: linear-gradient(145deg, #345f9b, #2c4a75); font-size: 11px; font-weight: 750; color: #e7f0ff; }
.tenant-mini-copy { flex: 1; min-width: 0; }
.tenant-mini-copy small { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--nav-muted); }
.tenant-mini-copy b { display: block; font-size: 12.5px; font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tenant-switch { border: 0; background: transparent; color: var(--nav-muted); padding: 4px; border-radius: 6px; }
.tenant-switch:hover { background: rgba(255,255,255,.08); color: #fff; }
.tenant-switch .icon { width: 15px; height: 15px; }
.nav { flex: 1; overflow-y: auto; scrollbar-width: thin; }
.nav-group { margin-bottom: 18px; }
.nav-label { display: block; padding: 0 10px 7px; color: var(--nav-muted); font-size: 9.5px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--nav-ink); font-size: 12.5px; margin-bottom: 2px; position: relative; transition: background .14s, color .14s; }
.nav-link .icon { width: 17px; height: 17px; color: var(--nav-muted); transition: color .14s; }
.nav-link em { margin-left: auto; font-style: normal; font-size: 10px; color: var(--nav-muted); background: rgba(255,255,255,.06); padding: 1px 6px; border-radius: 20px; }
.nav-link:hover { background: rgba(255,255,255,.055); color: #fff; }
.nav-link:hover .icon { color: #c6dcff; }
.nav-link.active { background: linear-gradient(90deg, rgba(76,134,255,.22), rgba(76,134,255,.07)); color: #fff; box-shadow: inset 0 0 0 1px rgba(124,169,255,.16); }
.nav-link.active .icon { color: #8db8ff; }
.nav-link.active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 4px 4px 0; background: #5c9bff; }
.sidebar-foot { padding-top: 12px; border-top: 1px solid rgba(159, 186, 234, .1); }
.admin-chip { display: flex; align-items: center; gap: 8px; padding: 10px 7px 0; margin-top: 2px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #2c4a75; color: #dce9ff; font-size: 11px; font-weight: 700; flex: 0 0 auto; }
.admin-chip-copy { flex: 1; min-width: 0; }
.admin-chip-copy b { display: block; font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-chip-copy small { display: block; font-size: 9.5px; color: var(--nav-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-chip .icon-button { color: var(--nav-muted); }
.app-main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { height: 66px; display: flex; align-items: center; gap: 16px; padding: 0 clamp(18px, 3vw, 34px); background: color-mix(in srgb, var(--surface) 88%, transparent); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(16px); }
.menu-button { display: none; }
.topbar-tenant { display: flex; flex-direction: column; gap: 1px; }
.topbar-tenant .eyebrow { color: var(--muted); margin: 0; font-size: 9px; }
.tenant-picker { border: 0; background: transparent; padding: 0; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 650; color: var(--ink); }
.tenant-picker .icon { width: 14px; height: 14px; color: var(--muted); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 18%, transparent); }
.status-dot.suspended { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 7px; }
.command-search { display: flex; align-items: center; gap: 7px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; width: 230px; color: var(--muted); }
.command-search .icon { width: 15px; height: 15px; }
.command-search input { border: 0; background: none; outline: none; width: 100%; font-size: 11.5px; color: var(--ink); }
.command-search kbd { font-size: 9px; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 4px; padding: 1px 4px; background: var(--surface); }
.icon-button { border: 1px solid transparent; background: transparent; color: var(--muted); width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 8px; }
.icon-button:hover { background: var(--surface-3); color: var(--ink); }
.icon-button .icon { width: 18px; height: 18px; }
#themeToggle .theme-moon { display: none; }
:root[data-theme="dark"] #themeToggle .theme-sun { display: none; }
:root[data-theme="dark"] #themeToggle .theme-moon { display: block; }
.view-root { padding: clamp(22px, 3.2vw, 42px) clamp(18px, 3.4vw, 44px) 70px; max-width: 1560px; width: 100%; margin: 0 auto; outline: none; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.view-head h1 { margin: 0 0 5px; font-size: 28px; font-weight: 690; letter-spacing: -.035em; }
.view-head p { margin: 0; color: var(--muted); font-size: 12.5px; max-width: 660px; }
.view-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search-box { display: flex; align-items: center; gap: 7px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-width: 220px; }
.toolbar .search-box .icon { width: 15px; height: 15px; color: var(--muted); }
.toolbar .search-box input { border: 0; background: none; outline: none; width: 100%; font-size: 12px; }
.toolbar select, .toolbar .input { width: auto; min-width: 120px; padding: 7px 9px; font-size: 11.5px; border-radius: 8px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 19px 20px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 17px 19px 0; }
.card-head h2, .card-head h3 { margin: 0; font-size: 13.5px; font-weight: 680; letter-spacing: -.01em; }
.card-head p { margin: 3px 0 0; font-size: 11.5px; color: var(--muted); }
.panel-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .95fr); gap: 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 17px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 15px 16px; position: relative; overflow: hidden; }
.stat-card::after { content: ""; position: absolute; right: -18px; top: -22px; width: 76px; height: 76px; border-radius: 50%; background: var(--brand-soft); opacity: .65; }
.stat-label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; position: relative; z-index: 1; }
.stat-label .icon { width: 14px; height: 14px; }
.stat-value { display: block; margin: 11px 0 4px; font-size: 27px; letter-spacing: -.04em; font-weight: 700; position: relative; z-index: 1; }
.stat-meta { color: var(--muted); font-size: 10.5px; position: relative; z-index: 1; }
.stat-meta b { color: var(--good); font-weight: 650; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; }
.policy-ring { display: flex; align-items: center; gap: 18px; padding: 18px 19px; }
.ring { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--brand) calc(var(--value) * 1%), var(--surface-3) 0); position: relative; flex: 0 0 auto; }
.ring::before { content: ""; position: absolute; inset: 8px; background: var(--surface); border-radius: 50%; }
.ring strong { position: relative; z-index: 1; font-size: 20px; letter-spacing: -.04em; }
.ring small { position: absolute; z-index: 1; bottom: 25px; font-size: 8px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.ring-copy h3 { margin: 0 0 5px; font-size: 13px; }
.ring-copy p { margin: 0 0 9px; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.check-list { display: grid; gap: 8px; margin-top: 7px; }
.check-item { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--ink-2); }
.check-dot { width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); flex: 0 0 auto; }
.check-dot .icon { width: 11px; height: 11px; }
.check-dot.good { background: var(--good-soft); color: var(--good); }
.check-dot.warn { background: var(--warn-soft); color: var(--warn); }
.audit-mini { display: grid; }
.audit-mini-item { display: flex; gap: 10px; padding: 11px 19px; border-top: 1px solid var(--line); align-items: flex-start; }
.audit-mini-item:first-child { border-top: 0; }
.audit-mini-icon { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); flex: 0 0 auto; }
.audit-mini-icon .icon { width: 14px; height: 14px; }
.audit-mini-copy { min-width: 0; }
.audit-mini-copy b { display: block; font-size: 11.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-mini-copy small { display: block; color: var(--muted); font-size: 10.5px; margin-top: 1px; }
.audit-mini-time { margin-left: auto; color: var(--muted); font-size: 9.5px; white-space: nowrap; }
.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; padding: 15px 19px 19px; }
.quick-action { text-align: left; border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 11px; display: flex; flex-direction: column; gap: 8px; transition: border-color .15s, background .15s; }
.quick-action:hover { border-color: var(--line-strong); background: var(--surface); }
.quick-action .icon { width: 17px; height: 17px; color: var(--brand); }
.quick-action b { font-size: 11.5px; font-weight: 650; }
.quick-action small { font-size: 10px; color: var(--muted); }

/* Tables */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 12px; }
table.data th { text-align: left; padding: 10px 13px; font-size: 9.5px; letter-spacing: .075em; text-transform: uppercase; color: var(--muted); font-weight: 730; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 11px 13px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr.clickable { cursor: pointer; }
table.data .cell-strong { font-weight: 600; }
table.data .cell-sub { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.user-cell { display: flex; align-items: center; gap: 9px; min-width: 190px; }
.user-cell .avatar { width: 29px; height: 29px; font-size: 10px; }
.user-cell b { display: block; font-size: 12px; font-weight: 600; }
.user-cell small { display: block; color: var(--muted); font-size: 10.5px; }
.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 5px; padding: 2px 7px; font-size: 9.5px; font-weight: 680; letter-spacing: .015em; border: 1px solid transparent; white-space: nowrap; }
.badge.active { background: var(--good-soft); color: var(--good); border-color: color-mix(in srgb, var(--good) 18%, transparent); }
.badge.suspended { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 18%, transparent); }
.badge.invited { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 18%, transparent); }
.badge.system { background: #eef0ff; color: #5b45c9; border-color: #ded9ff; }
:root[data-theme="dark"] .badge.system { background: #241f4b; color: #b9aaff; border-color: #3d3477; }
.badge.verified { background: var(--good-soft); color: var(--good); }
.badge.pending { background: var(--warn-soft); color: var(--warn); }
.badge.neutral { background: var(--surface-3); color: var(--muted); }
.row-actions { display: flex; gap: 3px; align-items: center; justify-content: flex-end; }
.row-actions .icon-button { width: 27px; height: 27px; }
.row-actions .icon-button .icon { width: 15px; height: 15px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; background: var(--surface); }
.pagination .btn { padding: 5px 9px; font-size: 10.5px; }
.empty { padding: 52px 24px; text-align: center; color: var(--muted); }
.empty .icon { width: 30px; height: 30px; margin-bottom: 10px; color: var(--line-strong); }
.empty h3 { margin: 0 0 5px; color: var(--ink-2); font-size: 14px; }
.empty p { margin: 0; font-size: 12px; }
.bulk-bar { display: flex; align-items: center; gap: 10px; padding: 9px 13px; background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 18%, transparent); border-radius: 9px; margin-bottom: 11px; font-size: 11.5px; color: var(--ink-2); }
.bulk-bar b { color: var(--brand); }
.bulk-bar .spacer { flex: 1; }
input[type="checkbox"] { accent-color: var(--brand); width: 14px; height: 14px; }
.check-col { width: 34px; }

/* Cards/list pages */
.entity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.entity-card { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.entity-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.entity-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 11px; }
.entity-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: 0 0 auto; }
.entity-icon .icon { width: 17px; height: 17px; }
.entity-title { flex: 1; min-width: 0; }
.entity-title b { display: block; font-size: 13px; font-weight: 650; }
.entity-title small { display: block; font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.entity-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 10.5px; padding-top: 10px; border-top: 1px solid var(--line); margin-top: 10px; }
.entity-meta .spacer { flex: 1; }
.domain-card .check-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 10px; }
.check-pill { display: flex; align-items: center; justify-content: center; gap: 3px; padding: 4px 3px; border-radius: 5px; font-size: 9px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.check-pill.ok { background: var(--good-soft); color: var(--good); border-color: transparent; }
.check-pill .icon { width: 10px; height: 10px; }
.org-tree { padding: 10px 0; }
.org-node { display: flex; align-items: center; gap: 9px; padding: 9px 14px 9px calc(14px + var(--depth) * 22px); border-bottom: 1px solid var(--line); }
.org-node:last-child { border-bottom: 0; }
.org-node .org-caret { width: 15px; height: 15px; color: var(--muted); }
.org-node .org-name { font-size: 12px; font-weight: 600; flex: 1; }
.org-node .org-meta { font-size: 10.5px; color: var(--muted); }
.org-node .row-actions { opacity: 0; transition: opacity .12s; }
.org-node:hover .row-actions { opacity: 1; }

/* Policy forms */
.policy-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 18px; align-items: start; }
.policy-nav { position: sticky; top: 82px; display: grid; gap: 2px; }
.policy-nav button { border: 0; background: transparent; padding: 8px 10px; text-align: left; border-radius: 7px; color: var(--muted); font-size: 12px; font-weight: 550; }
.policy-nav button:hover { background: var(--surface-3); color: var(--ink); }
.policy-nav button.active { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.policy-panel { display: none; }
.policy-panel.active { display: block; }
.policy-section { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.policy-section:last-child { border-bottom: 0; }
.policy-section h3 { margin: 0 0 3px; font-size: 13px; }
.policy-section > p { margin: 0 0 14px; font-size: 11.5px; color: var(--muted); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 10px 0; border-top: 1px solid var(--line); }
.setting-row:first-of-type { border-top: 0; }
.setting-copy b { display: block; font-size: 11.5px; font-weight: 600; }
.setting-copy small { display: block; font-size: 10.5px; color: var(--muted); margin-top: 2px; max-width: 520px; line-height: 1.45; }
.setting-control { flex: 0 0 auto; }
.setting-control .input, .setting-control select { padding: 6px 8px; font-size: 11.5px; border-radius: 7px; min-width: 130px; }
.switch { width: 36px; height: 21px; border-radius: 20px; border: 0; background: var(--line-strong); padding: 2px; transition: background .15s; position: relative; }
.switch::after { content: ""; display: block; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--brand); }
.switch[aria-checked="true"]::after { transform: translateX(15px); }
.input-group { display: flex; gap: 5px; align-items: center; }
.input-group .input { width: 110px; }
.tag-input { display: flex; flex-wrap: wrap; gap: 5px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px; min-height: 34px; max-width: 360px; background: var(--surface); }
.tag-input .tag { display: inline-flex; align-items: center; gap: 3px; background: var(--surface-3); border-radius: 4px; padding: 2px 6px; font-size: 10px; }
.tag-input input { border: 0; outline: none; background: none; font-size: 11px; min-width: 80px; flex: 1; }
.policy-save { position: sticky; bottom: 14px; display: flex; align-items: center; gap: 10px; padding: 11px 14px; background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow); backdrop-filter: blur(14px); margin-top: 14px; }
.policy-save span { color: var(--muted); font-size: 11px; flex: 1; }

/* Roles */
.permission-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 7px; }
.permission-check { display: flex; align-items: flex-start; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 11px; background: var(--surface); }
.permission-check input { margin-top: 1px; }
.permission-check b { display: block; font-size: 11px; }
.permission-check small { display: block; color: var(--muted); font-size: 9.5px; margin-top: 1px; line-height: 1.35; }
.role-card { padding: 15px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.role-top { display: flex; gap: 9px; align-items: flex-start; }
.role-top .entity-icon { width: 30px; height: 30px; }
.role-top b { font-size: 12.5px; }
.role-top small { display: block; color: var(--muted); font-size: 10px; margin-top: 1px; }
.role-perms { display: flex; flex-wrap: wrap; gap: 4px; }
.perm-chip { font-size: 9px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 2px 5px; color: var(--muted); }
.role-actions { display: flex; gap: 5px; margin-top: auto; padding-top: 6px; }

/* Audit */
.audit-table td { font-size: 11px; }
.audit-action { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; color: var(--brand); background: var(--brand-soft); padding: 2px 5px; border-radius: 4px; }
.audit-detail { max-width: 340px; color: var(--muted); font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-time { color: var(--muted); font-size: 10px; white-space: nowrap; }

/* Modal/drawer */
.modal-backdrop { position: fixed; inset: 0; background: rgba(8, 15, 28, .55); backdrop-filter: blur(4px); z-index: 80; display: grid; place-items: center; padding: 20px; animation: fadeIn .14s ease; }
.modal { width: min(600px, 100%); max-height: min(86vh, 840px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow-lg); animation: slideUp .18s ease; }
.modal.wide { width: min(820px, 100%); }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 0; }
.modal-title { flex: 1; }
.modal-title h2 { margin: 0 0 4px; font-size: 19px; letter-spacing: -.025em; }
.modal-title p { margin: 0; color: var(--muted); font-size: 11.5px; }
.modal-body { padding: 18px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 22px 19px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 15px 15px; }
.modal-close { color: var(--muted); }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(8, 15, 28, .4); z-index: 70; animation: fadeIn .12s ease; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); z-index: 71; display: flex; flex-direction: column; animation: slideLeft .18s ease; }
.drawer-head { padding: 19px 21px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; gap: 10px; }
.drawer-head h2 { margin: 0 0 3px; font-size: 18px; letter-spacing: -.025em; }
.drawer-head p { margin: 0; font-size: 11.5px; color: var(--muted); }
.drawer-body { flex: 1; overflow: auto; padding: 18px 21px 26px; }
.drawer-foot { padding: 12px 21px; border-top: 1px solid var(--line); display: flex; gap: 7px; justify-content: flex-end; background: var(--surface-2); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 0 16px; }
.tabs button { border: 0; background: none; padding: 8px 10px; color: var(--muted); font-size: 11.5px; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.detail-list { display: grid; gap: 10px; }
.detail-row { display: flex; justify-content: space-between; gap: 16px; font-size: 11.5px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.detail-row:last-child { border-bottom: 0; }
.detail-row span { color: var(--muted); }
.detail-row b { font-weight: 600; text-align: right; word-break: break-word; }
.mini-section { margin-top: 18px; }
.mini-section h3 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.avatar-block { display: flex; gap: 11px; align-items: center; margin-bottom: 14px; }
.avatar-block .avatar { width: 46px; height: 46px; font-size: 15px; background: var(--brand-soft); color: var(--brand); }
.avatar-block h3 { margin: 0; font-size: 16px; }
.avatar-block p { margin: 2px 0 0; color: var(--muted); font-size: 11.5px; }
.copy-box { display: flex; align-items: center; gap: 8px; padding: 9px 10px; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 8px; font-family: ui-monospace, monospace; font-size: 11px; word-break: break-all; }
.copy-box span { flex: 1; }
.inline-form { display: flex; gap: 7px; align-items: flex-end; }
.inline-form .field { flex: 1; margin-bottom: 0; }
.empty-mini { color: var(--muted); font-size: 11.5px; padding: 8px 0; }

/* Toasts */
.toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 120; display: grid; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 9px; min-width: 260px; max-width: 380px; padding: 11px 13px; border-radius: 9px; background: var(--ink); color: var(--surface); box-shadow: var(--shadow-lg); font-size: 11.5px; animation: slideUp .16s ease; }
.toast .icon { width: 15px; height: 15px; color: #7ee2a8; }
.toast.error .icon { color: #ff9d96; }
.toast span { flex: 1; line-height: 1.4; }
.command-palette { position: fixed; inset: 0; z-index: 110; background: rgba(8,15,28,.45); display: grid; place-items: start center; padding-top: 12vh; }
.palette-box { width: min(520px, calc(100% - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.palette-input input { border: 0; outline: none; background: none; width: 100%; font-size: 13px; }
.palette-results { max-height: 280px; overflow: auto; padding: 6px; }
.palette-result { display: flex; align-items: center; gap: 8px; padding: 8px 9px; border-radius: 7px; font-size: 11.5px; cursor: pointer; }
.palette-result:hover, .palette-result.active { background: var(--surface-3); }
.palette-result .icon { width: 15px; height: 15px; color: var(--muted); }
.palette-empty { padding: 22px; text-align: center; color: var(--muted); font-size: 11.5px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideLeft { from { transform: translateX(22px); opacity: .6; } to { transform: translateX(0); opacity: 1; } }

@media (max-width: 1120px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .command-search { width: 180px; }
}
@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 260px; padding: 28px; }
  .login-hero-copy { display: none; }
  .login-foot { margin-top: auto; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 246px; transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar-close, .menu-button { display: inline-grid !important; }
  .menu-button { margin-right: 2px; }
  .panel-grid { grid-template-columns: 1fr; }
  .policy-layout { grid-template-columns: 1fr; }
  .policy-nav { position: static; display: flex; overflow: auto; gap: 3px; }
  .policy-nav button { white-space: nowrap; }
  .topbar { padding: 0 14px; gap: 9px; }
  .view-root { padding: 20px 14px 60px; }
  .command-search { display: none; }
  .view-head { align-items: flex-start; flex-direction: column; gap: 12px; }
}
@media (max-width: 620px) {
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat-value { font-size: 23px; }
  .topbar-tenant .eyebrow { display: none; }
  .tenant-picker { font-size: 12px; }
  .view-head h1 { font-size: 23px; }
  .field-row { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 10px; }
  .modal { max-height: 93vh; }
  .drawer { width: 100%; }
  .table-wrap { border-radius: 10px; }
  table.data th, table.data td { padding: 9px 10px; }
  .audit-detail { max-width: 160px; }
  .quick-grid { grid-template-columns: 1fr; }
}
