/* ===========================================================================
   Expense Tracker - design tokens

   The same visual language as the Cold Calling CRM, ported from its Tailwind
   theme to plain CSS so this app keeps its zero-dependency build. Three layers,
   in order:

     1. PRIMITIVE  raw ramps. Never referenced by a component.
     2. SEMANTIC   what a colour means here. Components use only these.
     3. COMPONENT  per-part decisions built from the semantic layer.

   The direction is warm and colourful: a cream shell, white cards lifted off
   the page on soft shadows, and a coral accent for the one thing on a screen
   you are meant to press.

   Two things this deliberately is NOT:

   - It is not glass. Depth comes from shadow and radius, not transparency. A
     flat cream page has nothing to refract, and the ambient field that glass
     needs was what pushed small figures under AA in the CRM.
   - It is not a landing page. This is a money table. The colour and the radius
     are generous; the row height is not.
   =========================================================================== */

:root {
  /* --- 1. PRIMITIVE ------------------------------------------------------ */
  /* A warm-neutral ramp, so no grey ever drifts cool against its neighbour. */
  --warm-25: #fdfcfa;
  --warm-50: #faf8f5;
  --warm-100: #f4f1ec;
  --warm-150: #ede9e2;
  --warm-200: #e3ded5;
  --warm-300: #d2ccc0;
  --warm-400: #ada597;
  /* Darkened from #857d72, which measured 4.06:1 on white at 12.5px and so
     failed AA everywhere the faint ink is used - which is every empty cell. */
  --warm-500: #787066;
  --warm-600: #635c54;
  --warm-700: #443f38;
  --warm-800: #2a2622;
  --warm-900: #1b1917;

  /* Cream - the shell. The sidebar, and any surface that should read as paper
     rather than screen. */
  --cream-50: #fdfaf6;
  --cream-100: #f9f2e9;
  --cream-200: #f3e9dc;
  --cream-300: #e9dccb;
  --cream-400: #d8c7b0;

  /* Coral - the primary action colour. */
  --coral-50: #fef1ee;
  --coral-100: #fcdcd5;
  --coral-200: #f8b9ac;
  --coral-400: #f4705c;
  --coral-500: #ef5a45;
  --coral-600: #d64227;
  --coral-700: #a8321d;

  /* Teal - the second voice. */
  --teal-50: #eef8f6;
  --teal-100: #dcf0ec;
  --teal-200: #b5e0d8;
  --teal-400: #6cc0b5;
  --teal-500: #48a89c;
  --teal-600: #35897e;
  --teal-700: #266b62;

  /* Amber - attention without alarm. */
  --amber-50: #fef6e7;
  --amber-100: #fce9c4;
  --amber-200: #f7d491;
  --amber-400: #f0b03c;
  --amber-500: #dd961c;
  --amber-600: #b87610;
  --amber-700: #8c5906;

  --blue-50: #eef3fc;
  --blue-100: #d8e4f8;
  --blue-500: #4a7fd4;
  --blue-600: #3563b5;
  --blue-700: #27508f;
  --violet-50: #f3effa;
  --violet-100: #e5dcf4;
  --violet-500: #8b6bc4;
  --violet-600: #6f4fa8;
  --violet-700: #563d85;
  --green-50: #eef7f0;
  --green-100: #d7ecdc;
  --green-500: #46a463;
  --green-600: #33854c;
  --green-700: #24683a;

  /* --- 2. SEMANTIC ------------------------------------------------------- */
  --canvas: #fbf8f4;
  --surface: #ffffff;
  --surface-subtle: var(--warm-50);
  --surface-sunken: var(--warm-100);
  --surface-cream: var(--cream-200);

  --line: var(--warm-200);
  --line-strong: var(--warm-300);

  --ink: var(--warm-900);
  --ink-soft: var(--warm-700);
  --ink-muted: var(--warm-600);
  --ink-faint: var(--warm-500);
  --ink-invert: #ffffff;

  --accent-50: var(--coral-50);
  --accent-100: var(--coral-100);
  --accent-200: var(--coral-200);
  --accent-400: var(--coral-400);
  --accent-500: var(--coral-500);
  --accent-600: var(--coral-600);
  --accent-700: var(--coral-700);

  /* Status hues. Danger is a deeper, browner red than the coral accent on
     purpose - "delete" must never read as "save" at a glance. */
  --positive-bg: var(--green-50);
  --positive-line: var(--green-100);
  --positive-ink: var(--green-700);
  --info-bg: var(--blue-50);
  --info-line: var(--blue-100);
  --info-ink: var(--blue-700);
  --warn-bg: var(--amber-50);
  --warn-line: var(--amber-100);
  --warn-ink: var(--amber-700);
  --danger-bg: #fbeceb;
  --danger-line: #f2d2cf;
  --danger-ink: #a02017;

  /* --- charts ------------------------------------------------------------
     Each chart here is a SINGLE series - one measure, named by its panel
     title - so identity comes from the label beside each bar, never from a
     hue. That is why there is no categorical ramp: seventeen expense
     categories cannot be told apart by colour, and a filter that drops one
     would repaint the survivors.

     All three passed the six checks against both #ffffff and the cream canvas
     (lightness band, chroma floor, CVD separation across all pairs,
     normal-vision floor, 3:1 contrast). The CRM's own teal (#48a89c) did not -
     it measured 2.85:1 on white and read grey at chroma 0.082 - so the chart
     teal is a saturated, darker step. Do not "restore" it to match the
     buttons. */
  --chart-spend: var(--coral-500);
  --chart-person: #00907f;
  --chart-source: var(--blue-600);
  --chart-grid: var(--warm-150);
  --chart-track: var(--warm-100);

  /* --- 3. COMPONENT ----------------------------------------------------- */
  --radius-card: 18px;
  --radius-float: 22px;
  --radius-tile: 20px;
  --radius-control: 11px;
  --radius-chip: 999px;

  --row-h: 40px;
  --row-pad-x: 16px;
  --control-h-sm: 32px;
  --control-h-md: 36px;
  --control-h-lg: 40px;

  --sidebar-w: 236px;

  /* --- depth -------------------------------------------------------------
     What makes a card read as an object rather than a rectangle is a wide,
     very soft, warm-tinted shadow with almost no dark core. Warm-tinted
     rather than black: a neutral-black shadow over cream turns grey and drags
     the whole palette cold. */
  --shadow-card:
    0 1px 2px rgb(74 52 36 / 0.04),
    0 8px 22px -8px rgb(74 52 36 / 0.12);
  --shadow-raised:
    0 2px 6px rgb(74 52 36 / 0.05),
    0 18px 38px -12px rgb(74 52 36 / 0.18);
  --shadow-pop:
    0 6px 14px -2px rgb(74 52 36 / 0.10),
    0 34px 66px -20px rgb(74 52 36 / 0.30);
  --shadow-tint-coral: 0 10px 26px -10px rgb(239 90 69 / 0.45);
  --shadow-inset-top: inset 0 1px 0 rgb(255 255 255 / 0.5);

  --font-sans: 'Fira Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Fira Code', ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace;
}

