/* Portal design system (round 7, dark theme round 8). Own shell, no third-party CSS.
   Themes on <html data-theme="semi|light|dark">: semi = black sidebar (default), dark = everything black for night use.
   "Auto" is resolved to light/dark before first paint (og/theme.js inline in <head>). Colours live ONLY in the tokens below. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
    src: url("fonts/inter-latin-wght-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
    src: url("fonts/inter-latin-ext-wght-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
    --bg: #f3f4f6; --card: #ffffff; --hover: #f5f6f8; --border: #e1e3e8; --border-strong: #cfd3da;
    --text: #111114; --muted: #3f4350; --dim: #6b7080;
    --accent: #2563eb; --accent-hover: #1d4ed8; --accent-soft: rgba(37, 99, 235, .1);
    --success: #16a34a; --success-soft: rgba(22, 163, 74, .1); --warning: #d97706; --warning-soft: rgba(217, 119, 6, .12);
    --danger: #dc2626; --danger-soft: rgba(220, 38, 38, .1);
    --on-accent: #ffffff; --danger-fill: #dc2626; --success-fill: #16a34a; --on-warning: #ffffff; --accent-fill: #2563eb; --accent-fill-hover: #1d4ed8; --input-bg: #ffffff; --row-hover: #fafbfc; --raised: #ffffff;
    --toast-bg: #111114; --toast-text: #ffffff; --toast-ok: #4ade80; --overlay: rgba(10, 10, 11, .5); --shadow: rgba(0, 0, 0, .18);
    --money-bg: #dcfce7; --money-text: #166534; --money-hover-bg: #bbf7d0; --money-hover-text: #14532d; --low-bg: #fef3c7; --low-text: #92400e;
    --ok-text: #166534; --ok-border: rgba(22, 163, 74, .25); --bad-text: #991b1b; --bad-border: rgba(220, 38, 38, .25); --warn-text: #92400e; --warn-border: rgba(217, 119, 6, .3);
    --info-text: #1e40af; --info-border: rgba(37, 99, 235, .25); --danger-line: rgba(220, 38, 38, .4); --warning-line: rgba(217, 119, 6, .45); --success-line: rgba(22, 163, 74, .45);
    --phone-body: #000000; --phone-screen: #ffffff; --phone-text: #111114; --phone-bubble: #e9e9eb; --phone-muted: #6b7080;
    --bubble-out-bg: #dbeafe; --bubble-out-text: #1e3a8a; --paper: #ffffff; --paper-text: #111114;
    --chart-sent: #93b4f5; --chart-delivered: #2563eb; --chart-grid: #e1e3e8; --chart-axis: #6b7080; --chart-tip-bg: #111114; --chart-tip-text: #ffffff;
    --shadow-soft: rgba(0, 0, 0, .08); --note-border: rgba(217, 119, 6, .35); --note-dash: rgba(217, 119, 6, .5); --on-accent-muted: rgba(255, 255, 255, .8); --danger-chip: rgba(220, 38, 38, .9);
    --frame-head-bg: #f8fafc; --frame-line: #e5e7eb;
    --wa-chat: #efeae2; --wa-dots: rgba(0, 0, 0, .035); --wa-bubble: #ffffff; --wa-text: #111b21; --wa-meta: #667781; --wa-muted: #8696a0; --wa-shadow: rgba(11, 20, 26, .13); --wa-var-bg: #d9fdd3; --wa-var-text: #0b5c3f; --wa-soft: rgba(37, 211, 102, .14);
    --phone-head: #f6f6f8; --phone-head-android: #f3f6fc; --phone-line: #ececf0; --phone-avatar: #9ca3af; --phone-avatar-text: #ffffff; --phone-bubble-android: #e8eef9; --phone-link: #1a56db; --phone-accent: #2563eb;
    --phone-field: #f1f2f5; --phone-field-border: #e1e3e8; --phone-field-text: #9ca3af; --phone-chip: #dbe6fb; --phone-home: #111114; --phone-card: #ffffff; --phone-card-ios: rgba(255, 255, 255, .96); --phone-scrim: rgba(10, 10, 11, .55);
    color-scheme: light;
    --side-bg: #0a0a0b; --side-item: #161618; --side-hover: #1c1c1f; --side-border: #2a2a2e; --side-text: #f4f4f5; --side-muted: #a1a1aa; --side-dim: #71717a; --side-accent: #60a5fa;
    --radius: 10px; --radius-sm: 8px; --side-w: 220px; --top-h: 64px;
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
html[data-theme="light"] { --side-bg: #ffffff; --side-item: #ffffff; --side-hover: #f1f2f5; --side-border: #e1e3e8; --side-text: #111114; --side-muted: #3f4350; --side-dim: #6b7080; }
/* Dark (round 8): Ogave black, not gray. Contrast (WCAG AA) checked by tools/contrast-check.py: see docs/ui/dark-theme.md. */
html[data-theme="dark"] {
    --bg: #0a0a0b; --card: #141416; --hover: #1c1c1f; --raised: #1c1c1f; --border: #232327; --border-strong: #2a2a2e;
    --text: #f4f4f5; --muted: #a1a1aa; --dim: #a1a1aa; --faint: #71717a;
    --accent: #3b82f6; --accent-hover: #60a5fa; --accent-soft: rgba(59, 130, 246, .16); --accent-fill: #2563eb; --accent-fill-hover: #1d4ed8;
    --success: #22c55e; --success-soft: rgba(34, 197, 94, .14); --warning: #f59e0b; --warning-soft: rgba(245, 158, 11, .14);
    --danger: #ef4444; --danger-soft: rgba(239, 68, 68, .15); --danger-fill: #dc2626; --b-danger-text: #f87171; --b-accent-text: #60a5fa; --success-fill: #15803d; --on-warning: #0a0a0b;
    --side-bg: #050506; --side-item: #141416; --side-hover: #1c1c1f; --side-border: #1f1f23; --side-text: #f4f4f5; --side-muted: #a1a1aa; --side-dim: #8b8b94;
    --input-bg: #101012; --row-hover: #18181b; --toast-bg: #1c1c1f; --toast-text: #f4f4f5; --overlay: rgba(0, 0, 0, .7); --shadow: rgba(0, 0, 0, .6);
    --money-bg: rgba(34, 197, 94, .14); --money-text: #4ade80; --money-hover-bg: rgba(34, 197, 94, .22); --money-hover-text: #86efac; --low-bg: rgba(245, 158, 11, .16); --low-text: #fbbf24;
    --ok-text: #4ade80; --ok-border: rgba(34, 197, 94, .3); --bad-text: #fca5a5; --bad-border: rgba(239, 68, 68, .35); --warn-text: #fbbf24; --warn-border: rgba(245, 158, 11, .35);
    --info-text: #93c5fd; --info-border: rgba(59, 130, 246, .35); --danger-line: rgba(239, 68, 68, .5); --warning-line: rgba(245, 158, 11, .5); --success-line: rgba(34, 197, 94, .5);
    --phone-body: #000000; --phone-screen: #000000; --phone-text: #f4f4f5; --phone-bubble: #262629; --phone-muted: #a1a1aa;
    --phone-frame: #26262a; --phone-frame-edge: #3a3a40; --phone-notch: #26262a; --phone-notch-edge: #3a3a40; /* black screen in a visible frame + dynamic island (DARK-APPROVED fix) */
    --bubble-out-bg: rgba(59, 130, 246, .2); --bubble-out-text: #dbeafe;
    --chart-sent: #93b4f5; --chart-delivered: #3b82f6; --chart-grid: #232327; --chart-axis: #a1a1aa; --chart-tip-bg: #1c1c1f; --chart-tip-text: #f4f4f5;
    --shadow-soft: rgba(0, 0, 0, .6); --note-border: rgba(245, 158, 11, .4); --note-dash: rgba(245, 158, 11, .5); --on-accent-muted: rgba(255, 255, 255, .85); --danger-chip: rgba(220, 38, 38, .95);
    --frame-head-bg: #1c1c1f; --frame-line: #232327;
    --wa-chat: #0b141a; --wa-dots: rgba(255, 255, 255, .03); --wa-bubble: #202c33; --wa-text: #e9edef; --wa-meta: #8696a0; --wa-muted: #8696a0; --wa-shadow: rgba(0, 0, 0, .4); --wa-var-bg: #005c4b; --wa-var-text: #d9fdd3; --wa-soft: rgba(37, 211, 102, .16);
    --phone-head: #121214; --phone-head-android: #111318; --phone-line: #1f1f23; --phone-avatar: #3f3f46; --phone-avatar-text: #f4f4f5; --phone-bubble-android: #1e2635; --phone-link: #93c5fd; --phone-accent: #0a84ff;
    --phone-field: #1c1c1f; --phone-field-border: #2a2a2e; --phone-field-text: #8b8b94; --phone-chip: rgba(59, 130, 246, .22); --phone-home: #f4f4f5; --phone-card: #1c1c1f; --phone-card-ios: rgba(28, 28, 31, .96); --phone-scrim: rgba(0, 0, 0, .6);
    color-scheme: dark;
}

