/* Signage Central — dashboard styles (no build step required) */

/*
 * Designs (themes) and modes. <html data-theme="aurora|midnight|clinical|studio" data-mode="light|dark">;
 * the head script resolves "auto" to light or dark. Every colour below is a token, so each design only
 * redefines tokens (see "Designs" at the end of this file). Organisation branding overrides --signal.
 */
:root {
    color-scheme: light;
    --ink: #1c1924;
    --ink-soft: #4f4a5c;
    --ink-faint: #827c8f;
    --canvas: #f4f2f8;
    --panel: #ffffff;
    --line: #e2dee9;
    --line-soft: #ece9f1;
    --line-strong: #c4bdd0;
    --head-bg: #faf9fc;
    --stage-bg: #e9e7ee;
    --signal: #6a3fb5;
    --signal-strong: #52308f;
    --signal-wash: #efe9f8;
    --on-signal: #ffffff;
    --bezel: #221d2b;
    --ok: #1f9d55;
    --ok-wash: #e4f5eb;
    --ok-line: #bfe3cd;
    --ok-ink: #176b3c;
    --warn: #b7791f;
    --warn-wash: #fbf1df;
    --warn-line: #efd8ab;
    --warn-ink: #855812;
    --bad: #c2410c;
    --bad-wash: #fbe9e1;
    --bad-line: #f2c9b6;
    --bad-ink: #9a330a;
    --idle: #8d879a;
    --idle-wash: #f2f1f4;

    /* Navigation (sidebar or top bar) */
    --nav-bg: #2a1d45;
    --nav-ink: #f3eefb;
    --nav-ink-soft: #c9bfdc;
    --nav-heading: #9a8db3;
    --nav-hover: rgba(255, 255, 255, .07);
    --nav-active-bg: rgba(155, 114, 230, .28);
    --nav-active-ink: #ffffff;
    --nav-line: transparent;

    /* Sign-in page */
    --hero-bg: #2a1d45;
    --hero-ink: #ffffff;
    --hero-soft: #c9bfdc;

    --font: "Schibsted Grotesk", "Segoe UI", system-ui, -apple-system, sans-serif;
    --font-display: var(--font);
    --radius-panel: 12px;
    --radius-control: 8px;
    --sidebar: 248px;
    --focus: 0 0 0 3px rgba(106, 63, 181, .35);
    --shadow: 0 1px 2px rgba(28, 25, 36, .04);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--canvas);

}

a { color: var(--signal); text-decoration: none; }
a:hover { color: var(--signal-strong); text-decoration: underline; }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }

h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-family: var(--font-display); }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.1rem; font-weight: 650; }
h3 { font-size: .98rem; font-weight: 650; }
p { margin: 0 0 .75rem; }

/* ---------- App shell ---------- */

.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }

.sidebar {
    background: var(--nav-bg);
    color: var(--nav-ink);
    border-inline-end: 1px solid var(--nav-line);
    padding: 20px 14px 32px;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; color: var(--nav-ink); }
