/* SYS060 — Fortescue Savings Dashboard
   Design tokens and components. Rules live in .claude/docs/design.md; change tokens here only. */

/* Söhne is Fortescue's face (commercial, not licensed to us). Inter is the stand-in, self-hosted. */
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Fortescue-derived palette */
  --fg-bg: #ffffff;
  --fg-surface: #f5f6f5;
  --fg-text: #2d2d2d;
  --fg-text-muted: #6b6b6b;
  --fg-border: #e1e3e1;
  --fg-green: #00ff00;          /* accent only — sparingly */
  --fg-green-deep: #00a651;     /* readable green for buttons, links, savings series */
  --fg-green-tint: #e6ffe6;
  --fg-footer-bg: #292929;
  --fg-footer-text: #c8c8c8;
  --fg-footer-btn: #4a4a4a;
  --fg-danger: #c62828;
  --fg-warn: #e08a00;

  /* Dashboard greens (project-team mock, 2026-09-14): deep Fortescue green for emphasis, tints for support */
  --dk-green: #0f6b4f;          /* hero tile, table header, "new savings" bars */
  --dk-green-2: #0a563f;        /* hero gradient end */
  --mid-green: #a9dcc6;         /* "ongoing savings" bars */
  --lt-green: #e6f4ee;          /* soft tile background, total row tint */
  --lt-green-2: #d3ebdf;        /* soft tile border */

  /* Cancellation-type tones (tiles, table dots, donuts) */
  --tone-orange: #ee7d2a;       /* BAU */
  --tone-purple: #6a5acd;       /* Monthly Audit */
  --tone-blue: #2b8cc4;         /* Exception */
  --tone-teal: #21a3a3;         /* Reactivations */
  --tone-slate: #5f7083;        /* No Usage */
  --tone-grey: #9aa5b1;         /* Other */

  /* Data-viz palette (also read by app.js via getComputedStyle) */
  --viz-1: #00a651;
  --viz-1-soft: #9fdcb9;
  --viz-2: #1f6f8b;
  --viz-3: #f2a541;
  --viz-4: #7b5ea7;
  --viz-5: #9aa5b1;
  --viz-grid: #e1e3e1;

  --radius: 12px;
  --container: 1600px;          /* desktop / widescreen by design */
  --gutter: 24px;
  --font: sohne, "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}

/* ---- Base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
/* Author display rules (e.g. .modal { display:flex }) beat the UA's [hidden] { display:none }.
   Re-assert it so el.hidden = true always hides — the upload modal was stuck open without this (2026-09-14). */
[hidden] { display: none !important; }
html { font-size: 16px; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--fg-bg);
  color: var(--fg-text);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--fg-green-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
:focus-visible { outline: 3px solid var(--fg-green); outline-offset: 2px; }
.muted { color: var(--fg-text-muted); }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
.site-main { flex: 1; padding-block: 32px; }
.card { background: var(--fg-surface); border: 1px solid var(--fg-border); border-radius: var(--radius); }
.inline-form { display: inline; }

/* ---- Header -------------------------------------------------------------- */
.site-header { background: var(--fg-bg); border-bottom: 1px solid var(--fg-border); }
.site-header__inner { display: flex; align-items: center; gap: 20px; min-height: 76px; }
.site-header__divider { width: 1px; height: 40px; background: var(--fg-border); }
.site-header__title { font-size: 1.375rem; color: var(--fg-text); font-weight: 600; flex: 1; letter-spacing: -0.015em; }
.site-header__page { color: var(--fg-text-muted); font-weight: 500; }
.site-header__user { display: flex; align-items: center; gap: 10px; }
.user-name { font-weight: 500; margin-right: 6px; }

.brand { display: inline-flex; align-items: center; color: inherit; line-height: 0; }
.brand:hover { text-decoration: none; }
.brand__logo { height: 40px; width: auto; display: block; }
.brand__logo--vendor { height: 30px; }