/* =============================================================== base == */

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

* {
  scrollbar-width: thin;
  scrollbar-color: var(--warm-300) transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--warm-300);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}

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

/* A quiet warm wash on the page. Fixed and pointer-events-none, so it never
   moves with a scrolling table and never intercepts a click. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60rem 44rem at 6% -12%, rgb(239 90 69 / 0.07), transparent 60%),
    radial-gradient(54rem 40rem at 98% 4%, rgb(240 176 60 / 0.09), transparent 62%),
    radial-gradient(50rem 38rem at 78% 110%, rgb(72 168 156 / 0.08), transparent 60%);
}

body {
  margin: 0;
  background-color: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Figures line up column to column without being asked to twice. */
  font-variant-numeric: tabular-nums;
}

/* Headings carry the typographic contrast. The page title is deliberately
   large - it is the single biggest difference between this and a conventional
   dashboard, and it costs one line of vertical space, not a screenful. */
h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  text-wrap: balance;
}
h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
h3, h4 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.008em;
}
p { margin: 0; text-wrap: pretty; }

a { color: var(--accent-600); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Every figure is mono: a date, a count and a currency amount all have to be
   scannable down a column. */
.tnum, td.num, th.num, .figure {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* Keyboard focus is visible; a mouse click does not draw a ring. */
:focus-visible {
  outline: 2px solid var(--accent-500);
  outline-offset: 2px;
  border-radius: 3px;
}
::selection { background: var(--coral-100); color: var(--ink); }

.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;
}

/* ============================================================== cards == */

/* A card has border: 0. The shadow IS the edge. Add a hairline back and the
   card flattens into a boxed-off region and the depth is gone - this is the
   whole difference between this look and a conventional dashboard. */
.card {
  background: var(--surface);
  border: 0;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.card-pad { padding: 18px 20px; }
.card-cream { background: var(--surface-cream); }

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-head .hint { font-size: 12px; color: var(--ink-faint); }

/* ============================================================= layout == */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--cream-100);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; }
.brand-mark {
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 11px;
  background: linear-gradient(140deg, var(--coral-400), var(--coral-600));
  box-shadow: var(--shadow-tint-coral), var(--shadow-inset-top);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 15px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 13.5px; font-weight: 700; letter-spacing: -0.01em; }
