:root {
    --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --fs-body: 0.875rem;
    --fs-sm: 0.8125rem;
    --fs-xs: 0.6875rem;
    --fs-lg: 1rem;
    --fs-xl: 1.125rem;
    --fs-display: clamp(1.35rem, 2.8vw, 2rem);
    --leading-snug: 1.35;
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --bg-deep: #09090b;
    --bg: #111113;
    --bg-elevated: #18181b;
    --panel: #1c1c21;
    --panel-2: #202027;
    --ink: #fafafa;
    --muted: #a1a1aa;
    --line: rgba(255, 255, 255, 0.06);
    --brand: #2563eb;
    --brand-2: #7c3aed;
    --brand-dark: #1d4ed8;
    --danger: #ef4444;
    --success: #10b981;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
    --glass: rgba(28, 28, 33, 0.72);
    --app-body-bg: #0b0f19;
    --input-bg: rgba(9, 9, 11, 0.55);
    --table-head-bg: rgba(9, 9, 11, 0.3);
    --pill-track-bg: rgba(9, 9, 11, 0.55);
    --progress-track: rgba(255, 255, 255, 0.08);
    --modal-surface: #0f172a;
    --shadow-card: 0 12px 36px rgba(0, 0, 0, 0.28);
    --dash-kpi-shade: rgba(17, 17, 19, 0.92);
}