[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); font-feature-settings: "cv11", "tnum"; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; } a:hover { color: var(--accent-hover); }
h1, h2, h3, h4 { margin: 0 0 .4rem; font-weight: 650; letter-spacing: -0.015em; color: var(--text); line-height: 1.25; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; } h4 { font-size: .92rem; }
p { margin: 0 0 .75rem; }
small, .small { font-size: .82rem; } .muted { color: var(--dim); } .mono { font-family: var(--mono); font-size: .85em; }
.ico { width: 18px; height: 18px; flex: 0 0 auto; vertical-align: -3px; } .ico-sm { width: 15px; height: 15px; } .ico-lg { width: 22px; height: 22px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
code { font-family: var(--mono); font-size: .85em; background: var(--hover); border: 1px solid var(--border); padding: 1px 5px; border-radius: 5px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.01em; font-size: 18px; color: var(--text); text-decoration: none; }
.logo:hover { color: inherit; }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent-fill); color: var(--on-accent); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; letter-spacing: 0; }
.logo-word { font-weight: 600; letter-spacing: -0.01em; }
.logo img { max-height: 30px; max-width: 170px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.side { background: var(--side-bg); border-right: 1px solid var(--side-border); color: var(--side-text); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.side .logo { color: var(--side-text); padding: 18px 22px 16px; font-size: 20px; }
.side-nav { flex: 1; overflow-y: auto; padding: 0 10px 16px; scrollbar-width: thin; display: flex; flex-direction: column; gap: 1px; }
.side-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--side-dim); padding: 14px 10px 6px; font-weight: 600; }
.side-link { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--side-muted); font-weight: 400; font-size: 15px; cursor: pointer; user-select: none; border: 0; background: none; width: 100%; text-align: left; }
.side-link:hover { background: var(--side-hover); color: var(--side-text); }
.side-link.active { background: var(--accent-fill); color: var(--on-accent); }
.side-link .badge { margin-left: auto; }
.side-link .chev { margin-left: auto; transition: transform .15s; width: 15px; height: 15px; }
.side-group.open > .side-link .chev { transform: rotate(90deg); }
.side-sub { display: none; padding: 2px 0 6px 30px; }
.side-group.open > .side-sub { display: block; }
.side-sub a { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 7px; color: var(--side-muted); font-size: 14px; }
.side-sub a:hover { color: var(--side-text); background: var(--side-hover); }
.side-sub a.active { color: var(--side-text); background: var(--side-hover); font-weight: 500; }
.side-sub .soon { margin-left: auto; font-size: .64rem; text-transform: uppercase; letter-spacing: .05em; color: var(--side-dim); border: 1px solid var(--side-border); border-radius: 999px; padding: 0 6px; }
.side-foot { border-top: 1px solid var(--side-border); padding: 12px 14px; display: flex; align-items: center; gap: 10px; font-size: .82rem; }
.side-foot .who { min-width: 0; } .side-foot .who b { display: block; font-weight: 600; color: var(--side-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .lang { font-size: .72rem; font-weight: 600; color: var(--side-muted); border: 1px solid var(--side-border); border-radius: 6px; padding: 2px 6px; } .side-foot .lang:hover { color: var(--side-text); }
.side-foot .who span { color: var(--side-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--side-item); border: 1px solid var(--side-border); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; color: var(--side-text); flex: 0 0 auto; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { min-height: var(--top-h); display: flex; align-items: center; gap: 12px; padding: 20px 22px 4px; max-width: 1360px; width: 100%; margin: 0 auto; }
.top .menu-btn { display: none; }
.top-title { min-width: 0; }
.top-title b { display: block; font-weight: 500; font-size: 20px; letter-spacing: -0.01em; } .top-title small { color: var(--dim); font-size: 13px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--muted); }
.top .icon-btn { border: 0; background: transparent; width: 34px; height: 34px; } .top .icon-btn:hover { background: var(--card); }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 8px; padding: 4px 12px; background: var(--hover); color: var(--muted); font-size: 13px; white-space: nowrap; }
.pill-money { background: var(--money-bg); color: var(--money-text); font-size: 14px; } .pill-money:hover { color: var(--money-hover-text); background: var(--money-hover-bg); }
.pill-money.low { background: var(--low-bg); color: var(--low-text); }
.pill .label { color: var(--dim); font-weight: 500; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; }
.icon-btn { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--border); background: var(--card); display: inline-flex; align-items: center; justify-content: center; color: var(--muted); cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn .dot { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--card); }
.content { padding: 8px 22px 28px; max-width: 1360px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { color: var(--dim); margin: 0; }
.crumbs { font-size: .8rem; color: var(--dim); margin-bottom: 4px; } .crumbs a { color: var(--dim); } .crumbs a:hover { color: var(--accent); }

/* ---------- grid ---------- */
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } .g-side { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.stack { display: flex; flex-direction: column; gap: 16px; } .hstack { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .between { justify-content: space-between; }
.mt-0 { margin-top: 0 } .mt-1 { margin-top: 8px } .mt-2 { margin-top: 16px } .mt-3 { margin-top: 24px } .mb-0 { margin-bottom: 0 } .mb-1 { margin-bottom: 8px } .mb-2 { margin-bottom: 16px }
.w-100 { width: 100%; } .text-right { text-align: right; } .text-center { text-align: center; } .nowrap { white-space: nowrap; } .grow { flex: 1; min-width: 0; }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 0; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card-body { padding: 16px 18px 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.kpi { padding: 16px 18px; }
.kpi-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; line-height: 1.15; }
.kpi-sub { font-size: .8rem; color: var(--dim); margin-top: 2px; }
.up { color: var(--success); } .down { color: var(--danger); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); display: inline-block; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--card); color: var(--text); font: 600 .88rem/1 var(--font); cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--hover); color: var(--text); }
.btn:disabled, .btn.disabled { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); } .btn-primary:hover { background: var(--accent-fill-hover); border-color: var(--accent-fill-hover); color: var(--on-accent); }
.btn-danger { background: var(--danger-fill); border-color: var(--danger-fill); color: var(--on-accent); } .btn-danger:hover { filter: brightness(.95); color: var(--on-accent); }
.btn-ghost { border-color: transparent; background: transparent; } .btn-ghost:hover { background: var(--hover); }
.btn-link { border: 0; background: none; color: var(--accent); padding: 0; height: auto; } .btn-link:hover { background: none; color: var(--accent-hover); }
.btn-sm { height: 30px; padding: 0 10px; font-size: .8rem; border-radius: 7px; } .btn-lg { height: 44px; padding: 0 18px; font-size: .95rem; }
.btn-block { width: 100%; }