.role-badge {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; color: #fff; background: var(--viz-5);
}
.role-badge--manager { background: var(--fg-green-deep); }
.role-badge--admin { background: var(--fg-text); }

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--fg-green-deep); color: #fff; }
.btn--primary:hover { background: #008f46; }
.btn--secondary { background: var(--fg-bg); color: var(--fg-text); border-color: var(--fg-border); }
.btn--secondary:hover { background: var(--fg-surface); }
.btn--ghost { background: transparent; color: var(--fg-text); border-color: var(--fg-border); }
.btn--ghost:hover { background: var(--fg-surface); }
.btn--ghost.is-active { background: var(--fg-text); color: #fff; border-color: var(--fg-text); }
.btn--sm { padding: 6px 12px; font-size: 0.9rem; }
.btn--block { width: 100%; }

/* ---- Flash --------------------------------------------------------------- */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; border: 1px solid; font-size: 0.95rem; }
.flash--ok    { background: var(--fg-green-tint); border-color: var(--fg-green-deep); color: #0a5c2f; }
.flash--error { background: #fdecec; border-color: var(--fg-danger); color: #7a1b1b; }
.flash--warn  { background: #fff4e0; border-color: var(--fg-warn); color: #6b4200; }

/* ---- Pills --------------------------------------------------------------- */
.pill { display: inline-block; font-size: 0.8rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; border: 1px solid; line-height: 1.5; }
.pill--on  { background: var(--fg-green-tint); border-color: var(--fg-green-deep); color: #0a5c2f; }
.pill--off { background: #f0f0f0; border-color: var(--fg-border); color: var(--fg-text-muted); }

/* ---- Login --------------------------------------------------------------- */
.is-anon .site-main { display: flex; align-items: center; justify-content: center; }
.login { width: 100%; max-width: 420px; }
.login__card { padding: 32px; background: var(--fg-bg); }
.login__brand { text-align: center; margin-bottom: 24px; }
.login__logo { height: 60px; width: auto; }
.login__subtitle { margin: 10px 0 0; color: var(--fg-text-muted); }
.login__divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--fg-text-muted); font-size: 0.85rem; }
.login__divider::before, .login__divider::after { content: ""; flex: 1; height: 1px; background: var(--fg-border); }

/* ---- Forms --------------------------------------------------------------- */
.form { display: grid; gap: 6px; }
.form__label { font-size: 0.875rem; font-weight: 600; margin-top: 8px; }
.form__input {
  font: inherit; padding: 10px 12px; border: 1px solid var(--fg-border); border-radius: 8px;
  background: var(--fg-bg); color: var(--fg-text); width: 100%;
}
.form__input:focus { border-color: var(--fg-green-deep); outline: none; box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.2); }
.form > .btn { margin-top: 16px; }
.form__hint { font-size: 0.8rem; color: var(--fg-text-muted); margin-top: 4px; }
.form__error { font-size: 0.85rem; color: var(--fg-danger); margin-top: 4px; font-weight: 500; }
.form--admin { gap: 4px; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form__field { display: grid; gap: 4px; align-content: start; }
.form__check { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-size: 0.95rem; }
.form__check input { width: 18px; height: 18px; accent-color: var(--fg-green-deep); }
.form__actions { display: flex; gap: 10px; margin-top: 20px; }

/* ---- Dashboard (per the project-team mock; desktop/widescreen) ----------------- */
.ico { width: 22px; height: 22px; }

/* Tiles: hero (dark green) · services · 3 type splits · reactivations · cumulative (light green) */
.tiles { display: grid; grid-template-columns: 1.3fr repeat(6, minmax(0, 1fr)) 1.3fr; gap: 12px; margin-bottom: 20px; }   /* 8 tiles since the 4-type split */
.tile { display: flex; gap: 12px; align-items: flex-start; padding: 16px 14px 14px; border-radius: var(--radius); border: 1px solid var(--fg-border); background: var(--fg-bg); min-width: 0; }
.tile__icon { flex: 0 0 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; background: var(--tone-grey); }
.tile__icon--green  { background: var(--fg-green-deep); }
.tile__icon--orange { background: var(--tone-orange); }
.tile__icon--purple { background: var(--tone-purple); }
.tile__icon--blue   { background: var(--tone-blue); }
.tile__icon--teal   { background: var(--tone-teal); }
.tile__icon--deep   { background: var(--dk-green); }
.tile__icon--slate  { background: var(--tone-slate); }
.tile__body { min-width: 0; }
.tile__label { font-size: 0.9rem; font-weight: 600; color: var(--fg-text); line-height: 1.25; min-height: 2.5em; /* always reserve two lines so the big numbers align across tiles (Sam, 2026-09-14) */ }
.tile__value { font-size: 1.75rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1.15; margin-top: 6px; }
.tile__hint { font-size: 0.8rem; color: var(--fg-text-muted); margin-top: 4px; }
.tile--hero { background: linear-gradient(135deg, var(--dk-green), var(--dk-green-2)); border-color: var(--dk-green-2); color: #fff; box-shadow: 0 10px 24px rgba(15, 107, 79, 0.25); }
.tile--hero .tile__icon { background: rgba(255, 255, 255, 0.18); color: var(--fg-green); }
.tile--hero .tile__label, .tile--hero .tile__value { color: #fff; }
.tile--hero .tile__value { font-size: 2.25rem; }
.tile--hero .tile__hint { color: rgba(255, 255, 255, 0.75); }
.tile--soft { background: var(--lt-green); border-color: var(--lt-green-2); }
.tile--soft .tile__value { color: var(--dk-green); }
.tile--dim .tile__value { color: var(--fg-text-muted); }

/* Panels */
.panel { padding: 20px 24px 18px; margin-bottom: 20px; background: var(--fg-bg); }
.panel__title { font-size: 1.125rem; }
.panel__sub { margin: 2px 0 12px; font-size: 0.875rem; color: var(--fg-text-muted); }
/* Chart.js sets an explicit canvas width; with default `1fr` (= minmax(auto,1fr)) grid tracks the
   canvas pushes the tracks wider than the container — seen as donuts spilling off the right edge on a
   3440px monitor (Sam, 2026-10-06). minmax(0,1fr) + min-width:0 + max-width on the canvas stop it. */
.chart-box { position: relative; height: 320px; min-width: 0; }
.chart-box canvas { max-width: 100% !important; }
.panel { min-width: 0; }
.chart-box--wide { height: 340px; margin-top: 8px; }
.chart-box--donut { height: 250px; }
.chart-empty { margin: 0; padding: 40px 0; text-align: center; color: var(--fg-text-muted); font-size: 0.9rem; }
.donuts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.donuts .panel { margin-bottom: 0; }

/* Month table */
.mtable { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.9rem; margin-top: 10px; border: 1px solid var(--fg-border); border-radius: 10px; overflow: hidden; }
.mtable th, .mtable td { padding: 10px 8px; text-align: center; border-bottom: 1px solid var(--fg-border); font-variant-numeric: tabular-nums; }
.mtable thead th { background: var(--dk-green); color: #fff; font-weight: 600; font-size: 0.85rem; line-height: 1.2; }
.mtable thead th small { display: block; font-weight: 500; font-size: 0.75rem; opacity: 0.85; }
.mtable thead th.is-future { opacity: 0.55; }
.mtable__type { text-align: left !important; padding-left: 16px !important; font-weight: 500; white-space: nowrap; min-width: 190px; }
.mtable__total { border-left: 1px dashed rgba(255, 255, 255, 0.5); font-weight: 600; }
.mtable tbody .mtable__total { border-left: 1px dashed var(--fg-border); }
.mtable__money { font-weight: 700; }
.mtable tbody tr:last-child td { border-bottom: 0; }
.mtable td.is-future { color: var(--fg-text-muted); opacity: 0.5; }
.mtable__sum td { background: var(--lt-green); font-weight: 700; }
.mtable__react td { color: var(--fg-text); }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 10px; vertical-align: -1px; background: var(--tone-grey); }
.dot--orange { background: var(--tone-orange); } .dot--purple { background: var(--tone-purple); } .dot--blue { background: var(--tone-blue); } .dot--slate { background: var(--tone-slate); } .dot--grey { background: var(--tone-grey); }
.dot-ico { display: inline-flex; vertical-align: -5px; margin-right: 8px; color: var(--tone-teal); }
.dot-ico .ico { width: 16px; height: 16px; }

/* Pickers (mock style: boxed, icon, small label over the value). Three global filters sit in the
   toolbar: Company Code + Cost Centre (searchable [data-combo], ui.js) and Financial Year (native select). */
.toolbar__pickers { display: flex; align-items: stretch; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.picker { position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 14px; border: 1px solid var(--fg-border); border-radius: 10px; background: var(--fg-bg); min-width: 210px; }
.picker--wide { min-width: 300px; max-width: 380px; }
.fy-picker { min-width: 290px; }
.picker__icon { color: var(--fg-text); display: inline-flex; }
.picker__body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.picker__label { font-size: 0.75rem; color: var(--fg-text-muted); font-weight: 500; }
.picker__value { font: inherit; font-size: 1rem; font-weight: 600; color: var(--fg-text); border: 0; background: transparent; padding: 0 18px 0 0; margin-top: 2px; cursor: pointer; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; width: 100%; }
.picker__value::after { content: ""; position: absolute; right: 2px; top: 50%; width: 7px; height: 7px; border-right: 2px solid var(--fg-text-muted); border-bottom: 2px solid var(--fg-text-muted); transform: translateY(-70%) rotate(45deg); }
.picker__value:focus { outline: none; }
.picker:focus-within, .picker.is-open { border-color: var(--fg-green-deep); box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.2); }
.picker__pop { position: absolute; z-index: 50; top: calc(100% + 6px); left: 0; right: 0; min-width: 280px; background: var(--fg-bg); border: 1px solid var(--fg-border); border-radius: 10px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18); padding: 8px; }
.picker--wide .picker__pop { min-width: 380px; }
.picker__search { width: 100%; font: inherit; font-size: 0.9rem; padding: 8px 10px; border: 1px solid var(--fg-border); border-radius: 8px; margin-bottom: 6px; }
.picker__search:focus { outline: none; border-color: var(--fg-green-deep); }
.picker__list { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; }
.picker__list li { padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 0.9rem; display: flex; justify-content: space-between; gap: 12px; }
.picker__list li small { color: var(--fg-text-muted); }
.picker__list li:hover, .picker__list li:focus { background: var(--lt-green); outline: none; }
.picker__list li.is-selected { font-weight: 700; color: var(--dk-green); }
.picker__empty { padding: 10px; color: var(--fg-text-muted); font-size: 0.85rem; }
.fy-picker__select { font: inherit; font-size: 1rem; font-weight: 600; color: var(--fg-text); border: 0; background: transparent; padding: 0; margin-top: 2px; cursor: pointer; width: 100%; }
.fy-picker__select:focus { outline: none; }
.toolbar__filters { display: block; margin-top: 4px; color: var(--fg-text); font-size: 0.9rem; }

/* Hover panels (ui.js, [data-pop]) — used instead of title= tooltips */
.hover-pop { position: fixed; z-index: 300; background: var(--fg-text); color: #fff; padding: 10px 12px; border-radius: 8px; font-size: 0.85rem; line-height: 1.45; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); white-space: pre-wrap; word-wrap: break-word; pointer-events: none; }
.hover-pop__title { font-weight: 700; margin-bottom: 4px; color: var(--fg-green); }
.pop-anchor { color: var(--dk-green); text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
.pop-anchor:hover { text-decoration-style: solid; }
.help-ico { display: inline-flex; vertical-align: -3px; margin-left: 4px; color: var(--fg-text-muted); cursor: help; border-radius: 50%; }
.help-ico .ico { width: 15px; height: 15px; }
.help-ico:hover, .help-ico:focus-visible { color: var(--dk-green); outline: none; }
.tile--hero .help-ico { color: rgba(255, 255, 255, 0.75); }

/* Upload File menu */
.menu { position: relative; }
.menu__list { position: absolute; z-index: 60; right: 0; top: calc(100% + 8px); width: 340px; background: var(--fg-bg); border: 1px solid var(--fg-border); border-radius: 10px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18); padding: 6px; display: grid; gap: 2px; }
.menu__item { font: inherit; text-align: left; background: none; border: 0; border-radius: 8px; padding: 10px 12px; cursor: pointer; display: grid; gap: 2px; color: var(--fg-text); }
.menu__item strong { font-size: 0.95rem; }
.menu__item span { font-size: 0.8rem; color: var(--fg-text-muted); line-height: 1.35; }
.menu__item:hover:not(:disabled), .menu__item:focus-visible { background: var(--lt-green); outline: none; }
.menu__item:disabled { cursor: not-allowed; opacity: 0.5; }

/* Blitz month step */
.blitz-month { margin-top: 18px; padding: 16px 18px; border: 1px solid var(--lt-green-2); background: var(--lt-green); border-radius: 10px; }
.blitz-month .wizard-h4 { margin-top: 0; }
.blitz-month__row { display: flex; align-items: center; gap: 12px; }
.blitz-month__row .form__label { margin: 0; }
.blitz-month__preview { margin-top: 12px; font-size: 0.95rem; }
.wizard-warning { margin-top: 12px; padding: 10px 14px; border-radius: 8px; background: #fff4e0; border: 1px solid var(--fg-warn); color: #6b4200; font-size: 0.9rem; }

.toolbar__note { color: var(--fg-text-muted); font-size: 0.9rem; }
.toolbar__empty { display: block; margin-top: 4px; color: #6b4200; }
.toolbar__hint { display: block; margin-top: 2px; font-size: 0.8rem; }

/* Clickable numbers in the month table */
.cell-link { font: inherit; font-weight: inherit; color: inherit; background: none; border: 0; padding: 2px 6px; margin: -2px -6px; border-radius: 6px; cursor: pointer; text-decoration: underline dotted transparent; text-underline-offset: 3px; }
.cell-link:hover, .cell-link:focus-visible { background: var(--lt-green); color: var(--dk-green); text-decoration-color: var(--dk-green); outline: none; }
.mtable__sum .cell-link:hover { background: var(--lt-green-2); }

/* ---- Drill-down modal + DataTables ------------------------------------------- */
/* Specificity note: `.modal__dialog` (declared later) beat `.modal__dialog--drill`, so the drill
   modal shipped at the wizard's 920px (Sam, 2026-09-14). Qualify by the modal variant instead. */
.modal--drill .modal__dialog { width: min(1800px, calc(100vw - 64px)); height: min(920px, calc(100vh - 48px)); grid-template-rows: auto 1fr auto; }
.modal__sub { margin: 2px 0 0; font-size: 0.85rem; color: var(--fg-text-muted); }
.modal__body--drill { padding: 12px 20px; }
.drill-loading { padding: 40px; text-align: center; color: var(--fg-text-muted); }
.row-ico { display: inline-flex; vertical-align: -3px; margin-right: 5px; cursor: help; }
.ico--active { color: var(--fg-green-deep); }
.ico--departed { color: var(--fg-danger); }
.ico--tablet { color: var(--tone-blue); }
.kind-pill { display: inline-block; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.04em; padding: 0 5px; border-radius: 4px; background: var(--tone-teal); color: #fff; vertical-align: 1px; }
.ico--sm { width: 15px; height: 15px; }
.note-ico { display: inline-flex; vertical-align: -3px; margin-left: 6px; color: var(--tone-orange); cursor: help; border-radius: 4px; }
.note-ico:focus-visible { outline: 2px solid var(--fg-green); }
.react-pill { display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 0 7px; border-radius: 999px; background: #e3f4f4; color: #0f6f6f; border: 1px solid var(--tone-teal); }
div.dt-container .dt-buttons .dt-export, div.dt-container .dt-buttons .dt-export:hover { font: inherit; font-size: 0.85rem; font-weight: 600; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--dk-green) !important; background: var(--dk-green) !important; color: #fff !important; margin-right: 10px; box-shadow: none; }
div.dt-container .dt-buttons .dt-export:hover { background: var(--dk-green-2) !important; }

/* DataTables: fit the design system (compact) */
table.dataTable { font-size: 0.78rem; color: var(--fg-text); line-height: 1.35; }
table.dataTable.compact thead th, table.dataTable.compact tbody td { padding: 4px 8px; }
table.dataTable thead th { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fg-text-muted); font-weight: 600; border-bottom: 1px solid var(--fg-border) !important; white-space: nowrap; }
table.dataTable tbody td { white-space: nowrap; }        /* dense: one line per row; wide modal gives the room */
table.dataTable tbody td.dt-wrap { white-space: normal; }
div.dt-container { font-size: 0.8rem; }
table.dataTable tbody td { border-bottom: 1px solid var(--fg-border); }
table.dataTable tbody tr:hover td { background: var(--lt-green); }
table.dataTable tfoot th { padding: 8px 10px; border-top: 2px solid var(--dk-green) !important; font-weight: 700; color: var(--fg-text); text-align: right; }
table.dataTable tfoot th:first-child { text-align: left; }
.dt-mono { font-variant-numeric: tabular-nums; }
.dt-right { text-align: right !important; }
.dt-nowrap { white-space: nowrap; }
.dt-muted { color: var(--fg-text-muted); font-size: 0.75rem; }
div.dt-container .dt-search input, div.dt-container .dt-length select { font: inherit; font-size: 0.875rem; padding: 6px 10px; border: 1px solid var(--fg-border); border-radius: 8px; background: var(--fg-bg); color: var(--fg-text); }
div.dt-container .dt-search input:focus { border-color: var(--fg-green-deep); outline: none; box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.2); }
div.dt-container .dt-info { color: var(--fg-text-muted); font-size: 0.85rem; }
div.dt-container .dt-paging .dt-paging-button { border-radius: 6px !important; font-size: 0.85rem; }
div.dt-container .dt-paging .dt-paging-button.current { background: var(--dk-green) !important; color: #fff !important; border-color: var(--dk-green) !important; }
div.dt-container .dt-paging .dt-paging-button:hover:not(.current):not(.disabled) { background: var(--lt-green) !important; color: var(--dk-green) !important; border-color: var(--lt-green-2) !important; }
table.dataTable thead > tr > th.dt-orderable-asc:hover, table.dataTable thead > tr > th.dt-orderable-desc:hover { outline: none; background: var(--fg-surface); }

/* ---- Admin --------------------------------------------------------------- */
.admin { display: grid; gap: 20px; }
.admin__tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--fg-border); }
.admin__tab {
  padding: 10px 18px; color: var(--fg-text-muted); font-weight: 600; border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}
.admin__tab:hover { color: var(--fg-text); text-decoration: none; }
.admin__tab.is-active { color: var(--fg-text); border-bottom-color: var(--fg-green); }
.admin__body { display: grid; gap: 20px; }
.admin__footer { display: flex; justify-content: flex-start; padding-top: 8px; border-top: 1px solid var(--fg-border); }

.admin-card { padding: 20px 24px; }
.admin-card--narrow { max-width: 760px; }
.admin-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 12px; }
.admin-card__title { font-size: 1.05rem; }
.admin-card__desc { margin: 4px 0 0; font-size: 0.9rem; color: var(--fg-text-muted); max-width: 64ch; }
.admin-card__action { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.925rem; background: var(--fg-bg); border-radius: 8px; overflow: hidden; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--fg-border); vertical-align: middle; }
.table th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fg-text-muted); font-weight: 600; background: var(--fg-surface); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.is-disabled td { color: var(--fg-text-muted); }
.table__mono { font-variant-numeric: tabular-nums; }
.table__actions { text-align: right; white-space: nowrap; }
.table__actions .btn + .inline-form { margin-left: 6px; }
.table__empty { text-align: center; color: var(--fg-text-muted); padding: 24px; }

/* ---- Dashboard toolbar (FY selector row under the header) ------------------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.form__input--inline { width: auto; padding: 8px 12px; }

/* ---- Utilities -------------------------------------------------------------- */
.text-danger { color: var(--fg-danger); font-weight: 600; }
.btn--danger { background: var(--fg-danger); color: #fff; }
.btn--danger:hover { background: #a61f1f; }
.pill--danger { background: #fdecec; border-color: var(--fg-danger); color: #7a1b1b; }
.table__num { text-align: right; font-variant-numeric: tabular-nums; }
.table--compact th, .table--compact td { padding: 6px 10px; font-size: 0.875rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 0; font-size: 0.925rem; }
.kv dt { color: var(--fg-text-muted); } .kv dd { margin: 0; font-variant-numeric: tabular-nums; }
.admin-card--danger { border-color: #f1c4c4; background: #fff8f8; }
.wipe-form { align-items: center; }

/* ---- Modal (upload wizard) — desktop-only by design ---------------------------- */
body.has-modal { overflow: hidden; }
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(45, 45, 45, 0.62); }
.modal__dialog {
  position: relative; width: min(920px, calc(100vw - 48px)); height: min(680px, calc(100vh - 48px));
  background: var(--fg-bg); border-radius: var(--radius); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  display: grid; grid-template-rows: auto auto 1fr auto; overflow: hidden;
}
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--fg-border); }
.modal__title { font-size: 1.125rem; }
.modal__close { font: inherit; font-size: 1.5rem; line-height: 1; background: none; border: 0; cursor: pointer; color: var(--fg-text-muted); padding: 4px 8px; border-radius: 6px; }
.modal__close:hover { background: var(--fg-surface); color: var(--fg-text); }
.modal__body { overflow-y: auto; padding: 24px; }
.modal__foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; border-top: 1px solid var(--fg-border); background: var(--fg-surface); }
.modal__status { font-size: 0.9rem; color: var(--fg-text-muted); }
.modal__actions { display: flex; gap: 10px; }
.modal.is-busy .modal__close { opacity: 0.5; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.stepper { display: flex; list-style: none; margin: 0; padding: 14px 24px; gap: 8px; border-bottom: 1px solid var(--fg-border); counter-reset: step; }
.stepper__step { flex: 1; display: flex; align-items: center; gap: 10px; font-size: 0.9rem; font-weight: 600; color: var(--fg-text-muted); position: relative; }
.stepper__step + .stepper__step::before { content: ""; flex: 0 0 24px; height: 1px; background: var(--fg-border); margin-right: 2px; }
.stepper__num { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--fg-border); font-size: 0.8rem; flex-shrink: 0; }
.stepper__step.is-active { color: var(--fg-text); }
.stepper__step.is-active .stepper__num { border-color: var(--fg-green); background: var(--fg-green); color: var(--fg-text); }
.stepper__step.is-done { color: var(--fg-green-deep); }
.stepper__step.is-done .stepper__num { border-color: var(--fg-green-deep); background: var(--fg-green-deep); color: #fff; }

.wizard-intro { margin: 0 0 20px; color: var(--fg-text-muted); font-size: 0.95rem; max-width: 72ch; }
.wizard-intro code { background: var(--fg-surface); padding: 1px 6px; border-radius: 4px; }
.wizard-h { font-size: 1.125rem; margin-bottom: 4px; }
.wizard-h--ok { color: var(--fg-green-deep); }
.wizard-h4 { font-size: 0.95rem; margin: 20px 0 6px; }
.wizard-h4--danger { color: var(--fg-danger); }
.wizard-sub { margin: 0 0 14px; color: var(--fg-text-muted); font-size: 0.9rem; }
.wizard-error { margin-top: 16px; padding: 12px 16px; border-radius: 8px; background: #fdecec; border: 1px solid var(--fg-danger); color: #7a1b1b; font-size: 0.95rem; }

.dropzone {
  border: 2px dashed var(--fg-border); border-radius: var(--radius); padding: 48px 24px; text-align: center;
  background: var(--fg-surface); cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--fg-green-deep); }
.dropzone.is-over { border-color: var(--fg-green); background: var(--fg-green-tint); }
.dropzone__icon { font-size: 2rem; color: var(--fg-text-muted); margin-bottom: 8px; }
.dropzone__icon--ok { color: var(--fg-green-deep); }
.dropzone__text { font-size: 1.05rem; }
.dropzone__text .link { color: var(--fg-green-deep); text-decoration: underline; }
.dropzone__hint { margin-top: 6px; font-size: 0.85rem; color: var(--fg-text-muted); }

.progress { height: 12px; background: var(--fg-surface); border: 1px solid var(--fg-border); border-radius: 999px; overflow: hidden; margin-top: 18px; }
.progress__bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--fg-green-deep), var(--fg-green)); transition: width 0.25s ease; }
.progress__label { margin-top: 8px; font-size: 0.9rem; color: var(--fg-text-muted); font-variant-numeric: tabular-nums; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--fg-border); background: var(--fg-surface); min-width: 0; }
.stat__label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fg-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat__value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1.15; margin-top: 2px; }
.stat__hint { font-size: 0.75rem; color: var(--fg-text-muted); margin-top: 2px; line-height: 1.3; }
.stat--ok .stat__value { color: var(--fg-text); }
.stat--muted .stat__value { color: var(--fg-text-muted); }
.stat--warn { border-color: var(--fg-warn); } .stat--warn .stat__value { color: #8a5300; }
.stat--danger { border-color: var(--fg-danger); background: #fdecec; } .stat--danger .stat__value { color: var(--fg-danger); }

.sheet-list__items { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sheet-list__item { padding: 8px 12px; border-radius: 8px; background: var(--fg-surface); font-size: 0.9rem; }
.sheet-list__item--ignored { color: var(--fg-text-muted); }
.sheet-list__note { font-size: 0.8rem; margin-top: 2px; }
.issues-details { margin-top: 16px; }
.issues-details summary { cursor: pointer; font-weight: 600; font-size: 0.95rem; color: var(--fg-text-muted); }

/* ---- Error --------------------------------------------------------------- */
.error-page { display: flex; justify-content: center; padding-top: 40px; }
.error-page__card { padding: 40px; text-align: center; max-width: 560px; width: 100%; }
.error-page__code { font-size: 4rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1; color: var(--fg-text-muted); }
.error-page__message { font-size: 1.125rem; margin: 12px 0 24px; }
.error-page__detail { text-align: left; font-size: 0.8rem; overflow: auto; background: #fff; padding: 12px; border-radius: 8px; border: 1px solid var(--fg-border); margin-bottom: 24px; }

/* ---- Footer -------------------------------------------------------------- */
.site-footer { background: var(--fg-footer-bg); color: var(--fg-footer-text); font-size: 0.875rem; }
.site-footer__inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 72px; flex-wrap: wrap; padding-block: 14px; }
.site-footer__vendor { display: flex; align-items: center; gap: 12px; }
.site-footer__label { color: var(--fg-footer-text); }
.site-footer a { color: #fff; }
.site-footer .btn { background: var(--fg-footer-btn); color: var(--fg-footer-text); }

/* ---- Responsive ---------------------------------------------------------- */
/* Desktop-first; these only keep narrower desktops usable. Mobile is out of scope. */
@media (max-width: 1500px) {
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tile--hero, .tile--soft { grid-column: span 2; }
  .donuts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .donuts { grid-template-columns: minmax(0, 1fr); }
  .site-header__page { display: none; }
}
@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .site-header__title, .site-header__divider { display: none; }
  .form__row { grid-template-columns: 1fr; }
  .admin-card__head { flex-direction: column; }
}
@media (max-width: 600px) {
  :root { --gutter: 16px; }
  .tiles { grid-template-columns: 1fr; }
  .tile--hero, .tile--soft { grid-column: auto; }
  .user-name { display: none; }
  .brand__logo { height: 32px; }
}

/* ---- Print (PDF export groundwork) ---------------------------------------- */
@media print {
  .site-header__user, .site-footer .btn, .flash--warn, .admin__footer, .toolbar__pickers, .modal, .hover-pop { display: none !important; }
  .tile--hero { box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .card { break-inside: avoid; border-color: #ccc; }
  body { background: #fff; }
}
