/* TF Executive Dashboard — chart chrome per dataviz reference palette (light) */
:root {
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;      /* series-1: current period */
  --context: #898781;     /* de-emphasis: last year (lines) */
  --context-fill: #c3c2b7;/* de-emphasis: last year (columns) */
  --up: #006300;
  --down: #d03b3b;
  --brand: #15427a;
}
* { box-sizing: border-box; margin: 0; }
html { color-scheme: light; }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--page); color: var(--ink); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 20px 18px 56px; }

header.top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.brand h1 { font-size: 19px; color: var(--brand); letter-spacing: -0.01em; }
.asof { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stale { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600;
         background: #fdeceb; color: var(--down); }
.controls { display: flex; gap: 10px; align-items: center; }
.toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--surface); }
.toggle button { border: 0; background: none; padding: 7px 14px; cursor: pointer; font: inherit; font-weight: 500; color: var(--ink-2); }
.toggle button.on { background: var(--brand); color: #fff; }
.toggle.disabled { opacity: 0.4; pointer-events: none; }
.ghost { border: 1px solid var(--border); background: var(--surface); border-radius: 9px; padding: 7px 12px; cursor: pointer; font: inherit; color: var(--ink-2); }

nav.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--grid); margin-bottom: 16px; overflow-x: auto; }
nav.tabs a { padding: 8px 14px; text-decoration: none; color: var(--ink-2); font-weight: 500; font-size: 13.5px;
             border-bottom: 2px solid transparent; white-space: nowrap; }
nav.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 650; }
nav.tabs a[data-nav="settings"] { margin-left: auto; color: var(--muted); }
nav.tabs a[data-nav="settings"].on { color: var(--brand); }
nav.tabs a:hover { color: var(--ink); }

.controlsrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.controlsrow .note, .note { font-size: 12px; color: var(--muted); }
.searchbox { padding: 7px 11px; border: 1px solid var(--baseline); border-radius: 9px; font: inherit; min-width: 200px; background: var(--surface); }
.crumb { font-size: 15px; font-weight: 650; margin-bottom: 14px; }
.crumb a { color: var(--accent); text-decoration: none; font-weight: 500; }
.crumb .note { font-weight: 400; margin-left: 6px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: baseline; }
table.data tr.clickable { cursor: pointer; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
th.sorted { color: var(--brand); }
#view { transition: opacity 0.12s; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.tile .lbl { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; }
.tile .val { font-size: 27px; font-weight: 650; margin: 3px 0 1px; }
.tile .delta { font-size: 13px; font-weight: 600; }
.tile .delta.up { color: var(--up); } .tile .delta.down { color: var(--down); }
.tile .delta .ctx { color: var(--muted); font-weight: 400; }
.tile .sub { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }

.grid2 { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 16px; }
@media (min-width: 900px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px 10px; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.chart-head h3 { font-size: 13.5px; font-weight: 650; }
.chart-head .note { font-size: 11.5px; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 14px; height: 0; border-top: 2.5px solid; border-radius: 2px; }
.legend .swatch.rect { width: 10px; height: 10px; border: 0; border-radius: 3px; }
.chart-body { position: relative; }
.chart-body svg { display: block; width: 100%; height: auto; }
.chart-body:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

.axis text, text.axis { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }

.tooltip { position: fixed; z-index: 30; pointer-events: none; background: #fff; border: 1px solid var(--border);
           border-radius: 10px; box-shadow: 0 6px 24px rgba(11,11,11,0.10); padding: 9px 12px; font-size: 12.5px; min-width: 150px; }
.tooltip .tt-title { color: var(--muted); font-size: 11.5px; margin-bottom: 5px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.tooltip .tt-key { width: 12px; height: 0; border-top: 2.5px solid; border-radius: 2px; flex: 0 0 auto; }
.tooltip .tt-val { font-weight: 650; font-variant-numeric: tabular-nums; margin-left: auto; }
.tooltip .tt-name { color: var(--ink-2); }

h2.sec { font-size: 15px; margin: 22px 0 10px; }
.chips { display: inline-flex; gap: 6px; margin-left: 10px; vertical-align: middle; }
.chips button { border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 3px 11px;
                font: inherit; font-size: 12px; color: var(--ink-2); cursor: pointer; }
.chips button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border);
             border-radius: 12px; overflow: hidden; font-size: 13.5px; }
table.data th, table.data td { padding: 8px 12px; text-align: right; border-bottom: 1px solid var(--grid);
                               white-space: nowrap; font-variant-numeric: tabular-nums; }
table.data th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; }
table.data th:first-child, table.data td:first-child { text-align: left; font-variant-numeric: normal; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #f4f5f2; }
td .delta { font-weight: 600; } td .delta.up { color: var(--up); } td .delta.down { color: var(--down); }
table.data td.muted-col { color: var(--muted); }
.two-col { display: grid; grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 980px) { .two-col { grid-template-columns: 1fr 1fr; } }

.login { max-width: 340px; margin: 12vh auto; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 28px; }
.login h1 { font-size: 26px; color: var(--brand); margin-bottom: 0; letter-spacing: -0.01em; }
.login .apptitle { font-size: 15px; font-weight: 600; color: var(--ink-2); letter-spacing: 0.02em; margin-bottom: 6px; }
.login p { color: var(--muted); font-size: 12.5px; margin-bottom: 18px; }
.login label { display: block; font-size: 12.5px; color: var(--ink-2); margin: 10px 0 4px; }
.login input { width: 100%; padding: 9px 10px; border: 1px solid var(--baseline); border-radius: 8px; font: inherit; }
.login button { width: 100%; margin-top: 18px; padding: 10px; border: 0; border-radius: 8px; background: var(--brand);
                color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.err { color: var(--down); font-size: 13px; margin-top: 10px; min-height: 18px; }
.hidden { display: none !important; }

.flabel { display: block; font-size: 12.5px; color: var(--ink-2); margin: 9px 0 4px; }
.fw { width: 100%; max-width: 320px; display: block; }
.chart-card h3.cardtitle { font-size: 14px; margin-bottom: 6px; }
.chart-card h4 { font-size: 13px; margin: 16px 0 6px; }
.msg-ok { color: var(--up); font-weight: 600; }
.msg-err { color: var(--down); font-weight: 600; }
button.danger { border: 1px solid var(--border); background: none; color: var(--down); border-radius: 7px; padding: 3px 10px; cursor: pointer; font-size: 12px; }

@media print {
  header.top .controls, nav.tabs, .noprint, .stale { display: none !important; }
  body { background: #fff; font-size: 12px; }
  .wrap { max-width: 100%; padding: 0; }
  .tile, .chart-card, table.data { border-color: #bbb; break-inside: avoid; }
  table.data th, table.data td { padding: 5px 8px; }
  h2.sec { break-after: avoid; }
  a { color: inherit; text-decoration: none; }
}
