/* Novena Hub admin portal. Brand tokens follow novena.hr: Epilogue, Novena blue #0077DD, navy #0054A2 / #00284D, cyan #1D9FC8. */

@font-face { font-family: "Epilogue"; font-style: normal; font-weight: 400 800; font-display: swap; src: url("fonts/epilogue-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Epilogue"; font-style: normal; font-weight: 400 800; font-display: swap; src: url("fonts/epilogue-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/poppins-600-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/poppins-600-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---------- Tokens ---------- */

:root {
    color-scheme: light;

    --brand-950: #001d38;
    --brand-900: #00284d;
    --brand-800: #003565;
    --brand-700: #0054a2;
    --accent: #0077dd;
    --accent-hover: #0066c0;
    --accent-soft: #e6f1fc;
    --cyan: #1d9fc8;
    --cyan-light: #5aaed7;

    --ground: #f3f6fa;
    --ground-glow: #e5effa;
    --surface: #ffffff;
    --surface-2: #f7f9fc;
    --surface-hover: #f4f8fd;
    --selected: #eaf3fd;
    --ink: #1b2433;
    --ink-strong: #00284d;
    --muted: #5b6678;
    --faint: #8a94a6;
    --line: #e1e7f0;
    --line-strong: #c9d3e1;

    --ok: #0e6b43;
    --ok-dot: #18a058;
    --ok-bg: #e4f5ec;
    --warn: #8a5a00;
    --warn-dot: #e0a100;
    --warn-bg: #fff4db;
    --bad: #b42318;
    --bad-dot: #d93025;
    --bad-bg: #fdecea;
    --info: #0058a8;
    --info-dot: #0077dd;
    --info-bg: #e6f1fc;
    --neutral-bg: #eef1f6;

    --sidebar-bg: #00284d;
    --sidebar-ink: #b9cce3;
    --sidebar-ink-strong: #ffffff;
    --sidebar-muted: #7d9cc2;
    --sidebar-hover: rgba(255, 255, 255, 0.07);
    --sidebar-line: rgba(255, 255, 255, 0.1);
    --sidebar-dots: rgba(255, 255, 255, 0.06);

    --code-bg: #0e1a2b;
    --code-ink: #dbe5f3;

    --focus-ring: 0 0 0 3px rgba(0, 119, 221, 0.35);
    --shadow-sm: 0 1px 2px rgba(0, 40, 77, 0.06);
    --shadow-md: 0 1px 2px rgba(0, 40, 77, 0.06), 0 8px 24px -12px rgba(0, 40, 77, 0.18);
    --radius: 8px;
    --radius-lg: 12px;

    --font: "Epilogue", "Segoe UI", system-ui, -apple-system, sans-serif;
    --font-accent: "Poppins", "Epilogue", "Segoe UI", sans-serif;
    --font-mono: "Cascadia Mono", Consolas, ui-monospace, monospace;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --accent: #3d9bf0;
        --accent-hover: #62b0f5;
        --accent-soft: #11304f;
        --ground: #0a1522;
        --ground-glow: #0e2238;
        --surface: #111f31;
        --surface-2: #0e1b2b;
        --surface-hover: #15273d;
        --selected: #15304e;
        --ink: #dfe7f2;
        --ink-strong: #ffffff;
        --muted: #93a2b8;
        --faint: #6b7b92;
        --line: #1f324a;
        --line-strong: #2d4562;
        --ok: #6fd6a0;
        --ok-dot: #2fbf71;
        --ok-bg: #0f2e22;
        --warn: #f2c360;
        --warn-dot: #e0a100;
        --warn-bg: #33270b;
        --bad: #ff9a8f;
        --bad-dot: #f0544a;
        --bad-bg: #3a1614;
        --info: #8cc5fa;
        --info-dot: #3d9bf0;
        --info-bg: #11304f;
        --neutral-bg: #1a2a3f;
        --sidebar-bg: #061220;
        --sidebar-line: rgba(255, 255, 255, 0.07);
        --code-bg: #07101c;
        --focus-ring: 0 0 0 3px rgba(61, 155, 240, 0.45);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px -14px rgba(0, 0, 0, 0.6);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --accent: #3d9bf0;
    --accent-hover: #62b0f5;
    --accent-soft: #11304f;
    --ground: #0a1522;
    --ground-glow: #0e2238;
    --surface: #111f31;
    --surface-2: #0e1b2b;
    --surface-hover: #15273d;
    --selected: #15304e;
    --ink: #dfe7f2;
    --ink-strong: #ffffff;
    --muted: #93a2b8;
    --faint: #6b7b92;
    --line: #1f324a;
    --line-strong: #2d4562;
    --ok: #6fd6a0;
    --ok-dot: #2fbf71;
    --ok-bg: #0f2e22;
    --warn: #f2c360;
    --warn-dot: #e0a100;
    --warn-bg: #33270b;
    --bad: #ff9a8f;
    --bad-dot: #f0544a;
    --bad-bg: #3a1614;
    --info: #8cc5fa;
    --info-dot: #3d9bf0;
    --info-bg: #11304f;
    --neutral-bg: #1a2a3f;
    --sidebar-bg: #061220;
    --sidebar-line: rgba(255, 255, 255, 0.07);
    --code-bg: #07101c;
    --focus-ring: 0 0 0 3px rgba(61, 155, 240, 0.45);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px -14px rgba(0, 0, 0, 0.6);
}

/* ---------- Base ---------- */

* { box-sizing: border-box; }
html { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--ground); -webkit-font-smoothing: antialiased; }
body { margin: 0; background: var(--ground); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1 { font-size: 26px; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; color: var(--ink-strong); margin: 0; }
h2 { font-size: 15px; font-weight: 700; color: var(--ink-strong); margin: 0 0 12px; }
h3 { font-size: 13px; font-weight: 700; color: var(--ink-strong); margin: 20px 0 8px; }
p { margin: 0 0 10px; }
code { font-family: var(--font-mono); font-size: 12.5px; }
pre { font-family: var(--font-mono); font-size: 12.5px; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 6px; }
::selection { background: rgba(0, 119, 221, 0.22); }

.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; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; padding: 8px 14px; border-radius: var(--radius); background: var(--accent); color: #fff; font-weight: 600; }
.skip-link:focus { top: 12px; text-decoration: none; }

.icon { width: 18px; height: 18px; flex: none; vertical-align: -4px; }
.icon.sm { width: 15px; height: 15px; vertical-align: -3px; }
.icon.lg { width: 22px; height: 22px; }

/* ---------- Shell ---------- */

.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    display: flex; flex-direction: column; gap: 2px;
    padding: 18px 12px 14px;
    background-color: var(--sidebar-bg);
    background-image: radial-gradient(var(--sidebar-dots) 1px, transparent 1px), linear-gradient(180deg, transparent 60%, rgba(0, 84, 162, 0.35) 100%);
    background-size: 16px 16px, 100% 100%;
    color: var(--sidebar-ink);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; color: var(--sidebar-ink-strong); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand img { height: 22px; width: auto; display: block; }
.brand-product { display: block; font-family: var(--font-accent); font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cyan-light); margin-top: 3px; }

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { padding: 16px 12px 6px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--sidebar-muted); }
.sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: var(--radius); color: var(--sidebar-ink); font-weight: 500; transition: background-color 0.15s, color 0.15s; }
.sidebar nav a .icon { opacity: 0.85; }
.sidebar nav a:hover { background: var(--sidebar-hover); color: var(--sidebar-ink-strong); text-decoration: none; }
.sidebar nav a.active { background: var(--accent); color: #fff; box-shadow: 0 6px 16px -8px rgba(0, 119, 221, 0.9); }
.sidebar nav a.active .icon { opacity: 1; }

.account { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 14px 8px 0; border-top: 1px solid var(--sidebar-line); }
.avatar { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand-700), var(--cyan)); color: #fff; font-weight: 700; font-size: 12px; letter-spacing: 0.02em; text-transform: uppercase; }
.account-text { min-width: 0; flex: 1; }
.account-email { color: var(--sidebar-ink-strong); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-role { color: var(--sidebar-muted); font-size: 11.5px; }
.sidebar .icon-button { color: var(--sidebar-ink); }
.sidebar .icon-button:hover { background: var(--sidebar-hover); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 10px;
    min-height: 56px; padding: 8px 32px;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--line);
}
.topbar-title { font-weight: 600; color: var(--muted); margin-right: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-title strong { color: var(--ink-strong); }
.content { width: 100%; max-width: 1440px; padding: 28px 32px 56px; min-width: 0; }
.main::before { content: ""; position: absolute; inset: 0 0 auto 248px; height: 260px; background: linear-gradient(180deg, var(--ground-glow), transparent); pointer-events: none; z-index: -1; }
body { position: relative; isolation: isolate; }

.icon-button { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: var(--muted); cursor: pointer; }
.icon-button:hover:not(:disabled) { background: var(--surface-hover); color: var(--ink); border-color: var(--line); }
.theme-toggle .when-dark { display: none; }
:root[data-theme="dark"] .theme-toggle .when-dark { display: inline; }
:root[data-theme="dark"] .theme-toggle .when-light { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .when-dark { display: inline; }
    :root:not([data-theme="light"]) .theme-toggle .when-light { display: none; }
}

.nav-toggle-input { position: absolute; opacity: 0; pointer-events: none; }
.nav-toggle, .nav-backdrop { display: none; }

/* ---------- Page header ---------- */

.page-header { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.page-header-text { margin-right: auto; min-width: 0; }
.page-header .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.eyebrow { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.eyebrow a { color: inherit; }
.subtitle { color: var(--muted); margin: 6px 0 0; }
.page-header .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.section-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.section-header h2 { margin: 0 auto 0 0; display: flex; align-items: center; gap: 8px; }
.section-header h2 .icon { color: var(--accent); }
.crumbs { margin: 0 0 6px; color: var(--muted); }

.muted { color: var(--muted); }
.small-text { font-size: 12px; }
.nowrap { white-space: nowrap; }
.text-bad { color: var(--bad); font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.subline { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }

/* ---------- Surfaces ---------- */

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.panel > h2:first-child { display: flex; align-items: center; gap: 8px; }
.panel > h2 .icon { color: var(--accent); }
.panel summary { cursor: pointer; font-weight: 600; color: var(--ink-strong); list-style: none; display: flex; align-items: center; gap: 8px; }
.panel summary::-webkit-details-marker { display: none; }
.panel summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform 0.15s; margin-right: 2px; }
.panel[open] summary::before { transform: rotate(45deg); }
.panel[open] summary { margin-bottom: 10px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush > .section-header { padding: 16px 20px 0; }
.panel.flush > .table-wrap table { border-radius: 0; }
.panel.danger-zone { border-color: color-mix(in srgb, var(--bad-dot) 35%, var(--line)); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-2 > .panel { margin-bottom: 0; }
.grid-2 + * { margin-top: 18px; }

/* ---------- KPI tiles ---------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: transparent; }
.stat.ok::before { background: var(--ok-dot); }
.stat.warn::before { background: var(--warn-dot); }
.stat.bad::before { background: var(--bad-dot); }
.stat.info::before { background: var(--info-dot); }
.stat-top { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 500; }
.stat-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); margin-left: auto; }
.stat.ok .stat-icon { background: var(--ok-bg); color: var(--ok); }
.stat.warn .stat-icon { background: var(--warn-bg); color: var(--warn); }
.stat.bad .stat-icon { background: var(--bad-bg); color: var(--bad); }
.stat-value { font-family: var(--font-accent); font-size: 28px; font-weight: 600; line-height: 1.1; letter-spacing: -0.02em; color: var(--ink-strong); margin-top: 8px; font-variant-numeric: tabular-nums; }
.stat-value small { font-family: var(--font); font-size: 14px; font-weight: 500; color: var(--faint); letter-spacing: 0; margin-left: 4px; }
.stat.warn .stat-value { color: var(--warn); }
.stat.bad .stat-value { color: var(--bad); }
.stat-label { color: var(--muted); }
.stat-hint { color: var(--faint); font-size: 12px; margin-top: 4px; }
.meter { height: 6px; border-radius: 999px; background: var(--neutral-bg); overflow: hidden; margin-top: 10px; }
.meter > span { display: block; height: 100%; width: var(--value, 0%); border-radius: inherit; background: var(--accent); transition: width 0.4s ease; }
.meter.ok > span { background: var(--ok-dot); }
.meter.warn > span { background: var(--warn-dot); }
.meter.bad > span { background: var(--bad-dot); }

/* ---------- Facts ---------- */

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 20px; margin: 0 0 18px; box-shadow: var(--shadow-sm); }
.panel .facts { border: 0; box-shadow: none; padding: 0; margin: 0 0 14px; background: transparent; }
.facts dt { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.facts dd { margin: 3px 0 0; overflow-wrap: anywhere; color: var(--ink); }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.panel .table-wrap { border: 0; border-radius: 0; box-shadow: none; margin: 0 -20px; }
.panel .table-wrap th:first-child, .panel .table-wrap td:first-child { padding-left: 20px; }
.panel .table-wrap th:last-child, .panel .table-wrap td:last-child { padding-right: 20px; }
.panel.flush .table-wrap { margin: 12px 0 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }
th button.sort { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; border-radius: 4px; }
th button.sort:hover { color: var(--ink); }
th button.sort:focus-visible { box-shadow: var(--focus-ring); }
th button.sort .icon { opacity: 0.35; }
th[aria-sort] button.sort { color: var(--ink-strong); }
th[aria-sort] button.sort .icon { opacity: 1; color: var(--accent); }
tbody tr { transition: background-color 0.12s; }
tbody tr:hover { background: var(--surface-hover); }
tr.selected { background: var(--selected); }
td a { font-weight: 600; }
td.actions, th.actions { text-align: right; white-space: nowrap; }

/* ---------- Badges and chips ---------- */

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; line-height: 1.6; background: var(--neutral-bg); color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.55; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.ok::before { background: var(--ok-dot); opacity: 1; }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.warn::before { background: var(--warn-dot); opacity: 1; }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.bad::before { background: var(--bad-dot); opacity: 1; }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.info::before { background: var(--info-dot); opacity: 1; animation: pulse 1.6s ease-in-out infinite; }
.badge.plain::before { display: none; }
.badge.plain { padding-left: 10px; }
.badge.live::before { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; margin: 0 4px 4px 0; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; background: var(--surface-2); color: var(--ink); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-row .chip { margin: 0; }
:is(button, a).filter-chip { padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 500; }
:is(button, a).filter-chip[aria-pressed="true"] { background: var(--ink-strong); border-color: var(--ink-strong); color: var(--surface); }

.bar { display: inline-block; height: 8px; width: var(--size); min-width: 4px; background: linear-gradient(90deg, var(--bad-dot), color-mix(in srgb, var(--bad-dot) 60%, var(--warn-dot))); border-radius: 999px; vertical-align: middle; margin-right: 8px; }

/* ---------- Banners, empty states, skeletons ---------- */

.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid transparent; font-weight: 500; }
.banner.error { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad-dot) 25%, transparent); }
.banner.ok { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok-dot) 25%, transparent); }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 36px 16px; color: var(--muted); }
.empty-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); margin-bottom: 6px; }
.empty-title { font-weight: 700; color: var(--ink-strong); font-size: 15px; }
.empty p { margin: 0; max-width: 42ch; }
.empty.compact { padding: 18px 12px; flex-direction: row; justify-content: center; text-align: left; }
.empty.compact .empty-icon { width: 34px; height: 34px; border-radius: 10px; margin: 0 6px 0 0; }