.brand-text span { font-size: 11px; color: var(--ink-faint); }

.nav-section {
  padding: 14px 10px 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--control-h-lg);
  padding: 0 12px;
  border: 0;
  width: 100%;
  background: transparent;
  border-radius: var(--radius-control);
  font: inherit;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  text-align: left;
  transition: background 120ms ease, color 120ms ease;
}
.nav-link:hover { background: rgb(255 255 255 / 0.7); color: var(--ink); }
.nav-link.is-active {
  background: var(--surface);
  color: var(--accent-700);
  box-shadow: var(--shadow-card);
}
.nav-link .glyph { width: 18px; text-align: center; font-size: 14px; }

.sidebar-foot { margin-top: auto; padding-top: 16px; }
.who {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-card);
}
.who-name { font-weight: 700; font-size: 12.5px; }
.who-role { font-size: 11px; color: var(--ink-faint); }

.avatar {
  width: 30px; height: 30px; flex: 0 0 30px;
  border-radius: 999px;
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 11.5px;
  background: var(--warm-600);
}

.main {
  flex: 1 1 auto;
  min-width: 0;
  padding: 26px 30px 56px;
  max-width: 1500px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head .sub { margin-top: 6px; color: var(--ink-muted); font-size: 13px; }

/* ============================================================== tiles == */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.tile {
  border: 0;
  border-radius: var(--radius-tile);
  padding: 16px 18px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.tile-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.tile-value {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.tile-value .cur { font-size: 13px; font-weight: 600; color: var(--ink-faint); margin-left: 4px; }
.tile-foot { margin-top: 6px; font-size: 11.5px; color: var(--ink-faint); }

/* The accent tiles. A tinted face plus a tinted shadow, so the lead figure of
   the screen sits closer to the reader than the ones beside it. */
.tile-accent {
  background: linear-gradient(150deg, var(--coral-500), var(--coral-600));
  color: var(--ink-invert);
  box-shadow: var(--shadow-tint-coral), var(--shadow-inset-top);
}
.tile-accent .tile-label,
.tile-accent .tile-foot { color: rgb(255 255 255 / 0.82); }
.tile-accent .tile-value .cur { color: rgb(255 255 255 / 0.8); }

.tile-teal { background: var(--teal-50); }
.tile-amber { background: var(--amber-50); }
.tile-cream { background: var(--surface-cream); }

/* ============================================================= charts == */

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.chart { width: 100%; display: block; overflow: visible; }

/* Recessive grid and axes: the data is the only thing meant to be looked at. */
.chart .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .axis-text { fill: var(--ink-faint); font-size: 10.5px; font-family: var(--font-mono); }
.chart .bar { transition: opacity 120ms ease; }
.chart .bar:hover { opacity: 0.82; }
.chart .value-text { fill: var(--ink-soft); font-size: 10.5px; font-family: var(--font-mono); font-weight: 600; }

/* Horizontal-bar breakdowns. The label is the identity, so it is text, never a
   colour swatch, and it always shows. */
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(84px, 34%) 1fr auto; align-items: center; gap: 10px; }
.bar-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-track {
  position: relative;
  height: 15px;
  background: var(--chart-track);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: var(--chart-spend);
  min-width: 3px;
}
.bars-person .bar-fill { background: var(--chart-person); }
.bars-source .bar-fill { background: var(--chart-source); }
.bar-value {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.bar-share { font-size: 11px; color: var(--ink-faint); margin-left: 6px; }

/* "Where the money went": every category as a clickable row, facts beside it. */
.cat-card { margin-bottom: 18px; }
.cat-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 22px; align-items: start; }
.cat-list { display: flex; flex-direction: column; gap: 2px; }
.cat-row {
  display: grid;
  grid-template-columns: minmax(130px, 30%) 1fr auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease;
}
.cat-row:hover { background: var(--warm-50); }
.cat-row:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--coral-50); }
.cat-row.is-active { background: var(--coral-50); }
.cat-row.is-active .cat-name strong { color: var(--coral-700); }
.cat-name { display: flex; flex-direction: column; min-width: 0; }
.cat-name strong {
  font-size: 13px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cat-name span { font-size: 11.5px; color: var(--ink-faint); }
.cat-amount {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  min-width: 128px;
  text-align: right;
}
.cat-facts { display: flex; flex-direction: column; gap: 10px; }
.fact { background: var(--surface-cream); border-radius: 12px; padding: 12px 14px; }
.fact-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}
.fact-value { font-size: 17px; font-weight: 800; color: var(--ink); margin-top: 2px; font-variant-numeric: tabular-nums; }
.fact-foot { font-size: 11.5px; color: var(--ink-muted); margin-top: 1px; }