.brand:hover { text-decoration: none; color: var(--nav-ink); }
.brand-mark {
    width: 30px; height: 22px; border-radius: 3px; border: 3px solid var(--bezel);
    background: linear-gradient(135deg, var(--signal) 0 55%, color-mix(in srgb, var(--signal) 50%, #fff) 55% 100%);
    position: relative; flex: none;
}
.brand-mark::after {
    content: ""; position: absolute; left: 50%; bottom: -8px; width: 10px; height: 3px;
    background: var(--bezel); transform: translateX(-50%); border-radius: 2px;
}
.brand-name { font-weight: 700; font-size: 1.02rem; letter-spacing: -0.02em; }

.nav-section { margin-top: 14px; }
.nav-heading { font-size: .74rem; color: var(--nav-heading); padding: 0 10px 4px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.nav a {
    gap: 10px;
    display: flex; align-items: center; justify-content: flex-start;
    padding: 7px 10px; border-radius: var(--radius-control);
    color: var(--nav-ink-soft); font-weight: 500;
}
.nav a:hover { background: var(--nav-hover); color: var(--nav-ink); text-decoration: none; }
.nav a.active { background: var(--nav-active-bg); color: var(--nav-active-ink); font-weight: 650; }
.nav .count { font-size: .78rem; color: var(--nav-heading); }

.main { min-width: 0; }

.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 12px 32px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.topbar-org { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.topbar-org .plan { font-weight: 500; color: var(--ink-faint); font-size: .85rem; }
.topbar-user { display: flex; align-items: center; gap: 14px; color: var(--ink-soft); font-size: .9rem; }
.topbar .menu-toggle { display: none; }
table, .figure .value, .meter, .code { font-variant-numeric: tabular-nums; }

.content { padding: 28px 40px 64px; max-width: 1640px; margin-inline: auto; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { color: var(--ink-soft); margin: 6px 0 0; max-width: 70ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: .85rem; color: var(--ink-faint); margin-bottom: 6px; }
.crumbs a { color: var(--ink-faint); }

/* ---------- Panels & layout ---------- */

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-panel); }
.panel + .panel { margin-top: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.panel-head p { margin: 2px 0 0; color: var(--ink-faint); font-size: .86rem; }
.panel-body { padding: 18px; }
.panel-body.flush { padding: 0; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-2 > * + .panel, .grid-2 .panel + .panel { margin-top: 0; }
.stack > * + * { margin-top: 20px; }

/* Key figures: a single quiet strip rather than a row of cards */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-panel); margin-bottom: 20px; }
.figure { padding: 14px 18px; border-inline-start: 1px solid var(--line-soft); }
.figure:first-child { border-inline-start: 0; }
.figure .value { font-size: 1.55rem; font-weight: 700; letter-spacing: -0.02em; }
.figure .label { color: var(--ink-soft); font-size: .86rem; }
.figure .sub { color: var(--ink-faint); font-size: .8rem; }
.meter { height: 5px; background: var(--line-soft); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--signal); }
.meter.high > span { background: var(--warn); }

/* ---------- The screen wall (signature element) ---------- */

.wall { display: flex; flex-wrap: wrap; gap: 26px 22px; align-items: flex-end; padding: 22px 20px 26px; }
.tile { width: 168px; color: var(--ink); }
.tile:hover { text-decoration: none; color: var(--ink); }
.tile.portrait { width: 96px; }
.tile-display {
    position: relative; background: var(--bezel); border-radius: 4px; padding: 5px;
    box-shadow: 0 0 0 0 transparent; transition: box-shadow .2s;
}
.tile-display::after { /* stand */
    content: ""; position: absolute; left: 50%; bottom: -9px; width: 26px; height: 5px;
    transform: translateX(-50%); background: var(--bezel); border-radius: 0 0 3px 3px;
}
.tile-screen {
    aspect-ratio: var(--ratio, 16 / 9); background: color-mix(in srgb, var(--bezel) 82%, var(--signal)) center / cover no-repeat;
    border-radius: 1px; display: grid; place-items: center; overflow: hidden;
    color: #b3abc2; font-size: .72rem; text-align: center;
}
.tile-screen img, .tile-screen video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile[data-status="online"] .tile-display { box-shadow: 0 0 0 2px var(--ok), 0 0 14px rgba(31, 157, 85, .35); }
.tile[data-status="offline"] .tile-display,
.tile[data-status="never_connected"] .tile-display { box-shadow: 0 0 0 2px var(--bad); }
.tile[data-status="offline"] .tile-screen { filter: grayscale(1) brightness(.55); }
.tile[data-status="unassigned"] .tile-display { background: var(--idle); }
.tile-name { margin-top: 14px; font-weight: 600; font-size: .88rem; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-meta { font-size: .78rem; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (prefers-reduced-motion: reduce) { .tile-display { transition: none; } }

/* Small inline monitor glyph for tables */
.glyph { display: inline-block; width: 22px; height: 14px; border: 2px solid var(--bezel); border-radius: 2px; vertical-align: -2px; margin-inline-end: 8px; background: #332c3f; }
.glyph.portrait { width: 12px; height: 20px; vertical-align: -5px; }
.glyph[data-status="online"] { background: var(--ok); }
.glyph[data-status="offline"], .glyph[data-status="never_connected"] { background: var(--bad); }
.glyph[data-status="unassigned"] { background: var(--line); border-color: var(--idle); }

/* ---------- Status ---------- */

.status { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-online, .status-active, .status-completed, .status-ready { color: var(--ok); background: var(--ok-wash); }
.status-stopped { color: var(--panel); background: var(--ink-soft); }
.status-offline, .status-never_connected, .status-error, .status-failed, .status-expired, .status-suspended, .status-revoked { color: var(--bad); background: var(--bad-wash); }
.status-pending, .status-delivered, .status-scheduled, .status-syncing, .status-warning, .status-interrupted { color: var(--warn); background: var(--warn-wash); }
.status-unassigned, .status-idle, .status-inactive, .status-draft { color: var(--idle); background: var(--idle-wash); }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 10px 18px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
th { font-size: .82rem; font-weight: 600; color: var(--ink-faint); background: var(--head-bg); }
tr:last-child td { border-bottom: 0; }
td .muted, .muted { color: var(--ink-faint); }
td.num, th.num { text-align: end; }
.row-title { font-weight: 600; color: var(--ink); }
a.row-title:hover { color: var(--signal); }

/* ---------- Definition lists ---------- */

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.facts dt { color: var(--ink-faint); font-size: .88rem; }
.facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* ---------- Forms ---------- */

.form { max-width: 760px; }
.field { margin-bottom: 16px; }
.field label, .label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 5px; }
.field .hint { color: var(--ink-faint); font-size: .83rem; margin-top: 4px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 16px; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=url],
input[type=date], input[type=time], input[type=datetime-local], input[type=search], input:not([type]), select, textarea {
    width: 100%; font: inherit; color: var(--ink); background: var(--panel);
    border: 1px solid var(--line); border-radius: var(--radius-control); padding: 8px 11px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--signal); box-shadow: var(--focus); }
input.code-input { font-size: 1.6rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; padding: 10px 14px; max-width: 280px; }

.check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin-bottom: 6px; }
.check input { width: 16px; height: 16px; accent-color: var(--signal); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 2px 14px; max-height: 260px; overflow-y: auto; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-control); }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { margin: 0; }
.days input { position: absolute; opacity: 0; }
.days span { display: inline-block; padding: 6px 11px; border: 1px solid var(--line); border-radius: var(--radius-control); cursor: pointer; font-weight: 600; font-size: .88rem; }
.days input:checked + span { background: var(--signal); border-color: var(--signal); color: var(--on-signal); }
.days input:focus-visible + span { box-shadow: var(--focus); }

.error-text { color: var(--bad); font-size: .85rem; margin-top: 4px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
fieldset { border: 0; padding: 0; margin: 0 0 18px; }
legend { font-weight: 650; margin-bottom: 8px; padding: 0; }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    font: inherit; font-weight: 600; font-size: .9rem; line-height: 1.2;
    padding: 8px 14px; border-radius: var(--radius-control);
    border: 1px solid var(--line); background: var(--panel); color: var(--ink);
    cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--line-strong); text-decoration: none; color: var(--ink); }
.btn-primary { background: var(--signal); border-color: var(--signal); color: var(--on-signal); }
.btn-primary:hover { background: var(--signal-strong); border-color: var(--signal-strong); color: var(--on-signal); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { border-color: var(--bad); color: var(--bad); }
.btn-small { padding: 5px 10px; font-size: .82rem; }
.btn-link { border: 0; background: none; padding: 0; color: var(--signal); font-weight: 600; cursor: pointer; font: inherit; }
.inline { display: inline; }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }
.command-level { display: inline-flex; align-items: center; gap: 4px; font-size: .82rem; }
.command-level input[type=number] { width: 68px; padding: 4px 6px; }

/* ---------- Flash & callouts ---------- */

.flash { padding: 11px 16px; border-radius: var(--radius-control); margin-bottom: 18px; font-weight: 500; border: 1px solid; }
.flash-success { background: var(--ok-wash); border-color: var(--ok-line); color: var(--ok-ink); }
.flash-error { background: var(--bad-wash); border-color: var(--bad-line); color: var(--bad-ink); }
.flash-warning { background: var(--warn-wash); border-color: var(--warn-line); color: var(--warn-ink); }
.callout { padding: 12px 16px; border-inline-start: 3px solid var(--signal); background: var(--signal-wash); border-radius: 0 var(--radius-control) var(--radius-control) 0; margin-bottom: 16px; }
.callout.warn { border-color: var(--warn); background: var(--warn-wash); }
/* Messages from the client's partner (ACE Partner), above the page content until they end. */
.partner-announcement { padding: 10px 16px; border: 1px solid var(--signal); border-inline-start-width: 4px; background: var(--signal-wash); border-radius: var(--radius-control); margin-bottom: 14px; }
.partner-announcement-warning { border-color: var(--warn-line); border-inline-start-color: var(--warn); background: var(--warn-wash); }
.partner-announcement-urgent { border-color: var(--bad-line); border-inline-start-color: var(--bad); background: var(--bad-wash); }
.partner-announcement-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.partner-announcement-level { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; opacity: .75; }
.partner-announcement-text { margin: 4px 0 0; white-space: pre-line; }
.partner-announcement-until { margin: 4px 0 0; font-size: 12px; opacity: .7; }

.empty { padding: 36px 20px; text-align: center; color: var(--ink-soft); }
.empty h3 { margin-bottom: 6px; color: var(--ink); }
.empty .btn { margin-top: 10px; }

/* ---------- Media library ---------- */

.media-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 20px; align-items: start; }
.folder-list a { display: flex; justify-content: space-between; padding: 6px 10px; border-radius: var(--radius-control); color: var(--ink-soft); }
.folder-list a.active { background: var(--signal-wash); color: var(--signal-strong); font-weight: 600; }
.folder-list a:hover { text-decoration: none; background: var(--canvas); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 16px; padding: 18px; }
.media-card { border: 1px solid var(--line-soft); border-radius: 8px; overflow: hidden; background: var(--panel); display: flex; flex-direction: column; }
.media-thumb { aspect-ratio: 16 / 10; background: #332c3f; display: grid; place-items: center; color: #cfc8dc; font-size: .8rem; position: relative; }
.media-thumb img, .media-thumb video { width: 100%; height: 100%; object-fit: cover; }
.media-thumb .kind { position: absolute; inset-inline-start: 8px; top: 8px; background: rgba(24, 33, 43, .78); color: #fff; font-size: .72rem; padding: 1px 7px; border-radius: 4px; }
.media-info { padding: 9px 11px 11px; font-size: .84rem; }
.media-info .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.media-info .meta { color: var(--ink-faint); }
.media-pick { position: relative; cursor: pointer; }
.media-pick input { position: absolute; top: 8px; inset-inline-end: 8px; width: 18px; height: 18px; z-index: 2; accent-color: var(--signal); }
.media-pick:has(input:checked) { outline: 2px solid var(--signal); }

.dropzone { border: 2px dashed var(--line); border-radius: var(--radius-panel); padding: 22px; text-align: center; color: var(--ink-soft); background: var(--head-bg); }
.dropzone.drag { border-color: var(--signal); background: var(--signal-wash); }
.upload-queue { list-style: none; margin: 12px 0 0; padding: 0; text-align: start; font-size: .86rem; }
.upload-queue li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--line-soft); }

/* ---------- Playlist editor ---------- */