/* ---------- forms ---------- */
.field { margin-bottom: 14px; }
.label { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.label .req { color: var(--danger); margin-left: 2px; }
.hint { font-size: .78rem; color: var(--dim); margin-top: 4px; }
.input, .select, .textarea { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--input-bg); color: var(--text);
    font: 400 .9rem var(--font); outline: none; transition: border-color .12s, box-shadow .12s; }
.textarea { height: auto; min-height: 110px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7080' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.select[multiple] { height: auto; padding: 6px; background-image: none; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.invalid, .select.invalid, .textarea.invalid { border-color: var(--danger); }
.err { color: var(--danger); font-size: .8rem; margin-top: 4px; }
.input-group { display: flex; } .input-group .input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .addon { display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid var(--border); border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--hover); color: var(--dim); font-size: .85rem; cursor: pointer; white-space: nowrap; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .9rem; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .88rem; }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 999px; background: var(--border-strong); position: relative; cursor: pointer; margin: 0; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--on-accent); transition: left .15s; }
.switch input:checked { background: var(--accent); } .switch input:checked::after { left: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; } .form-grid .full { grid-column: 1 / -1; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--hover); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--row-hover); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-compact td { padding: 7px 12px; }

/* ---------- badges / status ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: .74rem; font-weight: 600; background: var(--hover); color: var(--muted); white-space: nowrap; }
.b-success { background: var(--success-soft); color: var(--success); } .b-warning { background: var(--warning-soft); color: var(--warning); }
.b-danger { background: var(--danger-soft); color: var(--b-danger-text, var(--danger)); } .b-accent, .b-info { background: var(--accent-soft); color: var(--b-accent-text, var(--accent)); }
.b-solid-danger { background: var(--danger-fill); color: var(--on-accent); }
.st { font: 700 .7rem var(--mono); padding: 2px 6px; border-radius: 4px; letter-spacing: .03em; }
.st-DELIVRD { color: var(--success); background: var(--success-soft); } .st-ENROUTE { color: var(--warning); background: var(--warning-soft); }
.st-UNDELIV, .st-EXPIRED { color: var(--danger); background: var(--danger-soft); } .st-APPROVED { color: var(--accent); background: var(--accent-soft); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--dim); font-weight: 600; font-size: .88rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); } .tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--card); }
.seg a, .seg button { padding: 5px 12px; font-size: .8rem; font-weight: 600; color: var(--dim); border: 0; background: none; cursor: pointer; }
.seg .active { background: var(--accent-fill); color: var(--on-accent); }

/* ---------- alerts, toasts, modals, empty ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; border-radius: var(--radius-sm); padding: 11px 13px; font-size: .88rem; border: 1px solid var(--border); background: var(--hover); margin-bottom: 14px; }
.alert-success { background: var(--success-soft); border-color: var(--ok-border); color: var(--ok-text); }
.alert-error { background: var(--danger-soft); border-color: var(--bad-border); color: var(--bad-text); }
.alert-warning { background: var(--warning-soft); border-color: var(--warn-border); color: var(--warn-text); }
.alert-info { background: var(--accent-soft); border-color: var(--info-border); color: var(--info-text); }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast { background: var(--toast-bg); color: var(--toast-text); border: 1px solid var(--border); border-radius: 10px; padding: 11px 14px; font-size: .88rem; display: flex; gap: 10px; align-items: flex-start; box-shadow: 0 8px 24px var(--shadow); animation: tin .2s ease-out; }
.toast.t-error { background: var(--danger-fill); color: var(--on-accent); } .toast.t-success .ico { color: var(--toast-ok); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
.modal-bg { position: fixed; inset: 0; background: var(--overlay); display: none; align-items: center; justify-content: center; z-index: 90; padding: 16px; }
.modal-bg.open { display: flex; }
.modal { background: var(--card); border-radius: 14px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.empty { text-align: center; padding: 40px 20px; color: var(--dim); }
.empty .ico { width: 34px; height: 34px; color: var(--border-strong); margin-bottom: 10px; }
.empty h3 { color: var(--text); }
.progress { height: 8px; border-radius: 999px; background: var(--hover); overflow: hidden; } .progress > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar-row { margin-bottom: 11px; } .bar-row .hstack { font-size: .82rem; margin-bottom: 4px; } .bar-row .progress > span { background: var(--success); }
.list { list-style: none; margin: 0; padding: 0; } .list li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: .88rem; } .list li:last-child { border-bottom: 0; }
.shortcuts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.shortcut { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); color: var(--text); font-weight: 600; font-size: .88rem; }
.shortcut:hover { border-color: var(--accent); color: var(--text); }
.shortcut .ico { color: var(--accent); }
.steps { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.steps .step { display: flex; align-items: center; gap: 8px; color: var(--dim); font-weight: 600; font-size: .85rem; }
.steps .step b { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border-strong); display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; }
.steps .step.active { color: var(--accent); } .steps .step.active b { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }
.steps .step.done b { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); }
.steps .sep { width: 28px; height: 1px; background: var(--border-strong); align-self: center; }
.pagination { display: flex; gap: 4px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 32px; height: 32px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 7px; color: var(--muted); font-size: .82rem; background: var(--card); }
.pagination .active { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); } .pagination .disabled { opacity: .45; }
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 34px 20px; text-align: center; color: var(--dim); background: var(--hover); cursor: pointer; }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* ---------- auth ---------- */
.auth { display: grid; grid-template-columns: minmax(380px, 44%) 1fr; min-height: 100vh; }
.auth-wide { grid-template-columns: minmax(320px, 30%) 1fr; }
.auth-side { background: var(--side-bg); color: var(--side-text); border-right: 1px solid var(--side-border); padding: 40px 48px; display: flex; flex-direction: column; gap: 30px; position: sticky; top: 0; height: 100vh; }
.auth-side .logo { color: var(--side-text); }
.auth-side h1 { color: var(--side-text); font-size: 2rem; letter-spacing: -0.025em; margin-bottom: 10px; }
.auth-side p { color: var(--side-muted); max-width: 420px; }
.auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.auth-points li { display: flex; gap: 12px; } .auth-points .ico-box { width: 36px; height: 36px; border-radius: 9px; background: var(--side-item); border: 1px solid var(--side-border); display: flex; align-items: center; justify-content: center; color: var(--side-accent); flex: 0 0 auto; }
html[data-theme="light"] .auth-points .ico-box { color: var(--accent); }
.auth-points b { display: block; color: var(--side-text); font-weight: 600; } .auth-points small { color: var(--side-muted); }
.auth-side-foot { margin-top: auto; color: var(--side-dim); font-size: .8rem; }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-top { width: 100%; max-width: 440px; display: flex; justify-content: flex-end; gap: 6px; margin-bottom: 14px; }
.auth-wide .auth-top, .auth-wide .auth-card { max-width: 760px; }
.auth-card { width: 100%; max-width: 440px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 32px; }
.auth-mobile-logo { display: none; justify-content: center; margin-bottom: 20px; }
.auth-legal { margin-top: 16px; font-size: .8rem; color: var(--dim); } .auth-legal a { color: var(--dim); margin: 0 6px; }
.chip { display: inline-flex; align-items: center; height: 28px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--dim); font-size: .78rem; font-weight: 600; cursor: pointer; }
.chip.active { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }
.capslock { display: none; color: var(--warning); font-size: .78rem; margin-top: 4px; } .capslock.on { display: block; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: .78rem; margin: 18px 0; } .divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.mini-phone { width: 230px; border-radius: 32px; background: var(--phone-frame, var(--phone-body)); padding: 8px; border: 1px solid var(--phone-frame-edge, var(--side-border)); }
.mini-phone-screen { background: var(--phone-screen); border-radius: 25px; height: 200px; padding: 12px; }
.mini-phone-notch { width: 70px; height: 18px; border-radius: 10px; background: var(--phone-notch, var(--phone-body)); border: 1px solid var(--phone-notch-edge, transparent); margin: 0 auto 10px; }
.mini-phone-from { text-align: center; font-size: 11px; font-weight: 600; color: var(--phone-text); margin-bottom: 10px; }
.mini-phone-bubble { background: var(--phone-bubble); color: var(--phone-text); border-radius: 16px; padding: 8px 11px; font-size: 12.5px; line-height: 1.35; max-width: 90%; }
.code-big { font-size: 3.4rem; font-weight: 800; letter-spacing: -0.04em; color: var(--accent); line-height: 1; margin-bottom: 8px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-main, .g-side { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .side { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 80; transform: translateX(-100%); transition: transform .2s; }
    body.nav-open .side { transform: none; } body.nav-open::after { content: ""; position: fixed; inset: 0; background: var(--overlay); z-index: 70; }
    .top { padding: 12px 14px 4px; } .top .menu-btn { display: inline-flex; } .top-title small { display: none; }
    .content { padding: 6px 14px 24px; }
    .g-2, .g-3, #live { grid-template-columns: minmax(0, 1fr) !important; } .form-grid { grid-template-columns: minmax(0, 1fr); }
    .top-title { flex: 1; } .top-title b { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .top-title small { display: none; }
    .auth, .auth-wide { grid-template-columns: 1fr; } .auth-side { display: none; } .auth-mobile-logo { display: flex; } .auth-main { justify-content: flex-start; padding: 18px 14px; } .auth-card { padding: 22px 18px; }
}
@media (max-width: 560px) { .g-4 { grid-template-columns: 1fr 1fr; } .kpi-value { font-size: 1.4rem; } .pill .label, .top .hide-sm { display: none; } }

/* ---------- compatibility layer: class names used by the round 2–5 views, implemented with the tokens above ---------- */
.row { display: flex; flex-wrap: wrap; margin: 0 -8px; gap: 0; align-items: stretch; }
.row > [class*="col"] { padding: 0 8px; width: 100%; }
.row.g-1, .row.g-50, .row.gx-3 { margin: 0 -6px; row-gap: 10px; } .row.g-1 > [class*="col"], .row.g-50 > [class*="col"] { padding: 0 6px; }
.col, .col-auto { flex: 1 0 0; } .col-12 { width: 100%; }
.col-3 { width: 25%; } .col-4 { width: 33.333%; } .col-5 { width: 41.666%; } .col-6 { width: 50%; } .col-8 { width: 66.666%; }
@media (min-width: 768px) { .col-md-1 { width: 8.333%; } .col-md-2 { width: 16.666%; } .col-md-3 { width: 25%; } .col-md-4 { width: 33.333%; } .col-md-5 { width: 41.666%; } .col-md-6 { width: 50%; } .col-md-8 { width: 66.666%; } }
@media (min-width: 992px) { .col-lg-2 { width: 16.666%; } .col-lg-3 { width: 25%; } .col-lg-4 { width: 33.333%; } .col-lg-5 { width: 41.666%; } .col-lg-6 { width: 50%; } .col-lg-7 { width: 58.333%; } .col-lg-8 { width: 66.666%; } }
@media (min-width: 1200px) { .col-xl-4 { width: 33.333%; } .col-xl-5 { width: 41.666%; } .col-xl-7 { width: 58.333%; } .col-xl-8 { width: 66.666%; } }
.content .card { margin-bottom: 16px; } .grid > .card { margin-bottom: 0; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 16px 18px 0; }
.card-title { margin: 0; font-size: 1.02rem; font-weight: 650; }
.table-responsive { overflow-x: auto; } .table-sm td { padding: 8px 12px; } .table-sm th { padding: 8px 12px; }
.form-label { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.form-control, .form-select { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--input-bg); color: var(--text); font: 400 .9rem var(--font); outline: none; }
textarea.form-control { height: auto; padding: 10px 12px; min-height: 90px; }
.form-select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7080' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.form-select[multiple] { height: auto; background-image: none; padding: 4px; }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-control-sm, .form-select-sm { height: 32px; font-size: .82rem; }
.form-control-color { padding: 4px; height: 40px; }
.form-check { display: flex; align-items: center; gap: 8px; min-height: 24px; } .form-check-input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.form-check-label { font-size: .88rem; } .form-switch .form-check-input { width: 32px; }
.input-group-text { display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid var(--border); border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--hover); color: var(--dim); font-size: .85rem; white-space: nowrap; }
.input-group > .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); flex: 1; }
.btn-sm { height: 30px; padding: 0 10px; font-size: .8rem; border-radius: 7px; }
.btn-outline-primary { color: var(--accent); border-color: var(--accent); background: var(--card); } .btn-outline-primary:hover { background: var(--accent-soft); color: var(--accent); }
.btn-outline-secondary { color: var(--muted); } .btn-outline-danger { color: var(--danger); border-color: var(--danger-line); } .btn-outline-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-outline-warning { color: var(--warning); border-color: var(--warning-line); } .btn-outline-success { color: var(--success); border-color: var(--success-line); }
.btn-success { background: var(--success-fill); border-color: var(--success-fill); color: var(--on-accent); }
.btn-group { display: inline-flex; } .btn-group > .btn { border-radius: 0; margin-left: -1px; } .btn-group > .btn:first-child { border-radius: 7px 0 0 7px; } .btn-group > .btn:last-child { border-radius: 0 7px 7px 0; }
.btn-group .btn.active { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }
.badge.bg-light-success { background: var(--success-soft); color: var(--success); } .badge.bg-light-warning { background: var(--warning-soft); color: var(--warning); }
.badge.bg-light-danger { background: var(--danger-soft); color: var(--danger); } .badge.bg-light-primary, .badge.bg-light-info { background: var(--accent-soft); color: var(--accent); }
.badge.bg-light-secondary { background: var(--hover); color: var(--muted); } .badge.bg-success { background: var(--success-fill); color: var(--on-accent); } .badge.bg-danger { background: var(--danger-fill); color: var(--on-accent); }
.badge.bg-warning { background: var(--warning); color: var(--on-warning); } .badge.bg-secondary { background: var(--dim); color: var(--on-accent); } .badge.bg-primary { background: var(--accent-fill); color: var(--on-accent); }
.alert-danger { background: var(--danger-soft); border-color: var(--bad-border); color: var(--bad-text); }
.nav-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 0 0 16px; padding: 0; list-style: none; overflow-x: auto; }
.nav-tabs .nav-link { display: block; padding: 9px 14px; color: var(--dim); font-weight: 600; font-size: .88rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.nav-tabs .nav-link.active { color: var(--accent); border-bottom-color: var(--accent); }
.d-flex { display: flex; } .d-inline { display: inline; } .flex-wrap { flex-wrap: wrap; } .flex-fill { flex: 1 1 auto; } .align-items-center { align-items: center; } .align-items-end { align-items: flex-end; }
.justify-content-between { justify-content: space-between; } .justify-content-center { justify-content: center; }
.gap-0 { gap: 0; } .gap-25 { gap: 4px; } .gap-50 { gap: 8px; } .gap-1 { gap: 12px; }
.mb-0 { margin-bottom: 0 !important; } .mb-25 { margin-bottom: 4px; } .mb-50 { margin-bottom: 8px; } .mb-75 { margin-bottom: 12px; } .mb-1 { margin-bottom: 14px; } .mb-2 { margin-bottom: 20px; }
.mt-25 { margin-top: 4px; } .mt-50 { margin-top: 8px; } .mt-1 { margin-top: 14px; } .mt-2 { margin-top: 20px; } .ms-50 { margin-left: 8px; } .ms-auto { margin-left: auto; }
.p-1 { padding: 12px; } .py-25 { padding-top: 4px; padding-bottom: 4px; } .py-1 { padding-top: 12px; padding-bottom: 12px; } .pt-0 { padding-top: 0 !important; } .pb-0 { padding-bottom: 0 !important; }
.w-auto { width: auto; } .h-100 { height: 100%; } .text-end { text-align: right; } .text-start { text-align: left; }
.text-muted { color: var(--dim) !important; } .text-danger { color: var(--danger) !important; } .text-success { color: var(--success) !important; } .text-warning { color: var(--warning) !important; } .text-primary { color: var(--accent) !important; }
.text-nowrap { white-space: nowrap; } .text-break { word-break: break-word; } .text-wrap { white-space: normal; } .fw-bold, .fw-bolder { font-weight: 700; }
.user-select-all { user-select: all; } .rounded { border-radius: var(--radius-sm); } .border { border: 1px solid var(--border); } .border-warning { border-color: var(--warning-line) !important; }
.bg-light-warning { background: var(--warning-soft); } .bg-light-primary { background: var(--accent-soft); }
.og-kpi { padding: 16px 18px; } .og-kpi-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); font-weight: 600; }
.og-kpi-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; } .og-kpi-delta { font-size: .8rem; color: var(--dim); }
.og-up { color: var(--success); } .og-down { color: var(--danger); } .og-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); display: inline-block; margin-right: 6px; animation: pulse 1.6s infinite; }
.og-bar { height: 8px; border-radius: 999px; background: var(--hover); overflow: hidden; } .og-bar > span { display: block; height: 100%; background: var(--success); border-radius: 999px; }
.og-feed { font-family: var(--mono); font-size: .8rem; }
.og-st { font: 700 .7rem var(--mono); padding: 2px 6px; border-radius: 4px; }
.og-st-delivrd { color: var(--success); background: var(--success-soft); } .og-st-enroute { color: var(--warning); background: var(--warning-soft); }
.og-st-undeliv { color: var(--danger); background: var(--danger-soft); } .og-st-approved { color: var(--accent); background: var(--accent-soft); } .og-st-other { color: var(--dim); background: var(--hover); }
details > summary { cursor: pointer; }

