/* Treasury app styles.
   Colours, radii, shadows, sizes and durations come from howler-tokens.css (the Howler Design System).
   Raw hex is allowed only in the small "derived tokens" block below, for the three status-chip text colours
   the design system's StatusChip component defines but does not export as variables.
   Light ground, per the UX guidelines: dark is reserved for live-event surfaces, which Treasury does not have. */

:root {
  /* Derived tokens: copied from components/StatusChip in the design system. */
  --chip-live-fg: #8D5F00;
  --chip-success-fg: #12833C;
  --chip-info-fg: #3B45C4;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg-raised);
  color: var(--fg-1);
  font-size: var(--fs-16);
  line-height: var(--lh-relaxed);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-pressed); text-underline-offset: 2px; transition: color var(--dur-base) var(--ease-out); }
a:hover { color: var(--howler-midnight); }

:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-1); }

code { font-family: var(--font-mono); font-size: 0.92em; background: var(--bg-sunken); padding: 1px 6px; border-radius: var(--radius-1); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip-link {
  position: absolute; left: var(--space-4); top: -100px; z-index: 100;
  background: var(--howler-midnight); color: var(--howler-white);
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-2);
}
.skip-link:focus { top: var(--space-4); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100dvh; }

.sidebar {
  position: sticky; top: 0; align-self: start; height: 100dvh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-default);
  padding: var(--space-6) var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-8);
}

.brand { display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-2); text-decoration: none; }
.brand img { display: block; }
.brand-sub {
  font-size: var(--fs-12); font-weight: var(--fw-bold); letter-spacing: var(--tracking-caps);
  text-transform: uppercase; color: var(--fg-2);
  padding-left: var(--space-3); border-left: 1px solid var(--border-default);
}

.nav { display: flex; flex-direction: column; gap: var(--space-1); }
.nav-link {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  min-height: 44px; padding: 0 var(--space-3);
  border-radius: var(--radius-2);
  color: var(--fg-2); font-weight: var(--fw-semibold); font-size: var(--fs-14); text-decoration: none;
  transition: background var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out);
}
.nav-link:hover { background: var(--bg-sunken); color: var(--fg-1); }
/* Active item: Ember label (the pressed shade, which clears 4.5:1 on white) plus a bar, so it is not colour alone. */
.nav-link.active { color: var(--accent-pressed); background: rgba(255, 26, 77, 0.08); }
.nav-link.active::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px;
  border-radius: var(--radius-pill); background: var(--accent);
}
.nav-soon {
  font-size: var(--fs-12); font-weight: var(--fw-semibold); color: var(--fg-3);
  background: var(--bg-sunken); padding: 1px var(--space-2); border-radius: var(--radius-pill);
}

.content { min-width: 0; }
main { max-width: 1200px; margin: 0 auto; padding: var(--space-10) var(--space-8) var(--space-16); outline: none; }

/* ---------- headings and text ---------- */
.eyebrow { margin: 0 0 var(--space-2); font-size: var(--fs-12); font-weight: var(--fw-bold); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--fg-2); }
.page-head { margin-bottom: var(--space-8); }
.page-title { margin: 0; font-size: clamp(1.75rem, 3vw, var(--fs-40)); font-weight: var(--fw-extrabold); line-height: var(--lh-tight); letter-spacing: var(--tracking-tight); }
.page-lead { margin: var(--space-3) 0 0; max-width: 65ch; color: var(--fg-2); font-size: var(--fs-18); }
.h5 { margin: 0; font-size: var(--fs-16); font-weight: var(--fw-semibold); line-height: var(--lh-snug); }
.section-h { margin-top: var(--space-6); margin-bottom: var(--space-3); }
.body { margin: 0; max-width: 65ch; }
.caption { margin: var(--space-1) 0 0; font-size: var(--fs-13); line-height: var(--lh-normal); color: var(--fg-2); }
.hint { margin: var(--space-2) 0 0; max-width: 65ch; font-size: var(--fs-14); color: var(--fg-2); }

/* ---------- cards ---------- */
.card {
  margin-bottom: var(--space-6); padding: var(--space-6);
  background: var(--bg-surface); border-radius: var(--radius-4); box-shadow: var(--shadow-md);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-4); }
.card-title { margin: 0; font-size: var(--fs-20); font-weight: var(--fw-bold); letter-spacing: var(--tracking-snug); line-height: var(--lh-snug); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6); margin-bottom: var(--space-6); }
.grid-2 > .card { margin-bottom: 0; }