.items { list-style: none; margin: 0; padding: 0; }
.item { display: grid; grid-template-columns: 26px 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--line-soft); background: var(--panel); }
.item:last-child { border-bottom: 0; }
.item.dragging { opacity: .5; }
.item.disabled .item-title { color: var(--ink-faint); text-decoration: line-through; }
.handle { cursor: grab; color: var(--ink-faint); font-size: 1.1rem; text-align: center; user-select: none; }
.item-thumb { width: 64px; height: 40px; border-radius: 4px; background: #332c3f center / cover; }
.item-title { font-weight: 600; }
.item-meta { font-size: .82rem; color: var(--ink-faint); }
.item-edit { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.item-edit input[type=number] { width: 84px; padding: 5px 8px; }
.item-edit select { width: auto; padding: 5px 8px; }

/* ---------- Activation ---------- */

.pair-steps { margin: 0; padding-inline-start: 20px; color: var(--ink-soft); }
.pair-steps li { margin-bottom: 6px; }
.mode-switch { display: flex; gap: 8px; margin-bottom: 16px; }
.mode-switch label { flex: 1; border: 1px solid var(--line); border-radius: var(--radius-control); padding: 10px 14px; cursor: pointer; font-weight: 600; }
.mode-switch label:has(input:checked) { border-color: var(--signal); background: var(--signal-wash); }
.mode-switch input { accent-color: var(--signal); margin-inline-end: 6px; }

/* ---------- Auth ---------- */

.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); }
.auth-visual { background: var(--bezel); color: #e6e1ee; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.auth-visual h1 { font-size: 2.4rem; color: #fff; max-width: 15ch; letter-spacing: -0.03em; }
.auth-visual p { color: #b9b0c8; max-width: 46ch; }
.auth-wall { display: flex; gap: 14px; align-items: flex-end; margin: 36px 0; }
.auth-wall span { display: block; background: #332c3f; border: 4px solid #14111a; border-radius: 3px; box-shadow: 0 0 0 1px #4a3f5c; }
.auth-wall span.on { background: linear-gradient(160deg, #5b3a8e, #a58bd1); box-shadow: 0 0 0 1px #a58bd1, 0 0 24px rgba(165, 139, 209, .35); }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: var(--panel); }
.auth-form form { width: 100%; max-width: 360px; }
.auth-form h2 { font-size: 1.5rem; margin-bottom: 6px; }

/* ---------- Pagination ---------- */

.pager { display: flex; gap: 8px; justify-content: space-between; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line-soft); font-size: .88rem; color: var(--ink-faint); }

.code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .86em; background: var(--canvas); padding: 1px 6px; border-radius: 4px; }
.tag { display: inline-block; font-size: .76rem; background: var(--canvas); color: var(--ink-soft); border-radius: 4px; padding: 0 6px; margin: 1px 2px 1px 0; }

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
    .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; z-index: 30; inset-inline-start: 0; top: 0; width: 270px; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.2); }
    .sidebar.open { transform: none; }
    .topbar .menu-toggle { display: inline-flex; }
    .topbar { padding: 10px 16px; flex-wrap: wrap; row-gap: 8px; }
    .topbar-user { flex-wrap: wrap; gap: 8px 12px; }
    .topbar-org .plan, .topbar-user > span:not(.bell-count) { display: none; }
    .content { padding: 20px 16px 48px; }
    .media-layout { grid-template-columns: 1fr; }
    .auth { grid-template-columns: 1fr; }
    .auth-visual { display: none; }
    .item { grid-template-columns: 22px 48px minmax(0, 1fr); }
    .item-edit { grid-column: 2 / -1; }
    .wall { gap: 22px 16px; padding: 18px 14px; }
    .tile { width: 132px; }
    .tile.portrait { width: 76px; }
    th, td { padding: 9px 12px; }
}

