/* Neogon Design Portal ------------------------------------------------------ */

:root {
  color-scheme: light;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #64748b;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-soft: #e0e9ff;
  --on-primary: #ffffff;
  --focus: #2563eb;

  --side-bg: #0f1b2d;
  --side-text: #c4cfdf;
  --side-muted: #7d8ba1;
  --side-hover: #1a2a42;
  --side-active: #23395b;

  --good: #15803d;   --good-bg: #dcfce7;
  --warning: #a16207; --warning-bg: #fef3c7;
  --serious: #c2410c; --serious-bg: #ffedd5;
  --critical: #b91c1c; --critical-bg: #fee2e2;
  --neutral: #475569; --neutral-bg: #e2e8f0;

  --series-1: #2a78d6;
  --series-2: #eb6834;
  --grid: #e5e7eb;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, .18);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1220;
    --surface: #111a2b;
    --surface-2: #142034;
    --surface-3: #1a2840;
    --border: #22314a;
    --border-strong: #31435f;
    --text: #e6edf7;
    --text-2: #a9b7cc;
    --text-3: #8596ae;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-soft: #1b2f55;
    --focus: #60a5fa;
    --side-bg: #08101d;
    --side-hover: #121d30;
    --side-active: #1b2b45;
    --good: #4ade80;   --good-bg: #12301f;
    --warning: #facc15; --warning-bg: #33290b;
    --serious: #fb923c; --serious-bg: #3a210f;
    --critical: #f87171; --critical-bg: #3b1515;
    --neutral: #a9b7cc; --neutral-bg: #22314a;
    --series-1: #3987e5;
    --series-2: #d95926;
    --grid: #22314a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  }
}
:root[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 15px; font-weight: 650; }
p { margin: 0 0 .75em; }
code { font-family: var(--mono); font-size: 12px; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
small, .small { font-size: 12px; }
.muted { color: var(--text-3); }
.strong { font-weight: 600; color: var(--text); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); margin: 0 0 4px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 6px; }
.skip-link:focus { left: 8px; }

.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-lg { width: 28px; height: 28px; }
.icon-xl { width: 40px; height: 40px; color: var(--text-3); }
#i-dot circle { fill: currentColor; }