/* ---------- tables: square corners are allowed for data tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-14); }
.table th, .table td { padding: var(--space-3) var(--space-4); text-align: left; vertical-align: top; border-bottom: 1px solid var(--border-subtle); }
.table thead th { font-size: var(--fs-12); font-weight: var(--fw-bold); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--fg-2); border-bottom: 1px solid var(--border-default); white-space: nowrap; }
.table tbody th { font-weight: var(--fw-semibold); white-space: nowrap; }
.table tbody tr:hover { background: var(--bg-raised); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-compact th, .table-compact td { padding: var(--space-2) var(--space-4); }

/* ---------- status chips: tone is never colour alone, the text always says it too ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: var(--radius-pill);
  font-size: var(--fs-12); font-weight: var(--fw-semibold); line-height: 1.3; white-space: nowrap;
  background: var(--bg-sunken); color: var(--gray-600);
}
.chip-dot { width: 7px; height: 7px; flex-shrink: 0; border-radius: var(--radius-pill); background: var(--gray-400); }
.chip-live    { background: rgba(255, 178, 0, 0.14); color: var(--chip-live-fg); }
.chip-live .chip-dot    { background: var(--howler-yellow); }
.chip-urgent  { background: rgba(255, 26, 77, 0.10); color: var(--accent-pressed); }
.chip-urgent .chip-dot  { background: var(--howler-ember); }
.chip-success { background: rgba(22, 163, 74, 0.10); color: var(--chip-success-fg); }
.chip-success .chip-dot { background: var(--success); }
.chip-info    { background: rgba(94, 106, 254, 0.12); color: var(--chip-info-fg); }
.chip-info .chip-dot    { background: var(--howler-violet); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; }
.label { margin-bottom: var(--space-2); font-size: var(--fs-14); font-weight: var(--fw-semibold); }
.file-input {
  max-width: 520px; min-height: 44px; padding: var(--space-3);
  font: inherit; font-size: var(--fs-14); color: var(--fg-1);
  background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-3);
}
.file-input::file-selector-button {
  min-height: 36px; margin-right: var(--space-3); padding: var(--space-2) var(--space-4);
  font: inherit; font-weight: var(--fw-semibold); color: var(--fg-1); cursor: pointer;
  background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-2);
  transition: background var(--dur-base) var(--ease-out);
}
.file-input::file-selector-button:hover { background: var(--bg-raised); }
.status-line { min-height: var(--space-6); margin-top: var(--space-3); font-size: var(--fs-14); color: var(--fg-2); }
.error { color: var(--accent-pressed); font-weight: var(--fw-semibold); }
.error [aria-hidden] {
  display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 6px;
  font-size: var(--fs-12); color: var(--accent-ink); background: var(--accent-pressed); border-radius: var(--radius-pill);
}

/* ---------- buttons: 8/10/12px radii, never a pill ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 44px; padding: 0 var(--space-5);
  font: inherit; font-size: var(--fs-14); font-weight: var(--fw-semibold); letter-spacing: 0.005em;
  color: var(--fg-1); cursor: pointer;
  background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-3);
  transition: background var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.btn:hover:not(:disabled) { background: var(--bg-raised); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn-primary { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); box-shadow: 0 6px 18px rgba(255, 26, 77, 0.32); }
.btn-primary:hover:not(:disabled) { background: var(--accent-pressed); border-color: var(--accent-pressed); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); }
.actions .hint { margin: 0; }

/* ---------- import summary ---------- */
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }
.stat { padding: var(--space-5); background: var(--bg-surface); border-radius: var(--radius-4); box-shadow: var(--shadow-sm); }
.stat-wide { grid-column: 1 / -1; }
.stat-figure { margin: 0; font-size: var(--fs-28); font-weight: var(--fw-extrabold); letter-spacing: var(--tracking-tight); line-height: var(--lh-snug); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
/* Text figures (batch names) are smaller and break only at hyphens, never mid-number. */
.stat-figure-text { font-size: var(--fs-20); overflow-wrap: break-word; }
.money-neg { color: var(--accent-pressed); }
.result-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); max-width: none; }
.note { max-width: 70ch; margin: var(--space-4) 0 0; padding: var(--space-3) var(--space-4); font-size: var(--fs-14); background: var(--bg-raised); border-radius: var(--radius-3); }
.note-urgent { background: rgba(255, 26, 77, 0.08); }