@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* ---------- Phase 2: cards, editors, designer ---------- */

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card-grid > .panel + .panel { margin-top: 0; }
.layout-card { overflow: hidden; display: flex; flex-direction: column; }
.card-link { color: var(--ink); }
.card-link:hover { text-decoration: none; color: var(--ink); border-color: var(--signal); }
.layout-thumb { position: relative; display: block; width: 100%; background: var(--bezel); border-bottom: 1px solid var(--line-soft); overflow: hidden; }
.layout-thumb.large { border: 6px solid var(--bezel); border-radius: 6px; }
.zone-box {
    position: absolute; box-sizing: border-box; border: 1px solid rgba(255, 255, 255, .45);
    background: rgba(165, 139, 209, .18); color: #fff; font-size: .72rem; padding: 3px 6px; overflow: hidden; white-space: nowrap;
}
.zone-box.primary { background: rgba(91, 58, 142, .55); border-color: #a58bd1; }
.pick-card { display: block; border: 1px solid var(--line); border-radius: var(--radius-panel); overflow: hidden; cursor: pointer; }
.pick-card input { position: absolute; opacity: 0; }
.pick-card:has(input:checked) { outline: 2px solid var(--signal); border-color: var(--signal); }
.pick-card:has(input:focus-visible) { box-shadow: var(--focus); }
.pick-name { display: block; padding: 8px 12px; font-weight: 600; }

.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.editor-stage { display: grid; place-items: center; background: var(--stage-bg); border-radius: 8px; padding: 22px; }
.editor-surface { position: relative; width: 100%; max-height: 70vh; border: 8px solid var(--bezel); border-radius: 6px; touch-action: none; user-select: none; }
.edit-box { position: absolute; box-sizing: border-box; border: 1px dashed rgba(255, 255, 255, .7); background: rgba(165, 139, 209, .22); cursor: move; }
.edit-box.primary { background: rgba(91, 58, 142, .45); }
.edit-box.selected { border: 2px solid #fff; box-shadow: 0 0 0 2px var(--signal); }
.edit-label { position: absolute; left: 6px; top: 4px; color: #fff; font-size: .78rem; font-weight: 600; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); pointer-events: none; }
.edit-resize { position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px; background: #fff; border: 2px solid var(--signal); border-radius: 2px; cursor: nwse-resize; }
.edit-box:not(.selected) .edit-resize { display: none; }
.zone-list { list-style: none; margin: 0; padding: 0 18px 12px; }
.zone-list li { padding: 4px 0; }
.zone-list li.active .btn-link { color: var(--ink); }
.field-row.compact { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 0 10px; }

.designer-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 16px; }
.toolbar-gap { flex: 1; }
.designer-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.designer-canvas-wrap { padding: 22px; background: var(--stage-bg); }
.designer-canvas { position: relative; width: 100%; max-height: 72vh; margin: 0 auto; box-shadow: 0 0 0 8px var(--bezel); border-radius: 2px; overflow: hidden; }
.designer-render, .designer-handles { position: absolute; inset: 0; }
.designer-render { container-type: size; }
.designer-handles { touch-action: none; user-select: none; }
.design-handle { background: transparent; border-color: transparent; }
.design-handle:hover { border-color: rgba(255, 255, 255, .6); }
.designer-status { margin-top: 12px; min-height: 1.5em; font-size: .88rem; }
.designer-side { position: sticky; top: 16px; }

/* Design rendering inside the dashboard (same structure as the player). */
.design-frame { position: absolute; inset: 0; display: grid; place-items: center; container-type: size; }
.design { position: relative; overflow: hidden; container-type: size; }
.design .el { position: absolute; display: flex; align-items: center; align-items: safe center; overflow: hidden; box-sizing: border-box; white-space: pre-wrap; overflow-wrap: anywhere; }
.design .el-image, .design .el-qr { display: block; }
.design .el.missing { background: repeating-linear-gradient(45deg, #332c3f 0 10px, #3d3549 10px 20px); }
.template-thumb, .media-thumb.design-thumb { position: relative; display: block; width: 100%; background: var(--bezel); container-type: size; overflow: hidden; }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.chip { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-soft); font-size: .86rem; font-weight: 500; }
.chip:hover { text-decoration: none; border-color: var(--signal); color: var(--ink); }
.chip.active { background: var(--signal); border-color: var(--signal); color: var(--on-signal); }

.dialog { border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 0; width: min(440px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(28, 25, 36, .45); }

.health { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; padding: 1px 8px; border-radius: 999px; font-weight: 700; font-size: .82rem; }
.health-good { background: var(--ok-wash); color: var(--ok); }
.health-fair { background: var(--warn-wash); color: var(--warn); }
.health-poor { background: var(--bad-wash); color: var(--bad); }
.screenshot-img { width: 100%; border-radius: 6px; background: var(--bezel); display: block; }
.preview-frame { width: 100%; border: 8px solid var(--bezel); border-radius: 6px; background: #000; display: block; }
.issue-list { list-style: none; margin: 0; padding: 0; }
.issue-list li { padding: 8px 18px; border-bottom: 1px solid var(--line-soft); display: flex; gap: 10px; align-items: baseline; }
.issue-list li:last-child { border-bottom: 0; }
.emergency-live { border-inline-start: 4px solid var(--bad); }

@media (max-width: 1080px) {
    .editor-grid, .designer-body { grid-template-columns: 1fr; }
    .designer-side { position: static; }
}

/* ---------- Phase 3: reports, charts, notifications, portal ---------- */

:root {
    --series-1: #5b3a8e;   /* confirmed plays / primary series (validated with --series-2) */
    --series-2: #eb6834;
}

.report-filters { display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-end; margin-bottom: 18px; }
.report-filters .field { margin: 0; min-width: 150px; flex: 1 1 150px; max-width: 240px; }
.report-filter-actions { display: flex; align-items: center; gap: 10px; padding-bottom: 6px; font-size: .9rem; }

.chart-panel { margin-bottom: 20px; }
.chart-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 14px; margin: 0; padding: 0; font-size: .86rem; color: var(--ink-soft); }
.chart-legend li { display: flex; align-items: center; gap: 6px; }
.chart-key { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-multiples { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.chart { margin: 0; min-width: 0; }
.chart-title { font-size: .86rem; color: var(--ink-soft); font-weight: 600; margin-bottom: 6px; }
.chart-area { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: 190px auto; column-gap: 8px; }
.chart-axis { display: flex; flex-direction: column; justify-content: space-between; font-size: .74rem; color: var(--ink-faint); text-align: right; font-variant-numeric: tabular-nums; transform: translateY(-.5em); height: calc(100% + 1em); }
.chart-plot {
    position: relative; display: grid; grid-template-columns: repeat(var(--cols), 1fr); align-items: end; height: 100%;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(var(--line-soft), var(--line-soft)) 0 0 / 100% 1px no-repeat,
                linear-gradient(var(--line-soft), var(--line-soft)) 0 50% / 100% 1px no-repeat;
}
.chart-col { height: 100%; display: flex; align-items: flex-end; justify-content: center; cursor: default; border-radius: 4px 4px 0 0; }
.chart-col:hover, .chart-col:focus-visible { background: var(--signal-wash); box-shadow: none; }
.chart-stack { width: min(24px, 70%); min-height: 0; display: flex; flex-direction: column-reverse; gap: 2px; border-radius: 4px 4px 0 0; overflow: hidden; }
.chart-stack span { display: block; flex-basis: 0; min-height: 1px; }
.s1 { background: var(--series-1); }
.s2 { background: var(--series-2); }
.chart-x { display: grid; grid-template-columns: repeat(var(--cols), 1fr); font-size: .72rem; color: var(--ink-faint); margin-top: 4px; white-space: nowrap; }
.chart-x span { overflow: visible; }
.chart-tip {
    position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: #fff; font-size: .8rem;
    padding: 6px 10px; border-radius: 6px; max-width: 280px; box-shadow: 0 6px 18px rgba(28, 25, 36, .25);
}

.report-notes { margin-top: 20px; color: var(--ink-soft); font-size: .88rem; }
.report-notes h2 { font-size: .9rem; margin-bottom: 6px; color: var(--ink); }
.report-notes ul { margin: 0; padding-inline-start: 18px; }
.report-notes li { margin-bottom: 4px; }

.bell { position: relative; display: inline-flex; align-items: center; gap: 6px; }
.bell-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--signal); color: var(--on-signal); font-size: .74rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.notice-list { list-style: none; margin: 0; padding: 0; }
.notice { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line-soft); align-items: start; }
.notice:last-child { border-bottom: 0; }
.notice-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: transparent; }
.notice.unread .notice-dot { background: var(--signal); }
.notice.unread .notice-title { font-weight: 650; }
.notice-body { color: var(--ink-soft); font-size: .9rem; margin: 2px 0 0; }
.notice-level-critical .notice-title::before { content: "Critical · "; color: var(--bad); font-weight: 700; }
.notice-level-warning .notice-title::before { content: "Warning · "; color: var(--warn); font-weight: 700; }
.pref-table td, .pref-table th { text-align: start; }
.pref-table .check-cell { text-align: center; width: 110px; }

.portal-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.portal-nav a { padding: 6px 12px; border-radius: var(--radius-control); color: var(--ink-soft); font-weight: 500; }
.portal-nav a:hover { text-decoration: none; background: var(--canvas); color: var(--ink); }
.portal-nav a.active { background: var(--signal-wash); color: var(--signal-strong); }
.portal-shell { max-width: 1180px; margin: 0 auto; padding: 0 20px 40px; }
.portal-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 14px 0; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.portal-brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; }
.portal-brand:hover { text-decoration: none; color: var(--ink); }
.portal-brand small { font-weight: 500; color: var(--ink-faint); }

@media print {
    .sidebar, .topbar, .report-filters, .page-actions, nav.chip-row { display: none !important; }
    .shell { display: block; }
}

.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; }

.brand-logo { height: 30px; max-width: 140px; object-fit: contain; flex: none; }

.auth-card-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 28px; }
.auth-card .brand { padding: 0 0 18px; color: var(--ink); }
.auth-card h2 { margin-bottom: 6px; }
.recovery-codes { background: var(--canvas); border-radius: var(--radius-control); padding: 12px 16px; font-size: 1rem; line-height: 1.7; columns: 2; max-width: 420px; }
.two-factor-setup { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; margin-top: 10px; }
.two-factor-setup img { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 6px; }
.two-factor-setup .secret { font-size: 1.05rem; letter-spacing: .06em; word-break: break-all; }

/* ---------- Phase 4 ---------- */
.signage-map { height: 460px; border-radius: var(--radius-panel) var(--radius-panel) 0 0; }
.map-pin { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 26px; padding: 0 8px; border-radius: 999px; font: 700 12px/1 var(--font); color: #fff; box-shadow: 0 2px 6px rgba(28, 25, 36, .35); border: 2px solid #fff; }
.map-pin-ok { background: var(--ok); }
.map-pin-warn { background: var(--warn); }
.map-pin-bad { background: var(--bad); }
.map-pin-idle { background: var(--idle); }
.wall-grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 6px; }
.wall-cell { background: var(--bezel); color: #fff; border-radius: 4px; aspect-ratio: 16 / 9; padding: 8px; display: flex; flex-direction: column; justify-content: space-between; font-size: .82rem; min-width: 0; }
.wall-cell.empty { background: var(--canvas); color: var(--ink-faint); border: 1px dashed var(--line); }
.wall-cell span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wall-grid-edit .wall-cell { aspect-ratio: auto; background: var(--panel); color: var(--ink); border: 1px solid var(--line); gap: 6px; }
.secret-value { word-break: break-all; font-size: .95rem; background: var(--canvas); padding: 2px 6px; border-radius: 4px; }

/* ---------- Phase 5 ---------- */
.ai-variants { list-style: none; margin: 0; padding: 0 18px 12px; display: grid; gap: 10px; }
.ai-variants li, .ai-variant { border: 1px solid var(--line); border-radius: var(--radius-control); padding: 10px 12px; display: grid; gap: 6px; }
.ai-variants li p, .ai-variant p { margin: 0; }
.ai-variants li .btn { justify-self: start; }
.ai-summary { margin-bottom: 20px; border-inline-start: 3px solid var(--signal); }
.ai-headline { font-size: 1.05rem; font-weight: 650; margin-bottom: 12px; }
.ai-columns { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.ai-columns h3 { font-size: .86rem; color: var(--ink-soft); margin-bottom: 4px; }
.ai-columns ul { margin: 0; padding-inline-start: 18px; }
.market-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.market-card { color: var(--ink); overflow: hidden; display: flex; flex-direction: column; }
.market-card:hover { text-decoration: none; border-color: var(--signal); color: var(--ink); }
.market-card h3 { margin-top: 6px; }
.market-meta { display: flex; justify-content: space-between; align-items: center; }
.market-preview { background: var(--bezel); display: grid; gap: 8px; }
.market-preview.large { background: transparent; }
.layout-preview { position: relative; width: 100%; border-radius: 4px; overflow: hidden; }
.layout-preview span { position: absolute; border: 1px dashed rgba(255, 255, 255, .45); color: rgba(255, 255, 255, .8); font-size: .72rem; padding: 4px; box-sizing: border-box; }
.layout-preview span.primary { background: rgba(91, 58, 142, .45); }
.item-glyph { aspect-ratio: 16 / 9; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 1.4rem; letter-spacing: .04em; background: linear-gradient(135deg, var(--signal), var(--bezel)); }
.payload-view, .docs pre { margin: 0; padding: 14px 18px; background: var(--canvas); font-size: .8rem; overflow: auto; max-height: 520px; white-space: pre; }
.docs pre { border-radius: var(--radius-control); margin-bottom: 14px; }
.docs h2 { margin: 18px 0 6px; }
.docs h2:first-child { margin-top: 0; }
.code-input { font-family: Consolas, "Courier New", monospace; font-size: .85rem; }
.condition-row { align-items: end; }
.preset-apply select { max-width: 260px; }

/* Getting-started checklist (dashboard) */
.getting-started { margin-bottom: 20px; }
.checklist { list-style: none; margin: 0; padding: 6px 0; }
.checklist li { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center; padding: 9px 18px; }
.checklist .check-mark { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 600; border: 1px solid var(--line); color: var(--ink-soft); }
.checklist li.done .check-mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.checklist li.done .step-title { color: var(--ink-faint); text-decoration: line-through; }
.checklist li.next { background: var(--signal-wash); }
.checklist li.next .check-mark { border-color: var(--signal); color: var(--signal); }
.checklist .step-title { font-weight: 600; }
.checklist .muted { font-size: .84rem; }

/* Media quality warnings */
.quality-warn { display: inline-block; font-size: .76rem; color: var(--warn); background: var(--warn-wash); border-radius: 4px; padding: 0 6px; margin-top: 2px; }
.play-on-screens .screen-pick { display: flex; align-items: center; gap: 8px; padding: 7px 18px; border-bottom: 1px solid var(--line-soft); margin: 0; }
.play-on-screens .screen-pick .muted { font-size: .82rem; margin-inline-start: auto; }

/* Focal point picker (media details) */
.focal-picker { position: relative; cursor: crosshair; border-radius: 6px; overflow: hidden; background: #332c3f; }
.focal-picker img, .focal-picker video { display: block; width: 100%; }
.focal-dot { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--signal), 0 2px 8px rgba(0,0,0,.5); pointer-events: none; }

/* Manager app (phone) */
body.mobile { background: var(--canvas); padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
.m-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--nav-bg); color: var(--nav-ink); }
.m-bar a { color: var(--nav-ink); text-decoration: none; }
.m-title { flex: 1; font-weight: 700; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-back { font-size: 1.8rem; line-height: 1; padding-inline-end: 4px; }
.m-icon { position: relative; font-size: 1.15rem; }
.m-badge { position: absolute; top: -6px; inset-inline-end: -10px; background: var(--bad); color: #fff; border-radius: 9px; font-size: .68rem; font-weight: 700; padding: 1px 5px; }
.m-main { padding: 14px 16px; max-width: 640px; margin: 0 auto; }
.m-summary { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-panel); margin-bottom: 14px; }
.m-summary > div { padding: 12px; text-align: center; }
.m-summary > div + div { border-inline-start: 1px solid var(--line-soft); }
.m-summary strong { display: block; font-size: 1.6rem; }
.m-summary span { color: var(--ink-faint); font-size: .82rem; }
.m-card { display: flex; gap: 12px; align-items: center; justify-content: space-between; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 12px 14px; margin-bottom: 14px; }
.m-card .muted { font-size: .84rem; }
.m-h { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); margin: 18px 0 8px; }
.m-list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-panel); overflow: hidden; }
.m-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: inherit; text-decoration: none; min-height: 56px; }
.m-row + .m-row { border-top: 1px solid var(--line-soft); }
.m-row:active { background: var(--signal-wash); }
.m-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.m-row-main .muted { font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-when { font-size: .78rem; white-space: nowrap; }
.m-chevron { color: var(--ink-faint); font-size: 1.4rem; }
.m-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--idle); flex: none; }
.m-dot.big { width: 16px; height: 16px; }
.m-dot.ok { background: var(--ok); }
.m-dot.bad { background: var(--bad); }
.m-dot.warn { background: var(--warn); }
.m-status { justify-content: flex-start; }
.m-shot { flex-direction: column; align-items: stretch; }
.m-shot img { width: 100%; border-radius: 6px; background: #000; display: block; }
.m-actions { display: grid; gap: 10px; margin-top: 16px; }
.m-actions form { margin: 0; }
.btn-block { display: block; width: 100%; text-align: center; padding: 12px; font-size: 1rem; }
.m-tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.m-tabs a { flex: 1; text-align: center; padding: 14px 4px; color: var(--ink-soft); text-decoration: none; font-weight: 600; font-size: .86rem; }
.m-tabs a.active { color: var(--signal); box-shadow: inset 0 2px 0 var(--signal); }

/* Small drop-down panels in page actions (e.g. Translate…) */
.dropdown { position: relative; display: inline-block; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-panel { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 20; width: 280px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-panel); box-shadow: 0 10px 30px rgba(28, 25, 36, .15); padding: 14px; display: grid; gap: 8px; text-align: start; }
.dropdown-panel .hint { margin: 0; }

/* =====================================================================
   Designs (themes) x modes. :root at the top is Aurora light.
   ===================================================================== */

html[data-mode="dark"] { color-scheme: dark; }
.panel, .figures { box-shadow: var(--shadow); }
.figure .value, .page-head h1 { font-family: var(--font-display); }

/* ----- Aurora: dark ----- */
html[data-theme="aurora"][data-mode="dark"] {
    --ink: #ece8f4; --ink-soft: #c3bbd2; --ink-faint: #958ca7;
    --canvas: #120e1a; --panel: #1c1626; --line: #2f2742; --line-soft: #261f36; --line-strong: #4a3f60;
    --head-bg: #211a2e; --stage-bg: #0d0a13;
    --signal: #9b72e6; --signal-strong: #b494ef; --signal-wash: #2a1f40; --on-signal: #140e1f;
    --bezel: #07050b;
    --ok: #3ccf7c; --ok-wash: #11301f; --ok-line: #1f5435; --ok-ink: #7be3a5;
    --warn: #f0b44c; --warn-wash: #33260d; --warn-line: #5a4316; --warn-ink: #f6cd80;
    --bad: #ff7a45; --bad-wash: #3a1a10; --bad-line: #66301c; --bad-ink: #ffa47f;
    --idle: #8f86a2; --idle-wash: #241d31;
    --nav-bg: #0c0912; --nav-ink: #ece6f7; --nav-ink-soft: #b9aecd; --nav-heading: #7d7192; --nav-active-bg: rgba(155, 114, 230, .22);
    --hero-bg: #0c0912;
    --focus: 0 0 0 3px rgba(155, 114, 230, .45); --shadow: none;
}

/* ----- Midnight: slate and teal, menu across the top ----- */
html[data-theme="midnight"] {
    --ink: #0f1c22; --ink-soft: #3f525a; --ink-faint: #6b7d85;
    --canvas: #f3f6f7; --panel: #ffffff; --line: #dde5e8; --line-soft: #e9eff1; --line-strong: #bccacf;
    --head-bg: #f7fafb; --stage-bg: #e6edef;
    --signal: #0e8a7e; --signal-strong: #0a6d63; --signal-wash: #e3f3f1; --on-signal: #ffffff;
    --bezel: #13232a;
    --ok: #16a34a; --ok-wash: #e3f6ea; --ok-line: #b9e6c8; --ok-ink: #11692f;
    --warn: #d97706; --warn-wash: #fdf1df; --warn-line: #f3d4a5; --warn-ink: #8a4b05;
    --bad: #dc2626; --bad-wash: #fde8e8; --bad-line: #f5c2c2; --bad-ink: #991b1b;
    --idle: #8197a0; --idle-wash: #eef3f4;
    --nav-bg: #ffffff; --nav-ink: #0f1c22; --nav-ink-soft: #3f525a; --nav-heading: #6b7d85;
    --nav-hover: #f0f5f6; --nav-active-bg: #e3f3f1; --nav-active-ink: #0a6d63; --nav-line: #dde5e8;
    --hero-bg: #e6f2f0; --hero-ink: #0f1c22; --hero-soft: #3f525a;
    --font: "Inter", "Segoe UI", system-ui, sans-serif; --font-display: var(--font);
    --radius-panel: 12px; --radius-control: 9px;
    --focus: 0 0 0 3px rgba(14, 138, 126, .3); --shadow: 0 1px 2px rgba(15, 28, 34, .05);
}
html[data-theme="midnight"][data-mode="dark"] {
    --ink: #e4eef1; --ink-soft: #b5c7cd; --ink-faint: #85a0a9;
    --canvas: #0b1418; --panel: #122027; --line: #1f333b; --line-soft: #19292f; --line-strong: #2f4a54;
    --head-bg: #16262d; --stage-bg: #081014;
    --signal: #2dd4bf; --signal-strong: #5eead4; --signal-wash: #103330; --on-signal: #04201c;
    --bezel: #050a0c;
    --ok: #4ade80; --ok-wash: #0f2e1d; --ok-line: #1c5235; --ok-ink: #86efac;
    --warn: #fbbf24; --warn-wash: #33270a; --warn-line: #5b4512; --warn-ink: #fcd34d;
    --bad: #f87171; --bad-wash: #361414; --bad-line: #632222; --bad-ink: #fca5a5;
    --idle: #7b939b; --idle-wash: #16252b;
    --nav-bg: #0e1a1f; --nav-ink: #e4eef1; --nav-ink-soft: #b5c7cd; --nav-heading: #7b939b;
    --nav-hover: #152730; --nav-active-bg: #103330; --nav-active-ink: #5eead4; --nav-line: #1f333b;
    --hero-bg: #0e1a1f; --hero-ink: #e4eef1; --hero-soft: #9db3ba;
    --focus: 0 0 0 3px rgba(45, 212, 191, .35); --shadow: none;
}

/* ----- Clinical: crisp white and blue ----- */
html[data-theme="clinical"] {
    --ink: #0b2545; --ink-soft: #3d5573; --ink-faint: #6a7f96;
    --canvas: #f6f9fc; --panel: #ffffff; --line: #dfe7f0; --line-soft: #eaf0f6; --line-strong: #bfcee0;
    --head-bg: #f8fbfe; --stage-bg: #e8eef5;
    --signal: #1570ef; --signal-strong: #0e5bc7; --signal-wash: #e7f0fe; --on-signal: #ffffff;
    --bezel: #0b1b2e;
    --ok: #12a150; --ok-wash: #e3f6eb; --ok-line: #b6e5c9; --ok-ink: #0d6b36;
    --warn: #d97706; --warn-wash: #fdf1df; --warn-line: #f3d4a5; --warn-ink: #8a4b05;
    --bad: #e5484d; --bad-wash: #fdebeb; --bad-line: #f6c3c5; --bad-ink: #a51d22;
    --idle: #8094ab; --idle-wash: #eef3f8;
    --nav-bg: #0b4f8a; --nav-ink: #ffffff; --nav-ink-soft: #d3e3f5; --nav-heading: #8fb3da;
    --nav-hover: rgba(255, 255, 255, .08); --nav-active-bg: rgba(255, 255, 255, .16); --nav-active-ink: #ffffff;
    --hero-bg: #0b4f8a; --hero-ink: #ffffff; --hero-soft: #c4d9f0;
    --font: "Inter", "Segoe UI", system-ui, sans-serif; --font-display: var(--font);
    --radius-panel: 10px; --radius-control: 8px;
    --focus: 0 0 0 3px rgba(21, 112, 239, .3); --shadow: 0 1px 2px rgba(11, 37, 69, .05);
}
html[data-theme="clinical"][data-mode="dark"] {
    --ink: #e6eef8; --ink-soft: #b7c7da; --ink-faint: #8aa0b8;
    --canvas: #07111d; --panel: #0e1b2b; --line: #1c2d43; --line-soft: #162538; --line-strong: #2c4566;
    --head-bg: #112033; --stage-bg: #050c15;
    --signal: #4f9bff; --signal-strong: #7cb5ff; --signal-wash: #102a4d; --on-signal: #05101d;
    --bezel: #03080e;
    --ok: #3ddc84; --ok-wash: #0c2e1c; --ok-line: #175235; --ok-ink: #86efac;
    --warn: #fbbf24; --warn-wash: #33270a; --warn-line: #5b4512; --warn-ink: #fcd34d;
    --bad: #ff6b6b; --bad-wash: #391517; --bad-line: #652427; --bad-ink: #ffa3a3;
    --idle: #7d92aa; --idle-wash: #13223a;
    --nav-bg: #081627; --nav-ink: #e6eef8; --nav-ink-soft: #b1c4da; --nav-heading: #6f88a6; --nav-active-bg: rgba(79, 155, 255, .2);
    --hero-bg: #081627;
    --focus: 0 0 0 3px rgba(79, 155, 255, .4); --shadow: none;
}

/* ----- Studio: warm sand, charcoal and amber ----- */
html[data-theme="studio"] {
    --ink: #2b2620; --ink-soft: #5b5248; --ink-faint: #85796b;
    --canvas: #f7f3ec; --panel: #fffdf9; --line: #e8dfd2; --line-soft: #f0e9de; --line-strong: #d3c5b2;
    --head-bg: #fbf8f2; --stage-bg: #ece5d9;
    --signal: #c2410c; --signal-strong: #9a3412; --signal-wash: #fbeadf; --on-signal: #ffffff;
    --bezel: #1d1915;
    --ok: #4d7c0f; --ok-wash: #eef5df; --ok-line: #cfe2a8; --ok-ink: #3a5e0b;
    --warn: #b45309; --warn-wash: #fbefdc; --warn-line: #efd3a3; --warn-ink: #7c3a06;
    --bad: #b91c1c; --bad-wash: #fbe7e5; --bad-line: #f1c2bd; --bad-ink: #8a1515;
    --idle: #94887a; --idle-wash: #f2ece2;
    --nav-bg: #2b2620; --nav-ink: #f7f0e4; --nav-ink-soft: #d8ccba; --nav-heading: #9c8f7d;
    --nav-hover: rgba(255, 255, 255, .06); --nav-active-bg: rgba(194, 65, 12, .32); --nav-active-ink: #ffffff;
    --hero-bg: #2b2620; --hero-ink: #f7f3ec; --hero-soft: #d8ccba;
    --font: "Inter", "Segoe UI", system-ui, sans-serif; --font-display: "Fraunces", Georgia, serif;
    --radius-panel: 16px; --radius-control: 10px;
    --focus: 0 0 0 3px rgba(194, 65, 12, .28); --shadow: 0 1px 3px rgba(43, 38, 32, .06);
}
html[data-theme="studio"][data-mode="dark"] {
    --ink: #efe8dd; --ink-soft: #cdbfab; --ink-faint: #a0927f;
    --canvas: #141210; --panel: #1d1a17; --line: #2f2a25; --line-soft: #26221e; --line-strong: #4a4239;
    --head-bg: #221e1a; --stage-bg: #0d0c0a;
    --signal: #f59e0b; --signal-strong: #fbbf24; --signal-wash: #3a2a0c; --on-signal: #1a1206;
    --bezel: #080706;
    --ok: #a3e635; --ok-wash: #22300e; --ok-line: #3d5418; --ok-ink: #bef264;
    --warn: #fbbf24; --warn-wash: #33270a; --warn-line: #5b4512; --warn-ink: #fcd34d;
    --bad: #f87171; --bad-wash: #361414; --bad-line: #632222; --bad-ink: #fca5a5;
    --idle: #8f8475; --idle-wash: #24201b;
    --nav-bg: #0e0d0b; --nav-ink: #efe8dd; --nav-ink-soft: #c9bba6; --nav-heading: #7e7263; --nav-active-bg: rgba(245, 158, 11, .2);
    --hero-bg: #0e0d0b; --hero-ink: #efe8dd; --hero-soft: #b9ab96;
    --focus: 0 0 0 3px rgba(245, 158, 11, .35); --shadow: none;
}

/* Charts follow the design's accent. */
html[data-theme] { --series-1: var(--signal); }

/* ----- Menu across the top (Midnight) on wide screens ----- */
@media (min-width: 861px) {
    html[data-nav="top"] .shell { display: block; }
    html[data-nav="top"] .sidebar {
        position: sticky; top: 0; z-index: 25; height: auto; overflow: visible;
        display: flex; align-items: stretch; flex-wrap: wrap; gap: 2px; padding: 0 28px;
        border-inline-end: 0; border-bottom: 1px solid var(--nav-line);
    }
    html[data-nav="top"] .brand { padding: 0 18px 0 0; align-self: center; }
    html[data-nav="top"] .nav-section { margin: 0; position: relative; display: flex; }
    html[data-nav="top"] .nav-heading {
        display: flex; align-items: center; padding: 0 12px; height: 58px; cursor: default;
        text-transform: none; letter-spacing: 0; font-size: .9rem; font-weight: 600; color: var(--nav-ink-soft);
        border-bottom: 2px solid transparent;
    }
    html[data-nav="top"] .nav-section:has(a.active) .nav-heading { color: var(--signal); border-bottom-color: var(--signal); }
    html[data-nav="top"] .nav-section .nav {
        display: none; position: absolute; top: 100%; inset-inline-start: 0; min-width: 230px; padding: 6px;
        background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-panel);
        box-shadow: 0 14px 34px rgba(15, 28, 34, .14);
    }
    html[data-nav="top"] .nav-section:hover .nav, html[data-nav="top"] .nav-section:focus-within .nav { display: block; }
    html[data-nav="top"] .nav a { color: var(--ink-soft); }
    html[data-nav="top"] .nav a:hover { background: var(--canvas); color: var(--ink); }
    html[data-nav="top"] .nav a.active { background: var(--signal-wash); color: var(--signal-strong); }
    html[data-nav="top"] .content { margin: 0 auto; }
}