.statement-form { display: flex; flex-direction: column; gap: 12px; }
.statement-range { font-size: 12px; color: var(--ink-muted); margin-top: -4px; }

@media (max-width: 900px) {
  .cat-layout { grid-template-columns: 1fr; }
  .cat-facts { display: grid; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .cat-row { grid-template-columns: 1fr auto; }
  .cat-row .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .cat-amount { min-width: 0; }
}

/* ============================================================= tables == */

.table-wrap {
  border-radius: var(--radius-card);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }

.table-head th {
  position: sticky;
  top: 0;
  background: var(--surface-subtle);
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 10px var(--row-pad-x);
  white-space: nowrap;
  z-index: 1;
}
.table-head th.num { text-align: right; }

tbody tr { border-top: 1px solid var(--warm-100); }
tbody tr:hover { background: var(--warm-25); }
tbody td {
  height: var(--row-h);
  padding: 0 var(--row-pad-x);
  vertical-align: middle;
  color: var(--ink-soft);
  white-space: nowrap;
}
tbody td.num { text-align: right; font-family: var(--font-mono); color: var(--ink); font-weight: 600; }
tbody td.wrap { white-space: normal; min-width: 180px; }
tbody td.strong { color: var(--ink); font-weight: 600; }

.empty {
  padding: 34px 20px;
  text-align: center;
  color: var(--ink-faint);
}
.empty strong { display: block; color: var(--ink-soft); font-size: 14px; margin-bottom: 4px; }

/* ============================================ chips, badges, buttons == */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border-radius: var(--radius-chip);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.005em;
  background: var(--surface-sunken);
  color: var(--ink-muted);
  white-space: nowrap;
}
.chip-coral { background: var(--coral-50); color: var(--coral-700); }
.chip-teal { background: var(--teal-50); color: var(--teal-700); }
.chip-amber { background: var(--warn-bg); color: var(--warn-ink); }
.chip-blue { background: var(--info-bg); color: var(--info-ink); }
.chip-green { background: var(--positive-bg); color: var(--positive-ink); }
.chip-danger { background: var(--danger-bg); color: var(--danger-ink); }
.chip-lock { background: var(--violet-50); color: var(--violet-700); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: var(--control-h-md);
  padding: 0 15px;
  border: 0;
  border-radius: var(--radius-control);
  font: inherit;
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
  background: var(--surface);
  color: var(--ink-soft);
  box-shadow: var(--shadow-card);
  transition: transform 100ms ease, box-shadow 140ms ease, background 120ms ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-raised); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-card); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: var(--shadow-card); }

.btn-primary {
  background: linear-gradient(150deg, var(--coral-500), var(--coral-600));
  color: var(--ink-invert);
  box-shadow: var(--shadow-tint-coral), var(--shadow-inset-top);
}
.btn-primary:hover { box-shadow: 0 14px 32px -10px rgb(239 90 69 / 0.55), var(--shadow-inset-top); }

.btn-ghost { background: transparent; box-shadow: none; color: var(--ink-muted); }
.btn-ghost:hover { background: rgb(255 255 255 / 0.8); box-shadow: var(--shadow-card); }

.btn-danger { color: var(--danger-ink); }
.btn-danger:hover { background: var(--danger-bg); }