/* ---------- framework error banner ---------- */
#blazor-error-ui {
  position: fixed; bottom: 0; left: 0; z-index: 1000; display: none; width: 100%;
  padding: var(--space-3) var(--space-5); color: var(--howler-white); background: var(--howler-midnight);
}
#blazor-error-ui .reload { margin-left: var(--space-3); color: var(--howler-white); }
#blazor-error-ui .dismiss {
  margin-left: var(--space-3); padding: var(--space-1) var(--space-3);
  font: inherit; color: var(--howler-white); cursor: pointer;
  background: transparent; border: 1px solid var(--border-on-dark); border-radius: var(--radius-2);
}

/* ---------- responsive: the nav becomes a top bar below 900px ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row; align-items: center; gap: var(--space-4);
    padding: var(--space-3) var(--space-4); overflow-x: auto;
    border-right: 0; border-bottom: 1px solid var(--border-default);
  }
  .nav { flex-direction: row; }
  .nav-link { white-space: nowrap; }
  .nav-soon { display: none; }
  .nav-link.active::before { top: auto; left: 10px; right: 10px; bottom: 0; width: auto; height: 3px; }
  main { padding: var(--space-6) var(--space-4) var(--space-12); }
  .grid-2 { grid-template-columns: 1fr; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

.form-actions { margin-top: var(--space-4); }

/* ---------- sign-in and forms ---------- */
.login-shell { display: grid; place-items: center; min-height: 100dvh; padding: var(--space-6) var(--space-4); }
.login-card { width: 100%; max-width: 420px; padding: var(--space-8); background: var(--bg-surface); border-radius: var(--radius-4); box-shadow: var(--shadow-md); outline: none; }
.login-logo { display: block; margin-bottom: var(--space-6); }
.login-title { margin: 0 0 var(--space-4); font-size: var(--fs-24); font-weight: var(--fw-extrabold); letter-spacing: var(--tracking-tight); line-height: var(--lh-snug); }
.form-stack { display: flex; flex-direction: column; gap: var(--space-4); }
.input {
  width: 100%; min-height: 44px; padding: var(--space-2) var(--space-3);
  font: inherit; font-size: var(--fs-16); color: var(--fg-1);
  background: var(--bg-surface); border: 1px solid var(--border-strong); border-radius: var(--radius-3);
}
.input:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.btn-block { width: 100%; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--fg-2); min-height: 36px; padding: 0 var(--space-3); }
.btn-quiet:hover:not(:disabled) { background: var(--bg-sunken); color: var(--fg-1); }
.note-ok { background: rgba(22, 163, 74, 0.10); }

.user-chip { margin-top: auto; padding: var(--space-3); border-top: 1px solid var(--border-subtle); }
.user-name { margin: 0; font-size: var(--fs-14); font-weight: var(--fw-semibold); }
.user-link { display: inline-block; margin: var(--space-1) 0 var(--space-2); font-size: var(--fs-13); }
.user-signout { margin: 0; }
.stat-link { color: inherit; text-decoration: none; }
.stat-link:hover { color: var(--accent-pressed); text-decoration: underline; }
.code-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2) var(--space-6); padding: 0; margin: var(--space-4) 0; list-style: none; max-width: 360px; }
.code-list code { font-size: var(--fs-16); }
.secret { display: inline-block; padding: var(--space-1) var(--space-2); font-size: var(--fs-16); letter-spacing: 0.08em; }
.steps { padding-left: var(--space-5); max-width: 65ch; }
.steps li { margin-bottom: var(--space-2); }

@media (max-width: 900px) {
  .user-chip { margin-top: 0; margin-left: auto; padding: 0 var(--space-2); border-top: 0; display: flex; align-items: center; gap: var(--space-3); }
  .user-link { margin: 0; }
}