/* ---- Shell ----------------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; background: linear-gradient(to right, var(--side-bg) 240px, transparent 240px); }
@media (max-width: 900px) { .shell { background: none; } }
.sidebar {
  width: 240px; flex: none; background: var(--side-bg); color: var(--side-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff; font-weight: 800; font-size: 17px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { color: #fff; font-size: 15px; }
.brand-text small { color: var(--side-muted); font-size: 12px; }
.nav { padding: 6px 10px 16px; flex: 1; }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--side-muted); padding: 16px 10px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px;
  color: var(--side-text); font-weight: 500;
}
.nav-link:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
.nav-link.is-active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 #60a5fa; }
.nav-link .icon { opacity: .85; }
.nav-badge { margin-left: auto; background: #f59e0b; color: #1f1300; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; }
.sidebar-foot { padding: 12px 20px; font-size: 11px; color: var(--side-muted); }
.sidebar-scrim { display: none; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: 60px; display: flex; align-items: center; gap: 12px;
  padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.menu-btn { display: none; }
.top-search { flex: 1; max-width: 520px; position: relative; display: flex; align-items: center; }
.top-search .icon { position: absolute; left: 11px; color: var(--text-3); width: 16px; height: 16px; }
.top-search input[type=search] { width: 100%; padding-left: 34px; background: var(--surface-2); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--surface-3); }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta small { color: var(--text-3); }
.user-menu .menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 30;
}
.menu a, .menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 6px;
  color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-align: left;
}
.menu a:hover, .menu button:hover { background: var(--surface-3); text-decoration: none; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 13px;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }

.content { padding: 24px; max-width: 1440px; width: 100%; }

/* ---- Page header ----------------------------------------------------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; color: var(--text-3); margin-bottom: 6px; }
.back-link .icon { width: 16px; height: 16px; }
.head-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.id-tag { font-weight: 400; font-size: 18px; }

/* ---- Buttons --------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .icon { width: 16px; height: 16px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-success { background: var(--good); border-color: var(--good); color: #fff; }
.btn-success:hover { filter: brightness(1.08); background: var(--good); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-danger-ghost { color: var(--critical); border-color: transparent; background: transparent; }
.btn-danger-ghost:hover { background: var(--critical-bg); }
.btn-block { width: 100%; height: 42px; }
.btn.is-current { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn .count { background: var(--warning-bg); color: var(--warning); border-radius: 999px; padding: 0 7px; font-size: 12px; }
.btn.is-loading { pointer-events: none; opacity: .7; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 7px; border: 0;
  background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.link { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 550; }
.link .icon { width: 15px; height: 15px; }

/* ---- Forms ----------------------------------------------------------------- */
input[type=text], input[type=search], input[type=email], input[type=tel], input[type=password],
input[type=number], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 20%, transparent); }
input[type=file] { font: inherit; font-size: 13px; max-width: 100%; }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 16px; height: 16px; }
.input-sm { height: 32px; }
.input-num { max-width: 120px; text-align: right; margin-left: auto; }
.input-tiny { max-width: 80px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field > span, .field > legend { font-size: 13px; font-weight: 600; color: var(--text-2); padding: 0; }
.field em { color: var(--critical); font-style: normal; }
.field-inline { flex-direction: row; align-items: center; }
.hint { color: var(--text-3); font-weight: 400; }
.check { display: inline-flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.check input { margin-top: 2px; flex: none; }
.check.inline { display: inline-flex; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-card { padding: 24px; }
.form-narrow { max-width: 720px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.form-col { display: flex; flex-direction: column; gap: 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding-top: 8px; }
.table-card .form-actions { padding: 14px 16px; border-top: 1px solid var(--border); }
form.inline { display: inline; }
.danger-zone { margin-top: 16px; }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.choice-grid-2 { grid-template-columns: 1fr 1fr; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice-body {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface); height: 100%;
}
.choice-body strong { font-size: 14px; }
.choice-body .num { text-align: left; color: var(--text-2); font-weight: 600; }
.choice-body small { color: var(--text-3); }
.choice input:checked + .choice-body { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); background: var(--primary-soft); }
.choice input:focus-visible + .choice-body { outline: 2px solid var(--focus); outline-offset: 2px; }

.dropzone {
  position: relative; display: grid; place-items: center; min-height: 240px; border: 2px dashed var(--border-strong);
  border-radius: var(--radius); background: var(--surface-2); cursor: pointer; overflow: hidden; text-align: center; padding: 16px;
  transition: border-color .12s, background .12s;
}
.dropzone-sm { min-height: 130px; }
.dropzone:hover, .dropzone.is-over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dz-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-2); pointer-events: none; }
.dz-empty small { color: var(--text-3); }
.dz-preview { max-height: 320px; object-fit: contain; pointer-events: none; border-radius: 6px; }
.dz-file { font-weight: 600; pointer-events: none; display: flex; flex-direction: column; gap: 2px; }
.dz-file small { color: var(--text-3); font-weight: 400; }

.progress { position: relative; height: 28px; border-radius: 7px; background: var(--surface-3); overflow: hidden; margin-top: 16px; }
.progress-bar { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--primary); transition: width .2s; }
.progress-text { position: relative; display: block; text-align: center; line-height: 28px; font-size: 12px; font-weight: 600; color: var(--text); mix-blend-mode: normal; }