/* ---------- approved sketch (1b): section labels, KPI density, country bars, live feed ---------- */
.sec { font-size: 14px; color: var(--dim); margin: 16px 0 6px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sec a, .sec button { font-size: 13px; }
.kpi { padding: 10px 14px; } .kpi-label { font-size: 13px; color: var(--dim); text-transform: none; letter-spacing: 0; font-weight: 400; margin: 0; }
.kpi-value { font-weight: 500; font-size: 22px; letter-spacing: -0.01em; line-height: 1.35; } .kpi-sub { font-size: 12px; color: var(--dim); }
.cbar { display: flex; gap: 8px; align-items: center; font-size: 14px; margin: 6px 0; }
.cbar > span:first-child { width: 44px; } .cbar > span:last-child { min-width: 38px; text-align: right; }
.cbar .track { flex: 1; background: var(--bg); border-radius: 4px; } .cbar .fill { height: 9px; border-radius: 4px; background: var(--success); }
.cbar .fill.mid { background: var(--warning); } .cbar .fill.bad { background: var(--danger); }
.feed { font-family: var(--mono); font-size: 14px; line-height: 1.8; padding: 10px 14px; overflow: hidden; }
.feed > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .feed .t { color: var(--dim); }
.c-ok { color: var(--success); } .c-warn { color: var(--warning); } .c-bad { color: var(--danger); } .c-info { color: var(--accent); }
.qs { padding: 14px; display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 14px; }
.qs-chips { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.qs-chips .select, .qs-chips .input { width: auto; height: 30px; padding: 3px 10px; font-size: 13px; border-radius: 8px; background: var(--bg); border-color: transparent; color: var(--muted); }
.qs textarea { background: var(--bg); border: 1px solid transparent; border-radius: 8px; padding: 12px; font-size: 15px; min-height: 64px; width: 100%; resize: vertical; font-family: inherit; color: var(--text); }
.qs textarea:focus { outline: none; border-color: var(--accent); background: var(--card); }
.qs-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 13px; color: var(--dim); gap: 8px; flex-wrap: wrap; }
.qs-prev { border: 1px solid var(--border); border-radius: 14px; padding: 10px; font-size: 13px; }
.qs-prev .bubble { background: var(--bubble-out-bg); color: var(--bubble-out-text); border-radius: 12px; padding: 8px 10px; margin-top: 6px; white-space: pre-wrap; word-break: break-word; }
.chip-flash { background: var(--low-bg) !important; color: var(--low-text) !important; }
@media (max-width: 760px) { .qs { grid-template-columns: 1fr; } .top { padding: 12px 14px 4px; } .content { padding: 6px 14px 24px; } }

/* segmented control from radios: <div class="seg"><input type="radio" id="a" name="x"><label for="a">A</label>…</div> */
.seg input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.seg label { padding: 5px 12px; font-size: .8rem; font-weight: 600; color: var(--dim); cursor: pointer; margin: 0; }
.seg input[type="radio"]:checked + label { background: var(--accent-fill); color: var(--on-accent); }
.seg input[type="radio"]:focus-visible + label { outline: 2px solid var(--accent); outline-offset: -2px; }
.grid > * { min-width: 0; }
.top-title { min-width: 0; }

/* ---------- theme menu (round 8) ---------- */
.theme-menu { position: relative; display: inline-flex; }
.theme-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 95; min-width: 200px; background: var(--raised); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 10px 30px var(--shadow); padding: 5px; }
.theme-pop button { display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: none; color: var(--text); font: 400 .88rem var(--font); padding: 8px 10px; border-radius: 7px; cursor: pointer; text-align: left; flex-wrap: wrap; }
.theme-pop button:hover { background: var(--hover); }
.theme-pop button small { flex-basis: 100%; padding-left: 24px; color: var(--dim); font-size: .74rem; margin-top: -3px; }
.theme-pop .tick { margin-left: auto; visibility: hidden; color: var(--accent); }
.theme-pop button[aria-checked="true"] .tick { visibility: visible; }
html[data-theme="dark"] img.on-light-only { filter: invert(1) hue-rotate(180deg); }
.theme-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 12px 0 16px; }
.theme-choice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; cursor: pointer; background: var(--card); }
.theme-choice:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-choice input { margin-top: 3px; accent-color: var(--accent); }
.theme-choice small { display: block; }
/* swatches show each theme regardless of the current one: fixed preview colours on purpose */
.theme-swatch { width: 46px; height: 34px; border-radius: 6px; border: 1px solid var(--border-strong); display: flex; overflow: hidden; flex: 0 0 auto; }
.theme-swatch i { width: 14px; } .theme-swatch b { flex: 1; }
.sw-semi i { background: #0a0a0b; } .sw-semi b { background: #f3f4f6; }
.sw-light i { background: #ffffff; border-right: 1px solid #e1e3e8; } .sw-light b { background: #f3f4f6; }
.sw-dark i { background: #050506; } .sw-dark b { background: #141416; }
.sw-auto i { background: linear-gradient(135deg, #ffffff 50%, #050506 50%); } .sw-auto b { background: linear-gradient(135deg, #f3f4f6 50%, #141416 50%); }
.logo .logo-on-dark { display: none; }
html[data-theme="dark"] .logo .logo-on-light { display: none; } html[data-theme="dark"] .logo .logo-on-dark { display: inline; }

/* Phone preview (css/ogave-phone.css keeps the phone's light look, shared with classic pages): in Dark the phone shows its own dark mode. */
html[data-theme="dark"] .og-ph-tabs { background: var(--card); border-color: var(--border); }
html[data-theme="dark"] .og-ph-tabs button { color: var(--muted); }
html[data-theme="dark"] .og-ph-tabs button.active { background: var(--accent-fill); color: var(--on-accent); }
html[data-theme="dark"] .og-ph-device { background: var(--phone-body); box-shadow: 0 0 0 1px var(--border-strong) inset, 0 0 0 1px var(--border-strong); }
html[data-theme="dark"] .og-ph-btn { background: var(--border-strong); }
html[data-theme="dark"] .og-ph-screen { background: var(--phone-screen); color: var(--phone-text); }
html[data-theme="dark"] .og-ph-name { color: var(--phone-text); }
html[data-theme="dark"] .og-ph-head { border-bottom-color: var(--phone-line); }
html[data-theme="dark"] .og-ph-iphone .og-ph-head { background: var(--phone-head); }
html[data-theme="dark"] .og-ph-android .og-ph-head { background: var(--phone-head-android); }
html[data-theme="dark"] .og-ph-iphone .og-ph-back, html[data-theme="dark"] .og-ph-flash-title, html[data-theme="dark"] .og-ph-flash-actions { color: var(--phone-accent); }
html[data-theme="dark"] .og-ph-avatar { background: var(--phone-avatar); color: var(--phone-avatar-text); }
html[data-theme="dark"] .og-ph-android .og-ph-avatar { background: var(--accent-fill); color: var(--on-accent); }
html[data-theme="dark"] .og-ph-day, html[data-theme="dark"] .og-ph-time, html[data-theme="dark"] .og-ph-input, html[data-theme="dark"] .og-ph-foot { color: var(--phone-muted); }
html[data-theme="dark"] .og-ph-bubble, html[data-theme="dark"] .og-ph-iphone .og-ph-bubble::before { background: var(--phone-bubble); color: var(--phone-text); }
html[data-theme="dark"] .og-ph-iphone .og-ph-bubble::after { background: var(--phone-screen); }
html[data-theme="dark"] .og-ph-android .og-ph-bubble { background: var(--phone-bubble-android); }
html[data-theme="dark"] .og-ph-android .og-ph-link { color: var(--phone-link); }
html[data-theme="dark"] .og-ph-empty { color: var(--phone-field-text); }
html[data-theme="dark"] .og-ph-field { border-color: var(--phone-field-border); color: var(--phone-field-text); }
html[data-theme="dark"] .og-ph-android .og-ph-field { background: var(--phone-field); }
html[data-theme="dark"] .og-ph-micbtn { background: var(--phone-chip); color: var(--phone-link); }
html[data-theme="dark"] .og-ph-home { background: var(--phone-home); }
html[data-theme="dark"] .og-ph-nav i { background: var(--phone-muted); }
html[data-theme="dark"] .og-ph-flash { background: var(--phone-scrim); }
html[data-theme="dark"] .og-ph-flash-card { background: var(--phone-card); color: var(--phone-text); }
html[data-theme="dark"] .og-ph-iphone .og-ph-flash-card { background: var(--phone-card-ios); }
html[data-theme="dark"] .og-ph-iphone .og-ph-flash-actions { border-top-color: var(--phone-line); }