/* ---- Overview dashboard ------------------------------------------------------------------------------------ */
.ov-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-5); }
.period-tabs { display: inline-flex; padding: 3px; background: var(--bg-raised); border-radius: var(--radius-pill); }
.period-tab { padding: 6px 14px; border-radius: var(--radius-pill); font-size: var(--fs-13); font-weight: var(--fw-semibold); color: var(--fg-2); text-decoration: none; }
.period-tab:hover { color: var(--fg-1); }
.period-tab.active { background: var(--bg-surface); color: var(--fg-1); box-shadow: var(--shadow-sm); }
.quick-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.kpi-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }
.kpi { display: flex; flex-direction: column; gap: var(--space-1); min-height: 164px; padding: var(--space-5); background: var(--bg-surface); border-radius: var(--radius-4); box-shadow: var(--shadow-sm); min-width: 0; }
.kpi .eyebrow { margin-bottom: var(--space-1); }
.kpi-figure { margin: 0; font-size: var(--fs-28); font-weight: var(--fw-extrabold); letter-spacing: var(--tracking-tight); line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-unit { margin-left: 2px; font-size: var(--fs-16); font-weight: var(--fw-semibold); color: var(--fg-2); }
.kpi-delta { display: inline-flex; align-items: center; gap: 4px; margin: 0; font-size: var(--fs-13); font-weight: var(--fw-semibold); }
.kpi-delta.good { color: var(--chip-success-fg); }
.kpi-delta.bad { color: var(--accent-pressed); }
.kpi-delta.flat { color: var(--fg-2); }
.kpi .caption { margin-top: 0; }
.kpi-spark { margin-top: auto; }
.spark { display: block; width: 100%; height: 36px; overflow: visible; }
.spark-line { fill: none; stroke: var(--howler-violet); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark-area { fill: var(--howler-violet); opacity: 0.10; }
.spark-dot { fill: var(--howler-violet); }
.spark.good .spark-line, .spark.good .spark-dot { stroke: var(--success); fill: var(--success); }
.spark.good .spark-line { fill: none; }
.spark.good .spark-area { fill: var(--success); }
.spark.bad .spark-line, .spark.bad .spark-dot { stroke: var(--howler-ember); fill: var(--howler-ember); }
.spark.bad .spark-line { fill: none; }
.spark.bad .spark-area { fill: var(--howler-ember); }
.panel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6); align-items: stretch; }
.panel { min-width: 0; }
.panel.span-2 { grid-column: 1 / -1; }
.panel > .card { height: 100%; margin-bottom: 0; }
.meter { display: block; width: 100%; height: 8px; }
.meter-track { fill: var(--bg-raised); }
.meter-fill { fill: var(--howler-violet); }
.meter.good .meter-fill { fill: var(--success); }
.meter.warn .meter-fill { fill: var(--howler-yellow); }
.meter.bad .meter-fill { fill: var(--howler-ember); }
.meter-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(90px, 1fr) auto; gap: var(--space-3); align-items: center; padding: var(--space-2) 0; border-bottom: 1px solid var(--border-subtle); }
.meter-row:last-child { border-bottom: 0; }
.meter-row .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.meter-label { margin: 0; font-weight: var(--fw-semibold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter-sub { margin: 0; font-size: var(--fs-13); color: var(--fg-2); }
.bars { display: block; width: 100%; height: 72px; }
.bar { fill: var(--howler-violet); opacity: 0.55; }
.bar.last { opacity: 1; }
.bar.neg { fill: var(--howler-ember); }
.chart-foot { display: flex; justify-content: space-between; margin: var(--space-1) 0 0; font-size: var(--fs-12); color: var(--fg-2); }
.worklist { list-style: none; margin: 0; padding: 0; }
.worklist li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-3); align-items: start; padding: var(--space-3) 0; border-bottom: 1px solid var(--border-subtle); }
.worklist li:last-child { border-bottom: 0; }
.w-title { margin: 0; font-weight: var(--fw-semibold); }
.w-sub { margin: 2px 0 0; font-size: var(--fs-13); color: var(--fg-2); }
.w-amt { max-width: 13rem; font-variant-numeric: tabular-nums; font-weight: var(--fw-semibold); text-align: right; }
.w-amt .money { white-space: nowrap; }
.w-amt .caption { margin: 2px 0 0; font-weight: var(--fw-regular); }
.ageing { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3); margin-top: var(--space-4); }
.age { padding: var(--space-3) var(--space-4); border-radius: var(--radius-3); background: var(--bg-raised); }
.age .eyebrow { margin-bottom: 2px; }
.age-figure { margin: 0; font-size: var(--fs-20); font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; }
.age.hot { background: rgba(255, 26, 77, 0.08); }
.age.hot .age-figure { color: var(--accent-pressed); }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--border-subtle); font-size: var(--fs-14); line-height: var(--lh-normal); }
.feed li:last-child { border-bottom: 0; }
.feed time { flex: 0 0 7rem; color: var(--fg-2); font-size: var(--fs-13); font-variant-numeric: tabular-nums; }
.total-row td, .total-row th { font-weight: var(--fw-bold); border-top: 2px solid var(--border-default); }
.sub-h { margin: var(--space-5) 0 var(--space-2); font-size: var(--fs-14); font-weight: var(--fw-bold); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--fg-2); }
.sub-h:first-child { margin-top: 0; }
@media (max-width: 960px) { .panel-grid { grid-template-columns: 1fr; } .ageing { grid-template-columns: repeat(2, 1fr); } }