html.theme-light {
    --bg-deep: #f1f5f9;
    --bg: #ffffff;
    --bg-elevated: #f8fafc;
    --panel: #ffffff;
    --panel-2: #f1f5f9;
    --ink: #0f172a;
    --muted: #64748b;
    --line: rgba(15, 23, 42, 0.1);
    --shadow: 0 16px 48px rgba(15, 23, 42, 0.07);
    --glass: rgba(255, 255, 255, 0.94);
    --app-body-bg: #f1f5f9;
    --input-bg: #ffffff;
    --table-head-bg: #eef2f7;
    --pill-track-bg: #f1f5f9;
    --progress-track: rgba(15, 23, 42, 0.1);
    --modal-surface: #ffffff;
    --shadow-card: 0 8px 24px rgba(15, 23, 42, 0.06);
    --dash-kpi-shade: #ffffff;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    color: var(--ink);
    background: var(--app-body-bg);
    font-family: var(--font-sans);
    font-size: var(--fs-body);
    line-height: var(--leading-snug);
    -webkit-font-smoothing: antialiased;
}
html.theme-light body,
html.theme-light .ops-body {
    background: var(--app-body-bg);
    color: var(--ink);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.auth-main { min-height: 100vh; display: grid; place-items: center; padding: 2rem; }
.app-main { margin-left: 260px; padding: 2rem; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: 260px; padding: 1.25rem;
    background: #0f172a; color: #dbeafe; display: flex; flex-direction: column; gap: 1.5rem;
}
.brand { display: flex; align-items: center; gap: .75rem; font-weight: 800; font-size: 1.05rem; }
.brand span { display: grid; gap: .05rem; }
.brand small { color: #94a3b8; font-size: .72rem; font-weight: 600; }
.brand-logo { width: 38px; height: 38px; object-fit: cover; border-radius: 8px; background: white; }
.sidebar nav { display: grid; gap: .35rem; }
.sidebar nav a, .logout button {
    width: 100%; border: 0; border-radius: 8px; padding: .8rem .9rem; color: #cbd5e1;
    background: transparent; text-align: left;
}
.sidebar nav a:hover, .logout button:hover { background: rgba(255,255,255,.08); color: white; }
.logout { margin-top: auto; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; margin-bottom: 1.1rem; }
.eyebrow { color: var(--brand); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: var(--fs-xs); }
h1 { margin: .2rem 0; font-size: var(--fs-display); line-height: 1.12; font-weight: 700; letter-spacing: -0.02em; }
h2 { margin: 0 0 0.65rem; font-size: var(--fs-lg); font-weight: 700; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.panel, .card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}
.panel { padding: 1rem 1.1rem; }
.grid { display: grid; gap: 0.75rem; }
.stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat { padding: 0.75rem; }
.stat strong { display: block; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.two { grid-template-columns: 1fr 1fr; }
.three { grid-template-columns: repeat(3, 1fr); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 0; border-radius: var(--radius-md);
    padding: .55rem 0.85rem; background: var(--brand); color: white; font-weight: 600; font-size: var(--fs-sm); cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 4px 14px rgba(0, 0, 0, 0.25);
    transition: transform .14s ease, box-shadow .14s ease, filter .14s ease, background-color .14s ease;
}
.btn:hover { filter: brightness(1.05); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 8px 24px rgba(37, 99, 235, 0.35); }
.btn.secondary { background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); }
.btn.secondary:hover { filter: brightness(1.08); box-shadow: none; }
.btn.danger { background: var(--danger); }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid transparent; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.actions form.inline-form { display: inline; margin: 0; }
.actions form.inline-form button { margin: 0; }
.table td.actions {
    white-space: nowrap;
    vertical-align: middle;
    text-align: right;
}
.table td.actions .btn { white-space: nowrap; }

.pagination-ops {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-top: 1rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-card);
}
.pagination-ops__meta {
    margin: 0;
    font-size: var(--fs-sm);
    color: var(--muted);
}
.pagination-ops__meta strong {
    color: var(--ink);
    font-weight: 700;
}
.pagination-ops__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}
.pagination-ops__list > li { display: flex; align-items: center; }
.pagination-ops__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
    font-weight: 600;
    font-size: var(--fs-sm);
    text-decoration: none;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.pagination-ops__btn:hover {
    border-color: rgba(37, 99, 235, 0.45);
    background: rgba(37, 99, 235, 0.1);
    color: var(--ink);
}
.pagination-ops__btn--disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}
.pagination-ops__page {
    display: inline-grid;
    place-items: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.45rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
    font-weight: 600;
    font-size: var(--fs-sm);
    text-decoration: none;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.pagination-ops__page:hover {
    border-color: rgba(37, 99, 235, 0.4);
    background: rgba(37, 99, 235, 0.12);
}
.pagination-ops__page--current {
    border-color: rgba(37, 99, 235, 0.55);
    background: rgba(37, 99, 235, 0.22);
    color: var(--ink);
    cursor: default;
}
.pagination-ops__gap {
    display: inline-flex;
    align-items: center;
    padding: 0 0.25rem;
    color: var(--muted);
    font-size: var(--fs-sm);
    font-weight: 700;
}
html.theme-light .pagination-ops__page--current {
    background: rgba(37, 99, 235, 0.14);
}
.alert { margin-bottom: 0.75rem; padding: 0.65rem 0.85rem; border-radius: var(--radius-md); background: rgba(16, 185, 129, 0.14); color: #ecfdf5; border: 1px solid rgba(16, 185, 129, 0.35); font-size: var(--fs-sm); }
.alert.danger { background: rgba(239, 68, 68, 0.14); color: #fef2f2; border-color: rgba(239, 68, 68, 0.38); }
html.theme-light .alert { color: #065f46; }
html.theme-light .alert.danger { color: #991b1b; }

.form { display: grid; gap: 0.75rem; max-width: 900px; }
.form.panel, .form.ops-panel {
    background: var(--glass);
    border-color: var(--line);
}
.field { display: grid; gap: .3rem; }
.field label { font-weight: 600; font-size: var(--fs-sm); }
.field input, .field select, .field textarea {
    width: 100%; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 0.55rem 0.75rem;
    background: var(--input-bg); color: var(--ink); font-size: var(--fs-sm);
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: rgba(37, 99, 235, 0.55); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}
.field textarea { min-height: 88px; }
.field-hint { font-size: var(--fs-xs); color: var(--muted); margin: 0; line-height: 1.4; }
.advanced-disclosure--form {
    margin-top: .25rem; padding: 0.75rem 0.85rem; border: 1px solid var(--line); border-radius: var(--radius-lg);
    background: var(--bg-elevated);
}
.advanced-disclosure--form summary { font-size: .9rem; color: var(--ink); }
.checkbox { display: flex; align-items: center; gap: .5rem; font-weight: 700; }

.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th, .table td { padding: 0.55rem 0.65rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; background: var(--table-head-bg); position: sticky; top: 0; z-index: 1; backdrop-filter: blur(8px); font-weight: 600; }
.table tbody tr:hover td {
    background: rgba(37, 99, 235, 0.06);
}
.badge { display: inline-flex; padding: .2rem .45rem; border-radius: 999px; background: rgba(37, 99, 235, 0.18); color: #dbeafe; font-weight: 600; font-size: var(--fs-xs); border: 1px solid rgba(37, 99, 235, 0.28); }
html.theme-light .badge { color: #1e40af; background: rgba(37, 99, 235, 0.1); border-color: rgba(37, 99, 235, 0.22); }

.login-card { width: min(460px, 100%); padding: 2rem; }
.login-logo { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; margin-bottom: 1rem; }
.mapper-shell { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1rem; height: calc(100vh - 4rem); }
.mapper-stage { position: relative; overflow: hidden; background: #0b1120; border-radius: 24px; }
.mapper-canvas { width: 100%; height: 100%; overflow: auto; cursor: crosshair; }
.mapper-canvas svg { min-width: 100%; background: #111827; }
.mapper-canvas image { pointer-events: none; }
.plot { fill: rgba(34,197,94,.08); stroke: #22c55e; stroke-width: 3; cursor: pointer; vector-effect: non-scaling-stroke; }
.plot:hover, .plot.selected { fill: rgba(37,99,235,.35); stroke: #2563eb; }
.customplot { fill: rgba(245,158,11,.12); stroke: #f59e0b; stroke-width: 3; cursor: pointer; vector-effect: non-scaling-stroke; }
.customplot:hover, .customplot.selected { fill: rgba(236,72,153,.35); stroke: #ec4899; }
.draft-path { fill: rgba(37,99,235,.15); stroke: #60a5fa; stroke-width: 3; stroke-dasharray: 12 8; vector-effect: non-scaling-stroke; }
.mapper-panel { overflow: auto; padding: 1rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.region-list { display: grid; gap: .5rem; max-height: 260px; overflow: auto; }
.region-row { border: 1px solid var(--line); border-radius: 12px; padding: .65rem; cursor: pointer; background: white; }
.region-row.active { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.preview-wrap {
    overflow: hidden;
    height: min(78vh, 820px);
    min-height: 520px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0;
    cursor: grab;
}
.preview-wrap:active { cursor: grabbing; }
.preview-wrap svg { display: block; width: 100%; height: 100%; }
.preview-wrap svg .plot { fill: transparent; }
.preview-wrap svg .plot.matched { fill: rgba(236,72,153,.48); }
.preview-wrap svg .customplot { fill: rgba(245,158,11,.12); }
.preview-wrap svg .plot:hover { fill: rgba(37,99,235,.28); }
.plot-tooltip {
    position: fixed;
    z-index: 2000;
    max-width: 320px;
    padding: .45rem .6rem;
    border-radius: 8px;
    background: rgba(15, 23, 42, .92);
    color: white;
    font-size: .82rem;
    pointer-events: none;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .24);
}

@media (max-width: 1100px) {
    .app-main { margin-left: 0; padding-top: 6.5rem; }
    .sidebar { width: 100%; height: auto; bottom: auto; z-index: 10; flex-direction: row; align-items: center; }
    .sidebar nav { display: flex; overflow-x: auto; }
    .logout { margin-left: auto; margin-top: 0; }
    .stats, .two, .three, .mapper-shell { grid-template-columns: 1fr; }
    .mapper-shell { height: auto; }
    .mapper-stage { height: 70vh; }
}

/* --- Mapping studio (full-screen editor) --- */
.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;
}
.studio-root {
    margin: 0;
    min-height: 100vh;
    background: #070b14;
    color: #e5e7eb;
    font-family: var(--font-sans);
    font-size: var(--fs-body);
    line-height: var(--leading-snug);
}
html.theme-light .studio-root {
    background: #f4f6fb;
    color: #0f172a;
}
.studio-toast {
    position: fixed; top: 1rem; left: 50%; transform: translateX(-50%);
    z-index: 2000; padding: .65rem 1rem; border-radius: 999px;
    background: rgba(34, 197, 94, .95); color: #052e16; font-weight: 600; font-size: .9rem;
    box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.mapping-studio {
    display: flex; flex-direction: column;
    height: 100vh;
    overflow: hidden;
}
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ui-icon, .rail-icon {
    width: 1.15rem; height: 1.15rem;
    fill: none; stroke: currentColor; stroke-width: 2;
    stroke-linecap: round; stroke-linejoin: round;
    flex: 0 0 auto;
}
.studio-topbar {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1.2fr) minmax(0, 1fr) auto;
    align-items: center; gap: 1rem;
    padding: .75rem 1.25rem;
    border-bottom: 1px solid rgba(148, 163, 184, .18);
    background: rgba(15, 23, 42, .72);
    backdrop-filter: blur(14px);
}
html.theme-light .studio-topbar {
    background: rgba(255, 255, 255, .86);
    border-bottom-color: rgba(15, 23, 42, .08);
}
.studio-back {
    width: 2.25rem; height: 2.25rem;
    display: inline-grid; place-items: center;
    border: 1px solid rgba(148, 163, 184, .28);
    border-radius: 8px;
    color: #93c5fd; font-weight: 600; font-size: .9rem;
}
html.theme-light .studio-back { color: #2563eb; }
.studio-brand-lockup {
    display: flex; align-items: center; gap: .55rem;
    min-width: 8.5rem;
}
.studio-brand-logo {
    width: 34px; height: 34px;
    border-radius: 8px;
    object-fit: cover;
    background: white;
}
.studio-brand-lockup span { display: grid; line-height: 1.05; }
.studio-brand-lockup strong { font-size: .85rem; font-weight: 850; color: #f8fafc; }
.studio-brand-lockup small { font-size: .68rem; font-weight: 700; color: #94a3b8; }
html.theme-light .studio-brand-lockup strong { color: #0f172a; }
html.theme-light .studio-brand-lockup small { color: #64748b; }
.studio-title-block .studio-title {
    margin: 0; font-size: 1.05rem; font-weight: 800; letter-spacing: -0.02em;
}
.studio-meta { margin: .15rem 0 0; font-size: .78rem; color: #94a3b8; }
html.theme-light .studio-meta { color: #64748b; }
.studio-meta .dot { opacity: .45; padding: 0 .25rem; }
.studio-search-wrap { position: relative; }
.studio-search {
    width: 100%; border-radius: 999px; border: 1px solid rgba(148, 163, 184, .25);
    background: rgba(15, 23, 42, .5); color: #e5e7eb; padding: .55rem 2.25rem .55rem 1rem;
}
html.theme-light .studio-search {
    background: white; color: #0f172a; border-color: #e2e8f0;
}
.search-hint {
    position: absolute; right: .6rem; top: 50%; transform: translateY(-50%);
    font-size: .65rem; padding: .1rem .35rem; border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, .35); color: #94a3b8;
}
.studio-top-actions { display: flex; flex-wrap: wrap; gap: .45rem; justify-content: flex-end; align-items: center; }
.studio-save-feedback {
    font-size: .78rem; font-weight: 700; color: #94a3b8; min-width: 4.5rem;
}
.studio-save-feedback[data-state="pending"] { color: #fbbf24; }
.studio-save-feedback[data-state="ok"] { color: #4ade80; }
.studio-save-feedback[data-state="err"] { color: #f87171; }
html.theme-light .studio-save-feedback { color: #64748b; }
html.theme-light .studio-save-feedback[data-state="pending"] { color: #b45309; }
html.theme-light .studio-save-feedback[data-state="ok"] { color: #15803d; }
html.theme-light .studio-save-feedback[data-state="err"] { color: #b91c1c; }
.autosave-toggle {
    display: inline-flex; align-items: center; gap: .4rem;
    border: 1px solid rgba(148, 163, 184, .35);
    border-radius: 999px; padding: .42rem .75rem;
    color: #e5e7eb; font-size: .82rem; font-weight: 700;
    background: rgba(15, 23, 42, .35);
}
.autosave-toggle input { width: 1rem; height: 1rem; accent-color: #0f766e; }
html.theme-light .autosave-toggle { background: white; color: #0f172a; border-color: #e2e8f0; }
.chip-btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: .35rem;
    border-radius: 999px; padding: .45rem .85rem; font-weight: 600; font-size: .82rem;
    border: 1px solid rgba(148, 163, 184, .35); background: rgba(15, 23, 42, .35);
    color: #e5e7eb; cursor: pointer; text-decoration: none;
}
html.theme-light .chip-btn {
    background: white; color: #0f172a; border-color: #e2e8f0;
}
.chip-btn.primary { border-color: rgba(96, 165, 250, .55); color: #bfdbfe; }
html.theme-light .chip-btn.primary { color: #1d4ed8; border-color: #bfdbfe; }
.chip-btn.primary.solid {
    background: linear-gradient(135deg, #3b82f6, #6366f1); color: white; border: 0;
}
.chip-btn.danger { border-color: rgba(248, 113, 113, .45); color: #fecaca; }
html.theme-light .chip-btn.danger { color: #b91c1c; border-color: #fecaca; }
.chip-btn.icon-chip {
    width: 2.1rem; height: 2.1rem;
    padding: 0;
}
.studio-canvas-column .studio-canvas-wrap {
    flex: 1;
    min-height: 0;
}
.studio-canvas-wrap {
    position: relative;
    background: radial-gradient(circle at 20% 20%, rgba(59, 130, 246, .12), transparent 40%),
        radial-gradient(circle at 80% 60%, rgba(99, 102, 241, .1), transparent 35%),
        #0b1120;
}
html.theme-light .studio-canvas-wrap {
    background: #e8edf5;
}
.studio-svg {
    display: block; width: 100%; height: 100%;
    cursor: crosshair; touch-action: none;
}
.studio-svg.tool-pen { cursor: none; }
.studio-svg.tool-pen.pen-near-close {
    cursor: none;
}
/* Letterboxed SVG: plots must not steal clicks while drawing (see clientToDoc + meet). */
.studio-svg.tool-pen #regionsLayer {
    pointer-events: none;
}
.studio-svg #layoutBackgroundImage {
    pointer-events: none;
}
.studio-svg .snap-hint-layer .snap-hint-pulse {
    fill: rgba(251, 191, 36, 0.25);
    stroke: #fbbf24;
    stroke-width: 3;
    vector-effect: non-scaling-stroke;
    animation: snap-hint-pulse 0.85s ease-in-out infinite;
}
.studio-svg .boundary-hint-layer .boundary-hint-line {
    stroke: #f59e0b;
    stroke-width: 6;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
    filter: drop-shadow(0 0 10px rgba(245, 158, 11, .75));
}
.studio-svg .boundary-hint-layer .boundary-hint-dot {
    fill: #f59e0b;
    stroke: #fffbeb;
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}
@keyframes snap-hint-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.38; }
}
html.theme-light .studio-svg .snap-hint-layer .snap-hint-pulse {
    stroke: #d97706;
}
.studio-svg .draft-vertices .draft-vertex {
    fill: #38bdf8;
    stroke: rgba(255, 255, 255, 0.95);
    stroke-width: 1.5;
}
html.theme-light .studio-svg .draft-vertices .draft-vertex {
    stroke: #0f172a;
}
.studio-svg .draft-vertices .draft-vertex.first {
    fill: #4ade80;
}
.studio-svg .draft-vertices .draft-vertex.first.near-close {
    fill: #ef4444;
    stroke: #fecaca;
    stroke-width: 2;
}
.studio-svg .draft-vertices .draft-vertex.snap-active {
    fill: #fbbf24;
    stroke: #fffbeb;
    stroke-width: 2;
}
.studio-svg .cursor-layer .cursor-node {
    fill: #38bdf8;
    stroke: #ffffff;
    stroke-width: 1.75;
    vector-effect: non-scaling-stroke;
}
.studio-svg .cursor-layer .cursor-node-close {
    fill: #22c55e;
    stroke: #dcfce7;
    stroke-width: 2;
}
.studio-svg .cursor-layer .cursor-node-snap {
    fill: #fbbf24;
    stroke: #fffbeb;
    stroke-width: 2.25;
}
.studio-svg .plot, .studio-svg .customplot {
    fill: rgba(59, 130, 246, .12);
    stroke: rgba(96, 165, 250, .95);
    stroke-width: 2;
    transition: fill .15s ease, stroke .15s ease, filter .15s ease;
}
.studio-svg .plot.hover, .studio-svg .customplot.hover {
    fill: rgba(99, 102, 241, .22);
    filter: drop-shadow(0 0 12px rgba(99, 102, 241, .45));
}
.studio-svg .plot.selected, .studio-svg .customplot.selected {
    fill: rgba(236, 72, 153, .22);
    stroke: #f472b6;
    stroke-width: 2.5;
    filter: drop-shadow(0 0 14px rgba(236, 72, 153, .35));
}
.studio-svg .draft-path {
    fill: rgba(59, 130, 246, .12);
    stroke: #38bdf8;
    stroke-width: 2;
    pointer-events: none;
}
.studio-svg .draft-path.near-close {
    stroke: #4ade80;
    filter: drop-shadow(0 0 10px rgba(74, 222, 128, .55));
}
.floating-draw-aids {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease, max-height .2s ease;
}
.floating-draw-aids.floating-draw-aids--active {
    max-height: 6rem;
    opacity: 1;
    pointer-events: auto;
    margin-top: .35rem;
    padding-top: .35rem;
    border-top: 1px solid rgba(148, 163, 184, .22);
}
html.theme-light .floating-draw-aids.floating-draw-aids--active {
    border-top-color: #e2e8f0;
}
.handles-layer .handle-line {
    stroke: rgba(248, 250, 252, .35);
    stroke-width: 1;
    pointer-events: none;
}
.handles-layer .handle-anchor {
    fill: #f472b6; stroke: #fdf2f8; stroke-width: 1.5; cursor: grab;
}
.handles-layer .handle-in { fill: #a78bfa; stroke: #ede9fe; stroke-width: 1; cursor: grab; }
.handles-layer .handle-out { fill: #38bdf8; stroke: #e0f2fe; stroke-width: 1; cursor: grab; }
.canvas-hint {
    position: absolute; left: 50%; bottom: 1rem; transform: translateX(-50%);
    font-size: .72rem; color: #94a3b8; padding: .35rem .75rem;
    border-radius: 999px; background: rgba(15, 23, 42, .55); border: 1px solid rgba(148, 163, 184, .2);
    pointer-events: none;
}
.floating-toolbar {
    position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
    display: flex; flex-direction: column; gap: .35rem;
    padding: .5rem; border-radius: 16px;
    background: rgba(15, 23, 42, .78); border: 1px solid rgba(148, 163, 184, .22);
    backdrop-filter: blur(12px); box-shadow: 0 18px 50px rgba(0,0,0,.35);
}
html.theme-light .floating-toolbar {
    background: rgba(255,255,255,.92); border-color: #e2e8f0;
}
.tool-btn {
    border: 0; border-radius: 8px; padding: .5rem .65rem; cursor: pointer;
    background: transparent; color: #cbd5e1; font-weight: 700; font-size: .78rem;
}
html.theme-light .tool-btn { color: #475569; }
.tool-btn.active {
    background: linear-gradient(135deg, rgba(59,130,246,.35), rgba(99,102,241,.35));
    color: white;
}
html.theme-light .tool-btn.active { color: #1e3a8a; }
.tool-btn.icon-only { font-size: 1rem; }
.tool-btn.icon-only {
    width: 2rem; height: 2rem;
    display: inline-grid; place-items: center;
    padding: 0;
}
.tool-btn.tool-btn--labeled {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: .45rem;
    width: 100%;
    min-height: 2.15rem;
    padding: .38rem .55rem;
}
.tool-btn.tool-btn--labeled .ui-icon {
    width: 1.05rem;
    height: 1.05rem;
    flex-shrink: 0;
}
.tool-btn.tool-btn--labeled span {
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .03em;
    line-height: 1.1;
}
.inspector-form-block {
    display: grid;
    gap: .55rem;
}
.inspector-form-block[hidden] {
    display: none !important;
}
.floating-zoom {
    display: flex; flex-direction: column; gap: .2rem;
    padding-bottom: .35rem; margin-bottom: .2rem;
    border-bottom: 1px solid rgba(148, 163, 184, .22);
}
html.theme-light .floating-zoom { border-bottom-color: #e2e8f0; }
.toolbar-divider { height: 1px; background: rgba(148, 163, 184, .25); margin: .25rem 0; }
.studio-inspector {
    border-left: 1px solid rgba(148, 163, 184, .18);
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(12px);
    display: flex; flex-direction: column; min-height: 0;
}
html.theme-light .studio-inspector {
    background: rgba(255,255,255,.9); border-left-color: #e2e8f0;
}
.inspector-head { padding: 1rem 1rem .5rem; }
.inspector-head h2 { margin: 0; font-size: .95rem; font-weight: 800; }
.inspector-sub { margin: .35rem 0 0; font-size: .78rem; color: #94a3b8; }
.inspector-body { padding: 0 1rem 1rem; display: grid; gap: .65rem; overflow: auto; }
.details-heading {
    margin: .15rem 0 0;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #94a3b8;
}
.inspector-mode-panel {
    display: grid; gap: .55rem;
    margin: 0 1rem .85rem;
    padding: .75rem;
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: 8px;
    background: rgba(15, 23, 42, .28);
}
html.theme-light .inspector-mode-panel { background: #f8fafc; border-color: #e2e8f0; }
.segmented-control {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .25rem;
    padding: .2rem;
    border-radius: 8px;
    background: rgba(2, 6, 23, .38);
}
html.theme-light .segmented-control { background: #e2e8f0; }
.segment {
    border: 0;
    border-radius: 7px;
    padding: .45rem .35rem;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    font-weight: 800;
    font-size: .74rem;
}
.segment.active { background: #0f766e; color: white; }
.mode-help { color: #cbd5e1; font-size: .76rem; line-height: 1.35; }
html.theme-light .mode-help { color: #475569; }
.bulk-entry-panel { display: grid; gap: .35rem; }
.bulk-entry-panel label { font-weight: 800; font-size: .72rem; color: #94a3b8; }
.bulk-entry-panel textarea {
    width: 100%;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, .25);
    background: rgba(15, 23, 42, .4);
    color: #e5e7eb;
    padding: .55rem .65rem;
    resize: vertical;
}
html.theme-light .bulk-entry-panel textarea { background: white; color: #0f172a; border-color: #e2e8f0; }
.studio-field-hint.warning { color: #fbbf24; }
html.theme-light .studio-field-hint.warning { color: #92400e; }
.inspector-foot { margin-top: auto; padding: .75rem 1rem 1rem; border-top: 1px solid rgba(148, 163, 184, .15); }
.pill-row { display: flex; flex-wrap: wrap; gap: .35rem; }
.pill {
    display: inline-flex; padding: .2rem .55rem; border-radius: 999px;
    background: rgba(59, 130, 246, .18); font-size: .72rem; font-weight: 700;
}
.pill.muted { background: rgba(148, 163, 184, .15); color: #94a3b8; }
.field.compact label { font-size: .72rem; font-weight: 700; color: #94a3b8; }
.field.compact input, .field.compact select, .field.compact textarea {
    width: 100%; border-radius: 12px; border: 1px solid rgba(148, 163, 184, .25);
    background: rgba(15, 23, 42, .4); color: #e5e7eb; padding: .5rem .65rem;
}
html.theme-light .field.compact input, html.theme-light .field.compact select, html.theme-light .field.compact textarea {
    background: white; color: #0f172a; border-color: #e2e8f0;
}
.field.compact textarea { min-height: 64px; resize: vertical; }
.grid.tight { gap: .5rem; }
.inspector-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.advanced-disclosure summary {
    cursor: pointer; font-weight: 700; font-size: .8rem; color: #94a3b8;
}
.advanced-disclosure { font-size: .78rem; }
.advanced-disclosure .field { margin-top: .65rem; }
.studio-field-hint { color: #64748b; font-size: .72rem; margin: .35rem 0 0; line-height: 1.35; }
html.theme-light .studio-field-hint { color: var(--muted); }
textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .68rem; }
.modal-overlay {
    position: fixed; inset: 0; background: rgba(2, 6, 23, .65);
    display: grid; place-items: center; z-index: 3000; padding: 1rem;
    backdrop-filter: blur(6px);
}
.modal-card {
    width: min(420px, 100%); border-radius: var(--radius-lg); padding: 1rem 1.1rem;
    background: var(--modal-surface); border: 1px solid var(--line);
    box-shadow: var(--shadow);
    color: var(--ink);
}
html.theme-light .modal-card { border-color: var(--line); }
.modal-card h2 { margin: 0 0 .3rem; font-size: var(--fs-xl); font-weight: 700; }
.modal-lead { margin: 0 0 0.75rem; font-size: var(--fs-sm); color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
@media (max-width: 960px) {
    .studio-main { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
    .studio-tool-rail { grid-template-columns: 1fr; border-right: 0; border-bottom: 1px solid rgba(148, 163, 184, .18); }
    .tool-tabs { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .tool-tabs-muted { display: none; }
    .rail-btn { justify-content: center; text-align: center; min-height: 2.4rem; padding: .45rem .35rem; font-size: .7rem; }
    .studio-canvas-column { min-height: 50vh; }
    .studio-inspector { border-left: 0; border-top: 1px solid rgba(148, 163, 184, .18); max-height: 40vh; }
    .studio-topbar { grid-template-columns: 1fr; }
    .floating-toolbar { top: auto; bottom: 4.5rem; left: 50%; transform: translateX(-50%); flex-direction: row; }
}

/* --- Operations dashboard --- */
.dash-head { align-items: flex-end; flex-wrap: wrap; }
.dash-welcome { margin: 0 0 .25rem; font-size: var(--fs-sm); letter-spacing: .01em; }
.dash-lead { max-width: 42rem; margin: .35rem 0 0; line-height: 1.45; font-size: var(--fs-sm); }
.dash-head-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.dash-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
    margin-bottom: 1rem;
}
@media (max-width: 1100px) {
    .dash-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .dash-kpi-grid { grid-template-columns: 1fr; }
}
.dash-kpi {
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(150deg, var(--panel), var(--dash-kpi-shade));
    border: 1px solid var(--line);
    box-shadow: var(--shadow-card);
    display: grid;
    gap: .25rem;
}
.dash-kpi-link {
    color: inherit;
    transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.dash-kpi-link:hover {
    transform: translateY(-2px);
    border-color: rgba(37, 99, 235, 0.38);
    box-shadow: 0 22px 58px rgba(37, 99, 235, 0.12);
}
.dash-kpi--alert { border-color: rgba(245, 158, 11, .42); background: linear-gradient(145deg, rgba(245,158,11,.14), var(--dash-kpi-shade)); }
.dash-kpi--ok { border-color: rgba(16, 185, 129, .38); background: linear-gradient(145deg, rgba(16,185,129,.14), var(--dash-kpi-shade)); }
.dash-kpi-label {
    font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
}
.dash-kpi-value { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.dash-kpi-hint { font-size: var(--fs-xs); color: var(--muted); line-height: 1.35; }
.dash-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: 1rem;
    align-items: start;
    margin-bottom: 1.25rem;
}
.dash-split--balanced { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dash-split--single { grid-template-columns: 1fr; }
@media (max-width: 1100px) {
    .dash-split, .dash-split--balanced { grid-template-columns: 1fr; }
}
.dash-panel-head {
    display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .75rem;
    flex-wrap: wrap;
}
.dash-panel-head h2 { margin: 0; font-size: var(--fs-lg); font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.dash-side-caption { font-size: .78rem; }
.dash-table th { white-space: nowrap; }
.dash-activity { list-style: none; margin: 0; padding: 0; display: grid; gap: .85rem; }
.dash-activity-row {
    padding-bottom: .65rem;
    border-bottom: 1px solid var(--line);
}
.dash-activity-row:last-child { border-bottom: 0; padding-bottom: 0; }
.dash-activity-main { display: flex; flex-direction: column; gap: .15rem; }
.dash-activity-who { font-weight: 700; font-size: .88rem; }
.dash-activity-action { font-size: .82rem; color: var(--ink); }
.dash-activity-meta { font-size: .75rem; margin-top: .35rem; line-height: 1.35; }
.dash-panel--side {
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: min(72vh, 640px);
}
.dash-panel--side .dash-activity {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin-right: -.15rem;
    padding-right: .35rem;
}
.active-map-list { display: grid; gap: .7rem; }
.active-map-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(140px, .45fr) auto;
    gap: .6rem;
    align-items: center;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--panel-2);
}
.active-map-card:hover { border-color: rgba(37, 99, 235, .36); }
.active-map-card strong, .active-map-card .muted { display: block; }
.active-map-card.is-overdue { border-color: rgba(239, 68, 68, .42); background: rgba(239, 68, 68, .08); }
.active-map-progress { display: grid; gap: .35rem; }
.active-map-progress small { color: var(--muted); font-weight: 700; font-size: .75rem; }
.status-dot {
    width: .75rem;
    height: .75rem;
    border-radius: 999px;
    background: var(--brand);
    box-shadow: 0 0 0 5px rgba(37, 99, 235, .12);
}
@media (max-width: 760px) {
    .active-map-card { grid-template-columns: auto minmax(0, 1fr); }
    .active-map-progress, .active-map-card > .badge { grid-column: 2; }
}

/* Studio: main grid + tool rail + status bar */
.studio-main {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 148px minmax(0, 1fr) 300px;
}
.studio-tool-rail {
    display: grid;
    align-content: start;
    align-items: stretch;
    gap: .65rem;
    padding: .75rem .6rem;
    border-right: 1px solid rgba(148, 163, 184, .18);
    background: rgba(15, 23, 42, .65);
    backdrop-filter: blur(12px);
}
html.theme-light .studio-tool-rail {
    background: rgba(248, 250, 252, .95);
    border-right-color: #e2e8f0;
}
.rail-group-label {
    font-size: .58rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em;
    color: #64748b; padding: .5rem .35rem .25rem; margin-top: .25rem;
}
.rail-group-label:first-child { margin-top: 0; }
.tool-tabs {
    display: grid;
    gap: .35rem;
}
.tool-tabs-muted {
    padding-top: .65rem;
    border-top: 1px solid rgba(148, 163, 184, .18);
}
.rail-btn {
    min-height: 2.7rem;
    border: 1px solid transparent; border-radius: 8px; padding: .5rem .55rem; cursor: pointer;
    background: rgba(15, 23, 42, .28); color: #cbd5e1; font-size: .78rem; font-weight: 800;
    line-height: 1.15; text-align: left; display: flex; align-items: center; gap: .5rem;
}
html.theme-light .rail-btn { color: #64748b; }
.rail-btn .rail-icon { width: 1.2rem; height: 1.2rem; opacity: .95; }
.rail-btn:hover:not(:disabled) {
    background: rgba(59, 130, 246, .14); color: #e2e8f0; border-color: rgba(96, 165, 250, .3);
}
html.theme-light .rail-btn:hover:not(:disabled) { color: #1e40af; }
.rail-btn.active {
    background: #0f766e;
    border-color: rgba(45, 212, 191, .65);
    color: white;
}
html.theme-light .rail-btn.active { color: white; }
.rail-btn:disabled {
    opacity: .35; cursor: not-allowed;
}
.studio-canvas-column {
    position: relative;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.studio-statusbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem;
    padding: .45rem 1.25rem;
    font-size: .72rem;
    border-top: 1px solid rgba(148, 163, 184, .18);
    background: rgba(15, 23, 42, .88);
    color: #94a3b8;
}
html.theme-light .studio-statusbar {
    background: rgba(255, 255, 255, .94);
    border-top-color: #e2e8f0;
    color: #64748b;
}
.studio-statusbar strong { color: #e2e8f0; font-weight: 700; }
html.theme-light .studio-statusbar strong { color: #0f172a; }
.stat-spacer { flex: 1; }
.stat-sep {
    width: 1px;
    height: 1rem;
    align-self: center;
    background: rgba(148, 163, 184, 0.28);
}
html.theme-light .stat-sep { background: #e2e8f0; }
.stat-coverage { white-space: nowrap; max-width: 100%; }
.stat-coverage .tiny { font-size: 0.68rem; font-weight: 400; }
.status-ok { color: #4ade80; }
.status-warn { color: #fbbf24; }

/* --- Production operations polish --- */
.page-head--stack { align-items: flex-end; }
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    margin-bottom: 0.75rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--panel);
    box-shadow: var(--shadow-card);
}
.filter-bar select, .filter-bar input {
    min-height: 2.25rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--ink);
    padding: 0.4rem 0.55rem;
    font-size: var(--fs-sm);
}
.filter-bar-workflow-msg {
    flex: 1 1 100%;
    margin: 0;
    padding: 0.45rem 0.55rem;
    border-radius: var(--radius-md);
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.22);
    font-size: var(--fs-sm);
    color: var(--ink);
}
.filter-bar-workflow-clear {
    margin-left: 0.35rem;
    font-weight: 700;
    color: var(--brand);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.filter-bar select.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
html.theme-light .filter-bar-workflow-msg {
    background: rgba(37, 99, 235, 0.08);
}
.search-field {
    display: flex;
    align-items: center;
    gap: .45rem;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    padding: 0 0.55rem;
    flex: 1 1 280px;
}
.search-field span { color: var(--muted); font-size: .78rem; font-weight: 700; display: inline-flex; align-items: center; gap: .35rem; }
.search-field input { border: 0; padding-left: 0; width: 100%; }
.search-field input:focus { outline: 0; }
.filter-check {
    min-height: 2.25rem;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: 0.4rem 0.55rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--muted);
    font-weight: 600;
    font-size: var(--fs-sm);
}
.layout-view-tabs {
    display: inline-flex;
    gap: .2rem;
    margin-top: 0.75rem;
    padding: .22rem;
    border-radius: var(--radius-md);
    background: var(--pill-track-bg);
    border: 1px solid var(--line);
}
.layout-view-tabs a {
    padding: .45rem .9rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: .82rem;
    color: var(--muted);
    text-decoration: none;
    transition: background .12s ease, color .12s ease;
}
.layout-view-tabs a:hover { color: var(--ink); background: rgba(37, 99, 235, 0.08); }
html.theme-light .layout-view-tabs a:hover { background: rgba(37, 99, 235, 0.1); }
.layout-view-tabs a.is-active {
    background: rgba(37, 99, 235, 0.28);
    color: var(--ink);
}
.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(220px, 1fr));
    gap: .85rem;
    margin-bottom: 1.25rem;
    overflow-x: auto;
    align-items: stretch;
}
.kanban-column {
    min-width: 240px;
    max-height: min(72vh, 820px);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    padding: 0.55rem;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.kanban-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .65rem; flex-shrink: 0; }
.kanban-head h2 { margin: 0; font-size: var(--fs-sm); font-weight: 700; }
.kanban-head span {
    display: inline-grid; place-items: center;
    min-width: 26px; height: 26px;
    border-radius: 999px; background: var(--panel-2); color: var(--muted); font-weight: 700; font-size: var(--fs-xs);
}
.kanban-lane {
    display: grid;
    gap: .65rem;
    align-content: start;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: .2rem;
    margin-right: -.2rem;
}
.kanban-card {
    display: grid;
    gap: .35rem;
    border: 1px solid var(--line);
    border-left: 3px solid var(--brand);
    border-radius: var(--radius-md);
    background: var(--panel);
    padding: 0.55rem 0.65rem;
    box-shadow: var(--shadow-card);
    transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.kanban-card:hover {
    transform: translateY(-2px);
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 18px 44px rgba(37, 99, 235, 0.12);
}
.kanban-card.is-late { border-left-color: var(--danger); }
.kanban-card-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.kanban-meta { display: flex; justify-content: space-between; gap: .75rem; font-size: var(--fs-xs); color: var(--muted); }
.progress-line { height: 5px; overflow: hidden; border-radius: 999px; background: var(--progress-track); }
.progress-line i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--success)); }
.kanban-empty { min-height: 64px; display: grid; place-items: center; border: 1px dashed var(--line); border-radius: var(--radius-sm); font-size: var(--fs-sm); color: var(--muted); }
.kanban-column--final {
    border-color: rgba(37, 99, 235, 0.28);
    background: linear-gradient(165deg, var(--bg-elevated), rgba(37, 99, 235, 0.06));
}
.kanban-final-panel {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    align-items: flex-start;
    justify-content: center;
    min-height: 120px;
}
.kanban-final-lead { margin: 0; font-size: var(--fs-sm); color: var(--muted); line-height: 1.45; }
.kanban-final-count { margin: 0; font-size: var(--fs-md); }
.kanban-final-count strong { font-size: 1.35rem; letter-spacing: -0.02em; }
.kanban-final-link { align-self: stretch; justify-content: center; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: .75rem; }
.section-head h2 { margin: 0; }
.data-panel { overflow: auto; }
.table-modern td strong, .table-modern td span { display: block; }
.is-overdue-row td {
    background: rgba(239, 68, 68, 0.08);
    border-bottom-color: rgba(239, 68, 68, 0.22);
}
.layout-cell {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-width: 220px;
}
.table-cell-rich {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    min-width: 0;
}
.table-cell-icon {
    flex: 0 0 auto;
    width: 2.35rem;
    height: 2.35rem;
    display: grid;
    place-items: center;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: var(--panel-2);
    color: var(--brand);
}
.table-cell-icon--project {
    background: rgba(37, 99, 235, 0.12);
    border-color: rgba(37, 99, 235, 0.28);
}
.table-cell-icon--client {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.28);
    color: #6ee7b7;
}
.table-cell-icon--layout {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.28);
    color: #fcd34d;
}
html.theme-light .table-cell-icon--client { color: #047857; }
html.theme-light .table-cell-icon--layout { color: #92400e; }
.table-stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: var(--fs-xs);
    background: rgba(37, 99, 235, 0.14);
    border: 1px solid rgba(37, 99, 235, 0.25);
    color: var(--ink);
}
.table-modern tbody tr:nth-child(even) td {
    background: rgba(15, 23, 42, 0.25);
}
html.theme-light .table-modern tbody tr:nth-child(even) td {
    background: rgba(248, 250, 252, 0.9);
}
.status-cell-tight {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}
.status-cell-tight .status-dot {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px;
    background: var(--brand);
    flex-shrink: 0;
}
.status-cell-tight:has(.status-draft) .status-dot { background: #94a3b8; }
.status-cell-tight:has(.status-mapping) .status-dot,
.status-cell-tight:has(.status-active) .status-dot { background: #34d399; }
.status-cell-tight:has(.status-review) .status-dot,
.status-cell-tight:has(.status-pending-validation) .status-dot { background: #fbbf24; }
.status-cell-tight:has(.status-published) .status-dot,
.status-cell-tight:has(.status-complete) .status-dot,
.status-cell-tight:has(.status-completed) .status-dot,
.status-cell-tight:has(.status-final) .status-dot { background: #60a5fa; }
.status-cell-tight:has(.status-archived) .status-dot { background: #9ca3af; }
.status-cell-tight:has(.status-on-hold) .status-dot { background: #f59e0b; }
html.theme-light .status-cell-tight:has(.status-draft) .status-dot { background: #64748b; }
html.theme-light .status-cell-tight:has(.status-mapping) .status-dot,
html.theme-light .status-cell-tight:has(.status-active) .status-dot { background: #059669; }
html.theme-light .status-cell-tight:has(.status-review) .status-dot { background: #d97706; }
html.theme-light .status-cell-tight:has(.status-published) .status-dot,
html.theme-light .status-cell-tight:has(.status-complete) .status-dot,
html.theme-light .status-cell-tight:has(.status-final) .status-dot { background: #2563eb; }
.layout-thumb {
    width: 52px;
    height: 38px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--muted);
}
.layout-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.priority-low { background: rgba(59, 130, 246, 0.2); color: #bfdbfe; border-color: rgba(59, 130, 246, 0.35); }
.priority-normal { background: rgba(16, 185, 129, 0.16); color: #a7f3d0; border-color: rgba(16, 185, 129, 0.3); }
.priority-high { background: rgba(245, 158, 11, 0.18); color: #fde68a; border-color: rgba(245, 158, 11, 0.35); }
.priority-urgent { background: rgba(239, 68, 68, 0.18); color: #fecaca; border-color: rgba(239, 68, 68, 0.35); }
.badge-danger {
    background: rgba(239, 68, 68, 0.18);
    color: #fecaca;
    border-color: rgba(239, 68, 68, 0.4);
}
.status-badge, .status-card { border-color: var(--line); }
.status-active, .status-mapping, .status-card--active, .status-card--mapping {
    background: rgba(16, 185, 129, 0.16);
    color: #a7f3d0;
    border-color: rgba(16, 185, 129, 0.35);
}
.status-draft, .status-card--draft {
    background: rgba(148, 163, 184, 0.13);
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.28);
}
.status-review, .status-pending-validation, .status-card--review, .status-card--pending-validation {
    background: rgba(245, 158, 11, 0.16);
    color: #fde68a;
    border-color: rgba(245, 158, 11, 0.35);
}
.status-published, .status-completed, .status-complete, .status-final, .status-card--published, .status-card--completed, .status-card--complete, .status-card--final {
    background: rgba(37, 99, 235, 0.18);
    color: #bfdbfe;
    border-color: rgba(37, 99, 235, 0.35);
}
.status-on-hold, .status-card--on-hold {
    background: rgba(245, 158, 11, 0.14);
    color: #fcd34d;
    border-color: rgba(245, 158, 11, 0.35);
}
.status-archived, .status-card--archived {
    background: rgba(107, 114, 128, 0.16);
    color: #d1d5db;
    border-color: rgba(107, 114, 128, 0.35);
}
html.theme-light .priority-low { color: #1e40af; background: rgba(59, 130, 246, 0.12); }
html.theme-light .priority-normal { color: #047857; background: rgba(16, 185, 129, 0.12); }
html.theme-light .priority-high { color: #92400e; background: rgba(245, 158, 11, 0.14); }
html.theme-light .priority-urgent { color: #991b1b; background: rgba(239, 68, 68, 0.1); }
html.theme-light .badge-danger { color: #991b1b; background: rgba(239, 68, 68, 0.1); }
html.theme-light .status-active,
html.theme-light .status-mapping,
html.theme-light .status-card--active,
html.theme-light .status-card--mapping { color: #047857; background: rgba(16, 185, 129, 0.12); }
html.theme-light .status-draft,
html.theme-light .status-card--draft { color: #475569; background: rgba(100, 116, 139, 0.12); }
html.theme-light .status-review,
html.theme-light .status-pending-validation,
html.theme-light .status-card--review,
html.theme-light .status-card--pending-validation { color: #92400e; background: rgba(245, 158, 11, 0.14); }
html.theme-light .status-published,
html.theme-light .status-completed,
html.theme-light .status-complete,
html.theme-light .status-final,
html.theme-light .status-card--published,
html.theme-light .status-card--completed,
html.theme-light .status-card--complete,
html.theme-light .status-card--final { color: #1e40af; background: rgba(37, 99, 235, 0.1); }
html.theme-light .status-on-hold,
html.theme-light .status-card--on-hold { color: #92400e; background: rgba(245, 158, 11, 0.12); }
html.theme-light .status-archived,
html.theme-light .status-card--archived { color: #475569; background: rgba(100, 116, 139, 0.12); }
html.theme-light .status-card small { opacity: 0.9; }
.status-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: .75rem;
    margin-bottom: 1rem;
}
.status-card-grid--wide { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.status-card {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-lg);
    border-width: 1px;
    border-style: solid;
    background-color: var(--panel);
    box-shadow: var(--shadow-card);
    transition: transform .14s ease, border-color .14s ease;
}
.status-card:hover { transform: translateY(-1px); border-color: rgba(37, 99, 235, 0.25); }
.status-card-icon {
    width: 2rem;
    height: 2rem;
    display: grid;
    place-items: center;
    border-radius: var(--radius-md);
    background: var(--panel-2);
}
.status-card strong { display: block; font-size: 1.1rem; line-height: 1; font-weight: 700; }
.status-card small { display: block; margin-top: .2rem; color: currentColor; opacity: .82; font-weight: 700; }
.status-card--active, .status-card--mapping { background-color: rgba(16, 185, 129, 0.16); }
.status-card--draft { background-color: rgba(148, 163, 184, 0.13); }
.status-card--review, .status-card--pending-validation { background-color: rgba(245, 158, 11, 0.16); }
.status-card--published, .status-card--completed, .status-card--complete, .status-card--final { background-color: rgba(37, 99, 235, 0.18); }
.status-card--on-hold { background-color: rgba(245, 158, 11, 0.14); }
.status-card--archived { background-color: rgba(107, 114, 128, 0.16); }
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.75rem;
}
.entity-card {
    display: grid;
    gap: 0.55rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--panel);
    box-shadow: var(--shadow-card);
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.entity-card--ops:hover {
    transform: translateY(-3px);
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 22px 60px rgba(37, 99, 235, 0.14);
}
.entity-card h2 { margin: 0; }
.entity-card-top { display: flex; justify-content: space-between; align-items: center; }
.avatar {
    width: 34px; height: 34px; border-radius: var(--radius-sm); display: grid; place-items: center;
    background: linear-gradient(135deg, var(--panel-2), var(--bg-deep)); color: var(--ink); font-weight: 700;
    border: 1px solid var(--line);
}
html.theme-light .avatar {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    color: var(--ink);
}
.entity-meta { display: grid; gap: .2rem; color: var(--muted); font-size: var(--fs-sm); }
.empty-state { padding: 1.5rem; color: var(--muted); }
.mapped-list { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .65rem; max-height: 130px; overflow: auto; }
.mapped-chip {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel-2);
    color: var(--ink);
    padding: .2rem .45rem;
    cursor: pointer;
    font-size: var(--fs-xs);
}
html.theme-light .mapped-chip { background: var(--panel-2); color: var(--ink); }
@media (max-width: 980px) {
    .filter-bar { grid-template-columns: 1fr; }
    .kanban-board { grid-template-columns: repeat(4, minmax(240px, 1fr)); }
    .page-head--stack { align-items: flex-start; }
}

/* --- Ops shell (mapping OS chrome) --- */
.ops-html { scroll-behavior: smooth; }
.ops-body { min-height: 100vh; }
.ops-shell {
    display: grid;
    grid-template-columns: 11.5rem minmax(0, 1fr);
    min-height: 100vh;
}
.ops-rail {
    background: var(--panel);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: .65rem .45rem;
    backdrop-filter: blur(18px);
}
.ops-rail-brand {
    display: grid;
    place-items: center;
    padding: .35rem;
    margin-bottom: .75rem;
}
.ops-rail-brand img {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--line);
}
.ops-rail-nav {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    flex: 1;
}
.ops-rail-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .5rem .55rem;
    border-radius: 12px;
    color: var(--muted);
    border: 1px solid transparent;
    transition: background .14s ease, color .14s ease, border-color .14s ease;
    text-decoration: none;
    text-align: left;
}
.ops-rail-link:hover {
    background: rgba(37, 99, 235, 0.12);
    color: var(--ink);
}
.ops-rail-link.is-active {
    background: rgba(37, 99, 235, 0.16);
    border-color: rgba(37, 99, 235, 0.35);
    color: var(--ink);
}
.ops-rail-ico {
    font-size: .95rem;
    line-height: 1;
    opacity: .88;
    flex-shrink: 0;
    width: 1.25rem;
    text-align: center;
}
.ops-rail-text {
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.2;
    white-space: nowrap;
}
.ops-rail-link--btn {
    cursor: pointer;
    width: 100%;
    background: transparent;
    border: 1px dashed var(--line);
}

.staff-directory .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}
.inline-form {
    display: inline;
    margin: 0;
}
.staff-devices-row td {
    padding-top: 0;
    border-top: 0;
    background: var(--panel-2);
}
.staff-devices-details {
    margin: 0 0 0.65rem;
    padding: 0 0 0.35rem;
}
.staff-devices-summary {
    cursor: pointer;
    font-size: var(--fs-sm);
    user-select: none;
}
.staff-devices-empty {
    margin: 0.35rem 0 0;
    font-size: var(--fs-sm);
}
.staff-device-list {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.staff-device-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: var(--fs-sm);
}
.ops-main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}
.ops-topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 420px) auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1rem;
    border-bottom: 1px solid var(--line);
    background: var(--glass);
    backdrop-filter: blur(16px);
}
.ops-product-line {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .15rem;
}
.ops-product-name {
    font-weight: 700;
    letter-spacing: -0.02em;
    font-size: var(--fs-sm);
}
.ops-product-sub {
    font-size: var(--fs-xs);
    color: var(--muted);
    font-weight: 600;
}
.ops-cmd-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: .45rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--input-bg);
    color: var(--muted);
    cursor: pointer;
    transition: border-color .14s ease, box-shadow .14s ease;
}
.ops-cmd-trigger:hover {
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.ops-cmd-placeholder { font-size: var(--fs-sm); }
.ops-kbd {
    font-size: var(--fs-xs);
    padding: .12rem .35rem;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: var(--panel-2);
    color: var(--muted);
}
.ops-topbar-right {
    display: flex;
    align-items: center;
    gap: .65rem;
}
.ops-user-chip {
    font-size: var(--fs-sm);
    font-weight: 600;
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ops-role-pill {
    font-size: .68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: .28rem .55rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--muted);
}
.ops-content {
    flex: 1;
    padding: 1rem 1.25rem 1.75rem;
    font-size: var(--fs-body);
}
.ops-footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.65rem 1.25rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: var(--fs-xs);
    background: var(--bg-elevated);
}
.ops-toast {
    margin-bottom: 1rem;
    padding: .85rem 1rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: .9rem;
}
.ops-toast--ok {
    background: rgba(16, 185, 129, 0.14);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #ecfdf5;
}
.ops-toast--err {
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.38);
    color: #fef2f2;
}
.ops-eyebrow {
    color: var(--brand);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: .72rem;
    margin: 0 0 .35rem;
}
.ops-guest-main {
    min-height: 100vh;
}
.login-split {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
    min-height: 100vh;
}
.login-split--narrow {
    grid-template-columns: 1fr;
    place-items: center;
    padding: 2rem;
}
.login-hero {
    position: relative;
    overflow: hidden;
    border-right: 1px solid var(--line);
}
.login-mesh {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}
.login-wireframe path {
    stroke-dasharray: 520;
    stroke-dashoffset: 520;
    animation: login-wire 14s ease-in-out infinite alternate;
}
@keyframes login-wire {
    to { stroke-dashoffset: 0; }
}
.login-float-node circle {
    animation: login-float 9s ease-in-out infinite;
}
.login-float-node circle:nth-child(2) { animation-delay: -3s; }
.login-float-node circle:nth-child(3) { animation-delay: -5s; }
@keyframes login-float {
    0%, 100% { transform: translateY(0); opacity: .45; }
    50% { transform: translateY(-14px); opacity: .95; }
}
.login-hero-copy {
    position: relative;
    z-index: 2;
    padding: 3rem 2.5rem;
    max-width: 28rem;
}
.login-brand-logo {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    margin-bottom: 1rem;
    border: 1px solid rgba(255,255,255,.1);
}
.login-brand-kicker { margin-bottom: .75rem; }
.login-hero-title {
    margin: 0 0 .75rem;
    font-size: clamp(1.75rem, 3vw, 2.35rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
}
.login-hero-muted { color: var(--muted); font-weight: 700; }
.login-hero-lead {
    margin: 0;
    font-size: .95rem;
    color: var(--muted);
    line-height: 1.55;
}
.login-aside {
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: radial-gradient(700px 420px at 80% 10%, rgba(37, 99, 235, 0.08), transparent),
        var(--bg-elevated);
}
.login-glass {
    width: min(400px, 100%);
    padding: 1.5rem 1.65rem 1.65rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background: var(--glass);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(22px);
}
.login-title {
    margin: .3rem 0 .3rem;
    font-size: var(--fs-xl);
    font-weight: 700;
    letter-spacing: -0.02em;
}
.login-lead {
    margin: 0;
    font-size: var(--fs-sm);
    line-height: 1.45;
}
.login-flash-ok {
    margin: 1rem 0 0;
    padding: .65rem .85rem;
    border-radius: 12px;
    border: 1px solid rgba(34, 197, 94, 0.35);
    background: rgba(34, 197, 94, 0.1);
    color: #bbf7d0;
    font-size: .88rem;
    line-height: 1.45;
}
.ops-form {
    display: grid;
    gap: 1rem;
}
.ops-float-field {
    position: relative;
    display: block;
}
.ops-float-field input, .ops-float-field select {
    width: 100%;
    padding: 1rem .85rem .55rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(9, 9, 11, 0.55);
    color: var(--ink);
}
.ops-float-field span {
    position: absolute;
    left: .85rem;
    top: .42rem;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    pointer-events: none;
}
.ops-check {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    font-size: .82rem;
    color: var(--muted);
    cursor: pointer;
}
.ops-check input {
    margin-top: .15rem;
    accent-color: var(--brand);
}
.btn-primary-ops {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    border: 0;
    border-radius: 10px;
    padding: .72rem 1rem;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: white;
    font-weight: 700;
    cursor: pointer;
    margin-top: .25rem;
    transition: filter .14s ease, box-shadow .14s ease;
}
.btn-primary-ops:hover {
    filter: brightness(1.06);
    box-shadow: 0 12px 36px rgba(37, 99, 235, 0.28);
}
.btn-secondary-ops {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: .72rem 1rem;
    background: var(--panel-2);
    color: var(--ink);
    font-weight: 700;
    cursor: pointer;
}
.btn-secondary-ops:hover {
    filter: brightness(1.08);
}
.btn-danger-ops {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    border: 0;
    border-radius: 10px;
    padding: .72rem 1rem;
    background: var(--danger);
    color: white;
    font-weight: 700;
    cursor: pointer;
}
.btn-sm {
    padding: .38rem 0.65rem;
    font-size: var(--fs-xs);
}
.ops-cmd-overlay {
    position: fixed;
    inset: 0;
    z-index: 4000;
}
.ops-cmd-overlay[hidden] { display: none; }
.ops-cmd-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(10px);
}
.ops-cmd-dialog {
    position: absolute;
    left: 50%;
    top: 18%;
    transform: translateX(-50%);
    width: min(520px, 94vw);
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: .65rem 0.75rem 0.85rem;
}
.ops-cmd-input {
    width: 100%;
    padding: .5rem 0.65rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: var(--input-bg);
    color: var(--ink);
    font-size: var(--fs-sm);
}
.ops-cmd-list {
    list-style: none;
    margin: .65rem 0 0;
    padding: 0;
    max-height: 320px;
    overflow: auto;
}
.ops-cmd-item {
    display: block;
    padding: .55rem .65rem;
    border-radius: 10px;
    color: var(--ink);
    font-weight: 600;
}
.ops-cmd-item:hover {
    background: rgba(37, 99, 235, 0.14);
}
.ops-cmd-empty {
    padding: .65rem;
    color: var(--muted);
    font-size: var(--fs-sm);
}
.unit-coverage-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 14px;
    margin-bottom: 1.25rem;
    border: 1px solid var(--line);
}
.unit-coverage--complete {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.38);
}
.unit-coverage--partial {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.38);
}
.unit-coverage--missing {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.38);
}
.unit-coverage-label {
    margin: 0;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}
.unit-coverage-value {
    margin: .25rem 0 0;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}
.unit-coverage-sub {
    margin: .35rem 0 0;
    font-size: .85rem;
    color: var(--muted);
}
.unit-coverage-pill {
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: .35rem .65rem;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.12);
}
.wizard-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .65rem;
    list-style: none;
    margin: 0 0 1.25rem;
    padding: 0;
}
.wizard-step {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .55rem .65rem;
    border-radius: 12px;
    border: 1px dashed rgba(255,255,255,.12);
    color: var(--muted);
    font-size: .82rem;
    font-weight: 700;
}
.wizard-step.is-active {
    border-style: solid;
    border-color: rgba(37, 99, 235, 0.45);
    color: var(--ink);
    background: rgba(37, 99, 235, 0.1);
}
.wizard-step-num {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.18);
    font-size: .78rem;
}
.wizard-divider {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 1.25rem 0;
}
.ops-panel--accent {
    border-color: rgba(37, 99, 235, 0.35);
}
.recovery-code-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: .5rem;
    margin: .85rem 0 0;
    padding: 0;
    list-style: none;
}
.recovery-code-grid code {
    display: block;
    padding: .45rem .55rem;
    border-radius: 8px;
    background: rgba(9, 9, 11, 0.65);
    border: 1px solid var(--line);
    font-size: .82rem;
}
.mfa-qr svg {
    width: 220px;
    height: 220px;
    border-radius: 12px;
    border: 1px solid var(--line);
    padding: .5rem;
    background: white;
}
.table-ops tbody tr:hover {
    background: rgba(37, 99, 235, 0.06);
}
.badge-ops-muted {
    background: rgba(255,255,255,.06);
    color: var(--muted);
    border-color: rgba(255,255,255,.08);
}
.badge-ops-accent {
    background: rgba(124, 58, 237, 0.18);
    color: #ede9fe;
    border-color: rgba(124, 58, 237, 0.35);
}
.badge-ops-ok {
    background: rgba(16, 185, 129, 0.18);
    color: #d1fae5;
}
.h2-sm {
    margin: 0 0 .3rem;
    font-size: var(--fs-lg);
    font-weight: 700;
}
@media (max-width: 960px) {
    .login-split {
        grid-template-columns: 1fr;
    }
    .login-hero {
        min-height: 42vh;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
    .ops-shell {
        grid-template-columns: 1fr;
    }
    .ops-rail {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: .5rem .75rem;
    }
    .ops-rail-nav {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    .ops-rail-foot {
        flex-shrink: 0;
    }
    .ops-content {
        padding: 1rem;
    }
    .ops-topbar {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .ops-rail-text {
        display: none;
    }
    .ops-rail-link {
        justify-content: center;
        padding: .55rem .4rem;
    }
    .ops-rail-ico {
        width: auto;
    }
    .ops-rail-link--btn .ops-rail-text {
        display: none;
    }
}

/* --- Light theme: ops shell, auth, shared chrome (class on html) --- */
html.theme-light .ops-rail {
    background: rgba(248, 250, 252, 0.98);
    border-right-color: var(--line);
}
html.theme-light .ops-rail-brand img {
    border-color: var(--line);
}
html.theme-light .ops-rail-link--btn {
    border-color: rgba(15, 23, 42, 0.14);
}
html.theme-light .ops-main {
    background: var(--app-body-bg);
}
html.theme-light .ops-topbar {
    background: rgba(255, 255, 255, 0.92);
    border-bottom-color: var(--line);
}
html.theme-light .ops-footer {
    background: rgba(248, 250, 252, 0.95);
    border-top-color: var(--line);
}
html.theme-light .ops-cmd-trigger {
    background: #ffffff;
    border-color: var(--line);
    color: var(--muted);
}
html.theme-light .ops-kbd {
    background: #f1f5f9;
    border-color: var(--line);
    color: var(--muted);
}
html.theme-light .ops-role-pill {
    border-color: var(--line);
}
html.theme-light .ops-toast--ok {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(5, 150, 105, 0.35);
    color: #065f46;
}
html.theme-light .ops-toast--err {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(220, 38, 38, 0.35);
    color: #991b1b;
}
html.theme-light .login-aside {
    background: radial-gradient(700px 420px at 80% 10%, rgba(37, 99, 235, 0.06), transparent), #f8fafc;
}
html.theme-light .login-glass {
    background: rgba(255, 255, 255, 0.94);
    border-color: var(--line);
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.08);
}
html.theme-light .login-hero {
    border-right-color: var(--line);
}
html.theme-light .login-flash-ok {
    color: #166534;
    border-color: rgba(34, 197, 94, 0.4);
    background: rgba(34, 197, 94, 0.08);
}
html.theme-light .ops-float-field input,
html.theme-light .ops-float-field select {
    background: #ffffff;
    color: var(--ink);
    border-color: var(--line);
}
html.theme-light .ops-cmd-backdrop {
    background: rgba(15, 23, 42, 0.4);
}
html.theme-light .ops-cmd-dialog {
    background: #ffffff;
    border-color: var(--line);
    box-shadow: 0 32px 90px rgba(15, 23, 42, 0.12);
}
html.theme-light .ops-cmd-input {
    background: #f8fafc;
    color: var(--ink);
    border-color: var(--line);
}
html.theme-light .ops-cmd-item:hover {
    background: rgba(37, 99, 235, 0.08);
}
html.theme-light .ops-cmd-empty {
    color: var(--muted);
}
html.theme-light .form.panel,
html.theme-light .form.ops-panel {
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--line);
}
html.theme-light .advanced-disclosure--form {
    background: #f8fafc;
    border-color: var(--line);
}
html.theme-light .staff-devices-row td {
    background: rgba(241, 245, 249, 0.9);
}
html.theme-light .recovery-code-grid code {
    background: #f8fafc;
    color: var(--ink);
    border-color: var(--line);
}
html.theme-light .wizard-step {
    border-color: rgba(15, 23, 42, 0.12);
    color: var(--muted);
}
html.theme-light .wizard-step.is-active {
    background: rgba(37, 99, 235, 0.08);
    color: var(--ink);
}
html.theme-light .badge-ops-muted {
    background: rgba(15, 23, 42, 0.06);
    color: var(--muted);
    border-color: rgba(15, 23, 42, 0.1);
}
html.theme-light .badge-ops-accent {
    color: #5b21b6;
    border-color: rgba(124, 58, 237, 0.35);
}
html.theme-light .badge-ops-ok {
    color: #047857;
}
html.theme-light .unit-coverage-pill {
    border-color: rgba(15, 23, 42, 0.12);
}
html.theme-light .btn.secondary {
    background: #ffffff;
    color: var(--ink);
    border: 1px solid var(--line);
}
html.theme-light .btn.secondary:hover {
    filter: none;
    background: #f8fafc;
}
.ops-theme-fab {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 60;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(17, 17, 19, 0.85);
    color: var(--ink);
    cursor: pointer;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(12px);
}
html.theme-light .ops-theme-fab {
    background: #ffffff;
    color: #0f172a;
    border-color: var(--line);
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.1);
}
.ops-theme-fab .ui-icon {
    width: 1.25rem;
    height: 1.25rem;
}

html.theme-light .preview-btn--primary {
    color: #1e40af;
    background: rgba(37, 99, 235, 0.12);
}
html.theme-light .preview-btn.is-active {
    color: #065f46;
    background: rgba(16, 185, 129, 0.1);
}
html.theme-light .layout-preview-kpi-pct {
    color: #15803d;
}

/* --- Layout preview (compact workspace) --- */
body:has(.layout-preview-page) {
    background-color: var(--bg-deep);
    background-image: none;
}
html.theme-light body:has(.layout-preview-page) {
    background-color: var(--app-body-bg);
}
.layout-preview-page {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: calc(100vh - 6rem);
}
.layout-preview-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--line);
}
.layout-preview-eyebrow {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
}
.layout-preview-title {
    margin: 0.15rem 0 0;
    font-size: var(--fs-xl);
    font-weight: 700;
    line-height: 1.2;
}
.layout-preview-project {
    margin: 0.25rem 0 0;
    font-size: 0.88rem;
    font-weight: 600;
}
.layout-preview-meta {
    margin: 0.2rem 0 0;
    font-size: 0.82rem;
}
.layout-preview-head-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.preview-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.7rem;
    border-radius: var(--radius-md);
    font-size: var(--fs-sm);
    font-weight: 600;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
    cursor: pointer;
    text-decoration: none;
}
.preview-btn-ico {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.preview-btn--ghost {
    background: var(--panel-2);
}
.preview-btn--primary {
    border-color: rgba(37, 99, 235, 0.45);
    background: rgba(37, 99, 235, 0.22);
    color: #e0e7ff;
}
.preview-btn--solid {
    background: rgba(37, 99, 235, 0.35);
    border-color: rgba(37, 99, 235, 0.5);
    color: #fff;
}
.preview-btn--sm {
    padding: 0.35rem 0.55rem;
    font-size: 0.78rem;
}
.preview-btn--block {
    width: 100%;
    justify-content: flex-start;
}
.preview-btn.is-active {
    border-color: rgba(16, 185, 129, 0.55);
    background: rgba(16, 185, 129, 0.15);
    color: #d1fae5;
}
.layout-preview-workspace {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(200px, 240px) minmax(0, 1fr);
    gap: 0.75rem;
    min-height: 0;
}
.layout-preview-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    align-self: stretch;
}
.layout-preview-kpi {
    padding: 0.5rem 0.55rem;
    border-radius: var(--radius-md);
    background: var(--panel-2);
    border: 1px solid var(--line);
}
.layout-preview-kpi-label {
    margin: 0;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}
.layout-preview-kpi-value {
    margin: 0.25rem 0 0;
    font-size: 0.95rem;
}
.layout-preview-kpi-pct {
    margin-left: 0.35rem;
    font-weight: 800;
    color: #86efac;
}
.layout-preview-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.layout-preview-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--muted);
}
.layout-preview-inline {
    display: flex;
    gap: 0.35rem;
    align-items: stretch;
}
.layout-preview-inline input {
    flex: 1;
    min-width: 0;
    padding: 0.4rem 0.55rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--input-bg);
    color: var(--ink);
}
.layout-preview-details summary {
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--muted);
}
.layout-preview-details textarea {
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.45rem 0.55rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--input-bg);
    color: var(--ink);
    font-family: ui-monospace, monospace;
    font-size: var(--fs-xs);
    resize: vertical;
}
.layout-preview-hint {
    margin: 0;
    font-size: 0.72rem;
}
.layout-preview-canvas {
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.layout-preview-canvas .preview-wrap {
    flex: 1;
    min-height: 360px;
    height: 100%;
    max-height: none;
    border-radius: 12px;
    background: #f1f5f9;
    border: 1px solid var(--line);
}
.preview-wrap svg .plot.plot--marked {
    fill: rgba(16, 185, 129, 0.2);
    stroke: #34d399;
    stroke-width: 2px;
}
.wizard-section-label {
    margin: 0 0 0.75rem;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
}
.field-label-like {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
    color: var(--ink);
}
.current-plan-asset .current-plan-links {
    margin: 0;
    font-size: 0.88rem;
}
.current-plan-asset .current-plan-links a {
    color: var(--brand);
    text-decoration: underline;
}
@media (max-width: 900px) {
    .layout-preview-workspace {
        grid-template-columns: 1fr;
    }
    .layout-preview-canvas .preview-wrap {
        min-height: 52vh;
    }
}