.btn-sm { height: var(--control-h-sm); padding: 0 11px; font-size: 11.5px; }
.btn-icon { width: var(--control-h-sm); padding: 0; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ============================================================== forms == */

/* A control carries a hairline, unlike a card: an input has to look like a
   place you can type, and without an edge it dissolves into the card. */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

input[type="text"], input[type="password"], input[type="number"],
input[type="date"], input[type="email"], select, textarea {
  height: var(--control-h-md);
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  width: 100%;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
textarea { height: auto; min-height: 66px; padding: 9px 11px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-400);
  box-shadow: 0 0 0 3px var(--coral-50);
}
input::placeholder, textarea::placeholder { color: var(--warm-400); }
input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent-500); }

.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 16px;
  padding: 14px 16px;
}
.filters .field { min-width: 132px; }
.filters .field > label { font-size: 10.5px; }

/* A segmented control for the day / month / year switch. */
.segment {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface-sunken);
  border-radius: var(--radius-control);
}
.segment button {
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 700;
  font-size: 12px;
  color: var(--ink-muted);
  height: 30px;
  padding: 0 14px;
  border-radius: 8px;
  cursor: pointer;
}
.segment button.is-active {
  background: var(--surface);
  color: var(--accent-700);
  box-shadow: var(--shadow-card);
}

/* ============================================= dialogs and messages == */

.modal-back {
  position: fixed;
  inset: 0;
  background: rgb(43 34 26 / 0.34);
  display: grid;
  place-items: center;
  padding: 22px;
  z-index: 50;
}
.modal {
  background: var(--surface);
  border: 0;
  border-radius: var(--radius-float);
  box-shadow: var(--shadow-pop);
  width: min(560px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: 22px 24px 24px;
}
.modal h2 { margin-bottom: 4px; }
.modal .sub { color: var(--ink-muted); font-size: 12.5px; margin-bottom: 16px; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-grid .span-2 { grid-column: 1 / -1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.note {
  padding: 11px 14px;
  border-radius: var(--radius-control);
  font-size: 12.5px;
  font-weight: 600;
}
.note-danger { background: var(--danger-bg); color: var(--danger-ink); }
.note-warn { background: var(--warn-bg); color: var(--warn-ink); }
.note-info { background: var(--info-bg); color: var(--info-ink); }
.note-ok { background: var(--positive-bg); color: var(--positive-ink); }

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 60;
}
.toast {
  padding: 11px 15px;
  border-radius: var(--radius-control);
  background: var(--warm-800);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: var(--shadow-pop);
  max-width: 340px;
}
.toast-bad { background: var(--danger-ink); }
.toast-good { background: var(--green-700); }

/* =============================================================== login == */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(390px, 100%);
  padding: 30px 30px 26px;
  border: 0;
  border-radius: var(--radius-float);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
}
.login-card .brand { justify-content: center; padding-bottom: 18px; }
.login-card h1 { font-size: 26px; text-align: center; }
.login-card .sub { text-align: center; color: var(--ink-muted); margin: 7px 0 22px; font-size: 13px; }
.login-card .field { margin-bottom: 13px; }
.login-card .btn { width: 100%; height: var(--control-h-lg); }
.login-foot { margin-top: 18px; text-align: center; font-size: 11.5px; color: var(--ink-faint); }

/* ============================================================ utility == */

.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap-gap { display: flex; flex-wrap: wrap; gap: 10px; }
.muted { color: var(--ink-muted); }
.faint { color: var(--ink-faint); }
.small { font-size: 11.5px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.hidden { display: none !important; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }
.grow { flex: 1 1 auto; min-width: 0; }
.right { text-align: right; }

/* ========================================================= responsive == */

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex: 0 0 auto;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px;
  }
  .brand { padding: 0 8px 0 0; }
  .nav-section { display: none; }
  .nav-link { width: auto; height: var(--control-h-sm); font-size: 12px; }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; }
  .who { padding: 6px 10px; }
  .main { padding: 18px 16px 44px; }
  h1 { font-size: 27px; }
  .tile-value { font-size: 22px; }
  .modal-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .who-name, .who-role { display: none; }
  .bar-row { grid-template-columns: minmax(70px, 40%) 1fr auto; }
}

@media print {
  .sidebar, .btn, .filters { display: none !important; }
  body::before { display: none; }
  .card { box-shadow: none; border: 1px solid var(--line); }
}