/* ==== Signature look ===========================================================================================
   The Owl treatment, app-wide: a cosmos-gradient hero on every page header, a dark sidebar, softer cards with a
   lift on hover, and figures set large. Later rules here override the plainer ones above. */

body {
  background:
    radial-gradient(900px 480px at 100% -8%, rgba(94, 106, 254, 0.10), transparent 60%),
    radial-gradient(700px 420px at -10% 110%, rgba(255, 26, 77, 0.06), transparent 60%),
    var(--bg-raised);
  background-attachment: fixed;
}

/* ---- sidebar: midnight, with the wordmark knocked out to white ---- */
.sidebar {
  background: linear-gradient(180deg, var(--howler-midnight) 0%, var(--bg-surface-dark) 100%);
  border-right: 0; box-shadow: var(--shadow-lg); color: var(--fg-on-dark-1);
}
.brand img { filter: brightness(0) invert(1); }
.brand-sub { color: var(--howler-yellow); border-left-color: var(--border-on-dark); }
.nav-link { color: var(--fg-on-dark-2); }
.nav-link:hover { background: rgba(255, 255, 255, 0.06); color: var(--fg-on-dark-1); }
.nav-link.active { color: var(--fg-on-dark-1); background: rgba(255, 255, 255, 0.10); box-shadow: inset 0 0 0 1px var(--border-on-dark); }
.nav-link.active::before { background: var(--howler-gradient-ember); }
.nav-soon { background: rgba(255, 255, 255, 0.08); color: var(--fg-on-dark-3); }
.user-chip { border-top-color: var(--border-on-dark); }
.user-name { color: var(--fg-on-dark-1); }
.user-link { color: var(--howler-yellow); }
.user-link:hover { color: var(--fg-on-dark-1); }
.sidebar .btn-quiet { color: var(--fg-on-dark-2); }
.sidebar .btn-quiet:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); color: var(--fg-on-dark-1); }
.sidebar :focus-visible { outline-color: var(--howler-yellow); }

/* ---- page hero ---- */
.page-head {
  position: relative; overflow: hidden; isolation: isolate;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-8); align-items: center;
  margin-bottom: var(--space-8); padding: var(--space-8) var(--space-10);
  border-radius: var(--radius-5); background: var(--howler-gradient-cosmos); color: var(--fg-on-dark-1);
  box-shadow: var(--shadow-glow-violet);
}
.page-head:has(.page-head-aside) { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.page-head::after {
  content: ""; position: absolute; z-index: -1; inset: auto -12% -70% auto; width: 58%; aspect-ratio: 1; border-radius: 50%;
  background: var(--howler-gradient-radial); opacity: 0.35; pointer-events: none;
}
.page-eyebrow { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); color: var(--howler-yellow); font-size: var(--fs-13); }
.page-eyebrow-mark { width: 9px; height: 9px; border-radius: 2px; background: var(--howler-yellow); transform: rotate(45deg); box-shadow: 0 0 12px rgba(255, 178, 0, 0.7); }
.page-title { font-family: var(--font-display); font-size: clamp(2rem, 4vw, var(--fs-48)); color: var(--fg-on-dark-1); }
.page-lead { color: var(--fg-on-dark-2); line-height: var(--lh-relaxed); }
.page-head a { color: var(--howler-yellow); }
.page-head :focus-visible { outline-color: var(--howler-yellow); }

/* ---- cards ---- */
.card {
  border-radius: var(--radius-5); border: 1px solid rgba(22, 30, 111, 0.06); box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur-base) var(--ease-out);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-title { font-family: var(--font-display); font-weight: var(--fw-extrabold); }
.card-title::before {
  content: ""; display: inline-block; width: 4px; height: 0.9em; margin-right: var(--space-3); vertical-align: -0.08em;
  border-radius: var(--radius-pill); background: var(--howler-gradient-ember);
}

/* ---- headline figures: KPI tiles and import summaries ---- */
.kpi, .stat {
  position: relative; overflow: hidden; border: 1px solid rgba(22, 30, 111, 0.06); border-radius: var(--radius-5);
  transition: box-shadow var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
.kpi::before, .stat::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--howler-gradient); }
.kpi:hover, .stat:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi-figure, .stat-figure { font-family: var(--font-display); }
.stat-figure-text { font-size: var(--fs-20); }
.age { border-radius: var(--radius-4); }