/* ----- Appearance menu and design pickers ----- */
.appearance-menu .dropdown-panel { width: 300px; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--radius-control); overflow: hidden; }
.segmented label { margin: 0; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: block; text-align: center; padding: 7px 4px; font-size: .84rem; font-weight: 600; cursor: pointer; color: var(--ink-soft); }
.segmented label + label span { border-inline-start: 1px solid var(--line); }
.segmented input:checked + span { background: var(--signal-wash); color: var(--signal-strong); }
.segmented input:focus-visible + span { box-shadow: inset var(--focus); }
.theme-picks { display: grid; gap: 6px; }
.theme-pick { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border: 1px solid var(--line); border-radius: var(--radius-control); cursor: pointer; margin: 0; font-weight: 600; font-size: .9rem; }
.theme-pick:has(input:checked) { border-color: var(--signal); background: var(--signal-wash); }
.theme-pick input { accent-color: var(--signal); }
.theme-swatch { display: inline-flex; border-radius: 5px; overflow: hidden; border: 1px solid var(--line); flex: none; }
.theme-swatch i { width: 12px; height: 18px; display: block; }
.theme-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.theme-card { border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 12px; cursor: pointer; display: grid; gap: 8px; margin: 0; background: var(--panel); font-weight: 600; }
.theme-card:has(input:checked) { border-color: var(--signal); box-shadow: 0 0 0 1px var(--signal); }
.theme-card input { accent-color: var(--signal); }
.theme-card .preview { height: 64px; border-radius: 8px; display: grid; grid-template-columns: 26% 1fr; overflow: hidden; border: 1px solid var(--line); }
.theme-card .preview em { display: block; padding: 8px; }
.theme-card .preview em span { display: block; height: 8px; border-radius: 3px; margin-bottom: 6px; }
.theme-card .muted { font-size: .82rem; font-weight: 400; }
.plan-matrix td, .plan-matrix th { text-align: center; }
.plan-matrix td:first-child, .plan-matrix th:first-child { text-align: start; }