.skeleton { position: relative; overflow: hidden; background: var(--neutral-bg); border-radius: 6px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 60%, transparent), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { 100% { transform: translateX(100%); } }
.skeleton-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.skeleton-stats .skeleton { height: 96px; border-radius: var(--radius-lg); }
.skeleton-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 20px; display: grid; gap: 14px; }
.skeleton-line { height: 12px; }
.skeleton-line.w40 { width: 40%; }
.skeleton-line.w70 { width: 70%; }
.skeleton-line.w90 { width: 90%; }

/* ---------- Activity feed ---------- */

.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.feed li { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--neutral-bg); color: var(--muted); }
.feed-icon.ok { background: var(--ok-bg); color: var(--ok); }
.feed-icon.warn { background: var(--warn-bg); color: var(--warn); }
.feed-icon.bad { background: var(--bad-bg); color: var(--bad); }
.feed-icon.info { background: var(--info-bg); color: var(--info); }
.feed-title { font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.feed-meta { color: var(--muted); font-size: 12px; }

/* ---------- Buttons ---------- */

button, .button { font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; line-height: 1.25; text-decoration: none; transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s; }
button:hover:not(:disabled), .button:hover { border-color: var(--faint); background: var(--surface-hover); text-decoration: none; }
button:disabled { opacity: 0.5; cursor: default; }
button.small, .button.small { padding: 5px 10px; font-size: 12.5px; gap: 5px; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 14px -8px rgba(0, 119, 221, 0.8); }
button.primary:hover:not(:disabled), .button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad-dot) 40%, var(--line)); }
button.danger:hover:not(:disabled) { background: var(--bad-dot); border-color: var(--bad-dot); color: #fff; }
button.ghost { border-color: transparent; background: transparent; }
button.link { background: none; border: none; padding: 0; color: var(--accent); font-weight: 600; }
button.link:hover:not(:disabled) { background: none; text-decoration: underline; }
.sidebar button.link { color: var(--sidebar-ink); }
button.wide { width: 100%; margin-top: 10px; }

.action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.action-grid button { justify-content: flex-start; text-align: left; padding: 10px 12px; font-weight: 500; }
.action-grid button .icon { color: var(--accent); }
.action-grid button.danger .icon { color: inherit; }
.action-group-label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 14px 0 8px; }

