/*!*****************************************************************************************************************************************************************************************************************************************************************!*\
  !*** css ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[14].oneOf[10].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[14].oneOf[10].use[3]!./src/app/globals.css ***!
  \*****************************************************************************************************************************************************************************************************************************************************************/
/* ─────────────────────────────────────────────────────────────────────────────
   ClearTrace design system.
   Visual language transplanted from the established ClearTrace application:
   light warm canvas · dark sidebar · green / blue / amber accents (Scope 1 / 2 / 3)
   · Instrument Sans body · DM Mono for labels, codes and numbers · 10–14px radii.
   Functional truth is the rebuilt product: nothing here changes a state, a label
   or a number; the sheet only draws them.
   ───────────────────────────────────────────────────────────────────────────── */

:root {
  /* canvas + surfaces */
  --bg: #f4f3ee;
  --surface: #ffffff;
  --surface2: #f9f8f4;
  --surface-muted: #f9f8f4;
  --border: #e5e2d9;
  --border-strong: #d6d2c6;
  --dim: #e5e2d9;
  /* ink */
  --text: #1a1a18;
  --text-muted: #6f6d66;
  --muted: #8a8880;
  --text-faint: #a5a39b;
  /* accents */
  --accent: #1a6b4a;
  --accent-hover: #155a3d;
  --accent-light: #e8f5ef;
  --accent-soft: #e8f5ef;
  --accent2: #2d5be3;
  --accent2-light: #edf0fd;
  --warn: #c47d1a;
  --warn-light: #fef3e2;
  --warn-soft: #fef3e2;
  --danger: #c0392b;
  --danger-light: #fdecea;
  --danger-soft: #fdecea;
  --ok: #1a6b4a;
  --ok-soft: #e8f5ef;
  --info: #2d5be3;
  --info-soft: #edf0fd;
  /* scopes */
  --scope1: #1a6b4a;
  --scope2: #2d5be3;
  --scope3: #c47d1a;
  --scope1-light: #e8f5ef;
  --scope2-light: #edf0fd;
  --scope3-light: #fef3e2;
  /* dark sidebar */
  --side-bg: #1a1a18;
  --side-text: rgba(255, 255, 255, 0.55);
  --side-text-strong: #ffffff;
  --side-line: rgba(255, 255, 255, 0.10);
  --side-hover: rgba(255, 255, 255, 0.07);
  --side-green: #4ade80;
  /* type */
  --font-head: 'Cabinet Grotesk', 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font: var(--font-body);
  --mono: var(--font-mono);
  /* shape */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 16px;
  --shadow: 0 1px 2px rgba(26, 26, 24, 0.04);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
  --ring: 0 0 0 3px rgba(26, 107, 74, 0.12);
  /* layout */
  --sidebar-w: 240px;
  --content-max: 1320px;
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font-body); line-height: 1.5; min-height: 100vh; -webkit-font-smoothing: antialiased; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: inline-block; vertical-align: middle; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--dim); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.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; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px; font-weight: 600; }
.skip-link:focus { top: 12px; text-decoration: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ── Typography ───────────────────────────────────────────────────────────── */
h1, h2, h3, h4 { margin: 0; font-family: var(--font-head); font-weight: 700; letter-spacing: -0.2px; line-height: 1.25; }
h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0 0 8px; }
code, .mono { font-family: var(--font-mono); font-size: 12px; }
.muted { color: var(--muted); }
.faint { color: var(--text-faint); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { font-family: var(--font-mono); font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; font-size: 12.5px; }
.label, .eyebrow { font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mb-16 { margin-bottom: 16px; } .mb-8 { margin-bottom: 8px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-gap: 16px; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-gap: 16px; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-gap: 16px; gap: 16px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 360px; grid-gap: 20px; gap: 20px; }
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-main { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
ul.list { margin: 0; padding-left: 18px; }
ul.list li { margin: 3px 0; }
.error { color: var(--danger); }

/* ══════════════════════════════════════════════════════════════════════════════
   APPLICATION SHELL — dark sidebar + main column
   ══════════════════════════════════════════════════════════════════════════════ */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--side-bg); color: var(--side-text);
  padding: 24px 16px 20px; display: flex; flex-direction: column; flex-shrink: 0;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 40; overflow-y: auto;
  transition: transform 0.2s ease;
}
.sidebar a { color: inherit; }
.sidebar a:hover { text-decoration: none; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; margin-bottom: 14px; border-bottom: 1px solid var(--side-line); }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); display: inline-grid; place-items: center; color: #fff; flex-shrink: 0; }
.brand-mark.admin { background: var(--accent2); }
.brand-mark svg { width: 18px; height: 18px; }
.brand-text { font-family: var(--font-head); font-weight: 800; font-size: 17px; color: var(--side-text-strong); letter-spacing: -0.3px; line-height: 1.1; }
.brand-text span { color: var(--side-green); }
.brand-sub { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255, 255, 255, 0.35); margin-top: 3px; font-weight: 400; }
.nav-section { margin-bottom: 14px; }
.nav-label { font-family: var(--font-mono); font-size: 10px; color: rgba(255, 255, 255, 0.30); letter-spacing: 0.10em; text-transform: uppercase; margin: 0 0 6px; padding-left: 12px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; font-size: 13.5px;
  color: var(--side-text); transition: background 0.15s, color 0.15s; margin-bottom: 2px; cursor: pointer;
}
.nav-item:hover { background: var(--side-hover); color: var(--side-text-strong); }
.nav-item.active, .nav-item[aria-current="page"] { background: var(--accent); color: var(--side-text-strong); }
.sidebar.admin .nav-item.active, .sidebar.admin .nav-item[aria-current="page"] { background: var(--accent2); }
.nav-item .icon { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.85; }
.nav-item .count { margin-left: auto; font-family: var(--font-mono); font-size: 10px; background: rgba(255, 255, 255, 0.10); border-radius: 10px; padding: 1px 7px; }
.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--side-line); }
.ws-pill { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: rgba(255, 255, 255, 0.06); border-radius: 10px; min-width: 0; }
.ws-avatar { width: 28px; height: 28px; background: var(--accent); border-radius: 6px; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; font-family: var(--font-head); flex-shrink: 0; }
.sidebar.admin .ws-avatar { background: var(--accent2); }
.ws-name { font-size: 12px; color: #fff; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-sub { font-size: 10px; color: rgba(255, 255, 255, 0.40); font-family: var(--font-mono); letter-spacing: 0.05em; text-transform: uppercase; }
.side-link { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; font-size: 13px; color: rgba(255, 255, 255, 0.40); margin-top: 6px; transition: all 0.15s; background: none; border: 0; width: 100%; text-align: left; }
.side-link:hover { color: #f87171; background: rgba(248, 113, 113, 0.08); }
.side-link.neutral:hover { color: #fff; background: var(--side-hover); }
.side-link .icon { width: 16px; height: 16px; }

.main-col { margin-left: var(--sidebar-w); flex: 1 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.utility-bar {
  display: flex; align-items: center; gap: 14px; padding: 10px 36px; min-height: 52px;
  background: var(--surface); border-bottom: 1px solid var(--border); position: -webkit-sticky; position: sticky; top: 0; z-index: 30;
}
.utility-bar .spacer { flex: 1 1; }
.nav-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: transparent; overflow: hidden; pointer-events: none; }
.nav-progress.busy::after { content: ''; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%; background: var(--accent); border-radius: 2px; animation: navProgress 1.1s ease-in-out infinite; }
@keyframes navProgress { 0% { left: -40%; width: 30%; } 50% { width: 45%; } 100% { left: 100%; width: 30%; } }
.utility-bar .ulink { font-size: 13px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; }
.utility-bar .ulink:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
.utility-bar .ulink .icon { width: 15px; height: 15px; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface2); max-width: 260px; }
.user-chip:hover { text-decoration: none; border-color: var(--border-strong); }
.user-chip .avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; font-size: 11px; flex-shrink: 0; }
.user-chip .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-label { font-size: 13px; font-weight: 600; color: var(--text); display: inline-flex; align-items: center; gap: 8px; }
.ws-label .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.nav-toggle { display: none; width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); align-items: center; justify-content: center; }
.nav-toggle .icon { width: 18px; height: 18px; }
.nav-backdrop { display: none; position: fixed; inset: 0; background: rgba(26, 26, 24, 0.45); z-index: 35; }
.content { flex: 1 1; padding: 28px 36px 56px; max-width: var(--content-max); width: 100%; animation: fadeIn 0.3s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Legacy topbar shell class names kept for pages that still reference them */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.shell { display: contents; }
.spacer { flex: 1 1; }

@media (max-width: 1100px) { .utility-bar { padding: 10px 20px; } .content { padding: 20px 20px 48px; } }
@media (max-width: 900px) {
  .card-body:has(> .table) { overflow-x: auto; }
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  html[data-nav-open] .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  html[data-nav-open] .nav-backdrop { display: block; }
  html[data-nav-open] { overflow: hidden; }
  .main-col { margin-left: 0; }
  .nav-toggle { display: inline-flex; }
  .utility-bar { padding: 8px 16px; gap: 8px; }
  .content { padding: 16px 16px 40px; }
  .user-chip .name { display: none; }
}

/* ── Page header ──────────────────────────────────────────────────────────── */
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header > div:first-child { min-width: 0; flex: 1 1 420px; }
.page-header h1 { font-size: 26px; }
.page-header p { color: var(--muted); margin: 6px 0 0; font-size: 13px; max-width: 900px; line-height: 1.5; }
.page-header .actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.breadcrumb { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 8px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.section-title { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 20px 0 10px; }

/* ══════════════════════════════════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════════════════════════════════ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-header { padding: 16px 22px 14px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-header h2 { font-size: 15px; font-weight: 700; letter-spacing: -0.2px; }
.card-header .card-sub { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); margin-top: 2px; display: block; }
.card-header .row { gap: 8px; }
.card-body { padding: 18px 22px 20px; }
.card-body > .table:first-child, .card-body > .table-wrap:first-child { margin-top: -6px; }
.card.flush .card-body { padding: 0; }
.card.flush .table { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card.accent-top { border-top: 3px solid var(--accent); }
.card.s1-top { border-top: 3px solid var(--scope1); }
.card.s2-top { border-top: 3px solid var(--scope2); }
.card.s3-top { border-top: 3px solid var(--scope3); }
.card.dark { background: var(--side-bg); border-color: var(--side-bg); color: #fff; }
.card.dark .muted { color: rgba(255, 255, 255, 0.55); }

/* Key / value lists */
.kv { display: grid; grid-template-columns: max-content 1fr; grid-gap: 8px 20px; gap: 8px 20px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--muted); font-family: var(--font-mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; padding-top: 2px; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv dd .muted { color: var(--muted); }
@media (max-width: 640px) { .kv { grid-template-columns: 1fr; gap: 2px 0; } .kv dd { margin-bottom: 8px; } }
/* Field rows (record detail) */
.field-row { display: grid; grid-template-columns: 240px 1fr; grid-gap: 12px; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: start; }
.field-row:last-child { border-bottom: 0; }
.field-row .k { font-size: 13px; color: var(--muted); }
.field-row .v { font-size: 13.5px; font-weight: 500; }
@media (max-width: 900px) { .field-row { grid-template-columns: 1fr; gap: 2px; } }

/* ══════════════════════════════════════════════════════════════════════════════
   STATS / KPI CARDS
   ══════════════════════════════════════════════════════════════════════════════ */
.kpi-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-gap: 16px; gap: 16px; }
@media (max-width: 1200px) { .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .kpi-strip { grid-template-columns: 1fr; } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; transition: box-shadow 0.2s, transform 0.2s; animation: fadeIn 0.4s ease both; min-width: 0; box-shadow: var(--shadow); }
.kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi:nth-child(2) { animation-delay: 0.05s; } .kpi:nth-child(3) { animation-delay: 0.10s; } .kpi:nth-child(4) { animation-delay: 0.15s; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.kpi-icon { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-light); color: var(--accent); }
.kpi-icon svg { width: 18px; height: 18px; }
.kpi-icon.s1 { background: var(--scope1-light); color: var(--scope1); }
.kpi-icon.s2 { background: var(--scope2-light); color: var(--scope2); }
.kpi-icon.s3 { background: var(--scope3-light); color: var(--scope3); }
.kpi-icon.total { background: var(--side-bg); color: var(--side-green); }
.kpi-value { font-family: var(--font-head); font-weight: 800; font-size: 26px; letter-spacing: -1px; line-height: 1; margin-bottom: 4px; font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.kpi-value small, .kpi-unit { font-size: 12.5px; color: var(--muted); font-weight: 400; letter-spacing: 0; font-family: var(--font-mono); }
.kpi-label { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; line-height: 1.6; }
.kpi-trend { font-family: var(--font-mono); font-size: 11px; padding: 3px 8px; border-radius: 20px; white-space: nowrap; }
.trend-good { background: var(--accent-light); color: var(--accent); }
.trend-warn { background: var(--warn-light); color: var(--warn); }
.trend-bad { background: var(--danger-light); color: var(--danger); }
.trend-none { background: var(--dim); color: var(--muted); }
/* Compact stat (used inside cards / receipts) */
.stat { padding: 16px 18px; min-width: 0; }
.stat .label { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.stat .value { font-family: var(--font-head); font-size: 24px; font-weight: 800; margin-top: 6px; font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; letter-spacing: -0.8px; line-height: 1.1; overflow-wrap: anywhere; }
.stat .value small { font-size: 12.5px; font-weight: 400; color: var(--muted); margin-left: 5px; letter-spacing: 0; font-family: var(--font-mono); }
.stat .sub { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
/* Summary strip (resolution / validation) */
.summary-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); grid-gap: 14px; gap: 14px; margin-bottom: 20px; }
.vstat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; }
.vstat-val { font-family: var(--font-head); font-size: 28px; font-weight: 800; line-height: 1; margin-bottom: 4px; letter-spacing: -0.8px; }
.vstat-val.warn { color: var(--warn); } .vstat-val.green { color: var(--accent); } .vstat-val.blue { color: var(--accent2); } .vstat-val.red { color: var(--danger); }
.vstat-label { font-size: 12px; color: var(--muted); }

/* ══════════════════════════════════════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; padding: 10px 12px; font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface2); }
.table th:first-child { border-top-left-radius: 8px; } .table th:last-child { border-top-right-radius: 8px; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--text); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface2); }
.table tr.clickable { cursor: pointer; }
.table td .small { line-height: 1.45; }
.table td.small, .table td .small { font-size: 12.5px; }
.table .num { font-family: var(--font-mono); font-size: 12.5px; }
.table th.right, .table th.num { text-align: right; }
.table td > a:first-child { font-weight: 500; }
.table td form.row, .table td form.stack { gap: 6px; }
.table td form.stack { min-width: 150px; }
.table td form.row input[type=text], .table td form.row select, .table td form.stack input[type=text], .table td form.stack select { padding: 6px 9px; font-size: 12.5px; }
.table td .badge { vertical-align: middle; }
.table.compact td { padding: 7px 10px; }
.table.dense { font-size: 12.5px; }
.table.dense td { padding: 8px 10px; }
tr.dimmed td { opacity: 0.6; }

/* ══════════════════════════════════════════════════════════════════════════════
   BADGES, TAGS, PILLS
   ══════════════════════════════════════════════════════════════════════════════ */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 20px; font-family: var(--font-mono); font-size: 11px; font-weight: 500; white-space: nowrap; border: 1px solid transparent; line-height: 1.6; vertical-align: middle; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; opacity: 0.9; }
.badge-ok { background: var(--accent-light); color: var(--accent); }
.badge-warn { background: var(--warn-light); color: var(--warn); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--accent2-light); color: var(--accent2); }
.badge-neutral { background: #f0eee8; color: #5f5d56; }
.badge-accent { background: var(--accent-light); color: var(--accent); }
/* Calculation states must be unambiguous: pending is a hollow marker on a dashed pill and never resembles a figure. */
.badge-pending { background: #fff; color: var(--accent2); border: 1px dashed var(--accent2); }
.badge-pending::before { background: transparent; border: 1.5px solid currentColor; width: 7px; height: 7px; }
.badge-action { background: var(--warn-light); color: #9a5f0c; border-color: #f0d3a3; }
.badge-action::before { content: '!'; width: auto; height: auto; border-radius: 0; background: none; font-weight: 700; line-height: 1; }
.badge-superseded { background: #f0eee8; color: #8a8880; border-color: var(--border); }
.badge-superseded::before { opacity: 0.5; }
.badge-fallback { background: var(--warn-light); color: var(--warn); }
.tag { display: inline-block; font-size: 11px; font-family: var(--font-mono); padding: 3px 10px; border-radius: 20px; white-space: nowrap; line-height: 1.6; }
.tag-green { background: var(--accent-light); color: var(--accent); }
.tag-blue { background: var(--accent2-light); color: var(--accent2); }
.tag-warn { background: var(--warn-light); color: var(--warn); }
.tag-red { background: var(--danger-light); color: var(--danger); }
.tag-neutral { background: #f0eee8; color: #5f5d56; }
.scope-badge { display: inline-flex; align-items: center; justify-content: center; padding: 2px 8px; border-radius: 20px; font-family: var(--font-mono); font-size: 11px; font-weight: 500; white-space: nowrap; line-height: 1.6; }
.scope-badge.s1 { background: var(--scope1-light); color: var(--scope1); }
.scope-badge.s2 { background: var(--scope2-light); color: var(--scope2); }
.scope-badge.s3 { background: var(--scope3-light); color: var(--scope3); }
.al-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }
.al-badge.create, .al-badge.insert, .al-badge.approved { background: var(--accent-light); color: var(--accent); border-color: transparent; }
.al-badge.update, .al-badge.amended { background: var(--accent2-light); color: var(--accent2); border-color: transparent; }
.al-badge.delete, .al-badge.rejected, .al-badge.revoked { background: var(--danger-light); color: var(--danger); border-color: transparent; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot.s1 { background: var(--scope1); } .dot.s2 { background: var(--scope2); } .dot.s3 { background: var(--scope3); }

/* Filter pills + segmented tabs */
.pills { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 13px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface); font-size: 12.5px; color: var(--muted); cursor: pointer; transition: all 0.15s; font-family: inherit; line-height: 1.5; }
.pill:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.pill.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.pill .count { font-family: var(--font-mono); font-size: 10.5px; opacity: 0.85; }
.segmented { display: inline-flex; gap: 3px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.segmented a, .segmented button { padding: 6px 14px; border-radius: 7px; font-size: 12.5px; font-weight: 500; color: var(--muted); border: 0; background: transparent; cursor: pointer; }
.segmented a:hover, .segmented button:hover { color: var(--text); text-decoration: none; }
.segmented .active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08); }
/* Underline tabs */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 16px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs .count { font-family: var(--font-mono); font-size: 11px; color: var(--warn); font-weight: 600; margin-left: 4px; }

/* ══════════════════════════════════════════════════════════════════════════════
   NOTICES, EMPTY STATES, SKELETONS
   ══════════════════════════════════════════════════════════════════════════════ */
.notice { padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface2); font-size: 13.5px; line-height: 1.5; }
.notice.has-icon { display: flex; gap: 10px; align-items: flex-start; }
.notice > strong:first-child { margin-right: 4px; }
.notice > .nicon { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.notice > .nbody { flex: 1 1; min-width: 0; }
.notice p:last-child { margin-bottom: 0; }
.notice-warn { background: var(--warn-light); border-color: #f0d3a3; color: #5a3d00; }
.notice-danger { background: var(--danger-light); border-color: #f2c1bb; color: #7a1c21; }
.notice-ok { background: var(--accent-light); border-color: #bfe3cc; color: #145232; }
.notice-info { background: var(--accent2-light); border-color: #c9d4f7; color: #1f3a8a; }
.notice + .notice { margin-top: 10px; }
.notice.mb-16 + .notice.mb-16 { margin-top: 0; }
.empty { padding: 32px; text-align: center; color: var(--muted); font-size: 13px; font-family: var(--font-mono); }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 48px 20px; gap: 6px; }
.empty-state .eicon { width: 44px; height: 44px; border-radius: 12px; background: var(--surface2); color: var(--muted); display: grid; place-items: center; margin-bottom: 8px; }
.empty-state .eicon svg { width: 22px; height: 22px; }
.empty-state .etitle { font-family: var(--font-head); font-weight: 700; font-size: 16px; }
.empty-state .edesc { color: var(--muted); font-size: 13px; max-width: 380px; line-height: 1.55; }
.empty-state .eactions { margin-top: 10px; display: flex; gap: 8px; }
.skeleton { position: relative; overflow: hidden; background: var(--surface2); border-radius: 8px; min-height: 12px; }
.skeleton::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.skeleton-lines { display: flex; flex-direction: column; gap: 10px; }
.skeleton-lines .skeleton { height: 12px; }
.skeleton-lines .skeleton:nth-child(2) { width: 85%; } .skeleton-lines .skeleton:nth-child(3) { width: 60%; }

/* ══════════════════════════════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════════════════════════════ */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .form-label { font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.field > label.question, .field.question > label { font-family: var(--font-body); font-size: 13.5px; font-weight: 600; color: var(--text); text-transform: none; letter-spacing: 0; }
.field .hint { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.field .error { font-size: 12.5px; color: var(--danger); }
.req { color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], input[type=tel], input[type=search], input[type=url], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font: inherit; font-size: 13.5px; background: var(--surface2); color: var(--text); transition: border-color 0.15s, box-shadow 0.15s; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); background: var(--surface); }
input[readonly], input[disabled], select[disabled], textarea[disabled] { background: var(--bg); color: var(--muted); cursor: not-allowed; }
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input[aria-invalid=true], select[aria-invalid=true] { border-color: var(--danger); }
select { -moz-appearance: none; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8880' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; cursor: pointer; }
select[multiple] { background-image: none; padding-right: 12px; }
textarea { min-height: 76px; resize: vertical; line-height: 1.5; }
input[type=file] { width: 100%; padding: 8px; border: 1px dashed var(--border-strong); border-radius: 8px; background: var(--surface2); font-size: 12.5px; color: var(--muted); }
input[type=file]::-webkit-file-upload-button { font: inherit; font-size: 12.5px; font-weight: 600; padding: 5px 12px; margin-right: 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
input[type=file]::file-selector-button { font: inherit; font-size: 12.5px; font-weight: 600; padding: 5px 12px; margin-right: 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; flex-shrink: 0; cursor: pointer; }
.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-group label { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius); cursor: pointer; background: var(--surface); transition: border-color 0.15s, background 0.15s; font-size: 13.5px; line-height: 1.45; }
.radio-group label input { margin-top: 3px; }
.radio-group label:hover { border-color: var(--accent); }
.radio-group label:has(input:checked) { border-color: var(--accent); background: var(--accent-light); }
.radio-group.inline { flex-direction: row; flex-wrap: wrap; }
.radio-group.inline label { padding: 8px 14px; align-items: center; }
.radio-group.inline label input { margin-top: 0; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; font-size: 13.5px; cursor: pointer; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); grid-gap: 6px 16px; gap: 6px 16px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; padding-top: 14px; border-top: 1px solid var(--border); margin-top: 4px; flex-wrap: wrap; }
.form-actions .left { margin-right: auto; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset + fieldset, fieldset.mt-8 { margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--border); }
legend { font-family: var(--font-head); font-weight: 700; font-size: 14px; padding: 0; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; letter-spacing: -0.1px; }
.input-suffix { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; background: var(--surface2); overflow: hidden; }
.input-suffix input { border: 0; background: transparent; box-shadow: none; }
.input-suffix span { padding: 9px 12px; background: var(--bg); border-left: 1px solid var(--border); font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
form[aria-busy=true] button[type=submit] { opacity: 0.7; pointer-events: none; }
/* Review rows (registration) */
.review-row { display: grid; grid-template-columns: 170px 1fr auto; grid-gap: 12px; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: start; font-size: 13.5px; }
.review-row:last-of-type { border-bottom: 0; }
.review-row .k { color: var(--muted); font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; padding-top: 2px; }
@media (max-width: 640px) { .review-row { grid-template-columns: 1fr; gap: 4px; } }

/* ══════════════════════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════════════════════ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; transition: all 0.15s; line-height: 1.4; white-space: nowrap; }
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn .icon { width: 15px; height: 15px; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-danger { background: var(--danger-light); color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: #f5c0bb; color: var(--danger); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); border-color: transparent; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { padding: 12px 22px; font-size: 14px; font-family: var(--font-head); font-weight: 700; }
.btn-link { border: 0; background: none; color: var(--accent); padding: 0; font-weight: 500; }
.btn-link:hover { text-decoration: underline; color: var(--accent-hover); }
.btn:disabled, .btn[aria-disabled=true] { opacity: 0.55; cursor: not-allowed; pointer-events: none; }
.btn-block { width: 100%; }

/* ══════════════════════════════════════════════════════════════════════════════
   AUTH + REGISTRATION
   ══════════════════════════════════════════════════════════════════════════════ */
.auth-frame { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; background: var(--bg); }
.auth-frame > .auth-card { margin-top: 0; }
.auth-card { width: 100%; max-width: 440px; border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); }
.auth-head { padding: 32px 40px 0; }
.auth-card .card-body { padding: 18px 40px 32px; }
.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.auth-card h1 + p { margin-bottom: 20px; }
.auth-card .form { gap: 14px; }
.auth-card .btn-primary { padding: 11px 18px; font-family: var(--font-head); font-weight: 700; font-size: 14px; }
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-head .auth-logo { margin-bottom: 0; }
.auth-logo .brand-mark { width: 34px; height: 34px; }
.auth-logo-text { font-family: var(--font-head); font-weight: 800; font-size: 20px; letter-spacing: -0.3px; color: var(--text); }
.auth-logo-text span { color: var(--accent); }
.auth-foot { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
@media (max-width: 480px) { .auth-card .card-body { padding: 18px 22px 26px; } .auth-head { padding: 24px 22px 0; } }
.wide-frame { width: 100%; max-width: 780px; }

/* Onboarding wizard: dark rail with steps + main panel */
.ob-shell { display: flex; min-height: 100vh; }
.ob-rail { width: 280px; background: var(--side-bg); padding: 28px 22px; display: flex; flex-direction: column; flex-shrink: 0; position: fixed; top: 0; left: 0; bottom: 0; z-index: 10; overflow-y: auto; color: var(--side-text); }
.ob-rail .sidebar-brand { margin-bottom: 28px; }
.ob-steps { display: flex; flex-direction: column; gap: 2px; flex: 1 1; }
.ob-step { display: flex; align-items: flex-start; gap: 14px; padding: 12px 10px; border-radius: 10px; position: relative; }
.ob-step:not(:last-child)::after { content: ''; position: absolute; left: 23px; top: 44px; width: 2px; height: calc(100% - 12px); background: var(--side-line); }
.ob-step.done::after { background: var(--accent); }
.ob-step-dot { width: 28px; height: 28px; border-radius: 50%; background: rgba(255, 255, 255, 0.10); border: 2px solid rgba(255, 255, 255, 0.15); display: grid; place-items: center; flex-shrink: 0; z-index: 1; font-family: var(--font-mono); font-size: 11px; color: rgba(255, 255, 255, 0.40); transition: all 0.2s; }
.ob-step.current .ob-step-dot, .ob-step.done .ob-step-dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.ob-step.done .ob-step-dot svg { width: 13px; height: 13px; }
.ob-step-title { font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, 0.40); line-height: 1.3; padding-top: 4px; }
.ob-step-desc { font-size: 11px; color: rgba(255, 255, 255, 0.25); font-family: var(--font-mono); margin-top: 2px; }
.ob-step.current .ob-step-title { color: #fff; }
.ob-step.done .ob-step-title { color: rgba(255, 255, 255, 0.6); }
.ob-rail-foot { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--side-line); font-size: 11.5px; color: rgba(255, 255, 255, 0.35); line-height: 1.5; }
.ob-rail-foot a { color: rgba(255, 255, 255, 0.6); }
.ob-main { margin-left: 280px; flex: 1 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.ob-progress { height: 3px; background: var(--dim); width: 100%; flex-shrink: 0; }
.ob-progress-bar { height: 100%; background: var(--accent); transition: width 0.4s ease; }
.ob-panel { flex: 1 1; padding: 44px 56px 56px; max-width: 900px; width: 100%; animation: fadeIn 0.3s ease both; }
.ob-panel .card > .card-body { padding: 26px 30px 28px; }
.ob-panel h1 { font-size: 24px; margin-bottom: 6px; }
.ob-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 12px; }
.ob-step-badge { display: inline-block; font-family: var(--font-mono); font-size: 11px; color: var(--accent); background: var(--accent-light); border-radius: 20px; padding: 3px 10px; letter-spacing: 0.05em; }
@media (max-width: 900px) { .ob-rail { width: 220px; padding: 22px 14px; } .ob-main { margin-left: 220px; } .ob-panel { padding: 28px 24px 40px; } }
@media (max-width: 640px) { .ob-rail { display: none; } .ob-main { margin-left: 0; } .ob-panel { padding: 20px 16px 40px; } }
/* Legacy stepper (kept for any residual reference) */
.stepper { display: flex; gap: 8px; margin: 0 0 20px; font-size: 12.5px; }
.stepper .step { flex: 1 1; padding: 8px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); }
.stepper .step.current { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.stepper .step.done { color: var(--ok); }
.reg-frame { max-width: 780px; margin: 0 auto; padding: 32px 16px 64px; }
.reg-frame h1 { margin-bottom: 8px; }

/* Option cards (module selection, structure choices) */
.option-card { display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px; border: 1.5px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.option-card:hover { border-color: var(--accent); }
.option-card:has(input:checked) { border-color: var(--accent); background: var(--accent-light); }
.option-card input { margin-top: 4px; }
.option-card h3 { font-size: 15px; margin-bottom: 4px; }
.option-card p { font-size: 12.5px; color: var(--muted); margin: 0; line-height: 1.5; }

/* ══════════════════════════════════════════════════════════════════════════════
   CONTEXT SWITCHER · HELP · RECEIPT · CHARTS · TILES · UPLOAD
   ══════════════════════════════════════════════════════════════════════════════ */
.ctx { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ctx .lbl { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.ctx select { width: auto; min-width: 190px; max-width: 320px; padding: 6px 30px 6px 10px; font-size: 13px; background-color: var(--surface); }
@media (max-width: 900px) { .ctx select { min-width: 140px; max-width: 200px; } .ctx .lbl { display: none; } }

.help-wrap { position: relative; display: inline-flex; vertical-align: middle; }
.help-btn { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); font-size: 10px; line-height: 14px; text-align: center; cursor: pointer; padding: 0; font-family: var(--font-mono); font-weight: 500; }
.help-btn:hover { border-color: var(--accent); color: var(--accent); }
.help-pop { position: absolute; z-index: 60; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 12px 14px; width: 320px; max-width: calc(100vw - 32px); font-size: 13px; font-weight: 400; text-transform: none; letter-spacing: 0; font-family: var(--font-body); color: var(--text); line-height: 1.5; }
.help-pop strong { font-family: var(--font-head); }

.receipt { font-size: 13.5px; }
.receipt .trace, pre.trace { font-family: var(--font-mono); font-size: 11.5px; background: var(--side-bg); color: #d9d6cc; padding: 12px 14px; border-radius: var(--radius); max-height: 320px; overflow: auto; white-space: pre-wrap; line-height: 1.5; margin: 0; }
.receipt-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.receipt-hero { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-gap: 14px; gap: 14px; margin-bottom: 18px; }
.receipt-hero .stat { border-radius: var(--radius); background: var(--surface2); border: 1px solid var(--border); }
.receipt-hero .stat.primary { background: var(--side-bg); border-color: var(--side-bg); color: #fff; }
.receipt-hero .stat.primary .label { color: rgba(255, 255, 255, 0.45); }
.receipt-hero .stat.primary .value { color: var(--side-green); }
.receipt-hero .stat.primary .value small, .receipt-hero .stat.primary .sub { color: rgba(255, 255, 255, 0.55); }
@media (max-width: 900px) { .receipt-hero { grid-template-columns: 1fr; } }
details.disclosure > summary { cursor: pointer; color: var(--muted); font-size: 12.5px; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: '▸'; font-size: 10px; transition: transform 0.15s; }
details.disclosure[open] > summary::before { transform: rotate(90deg); }
details.disclosure > summary:hover { color: var(--text); }
details summary { cursor: pointer; }

.bar { height: 8px; background: var(--dim); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.4s ease; }
.progress { display: flex; align-items: center; gap: 10px; }
.progress .track { flex: 1 1; height: 6px; background: var(--dim); border-radius: 3px; overflow: hidden; }
.progress .fill { height: 100%; background: var(--accent); border-radius: 3px; }
.progress .pct { font-family: var(--font-mono); font-size: 11px; color: var(--muted); white-space: nowrap; }

/* Bar chart: heights are API-provided percentages; nothing is scaled here. */
.chart { display: flex; align-items: flex-end; gap: 4px; padding: 8px 0 0; min-height: 170px; border-bottom: 1px solid var(--border); }
.chart .col { flex: 1 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.chart .col .bars { display: flex; align-items: flex-end; gap: 3px; height: 130px; width: 100%; justify-content: center; }
.chart .col .b { width: 40%; max-width: 22px; background: var(--scope2); border-radius: 4px 4px 0 0; min-height: 2px; transition: height 0.4s ease; }
.chart .col .b.s1 { background: var(--scope1); }
.chart .col .b.s2 { background: var(--scope2); }
.chart .col .b.s3 { background: var(--scope3); }
.chart .col .l { font-family: var(--font-mono); font-size: 10px; color: var(--muted); white-space: nowrap; padding-bottom: 6px; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-top: 10px; align-items: center; }
.chart-legend .swatch { display: inline-block; width: 12px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.legend-list { display: flex; flex-direction: column; gap: 10px; }
.legend-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.legend-row .legend-name { flex: 1 1; min-width: 0; }
.legend-row .legend-val { font-family: var(--font-mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.legend-row .legend-val strong { color: var(--text); font-weight: 500; }

.tile-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); grid-gap: 12px; gap: 12px; }
.tile { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); display: block; transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; color: var(--text); position: relative; }
a.tile:hover { border-color: var(--accent); text-decoration: none; box-shadow: var(--shadow-md); transform: translateY(-1px); }
.tile h3 { font-size: 13.5px; }
.tile p { color: var(--muted); font-size: 12px; margin: 5px 0 0; font-family: var(--font-mono); }
.tile.s1 { border-left: 3px solid var(--scope1); } .tile.s2 { border-left: 3px solid var(--scope2); } .tile.s3 { border-left: 3px solid var(--scope3); }
.tile.disabled { opacity: 0.7; background: var(--surface2); }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); grid-gap: 16px; gap: 16px; }
.hub-card { display: flex; flex-direction: column; gap: 8px; padding: 20px 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.hub-card .hicon { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-light); color: var(--accent); display: grid; place-items: center; }
.hub-card .hicon svg { width: 19px; height: 19px; }
.hub-card .htitle { font-family: var(--font-head); font-size: 16px; font-weight: 700; }
.hub-card .hdesc { font-size: 13px; color: var(--muted); line-height: 1.5; flex: 1 1; }
.hub-card .hfoot { margin-top: 8px; }

.upload-zone { border: 2px dashed var(--border-strong); border-radius: 12px; padding: 24px 20px; text-align: center; background: var(--surface2); transition: all 0.2s; }
.upload-zone:hover, .upload-zone:focus-within { border-color: var(--accent); background: var(--accent-light); }
.upload-zone .uicon { width: 40px; height: 40px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); color: var(--accent); display: grid; place-items: center; margin: 0 auto 10px; }
.upload-zone .uicon svg { width: 20px; height: 20px; }
.upload-zone .utitle { font-family: var(--font-head); font-weight: 700; font-size: 14px; margin-bottom: 3px; }
.upload-zone .usub { font-size: 12px; color: var(--muted); font-family: var(--font-mono); margin-bottom: 12px; }
.upload-zone input[type=file] { border: 0; background: transparent; padding: 0; text-align: center; width: auto; }
.format-badge { font-family: var(--font-mono); font-size: 10px; padding: 3px 8px; border-radius: 4px; background: var(--dim); color: var(--muted); margin: 0 3px; }

/* Pagination · toolbar · toast */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1 1; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.toast-stack { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 90; }
.toast { padding: 12px 18px; border-radius: 10px; font-size: 13px; font-weight: 500; box-shadow: var(--shadow-md); background: var(--side-bg); color: #fff; max-width: 340px; animation: fadeIn 0.25s ease both; }
.toast.ok { background: var(--accent); } .toast.danger { background: var(--danger); }
/* Modal / drawer (native dialog) */
dialog.modal { border: 0; border-radius: var(--radius-lg); padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); background: var(--surface); color: var(--text); }
dialog.modal::-webkit-backdrop { background: rgba(26, 26, 24, 0.4); }
dialog.modal::backdrop { background: rgba(26, 26, 24, 0.4); }
dialog.modal .modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 0; }
dialog.modal .modal-title { font-family: var(--font-head); font-size: 16px; font-weight: 700; }
dialog.modal .modal-body { padding: 18px 24px; }
dialog.modal .modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 24px 20px; }
dialog.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(480px, 100vw); border-radius: 0; }

/* Print: a receipt on paper */
@media print { .sidebar, .utility-bar, .nav-backdrop, .page-header .actions, .form-actions, .btn { display: none !important; } .main-col { margin: 0; } .content { padding: 0; max-width: none; } .card { box-shadow: none; page-break-inside: avoid; break-inside: avoid; } body { background: #fff; } }

/* ══════════════════════════════════════════════════════════════════════════════
   PHASE B — customer journey components
   ══════════════════════════════════════════════════════════════════════════════ */
.period-picker { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 4px 6px 4px 12px; flex-wrap: wrap; }
.period-picker .pp-label { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.period-picker .pp-label .icon { width: 13px; height: 13px; }
.period-picker select, .period-picker input[type=date] { width: auto; padding: 5px 8px; font-size: 12.5px; background: var(--surface2); }
.period-picker select { padding-right: 28px; }
@media (max-width: 640px) { .period-picker { width: 100%; } }
.step-no { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-family: var(--font-mono); font-size: 11px; font-weight: 500; }
.search-box { position: relative; flex: 1 1; min-width: 220px; max-width: 460px; }
.search-box .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.search-box input[type=search] { padding-left: 34px; }
.lru-card { border-top: 3px solid var(--accent); }
.lru-card .card-header h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.article { font-size: 15px; line-height: 1.7; max-width: 760px; }
.article p { margin-bottom: 12px; }
.tile-list .tile.disabled h3 { color: var(--muted); }
.check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.check-list li { display: flex; gap: 8px; align-items: flex-start; }
.check-list li .icon { width: 15px; height: 15px; flex-shrink: 0; margin-top: 2px; }
.check-list li.ok .icon { color: var(--accent); } .check-list li.fail .icon { color: var(--danger); }
.check-list li.fail { color: var(--danger); }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); grid-gap: 14px; gap: 14px; }

/* ══════════════════════════════════════════════════════════════════════════════
   PHASE C — administration density + wrapping cells
   ══════════════════════════════════════════════════════════════════════════════ */
.table td.wrap { white-space: normal; overflow-wrap: anywhere; word-break: break-word; max-width: 300px; min-width: 160px; }
.table td .trace, .table td pre.trace { max-width: 420px; max-height: 200px; font-size: 11px; }
.sidebar.admin .nav-item .icon { opacity: 0.8; }
.admin-note { font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.table td form.row select, .table td form.row input[type=number] { width: auto; }
.table td form.row input[type=number] { min-width: 70px; }
.kv.dense { gap: 5px 16px; font-size: 13px; }

/* ══════════════════════════════════════════════════════════════════════════════
   PHASE D — responsiveness, focus, contrast and polish
   ══════════════════════════════════════════════════════════════════════════════ */
/* Focus rings on every interactive control, visible against light and dark surfaces */
.btn:focus-visible, .pill:focus-visible, .nav-item:focus-visible, .ulink:focus-visible, .user-chip:focus-visible, .tile:focus-visible, .side-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.9); }
.sidebar .nav-item:focus-visible, .sidebar .side-link:focus-visible, .sidebar-brand:focus-visible { outline-color: var(--side-green); box-shadow: none; }
.btn-primary:focus-visible { outline-color: var(--accent-hover); }
/* Long labels, codes and file names never overflow their cells */
.table td.wrap, .table td.mono { overflow-wrap: anywhere; }
.card-header h2 { overflow-wrap: anywhere; }
.page-header h1 { overflow-wrap: anywhere; }
/* Page header actions stack under the title on narrow screens */
@media (max-width: 720px) {
  .page-header { flex-direction: column; align-items: stretch; }
  .page-header > div:first-child { flex: none; }
  .page-header .actions { justify-content: flex-start; }
  .page-header .actions > * { max-width: 100%; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .spacer { display: none; }
  .form-actions { flex-direction: column-reverse; align-items: stretch; }
  .form-actions .left { margin-right: 0; }
  .form-actions .btn { width: 100%; }
  .receipt-head { flex-direction: column; align-items: flex-start; }
  .summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hub-grid { grid-template-columns: 1fr; }
  .tile-list { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr; }
  .card-header { padding: 14px 16px 12px; }
  .card-body { padding: 14px 16px 16px; }
  .chart .col .l { font-size: 9px; }
  .chart .col:nth-child(even) .l { visibility: hidden; }
  .ctx { width: 100%; }
  .ctx select { flex: 1 1; max-width: none; }
}
@media (max-width: 480px) {
  .summary-strip { grid-template-columns: 1fr; }
  .kpi-value { font-size: 22px; }
  .page-header h1 { font-size: 22px; }
  .utility-bar .ulink span { display: none; }
}
/* Print keeps the trace readable */
@media print { .trace, pre.trace { max-height: none; background: #fff; color: #000; border: 1px solid #ccc; } .table-wrap { overflow: visible; } }
/* Disabled controls */
select:disabled, input:disabled { opacity: 0.8; }
/* Details / summary hover */
details.disclosure > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