/* ----- Sign-in pages (all designs) ----- */
.signin { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(380px, 1fr); background: var(--panel); }
.signin-hero { background: var(--hero-bg); color: var(--hero-ink); padding: 56px 64px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.signin-hero .eyebrow { font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--hero-soft); }
.signin-hero h1 { font: 600 2.6rem/1.15 var(--font-display); color: var(--hero-ink); max-width: 16ch; margin: 0 0 28px; letter-spacing: -0.02em; }
.signin-hero .lead { color: var(--hero-soft); max-width: 46ch; }
.signin-wall { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; max-width: 560px; }
.signin-wall span { aspect-ratio: 16 / 9; border-radius: 6px; border: 5px solid #0d0d0d; position: relative; overflow: hidden; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.signin-wall span b { position: absolute; inset-inline-start: 10px; bottom: 7px; font: 600 12px/1 var(--font); color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.signin-stats { display: flex; gap: 34px; color: var(--hero-soft); font-size: .9rem; }
.signin-stats strong { display: block; font-size: 1.5rem; color: var(--hero-ink); }
.signin-panel { display: grid; place-items: center; padding: 40px 28px; background: var(--panel); }
.signin-form { width: 100%; max-width: 390px; }
.signin-form .brand { padding: 0 0 34px; color: var(--ink); }
.signin-form h2 { font: 600 2rem/1.15 var(--font-display); margin-bottom: 8px; letter-spacing: -0.02em; }
.signin-form .lead { color: var(--ink-faint); margin-bottom: 24px; }
.signin-form input[type=email], .signin-form input[type=password] { padding: 11px 13px; background: var(--canvas); }
.signin-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 6px 0 18px; font-size: .9rem; }
.signin-row .check { margin: 0; }
.signin-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--ink-faint); font-size: .82rem; }
.signin-divider::before, .signin-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.signin-foot { display: flex; justify-content: center; gap: 16px; margin-top: 28px; color: var(--ink-faint); font-size: .85rem; }
.signin-foot button { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0; }
.signin-foot button:hover { color: var(--ink); }
.signin .btn-lg { width: 100%; padding: 12px; font-size: 1rem; }
.signin.centered { grid-template-columns: 1fr; place-items: center; align-content: center; background: var(--canvas); background-image: linear-gradient(var(--line-soft) 1px, transparent 1px), linear-gradient(90deg, var(--line-soft) 1px, transparent 1px); background-size: 44px 44px; padding: 32px 16px; }
.signin.centered .signin-card { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 44px 48px; box-shadow: 0 24px 60px rgba(15, 28, 34, .12); width: 100%; max-width: 480px; }
.signin.centered .copyright { text-align: center; color: var(--ink-faint); font-size: .82rem; margin-top: 20px; }
.signin-hero.photo { justify-content: flex-end; }
.signin-hero.photo::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 25% 25%, color-mix(in srgb, var(--signal) 45%, transparent), transparent 60%), radial-gradient(ellipse at 85% 85%, rgba(245, 158, 11, .3), transparent 55%); }
.signin-hero.photo .signin-wall { position: absolute; top: 64px; left: 64px; right: 64px; max-width: 660px; }
.signin-hero.photo h1 { font-weight: 500; font-size: 3rem; max-width: 20ch; position: relative; }
.signin-hero.photo .lead { position: relative; }
@media (max-width: 960px) {
    .signin { grid-template-columns: 1fr; }
    .signin-hero { display: none; }
}