/* ---- Cards & layout -------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card > h2 { margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.table-card { padding: 0; overflow: hidden; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.card-span { grid-column: 1 / -1; }
.collapsible > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
.collapsible > summary::-webkit-details-marker { display: none; }
.collapsible > summary::after { content: "+"; font-size: 18px; color: var(--text-3); }
.collapsible[open] > summary { margin-bottom: 14px; }
.collapsible[open] > summary::after { content: "−"; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi-label { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value small { font-size: 14px; font-weight: 500; color: var(--text-3); }
.kpi-sub { font-size: 12px; color: var(--text-3); }
.kpi-hero { background: linear-gradient(135deg, #1d4ed8, #1e3a8a); border-color: transparent; color: #fff; }
.kpi-hero .kpi-label, .kpi-hero .kpi-sub { color: rgba(255, 255, 255, .78); }

/* Alerts */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid transparent; }
.alert > span { flex: 1; }
.alert-success { background: var(--good-bg); color: var(--good); }
.alert-error { background: var(--critical-bg); color: var(--critical); }
.alert-warning { background: var(--warning-bg); color: var(--warning); }
.alert-close { background: none; border: 0; color: inherit; cursor: pointer; padding: 0; opacity: .7; }
.alert-close .icon { width: 16px; height: 16px; }