/* ---------- Forms ---------- */

input, select, textarea { font: inherit; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); max-width: 100%; transition: border-color 0.15s, box-shadow 0.15s; }
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
input::placeholder { color: var(--faint); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; padding: 0; accent-color: var(--accent); box-shadow: none; }
.search-field { position: relative; display: inline-flex; align-items: center; min-width: min(320px, 100%); }
.search-field .icon { position: absolute; left: 11px; color: var(--faint); pointer-events: none; }
.search-field input { width: 100%; padding-left: 36px; }
input.search { min-width: min(280px, 100%); }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
td.inline-form { margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; align-items: end; }
.form-grid label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 600; }
.form-grid label input, .form-grid label select { font-weight: 400; color: var(--ink); font-size: 14px; }
.form-grid label.check, label.check { flex-direction: row; align-items: center; gap: 9px; font-size: 13.5px; font-weight: 500; color: var(--ink); cursor: pointer; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .spacer { margin-left: auto; }

/* ---------- Code ---------- */

.log, .code-block { background: var(--code-bg); color: var(--code-ink); padding: 14px 16px; border-radius: var(--radius); font-family: var(--font-mono); font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0 12px; }
.log { max-height: 560px; overflow: auto; }
.log-view { padding: 6px 0; white-space: normal; max-height: 70vh; }
.log-entry { display: flex; gap: 12px; padding: 3px 16px 3px 0; border-left: 3px solid transparent; }
.log-entry.log-warning { border-left-color: var(--warn-dot); }
.log-entry.log-error { border-left-color: var(--bad-dot); background: color-mix(in srgb, var(--bad-dot) 10%, transparent); }
.log-line-no { flex: none; width: 5ch; text-align: right; opacity: 0.45; user-select: none; }
.log-body { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.log-warning .log-message { color: var(--warn-dot); }
.log-error .log-message { color: var(--bad-dot); font-weight: 600; }
.log-detail { opacity: 0.6; }

/* ---------- Health ---------- */

.health-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 14px; }
.health-tile { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; background: var(--surface-2); }
.health-tile .label { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.health-tile .value { font-weight: 600; color: var(--ink-strong); margin-top: 4px; }

/* ---------- Screenshot ---------- */

.screenshot { margin: 0 0 14px; }
.screenshot img { display: block; max-width: 100%; max-height: 440px; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-md); }
.screenshot figcaption { color: var(--muted); font-size: 12px; margin-top: 6px; }

/* ---------- Login ---------- */

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); background: var(--ground); }
.login-hero {
    position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 44px 52px; color: #fff;
    background-color: var(--brand-900);
    background-image: radial-gradient(rgba(255, 255, 255, 0.09) 1px, transparent 1px), radial-gradient(120% 90% at 100% 100%, rgba(29, 159, 200, 0.45), transparent 60%), linear-gradient(160deg, var(--brand-700) 0%, var(--brand-800) 45%, var(--brand-950) 100%);
    background-size: 18px 18px, 100% 100%, 100% 100%;
}
.login-hero img.wordmark { height: 30px; width: auto; align-self: flex-start; }
.login-hero .swoosh { position: absolute; right: -80px; bottom: -40px; width: 520px; max-width: 80%; opacity: 0.16; filter: brightness(0) invert(1); pointer-events: none; }
.login-hero h2 { color: #fff; font-size: 38px; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; max-width: 14ch; margin: 0 0 14px; }
.login-hero p { color: #c4d6ec; font-size: 16px; max-width: 40ch; margin: 0; }
.login-hero .eyebrow { color: var(--cyan-light); }
.login-hero footer { color: #8fb0d6; font-size: 12px; }
.login-main { display: grid; place-items: center; padding: 32px 20px; }
.login-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 34px 32px; box-shadow: var(--shadow-md); }
.login-card .login-mark { height: 34px; width: auto; margin-bottom: 18px; }
.login-card h1 { font-size: 24px; margin-bottom: 4px; }
.login-card > .muted { margin-bottom: 20px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; color: var(--muted); font-size: 12px; font-weight: 600; }
.login-card input { font-size: 14px; font-weight: 400; padding: 10px 12px; }
.login-card button.wide { margin-top: 22px; padding: 11px 14px; }
.validation-message { color: var(--bad); font-size: 12px; margin-top: 4px; }

#blazor-error-ui { display: none; position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 12px 18px; border-radius: var(--radius); background: var(--warn-bg); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn-dot) 40%, transparent); box-shadow: var(--shadow-md); z-index: 1000; font-weight: 500; }
#blazor-error-ui .reload { margin-left: 8px; font-weight: 700; }

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
    .grid-2 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 960px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; width: 272px; max-width: 86vw; height: 100vh; transform: translateX(-100%); transition: transform 0.22s ease; }
    .nav-toggle-input:checked ~ .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, 0.35); }
    .nav-toggle { display: inline-grid; }
    .nav-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0, 20, 40, 0.5); }
    .nav-toggle-input:checked ~ .nav-backdrop { display: block; }
    .main::before { inset: 0 0 auto 0; }
    .topbar { padding: 8px 16px; }
    .content { padding: 20px 16px 40px; }
    .login-shell { grid-template-columns: minmax(0, 1fr); }
    .login-hero { display: none; }
}

@media (max-width: 560px) {
    h1 { font-size: 22px; }
    .page-header { align-items: flex-start; }
    .page-header .actions { width: 100%; }
    .search-field { min-width: 100%; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stat { padding: 14px; }
    .stat-value { font-size: 24px; }
    .login-card { padding: 28px 22px; }
    .topbar-title .context { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
:is(button, a).filter-chip[aria-pressed="true"]:hover:not(:disabled) { background: var(--ink-strong); border-color: var(--ink-strong); color: var(--surface); }
:is(button, a).filter-chip[aria-pressed="true"] .muted { color: inherit; opacity: 0.7; }

/* Android provisioning QR: always dark-on-white so Setup Wizard can read it in either theme. */
.qr-wrap { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; margin: 12px 0; }
.qr { background: #fff; padding: 12px; border-radius: var(--radius-lg); border: 1px solid var(--line); width: min(320px, 100%); flex: none; }
.qr svg { display: block; width: 100%; height: auto; }
.qr-wrap > div:last-child { flex: 1 1 280px; min-width: 0; }
.recovery-pin { font-size: 22px; letter-spacing: 0.18em; padding: 4px 10px; }