/* ---------- Arabic (right-to-left) ---------- */
html[lang="ar"] { --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif; --font-display: var(--font); }
html[lang="ar"] body { letter-spacing: 0; }
html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] .signin-hero h1, html[lang="ar"] .signin-form h2 { letter-spacing: 0; }
[dir="rtl"] .callout { border-radius: var(--radius-control) 0 0 var(--radius-control); }
@media (max-width: 860px) {
    /* Off-screen to the right would widen the page in right-to-left mode, so the closed menu is hidden instead. */
    [dir="rtl"] .sidebar:not(.open) { transform: none; visibility: hidden; inset-inline-start: auto; left: 0; width: 0; overflow: hidden; }
    [dir="rtl"] .sidebar.open { transform: none; }
}
/* Screens are laid out left to right whatever the interface language: canvases, zones and previews keep their geometry. */
[dir="rtl"] .editor-surface, [dir="rtl"] .designer-canvas, [dir="rtl"] .zone-box, [dir="rtl"] .chart-axis, [dir="rtl"] .code, [dir="rtl"] .code-input { direction: ltr; }
[dir="rtl"] input[type="email"], [dir="rtl"] input[type="url"], [dir="rtl"] input[type="tel"] { direction: ltr; text-align: end; }
.lang-switch { display: inline-flex; gap: 2px; }
.lang-switch button, .lang-switch a { font: inherit; background: none; border: 1px solid var(--line); color: var(--ink-soft); padding: 4px 10px; border-radius: var(--radius-control); cursor: pointer; text-decoration: none; }
.lang-switch .current { background: var(--signal-wash); color: var(--ink); border-color: var(--signal); }
.signin-lang { display: flex; justify-content: center; margin-top: 14px; font-size: .82rem; }

/* ---------- Menu icons, and the categories-only menu ---------- */
.nav-ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-heading { display: flex; align-items: center; gap: 8px; }
.nav-heading .nav-ico { display: none; }
.nav-heading:focus-visible, .menu-pin:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-control); }
.menu-pin { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 22px; padding: 7px 10px; border: 1px dashed var(--nav-line); border-radius: var(--radius-control); background: none; color: var(--nav-heading); font: inherit; font-size: .84rem; cursor: pointer; }
.menu-pin:hover { color: var(--nav-ink); background: var(--nav-hover); }
@media (max-width: 860px) { .menu-pin { display: none; } }
html[data-nav="top"] .menu-pin { display: none; }