/* Badges: every status carries an icon + label, never colour alone */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 6px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge .icon { width: 13px; height: 13px; stroke-width: 2.5; }
.badge-good { background: var(--good-bg); color: var(--good); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-serious { background: var(--serious-bg); color: var(--serious); }
.badge-critical { background: var(--critical-bg); color: var(--critical); }
.badge-neutral { background: var(--neutral-bg); color: var(--neutral); }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .03em; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th.num { text-align: right; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table-hover tbody tr:hover { background: var(--surface-2); }
.table-compact th, .table-compact td { padding: 8px 12px; }
.card .table-compact th:first-child, .card .table-compact td:first-child { padding-left: 0; }
.card .table-compact th:last-child, .card .table-compact td:last-child { padding-right: 0; }
.card .table-compact th { background: none; }
.table-card .table-compact th:first-child, .table-card .table-compact td:first-child { padding-left: 14px; }
.col-check { width: 36px; }
.col-thumb { width: 60px; padding-right: 0 !important; }
.col-actions { text-align: right; white-space: nowrap; width: 1%; }
.thumb-btn { padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 6px; overflow: hidden; display: block; }
.thumb-btn img, .thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; background: var(--surface-3); }
.empty-row { text-align: center; color: var(--text-3); padding: 32px !important; }
tr.is-muted td { opacity: .6; }
.details-cell code { white-space: normal; word-break: break-word; }
.sub-line { font-size: 12px; margin-top: 2px; }
.person { display: flex; align-items: center; gap: 10px; }

/* Description list */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
.dl dt { color: var(--text-3); font-size: 13px; }
.dl dd { margin: 0; text-align: right; word-break: break-word; }

/* Filters & toolbar */
.status-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.status-tabs a { padding: 8px 12px; color: var(--text-2); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.status-tabs a:hover { color: var(--text); text-decoration: none; }
.status-tabs a.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 14px; padding: 14px; }
.filters .field { flex: 0 1 160px; }
.filters .field-grow { flex: 1 1 220px; }
.filter-actions { display: flex; gap: 6px; }
.toolbar { display: flex; align-items: center; gap: 12px; min-height: 40px; margin-bottom: 10px; flex-wrap: wrap; }
.toolbar-end { margin-left: auto; }
.bulk-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bulk-actions[hidden] { display: none; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.seg a { display: grid; place-items: center; width: 36px; height: 32px; color: var(--text-3); }
.seg a + a { border-left: 1px solid var(--border-strong); }
.seg a.is-active { background: var(--primary-soft); color: var(--primary); }
.pager-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.pager { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 16px; }
.pager-row .pager { margin-top: 0; }
.pager-links { display: flex; gap: 4px; align-items: center; }
.pager-gap { padding: 0 4px; color: var(--text-3); }
.per-page { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.per-page select { width: auto; height: 30px; }

/* Gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.tile { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s; }
.tile:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.tile-img { display: block; border: 0; padding: 0; margin: 0; width: 100%; cursor: zoom-in; background: repeating-conic-gradient(var(--surface-3) 0 25%, var(--surface-2) 0 50%) 0 0 / 16px 16px; }
.tile-img img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: contain; }
.tile-check { position: absolute; top: 8px; left: 8px; z-index: 2; background: var(--surface); border-radius: 6px; padding: 5px; display: flex; box-shadow: var(--shadow); cursor: pointer; }
.tile-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.tile-title { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-meta { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.tile-foot { display: flex; align-items: center; gap: 4px; font-size: 12px; border-top: 1px solid var(--border); padding-top: 6px; }
.tile-foot .icon { width: 13px; height: 13px; }
.tile:has(input:checked) { outline: 2px solid var(--primary); }

.thumb-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.mini-card { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; color: var(--text); }
.mini-card:hover { text-decoration: none; border-color: var(--border-strong); }
.mini-card img { aspect-ratio: 4 / 3; object-fit: contain; background: var(--surface-2); width: 100%; }
.mini-card > span { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; align-items: flex-start; }
.mini-card strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

.item-list { list-style: none; margin: 0; padding: 0; }
.item { display: flex; align-items: center; gap: 12px; padding: 8px 0; color: var(--text); border-bottom: 1px solid var(--border); }
.item-list li:last-child .item { border-bottom: 0; }
.item:hover { text-decoration: none; }
.item:hover strong { color: var(--primary); }
.item-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; background: var(--surface-3); flex: none; }
.item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.item-main strong, .item-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-main small { color: var(--text-3); }
.item-end { font-weight: 600; font-variant-numeric: tabular-nums; }
.empty-inline { display: flex; align-items: center; gap: 8px; color: var(--text-3); margin: 8px 0; }
.empty-state { text-align: center; padding: 48px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-state.small { padding: 24px; }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.timeline li { display: flex; gap: 10px; font-size: 13px; }
.tl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); margin-top: 6px; flex: none; }
.timeline small { display: block; }

/* Detail page */
.detail { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
.detail-media { position: sticky; top: 76px; padding: 12px; }
.detail-img { display: grid; place-items: center; width: 100%; min-height: 320px; max-height: calc(100vh - 220px); border: 0; padding: 0; cursor: zoom-in; border-radius: 8px; overflow: hidden; background: repeating-conic-gradient(var(--surface-3) 0 25%, var(--surface-2) 0 50%) 0 0 / 20px 20px; }
.detail-img img { max-height: calc(100vh - 220px); object-fit: contain; }
.detail-downloads { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.detail-side { display: flex; flex-direction: column; gap: 16px; }
.review-card { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary-soft), var(--shadow); }
.comments { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.comment { display: flex; gap: 10px; }
.comment > div { flex: 1; background: var(--surface-2); border-radius: 8px; padding: 8px 12px; }
.comment.is-mine > div { background: var(--primary-soft); }
.comment p { margin: 2px 0 0; white-space: pre-wrap; word-break: break-word; }
.comment-head { display: flex; justify-content: space-between; gap: 8px; }
.comment-form { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }

/* Chart */
.chart { position: relative; }
.chart-head { display: flex; justify-content: flex-end; margin: -4px 0 6px; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw-1 { background: var(--series-1); }
.sw-2 { background: var(--series-2); }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart .bar.s1 { fill: var(--series-1); }
.chart .bar.s2 { fill: var(--series-2); }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hit:hover, .chart .hit.is-hover { fill: color-mix(in srgb, var(--text) 6%, transparent); }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow-lg); padding: 8px 10px; font-size: 12px; min-width: 170px;
}
.chart-tip strong { display: block; margin-bottom: 4px; }
.chart-tip .row { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.chart-tip .row span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.chart-tip .row span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; }
.chart-table { margin-top: 8px; }
.chart-table summary { cursor: pointer; font-size: 12px; color: var(--text-3); }

/* Lightbox */
.lightbox { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(5, 10, 20, .94); color: #fff; }
.lightbox::backdrop { background: rgba(5, 10, 20, .9); }
.lightbox[open] { display: flex; flex-direction: column; }
.lb-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.lb-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-bar .muted { color: #9aa7bb; }
.lb-bar .icon-btn { color: #fff; }
.lb-bar .icon-btn:hover { background: rgba(255, 255, 255, .12); }
.lb-bar .btn { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .2); color: #fff; }
.lb-stage { flex: 1; position: relative; display: grid; place-items: center; min-height: 0; padding: 0 64px 24px; }
.lb-img { max-width: 100%; max-height: calc(100vh - 90px); object-fit: contain; border-radius: 4px; background: #fff; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .12); color: #fff; display: grid; place-items: center; cursor: pointer; }
.lb-nav:hover { background: rgba(255, 255, 255, .24); }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
.lb-spinner { position: absolute; width: 32px; height: 32px; border: 3px solid rgba(255, 255, 255, .25); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; display: none; }
.lightbox.is-loading .lb-spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Auth ------------------------------------------------------------------ */
.auth-body { background: var(--bg); }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-wrap-single { grid-template-columns: 1fr; place-items: center; padding: 16px; }
.auth-aside { background: radial-gradient(120% 90% at 0% 0%, #1e3a8a 0%, #0f1b2d 60%); color: #dbe5f5; padding: 40px 48px; display: flex; flex-direction: column; justify-content: space-between; }
.brand-lg { padding: 0; }
.brand-lg .brand-mark { width: 42px; height: 42px; font-size: 20px; }
.auth-pitch h2 { color: #fff; font-size: 28px; font-weight: 700; max-width: 420px; margin-bottom: 20px; }
.auth-pitch ul { list-style: none; margin: 0 0 40px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.auth-pitch li { display: flex; align-items: center; gap: 10px; }
.auth-pitch .icon { color: #93c5fd; }
.auth-card { align-self: center; justify-self: center; width: 100%; max-width: 380px; padding: 24px; }
.auth-wrap-single .auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.auth-card h1 { font-size: 24px; margin-bottom: 6px; }
.auth-card form { margin-top: 20px; }

/* Install page */
.install { max-width: 760px; margin: 40px auto; padding: 0 16px; }
.install .card + .card { margin-top: 16px; }
.install pre { background: var(--surface-2); padding: 12px; border-radius: 8px; overflow-x: auto; font-size: 12px; }

/* ---- Print (statement) ----------------------------------------------------- */
.only-print { display: none; }
@media print {
  .sidebar, .topbar, .no-print, .alert, .chart-table summary { display: none !important; }
  .only-print { display: block; margin-bottom: 12px; }
  body { background: #fff; font-size: 12px; }
  .content { padding: 0; }
  .card, .kpi { box-shadow: none; }
  .kpi-hero { background: none; color: inherit; border: 1px solid #999; }
  .kpi-hero .kpi-label, .kpi-hero .kpi-sub { color: #555; }
}

/* ---- Responsive ------------------------------------------------------------ */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail { grid-template-columns: 1fr; }
  .detail-media { position: static; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .45); }
  .menu-btn { display: inline-grid; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
}
@media (max-width: 640px) {
  .content { padding: 16px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .hide-sm { display: none !important; }
  .kpis, .kpis-3 { grid-template-columns: 1fr; }
  .row-2, .choice-grid-2 { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .filters .field, .filters .field-grow { flex: 1 1 100%; }
  .page-head { align-items: flex-start; }
  h1 { font-size: 20px; }
  .lb-stage { padding: 0 8px 16px; }
  .lb-nav { display: none; }
  .lb-open { display: none; }
  .chart .axis { font-size: 22px; }
  .chart .axis[text-anchor="middle"]:nth-of-type(even) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: 0s !important; }
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.install-brand { margin-bottom: 20px; }
.install-brand .brand-text strong { color: var(--text); }
.install h1 { margin-bottom: 8px; }