/* ---- tables ---- */
.table thead th { background: var(--bg-raised); border-bottom: 0; }
.table thead th:first-child { border-top-left-radius: var(--radius-3); border-bottom-left-radius: var(--radius-3); }
.table thead th:last-child { border-top-right-radius: var(--radius-3); border-bottom-right-radius: var(--radius-3); }
.table tbody tr { transition: background var(--dur-fast) var(--ease-out); }
.table tbody tr:hover { background: rgba(94, 106, 254, 0.05); }

/* ---- buttons, inputs, tabs ---- */
a.btn { text-decoration: none; }
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-primary:hover:not(:disabled) { box-shadow: var(--shadow-glow-ember); }
.btn-quiet:hover:not(:disabled) { transform: none; box-shadow: none; }
.input, .file-input { border-color: var(--border-default); transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
.input:hover, .file-input:hover { border-color: var(--border-strong); }
.input:focus-visible { outline: none; border-color: var(--howler-violet); box-shadow: 0 0 0 4px rgba(94, 106, 254, 0.22); }
.period-tabs { background: var(--bg-surface); box-shadow: var(--shadow-xs); border: 1px solid rgba(22, 30, 111, 0.06); }
.period-tab.active { background: var(--howler-gradient-cosmos); color: var(--fg-on-dark-1); }

/* ---- notes ---- */
.note { border-left: 3px solid var(--howler-violet); }
.note-urgent { border-left-color: var(--danger); }
.note-ok { border-left-color: var(--success); }

/* ---- sign-in: the card floats on the cosmos ---- */
.login-shell { position: relative; overflow: hidden; isolation: isolate; background: var(--howler-gradient-cosmos); }
.login-shell::after {
  content: ""; position: absolute; z-index: -1; right: -15%; bottom: -35%; width: 70vmax; aspect-ratio: 1; border-radius: 50%;
  background: var(--howler-gradient-radial); opacity: 0.35; pointer-events: none;
}
.login-card { border-radius: var(--radius-6); box-shadow: var(--shadow-xl); }
.login-title { font-family: var(--font-display); }

@media (max-width: 900px) {
  .sidebar { box-shadow: var(--shadow-md); }
  .page-head, .page-head:has(.page-head-aside) { grid-template-columns: minmax(0, 1fr); padding: var(--space-6); }
}

@media print {
  body { background: none; }
  .page-head { background: none; color: var(--fg-1); box-shadow: none; padding: 0; }
  .page-head::after { display: none; }
  .page-title, .page-lead { color: var(--fg-1); }
  .page-eyebrow { color: var(--fg-2); }
}

/* ---- sign-in: brand story on the left, the form on the right ---- */
.login-shell { grid-template-columns: minmax(0, 1.1fr) minmax(0, 420px); gap: var(--space-16); max-width: none; padding: var(--space-10) clamp(var(--space-6), 8vw, var(--space-24)); }
.login-hero { max-width: 560px; justify-self: end; color: var(--fg-on-dark-1); }
.login-hero-logo { display: block; margin-bottom: var(--space-10); filter: brightness(0) invert(1); }
.login-hero-title { margin: 0; font-family: var(--font-display); font-size: clamp(2.5rem, 5vw, var(--fs-60)); font-weight: var(--fw-extrabold); letter-spacing: var(--tracking-tight); line-height: var(--lh-tight); }
.login-hero-lead { margin: var(--space-4) 0 var(--space-8); max-width: 44ch; font-size: var(--fs-18); line-height: var(--lh-relaxed); color: var(--fg-on-dark-2); }
.login-hero-points { display: grid; gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
.login-hero-points li {
  display: flex; align-items: center; gap: var(--space-3); width: fit-content; padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill); border: 1px solid var(--border-on-dark); background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(6px); font-size: var(--fs-14); color: var(--fg-on-dark-1);
}
.login-hero-points li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--howler-yellow); box-shadow: 0 0 10px rgba(255, 178, 0, 0.8); }
.login-shell .login-card { justify-self: start; }
.login-shell .login-logo { display: none; }

@media (max-width: 900px) {
  .login-shell { grid-template-columns: minmax(0, 1fr); padding: var(--space-6) var(--space-4); }
  .login-hero { display: none; }
  .login-shell .login-card { justify-self: center; }
  .login-shell .login-logo { display: block; }
}