/* Categories only: a narrow column of category icons; pointing at one shows its pages beside it. */
@media (min-width: 861px) {
    html[data-nav="side"][data-sidebar="rail"] .shell { grid-template-columns: 72px 1fr; }
    html[data-nav="side"][data-sidebar="rail"] .sidebar { overflow: visible; padding: 16px 12px; display: flex; flex-direction: column; z-index: 40; }
    html[data-nav="side"][data-sidebar="rail"] .brand { justify-content: center; padding: 4px 0 12px; }
    html[data-nav="side"][data-sidebar="rail"] .brand-name { display: none; }
    html[data-nav="side"][data-sidebar="rail"] .brand-logo { max-width: 44px; max-height: 32px; object-fit: contain; }
    html[data-nav="side"][data-sidebar="rail"] .nav-section { position: relative; margin: 4px -12px 0; padding: 0 12px; }
    html[data-nav="side"][data-sidebar="rail"] .nav-heading { justify-content: center; height: 44px; padding: 0; border-radius: var(--radius-control); color: var(--nav-ink-soft); cursor: default; }
    html[data-nav="side"][data-sidebar="rail"] .nav-heading .nav-ico { display: block; width: 22px; height: 22px; }
    html[data-nav="side"][data-sidebar="rail"] .nav-heading .nav-text { display: none; }
    html[data-nav="side"][data-sidebar="rail"] .nav-section.has-active .nav-heading { background: var(--nav-active-bg); color: var(--nav-active-ink); }
    html[data-nav="side"][data-sidebar="rail"] .nav-section:hover .nav-heading,
    html[data-nav="side"][data-sidebar="rail"] .nav-section:focus-within .nav-heading { background: var(--nav-hover); color: var(--nav-ink); }
    html[data-nav="side"][data-sidebar="rail"] .nav {
        display: none; position: absolute; inset-inline-start: 100%; top: -6px; z-index: 50; min-width: 240px;
        padding: 8px; background: var(--nav-bg); border: 1px solid var(--nav-line); border-radius: var(--radius-panel);
        box-shadow: 0 12px 32px rgba(15, 12, 24, .28);
    }
    html[data-nav="side"][data-sidebar="rail"] .nav::before {
        content: attr(data-title); display: block; padding: 4px 10px 8px; font-size: .74rem; font-weight: 600;
        color: var(--nav-heading); text-transform: uppercase; letter-spacing: .06em;
    }
    html[lang="ar"][data-nav="side"][data-sidebar="rail"] .nav::before { text-transform: none; letter-spacing: 0; }
    html[data-nav="side"][data-sidebar="rail"] .nav-section:nth-last-child(-n+4) .nav { top: auto; bottom: -6px; }
    html[data-nav="side"][data-sidebar="rail"] .nav-section:hover .nav,
    html[data-nav="side"][data-sidebar="rail"] .nav-section:focus-within .nav { display: block; }
    html[data-nav="side"][data-sidebar="rail"] .menu-pin { justify-content: center; margin-top: auto; padding: 10px 0; border: 0; }
    html[data-nav="side"][data-sidebar="rail"] .menu-pin .nav-text { display: none; }
    html[data-nav="side"][data-sidebar="open"] .menu-pin .nav-ico { transform: rotate(45deg); }
}

/* ---------- Wide pages and option cards ---------- */
.grid-halves { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.grid-halves > .panel + .panel { margin-top: 0; }
@media (max-width: 1280px) { .grid-halves { grid-template-columns: minmax(0, 1fr); } }
.grid-halves .form { max-width: none; }

/* Tickable options with a code name and a plain description. */
.check-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 4px 0 6px; }
.check-card { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--panel); cursor: pointer; font-weight: 500; transition: border-color .12s, background .12s; }
.check-card:hover { border-color: color-mix(in srgb, var(--signal) 45%, var(--line)); }
.check-card:has(input:checked) { border-color: var(--signal); background: var(--signal-wash); }
.check-card:has(input:focus-visible) { box-shadow: var(--focus); }
.check-card input { width: 16px; height: 16px; margin: 2px 0 0; flex: none; accent-color: var(--signal); }
.check-card > span { display: grid; gap: 3px; min-width: 0; }
.check-card code { justify-self: start; font-size: .78rem; overflow-wrap: anywhere; }
.check-card small { color: var(--ink-soft); font-size: .84rem; line-height: 1.35; }

/* Category captions under the menu icons (categories-only menu). */
.nav-caption { display: none; }
@media (min-width: 861px) {
    html[data-nav="side"][data-sidebar="rail"] .shell { grid-template-columns: 92px 1fr; }
    html[data-nav="side"][data-sidebar="rail"] .sidebar { padding: 14px 10px; }
    html[data-nav="side"][data-sidebar="rail"] .nav-section { margin: 2px -10px 0; padding: 0 10px; }
    html[data-nav="side"][data-sidebar="rail"] .nav-heading { flex-direction: column; gap: 4px; height: auto; min-height: 58px; padding: 8px 2px 7px; }
    html[data-nav="side"][data-sidebar="rail"] .nav-heading .nav-ico { width: 21px; height: 21px; }
    html[data-nav="side"][data-sidebar="rail"] .nav-caption {
        display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
        font-size: .78rem; font-weight: 600; letter-spacing: .005em; text-transform: none; line-height: 1.25;
        color: var(--nav-ink); opacity: .92; -webkit-font-smoothing: antialiased;
    }
    html[data-nav="side"][data-sidebar="rail"] .nav-heading .nav-ico { color: var(--nav-ink); }
    html[data-nav="side"][data-sidebar="rail"] .nav-section.has-active .nav-caption,
    html[data-nav="side"][data-sidebar="rail"] .nav-section:hover .nav-caption { opacity: 1; }
    html[data-nav="side"][data-sidebar="rail"] .nav { top: 0; }
}

/* ---------- Privacy and terms ---------- */
.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; color: var(--ink-faint); font-size: .82rem; }
.legal-links a, .signin-foot a { color: inherit; }
.legal-links a:hover, .signin-foot a:hover { color: var(--ink); }
.signin-foot { flex-wrap: wrap; }
.signin-foot > span[aria-hidden] { opacity: .6; }
.auth-card .legal-links { margin: 10px 0 0; }
.app-foot { margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--line-soft); justify-content: flex-start; }
.legal-body { background: var(--canvas); }
.legal-top { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; padding: 14px max(16px, calc((100vw - 820px) / 2)); background: var(--panel); border-bottom: 1px solid var(--line); }
.legal-top .brand { padding: 0; color: var(--ink); }
.legal-nav { display: flex; gap: 16px; flex: 1; }
.legal-nav a { color: var(--ink-soft); font-weight: 500; }
.legal-nav a.current { color: var(--ink); font-weight: 650; text-decoration: underline; text-underline-offset: 6px; text-decoration-color: var(--signal); }
.legal-page { max-width: 820px; margin: 0 auto; padding: 36px 16px 64px; }
.legal-text { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 32px 40px; line-height: 1.7; margin-bottom: 16px; }
.legal-text h1 { font-size: 1.9rem; margin: 0 0 16px; }
.legal-text h2 { font-size: 1.15rem; margin: 28px 0 8px; }
.legal-text ul { padding-inline-start: 22px; }
.legal-text li { margin-bottom: 6px; }
@media (max-width: 600px) { .legal-text { padding: 22px 18px; } }

/* ---------- Go-live checklist ---------- */
.golive-summary .panel-body { display: grid; gap: 12px; }
.golive-progress { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.golive-progress strong { font-size: 1.15rem; }
.golive-meter { height: 10px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.golive-meter span { display: block; height: 100%; background: var(--warn); border-radius: inherit; transition: width .3s; }
.golive-summary.is-ready .golive-meter span { background: var(--ok); }
.golive-list { list-style: none; margin: 0; padding: 0; }
.golive-item { display: flex; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--line-soft); scroll-margin-top: 80px; }
.golive-item:first-child { border-top: 0; }
.golive-item:target { background: var(--signal-wash); }
.golive-ico { flex: none; width: 22px; height: 22px; margin-top: 1px; }
.golive-item.is-done .golive-ico { color: var(--ok); }
.golive-item.is-todo .golive-ico { color: var(--warn); }
.golive-item.is-optional .golive-ico { color: var(--ink-faint); }
.golive-body { flex: 1; min-width: 0; display: grid; gap: 6px; justify-items: start; }
.golive-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 600; }
.golive-item.is-done .golive-title > span:first-child { color: var(--ink-soft); }
.golive-detail { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; color: var(--ink-faint); overflow-wrap: anywhere; }
.golive-fix { margin: 0; color: var(--ink-soft); font-size: .9rem; max-width: 80ch; }
.golive-note { font-size: .85rem; }
.golive-inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
.golive-inline-form input { flex: 1 1 240px; max-width: 360px; }
