/* TAG Management - Reserve Fund Works System. One stylesheet, no external resources.
 *
 * Brand: the six colours sampled from TAG's logo are the --tag-* properties below. Everything
 * the application draws around the data (navigation, headings, links, buttons, focus rings,
 * table headers, the figures strips) is built from them through the second block of
 * properties, so a change of brand is a change of these few lines.
 *
 * Gold and lime are too light to be read as text on white: they are used as fills, borders
 * and markers, or as text on the dark green only. Body text is the logo's near-black.
 * Data colours (one per trade, the chart series, the heat shading) are a separate job and
 * live in rfs/web/helpers.py; nothing here competes with them for attention.
 * tests/test_web_branding.py computes the contrast of every text / background pair used here.
 */

:root {
  /* TAG Management brand colours (from "TAG Logo 2025") */
  --tag-green: #004925;
  --tag-green-mid: #366D32;
  --tag-lime: #ABD041;
  --tag-gold: #DEB509;
  --tag-black: #231F20;
  --tag-white: #FFFFFF;

  /* the application's chrome, built from them */
  --bg: #f4f6f1;
  --surface: #ffffff;
  --surface-2: #eef2ea;
  --ink: var(--tag-black);
  --ink-2: #454d47;
  --muted: #5c655d;
  --line: #dfe4da;
  --line-strong: #c2cabc;
  --accent: var(--tag-green);
  --accent-ink: var(--tag-white);
  --accent-hover: var(--tag-green-mid);
  --highlight: var(--tag-gold);
  --heading: var(--tag-green);
  --link: var(--tag-green-mid);
  --link-hover: var(--tag-green);
  --focus: var(--tag-green);
  --neg: #b3261e;
  --ok: #17703a;
  --ok-bg: #e5f3e9;
  --warn: #8a5a00;
  --warn-bg: #fdf1d3;
  --bad: #b3261e;
  --bad-bg: #fbe7e5;
  --info: #1f4e63;
  --info-bg: #e4eef2;
  --note-bg: #f4f8f1;
  --note-warn-bg: #fffbef;
  --note-bad-bg: #fffaf9;
  --group-bg: #e4ebdc;
  --side: var(--tag-green);
  --side-ink: #e3ecdf;
  --side-label: var(--tag-lime);
  --side-hover: #0a5530;
  --side-active: #14603c;
  --side-w: 220px;
  --grid: #e3e7df;
  --axis: #b4bbae;
}

* { box-sizing: border-box; }
html { font-size: 14px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 1rem/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
/* Links in the content are underlined, lightly: dark green next to near-black text is not told apart by colour alone. */
.page a:not(.btn) { text-decoration: underline; text-decoration-color: rgba(54, 109, 50, 0.38); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.page a:not(.btn):hover { text-decoration-color: currentColor; }
.page .tabs a, .page .seg a, .page .pager a, .page table.data th a.sort, .page table.matrix td a, .page table.matrix thead a,
.page .steps a { text-decoration: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 1.07rem; font-weight: 650; color: var(--heading); }
h3 { font-size: 0.95rem; font-weight: 650; color: var(--heading); }
small, .small { font-size: 0.86rem; }
.muted { color: var(--muted); }
.na { color: var(--muted); }
.neg { color: var(--neg); }
.nowrap { white-space: nowrap; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); color: var(--heading); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; top: 8px; }
code, .mono { font-family: Consolas, "Cascadia Mono", "Courier New", monospace; font-size: 0.92em; }
.path { font-family: Consolas, "Cascadia Mono", "Courier New", monospace; font-size: 0.84rem; color: var(--ink-2); word-break: break-all; }

/* ---------------------------------------------------------------- layout */

.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--side); color: var(--side-ink);
  overflow-y: auto; padding: 0 0 20px; z-index: 20;
}
/* The logo has a white background and black lettering: it always sits on a white panel, with clear space around it. */
.brand { display: block; color: var(--tag-white); font-weight: 600; line-height: 1.25; font-size: 0.93rem; margin-bottom: 4px; }
.brand:hover { text-decoration: none; color: var(--tag-white); }
.brand-logo { display: block; background: var(--tag-white); padding: 16px 18px 13px; border-bottom: 4px solid var(--tag-gold); }
.brand-logo img { display: block; width: 100%; height: auto; }
.brand-system { display: block; padding: 12px 16px 2px; font-size: 1rem; font-weight: 650; letter-spacing: 0.01em; text-wrap: balance; }
.brand-mark { background: var(--tag-gold); color: var(--tag-green); font-weight: 800; letter-spacing: 0.04em; padding: 5px 7px; border-radius: 4px; font-size: 0.93rem; }
.nav-group { padding: 12px 16px 4px; font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--side-label); }
.side ul { list-style: none; margin: 0; padding: 0; }
.side li a { display: block; padding: 6px 16px 6px 12px; color: var(--side-ink); border-left: 4px solid transparent; }
.side li a:hover { background: var(--side-hover); text-decoration: none; color: var(--tag-white); }
.side li a[aria-current="page"] { background: var(--side-active); color: var(--tag-white); border-left-color: var(--tag-gold); font-weight: 600; }
.side :focus-visible { outline-color: var(--tag-gold); outline-offset: -2px; }
.side .brand:focus-visible { outline-offset: 2px; }

.page { margin-left: var(--side-w); min-width: 0; padding: 0 22px 40px; }
.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 16px 0 12px; }
.top h1 { font-size: 1.5rem; font-weight: 650; letter-spacing: -0.01em; color: var(--heading); }
.lede { color: var(--ink-2); margin-top: 2px; max-width: 86ch; }
.crumbs { font-size: 0.86rem; color: var(--muted); margin-bottom: 2px; }
.search { display: flex; gap: 6px; flex: none; padding-top: 4px; }
.search input { width: 250px; }
main { display: block; }
footer.foot { margin-top: 26px; color: var(--muted); font-size: 0.84rem; border-top: 1px solid var(--line-strong); padding-top: 10px;
  display: flex; flex-wrap: wrap; gap: 4px 28px; justify-content: space-between; }
footer.foot .foot-brand { color: var(--ink-2); }
footer.foot .foot-brand strong { color: var(--heading); font-weight: 650; }
footer.foot .foot-note { flex: 1 1 360px; max-width: 78ch; }
footer.foot .foot-contact { white-space: nowrap; }

.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.wide-narrow { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.right { margin-left: auto; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 13px 15px 14px; min-width: 0; }
.card > h2 { margin-bottom: 2px; }
.card > .sub { color: var(--muted); font-size: 0.88rem; margin-bottom: 10px; }
.card.flush { padding: 0; }
.card.flush > .card-head { padding: 12px 15px 8px; }
.card-head h2 + .sub, .card-head .sub { color: var(--muted); font-size: 0.88rem; }
.section-title { margin: 22px 0 8px; font-size: 1.07rem; font-weight: 650; color: var(--heading); }

/* ---------------------------------------------------------------- headline figures */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 10px 13px 11px; }
.tile .label { color: var(--muted); font-size: 0.84rem; }
.tile .value { font-size: 1.55rem; font-weight: 650; letter-spacing: -0.01em; line-height: 1.2; margin-top: 2px; }
.tile .more { color: var(--ink-2); font-size: 0.84rem; margin-top: 1px; }
.tile.hero .value { font-size: 2rem; }
.tile.accent { border-left: 4px solid var(--highlight); }

.strip { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--tag-green-mid); border-radius: 6px; padding: 8px 13px; font-size: 0.93rem; }
.strip .strip-title { font-weight: 650; color: var(--heading); }

/* ---------------------------------------------------------------- forms and filters */

label { font-size: 0.86rem; color: var(--ink-2); }
input[type="text"], input[type="search"], input[type="number"], input[type="date"], input[type="email"], input[type="file"], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 4px;
  padding: 4px 8px; min-height: 30px; max-width: 100%;
}
input[type="number"] { width: 92px; }
textarea { width: 100%; min-height: 70px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { margin: 0 5px 0 0; vertical-align: -1px; accent-color: var(--tag-green); }
.btn, button {
  font: inherit; cursor: pointer; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  border-radius: 4px; padding: 4px 11px; min-height: 30px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover, button:hover { background: var(--surface-2); border-color: var(--tag-green-mid); color: var(--ink); text-decoration: none; }
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover, button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn.danger, button.danger { color: var(--bad); border-color: #e0b4b0; }
.btn.danger:hover, button.danger:hover { color: var(--bad); border-color: var(--bad); background: var(--note-bad-bg); }
.btn.small, button.small { min-height: 24px; padding: 1px 8px; font-size: 0.86rem; }
button.link { border: 0; background: none; color: var(--link); padding: 0; min-height: 0; }
button.link:hover { text-decoration: underline; background: none; color: var(--link-hover); }
button:disabled, .btn[aria-disabled="true"] { opacity: 0.6; cursor: default; }

.filters { display: flex; flex-wrap: wrap; gap: 9px 12px; align-items: flex-end; background: var(--surface); border: 1px solid var(--line);
  border-radius: 6px; padding: 10px 13px 11px; margin-bottom: 14px; }
.filters .field { display: flex; flex-direction: column; gap: 2px; }
.filters .field.inline { flex-direction: row; align-items: center; gap: 4px; padding-bottom: 5px; }
.filters .years input { width: 76px; }
.filters .actions { display: flex; gap: 6px; }

.multi { position: relative; }
.multi > summary { list-style: none; cursor: pointer; border: 1px solid var(--line-strong); border-radius: 4px; padding: 4px 26px 4px 8px;
  min-height: 30px; min-width: 150px; background: var(--surface); position: relative; white-space: nowrap; }
.multi > summary::-webkit-details-marker { display: none; }
.multi > summary::after { content: ""; position: absolute; right: 9px; top: 12px; border: 4px solid transparent; border-top-color: var(--ink-2); }
.multi[open] > summary { border-color: var(--focus); }
.multi .panel { position: absolute; z-index: 30; top: calc(100% + 3px); left: 0; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 6px; box-shadow: 0 6px 18px rgba(35, 31, 32, 0.14); padding: 6px 4px; max-height: 320px; overflow-y: auto; min-width: 250px; }
.multi .panel label { display: flex; align-items: center; gap: 4px; padding: 3px 8px; font-size: 0.93rem; color: var(--ink); border-radius: 3px; white-space: nowrap; }
.multi .panel label:hover { background: var(--surface-2); }

.form-grid { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 9px 14px; align-items: start; max-width: 820px; }
.form-grid > label { padding-top: 6px; font-size: 0.93rem; color: var(--ink); }
.form-grid input[type="text"], .form-grid input[type="email"], .form-grid select { width: 100%; max-width: 460px; }
.form-grid select.short, .form-grid input.short { width: auto; max-width: 180px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 3px 12px; }
.checks label { font-size: 0.93rem; color: var(--ink); }
.hint { color: var(--muted); font-size: 0.86rem; margin-top: 3px; }
.inline-form { display: inline-flex; gap: 5px; align-items: center; }
.req { color: var(--bad); font-weight: 650; }
.source-tag { display: inline-block; margin-left: 6px; color: var(--muted); font-size: 0.8rem; white-space: nowrap; }

/* ---------------------------------------------------------------- tables */

.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.table-scroll { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; overflow: auto; max-height: 76vh; }
.card .table-wrap, .card .table-scroll { border: 0; border-radius: 0; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.93rem; }
table.data th, table.data td { padding: 5px 9px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
table.data thead th {
  position: sticky; top: 0; z-index: 5; background: var(--surface-2); color: var(--heading); font-size: 0.84rem; font-weight: 650;
  border-bottom: 2px solid var(--tag-green-mid); white-space: nowrap; vertical-align: bottom;
}
table.data thead tr:first-child th:first-child { border-top-left-radius: 6px; }
table.data thead tr:first-child th:last-child { border-top-right-radius: 6px; }
table.data tbody tr:hover > td, table.data tbody tr:hover > th { background: #f8faf5; }
table.data tbody th { font-weight: 500; }
table.data tbody th.wrap { min-width: 210px; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tfoot td, table.data tfoot th { font-weight: 650; border-top: 2px solid var(--tag-green-mid); border-bottom: 0; background: var(--surface-2); }
table.data tr.subtotal td, table.data tr.subtotal th { font-weight: 650; background: #f6f8f3; }
table.data tr.group th { background: var(--group-bg); font-weight: 650; font-size: 0.93rem; border-top: 1px solid var(--line-strong); }
table.data td.wrap, table.data th.wrap, table.data.wrap-head thead th { white-space: normal; }
table.data.compact th, table.data.compact td { padding: 3px 8px; }
table.data th a.sort { color: inherit; display: inline-flex; gap: 4px; align-items: baseline; }
table.data th a.sort .arrow { font-size: 0.72rem; color: var(--link); }
table.data th[aria-sort] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--tag-gold); }
table.data th.sortable { cursor: pointer; }
table.data th.sortable:hover { color: var(--link); }
table.data tr.detail > td { background: #fafbf8; padding: 8px 14px 12px 36px; }
table.data tr.detail[hidden] { display: none; }
table.data tr.inactive > td, table.data tr.inactive > th { color: var(--muted); background: #f8f9f6; }
.empty { padding: 26px 18px; text-align: center; color: var(--ink-2); }
.empty strong { display: block; color: var(--heading); margin-bottom: 3px; font-size: 1.02rem; }
.clip { max-width: 34ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.desc { color: var(--ink-2); font-size: 0.86rem; max-width: 70ch; }

.pager { display: flex; gap: 6px; align-items: center; padding: 9px 12px; font-size: 0.93rem; flex-wrap: wrap; }
.pager .gap { color: var(--muted); }
.pager a, .pager span.cur { padding: 2px 8px; border: 1px solid var(--line); border-radius: 4px; }
.pager span.cur { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* the figures strip: the headline numbers of a page */
.totals { display: flex; flex-wrap: wrap; gap: 6px 22px; padding: 9px 13px; background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--highlight); border-radius: 6px; margin-bottom: 10px; align-items: baseline; }
.totals .item { display: flex; gap: 6px; align-items: baseline; }
.totals .item .k { color: var(--muted); font-size: 0.86rem; }
.totals .item .v { font-weight: 650; font-variant-numeric: tabular-nums; }
.totals .item.big .v { font-size: 1.14rem; color: var(--heading); }

/* inline bars (ranked lists) */
.barcell { min-width: 120px; width: 34%; }
.bar { height: 10px; border-radius: 0 3px 3px 0; background: #2a78d6; min-width: 2px; margin-top: 4px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: 0; flex: none; }
.trade { white-space: nowrap; }
.trade .code { color: var(--muted); font-size: 0.8rem; margin-left: 5px; }

/* heat-shaded matrix */
table.matrix { font-size: 0.86rem; }
table.matrix th, table.matrix td { padding: 4px 7px; }
table.matrix thead th { text-align: right; }
table.matrix thead th:first-child, table.matrix tbody th { text-align: left; position: sticky; left: 0; z-index: 6; background: var(--surface); white-space: nowrap; }
table.matrix thead th:first-child { z-index: 8; background: var(--surface-2); }
table.matrix tfoot th { position: sticky; left: 0; background: var(--surface-2); }
table.matrix td a { color: inherit; display: block; }
table.matrix td.total, table.matrix th.total { border-left: 1px solid var(--line-strong); font-weight: 650; }
.legend-ramp { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.84rem; }
.legend-ramp i { display: inline-block; width: 90px; height: 9px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(42, 120, 214, 0.06), rgba(42, 120, 214, 0.56)); border: 1px solid var(--line); }

/* ---------------------------------------------------------------- badges, flashes */

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 0.8rem; font-weight: 600; padding: 1px 8px 1px 7px; border-radius: 10px;
  background: var(--surface-2); color: var(--ink-2); white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.plain::before { display: none; }

.flashes { margin-bottom: 12px; display: grid; gap: 6px; }
.flash { border: 1px solid var(--line); border-left-width: 4px; background: var(--surface); border-radius: 4px; padding: 8px 12px; }
.flash.ok { border-left-color: var(--ok); }
.flash.error { border-left-color: var(--bad); background: var(--note-bad-bg); }
.flash.info { border-left-color: var(--highlight); }
.note { border: 1px solid var(--line); border-left: 4px solid var(--tag-green-mid); background: var(--note-bg); border-radius: 4px; padding: 9px 12px; color: var(--ink-2); font-size: 0.93rem; }
.note.warn { border-left-color: #d9a400; background: var(--note-warn-bg); }
.note.bad { border-left-color: var(--bad); background: var(--note-bad-bg); }
.note p + p, .note ul { margin-top: 5px; }
.note ul { padding-left: 18px; margin-bottom: 0; }
.note strong { color: var(--ink); }

dl.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; margin: 0; font-size: 0.93rem; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 3px 0; }
ul.tight { margin: 4px 0 0; padding-left: 18px; }
ol.tight { margin: 4px 0 0; padding-left: 20px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line-strong); margin-bottom: 14px; }
.tabs a { padding: 7px 14px; border: 1px solid transparent; border-bottom: 0; border-radius: 5px 5px 0 0; color: var(--ink-2); margin-bottom: -1px; }
.tabs a:hover { color: var(--link-hover); }
.tabs a[aria-current="page"] { background: var(--surface); border-color: var(--line-strong); color: var(--heading); font-weight: 650;
  box-shadow: inset 0 3px 0 var(--tag-gold); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 4px; overflow: hidden; }
.seg a { padding: 3px 10px; color: var(--ink-2); font-size: 0.9rem; border-left: 1px solid var(--line-strong); }
.seg a:first-child { border-left: 0; }
.seg a[aria-current="true"] { background: var(--accent); color: var(--accent-ink); }
.seg a:hover { text-decoration: none; background: var(--surface-2); color: var(--ink); }
.seg a[aria-current="true"]:hover { background: var(--accent); color: var(--accent-ink); }
.toggle { border: 1px solid var(--line-strong); background: var(--surface); width: 22px; height: 22px; min-height: 0; padding: 0; border-radius: 4px;
  justify-content: center; font-weight: 700; line-height: 1; color: var(--ink-2); }

/* ---------------------------------------------------------------- charts */

.chart { position: relative; margin: 0; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart svg:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.chart .tick, .chart .axis-title { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .axis-title { fill: var(--ink-2); }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .band { fill: var(--tag-black); opacity: 0; }
.chart .band.on { opacity: 0.06; }
.chart .hit { fill: transparent; }
.chart .hit.link { cursor: pointer; }
.chart .cross { stroke: var(--axis); stroke-width: 1; }
.chart-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 6px; padding: 0; font-size: 0.86rem; color: var(--ink-2); }
.chart-legend li { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .key { width: 11px; height: 11px; border-radius: 2px; flex: none; }
.chart-legend .key.line { height: 3px; width: 16px; border-radius: 2px; }
.chart-tip { position: absolute; z-index: 15; pointer-events: none; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px;
  box-shadow: 0 6px 18px rgba(35, 31, 32, 0.16); padding: 8px 10px; font-size: 0.86rem; min-width: 170px; max-width: 320px; }
.chart-tip[hidden] { display: none; }
.chart-tip .tip-title { font-weight: 650; margin-bottom: 4px; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 7px; padding: 1px 0; }
.chart-tip .tip-row .key { width: 10px; height: 3px; border-radius: 2px; flex: none; }
.chart-tip .tip-row .name { color: var(--ink-2); flex: 1; }
.chart-tip .tip-row .val { font-weight: 650; font-variant-numeric: tabular-nums; }
.chart-tip .tip-total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
.chart-tip .tip-hint { color: var(--muted); margin-top: 4px; font-size: 0.8rem; }
.chart-data { margin-top: 6px; font-size: 0.86rem; }
.chart-data > summary { cursor: pointer; color: var(--link); width: max-content; }
.chart-data .table-scroll { margin-top: 6px; max-height: 300px; }
.chart-empty { color: var(--muted); padding: 30px 0; text-align: center; }

/* ---------------------------------------------------------------- board statement */

.statement { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 30px 38px; max-width: 900px; }
.statement header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--accent); padding-bottom: 12px; margin-bottom: 16px; }
.statement h2 { font-size: 1.35rem; }
.statement .org { font-weight: 700; color: var(--accent); letter-spacing: 0.02em; }
.statement .figures { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0 18px; }
.statement .figures > div { border: 1px solid var(--line); border-top: 3px solid var(--highlight); border-radius: 4px; padding: 8px 10px; }
.statement .figures .k { color: var(--muted); font-size: 0.84rem; }
.statement .figures .v { font-size: 1.25rem; font-weight: 650; }
.statement h3 { margin: 18px 0 6px; }
.statement .fine { color: var(--ink-2); font-size: 0.86rem; margin-top: 14px; }
.statement .fine li { margin-bottom: 3px; }

/* ---------------------------------------------------------------- setup: the guided path and the readiness list */

.steps { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 0; margin: 0 0 14px; padding: 0; counter-reset: step; font-size: 0.93rem; }
.steps li { counter-increment: step; display: flex; align-items: center; gap: 8px; padding: 6px 16px 6px 10px; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line); border-left-width: 0; }
.steps li:first-child { border-left-width: 1px; border-radius: 6px 0 0 6px; }
.steps li:last-child { border-radius: 0 6px 6px 0; }
.steps li::before { content: counter(step); display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  border-radius: 50%; background: var(--surface-2); color: var(--ink-2); font-weight: 650; font-size: 0.86rem; flex: none; }
.steps li.done { color: var(--ink); }
.steps li.done::before { content: "\2713"; background: var(--tag-green-mid); color: var(--tag-white); }
.steps li[aria-current="step"] { color: var(--heading); font-weight: 650; box-shadow: inset 0 -3px 0 var(--tag-gold); }
.steps li[aria-current="step"]::before { background: var(--tag-green); color: var(--tag-white); }
.steps a { color: inherit; }

ul.attention { list-style: none; margin: 0; padding: 0; }
ul.attention li { padding: 1px 0 1px 15px; position: relative; }
ul.attention li::before { content: ""; position: absolute; left: 0; top: 0.58em; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
ul.attention li.bad::before { background: var(--bad); }
ul.attention li.warn::before { background: #d9a400; }
ul.attention li.info::before { background: var(--tag-green-mid); }
.ready-mark { color: var(--ok); font-weight: 650; white-space: nowrap; }
table.setup-table col.c-corp { width: 17%; }
table.setup-table col.c-details { width: 9%; }
table.setup-table col.c-study { width: 15%; }
table.setup-table col.c-due { width: 10%; }
table.setup-table col.c-recon { width: 7%; }
table.setup-table col.c-class { width: 8%; }
table.setup-table col.c-status { width: 10%; }
table.setup-table col.c-attention { width: 24%; }
table.setup-table .row-actions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 5px; }
.error-list { margin: 0; padding-left: 18px; }

/* ---------------------------------------------------------------- narrow laptop */

@media (max-width: 1340px) {
  :root { --side-w: 204px; }
  .page { padding: 0 16px 36px; }
  .search input { width: 200px; }
  table.data th, table.data td { padding: 5px 7px; }
  .brand-logo { padding: 14px 14px 11px; }
  /* wide tables give way before the page does: column headings and trade names may take two lines */
  table.data thead th { white-space: normal; }
  table.data .trade { white-space: normal; display: inline-block; padding-left: 16px; text-indent: -16px; }   /* a second line starts under the name, not under the swatch */
  .barcell { min-width: 64px; width: 24%; }
}
@media (max-width: 1100px) {
  .grid.two, .grid.three, .grid.wide-narrow { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------------------------------------------------------- print
 *
 * Every page prints with a TAG header (logo, page title, date printed) and a footer (company
 * name, address, telephone, website) on every sheet. Both are ordinary elements in base.html
 * (.print-head, .print-foot), fixed to the sheet; the page content is laid out as a table whose
 * header and footer groups are empty and repeat on every sheet, which reserves their room.
 * Navigation, search, filters and buttons do not print; table rows are never split across
 * sheets; colours that carry meaning (trade swatches, bars, heat shading, badges, charts) are kept.
 */

.print-only { display: none; }
@media print {
  @page {
    margin: 12mm 12mm 13mm;
    @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 8pt system-ui, "Segoe UI", Arial, sans-serif; color: #454d47; }
  }
  html { font-size: 11px; }
  body { background: #fff; color: #000; }
  .side, .search, .filters, .no-print, .flashes, footer.foot, .pager, .chart-data, .skip, .tabs, .seg, .steps,
  .btn, button, input[type="file"] { display: none !important; }
  .print-only { display: block; }

  .page { margin: 0; padding: 0; display: table; width: 100%; table-layout: fixed; }
  .page::before { content: " "; white-space: pre; display: table-header-group; line-height: 21mm; color: transparent; break-inside: avoid; }
  .page::after { content: " "; white-space: pre; display: table-footer-group; line-height: 11mm; color: transparent; break-inside: avoid; }
  .print-head { position: fixed; top: 0; left: 0; right: 0; height: 17mm; display: flex; align-items: center; gap: 6mm;
    border-bottom: 2px solid var(--tag-green); padding-bottom: 2mm; color: #000; }
  .print-head img { height: 14mm; width: auto; flex: none; }
  .print-head .print-title { flex: 1; min-width: 0; line-height: 1.3; }
  .print-head .print-title strong { display: block; font-size: 12px; color: var(--tag-green); }
  .print-head .print-title span { display: block; font-size: 13px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .print-head .print-date { flex: none; text-align: right; font-size: 10px; color: #333; line-height: 1.35; }
  .print-foot { position: fixed; bottom: 0; left: 0; right: 0; height: 8mm; display: flex; flex-wrap: nowrap; gap: 0 5mm; align-items: flex-end;
    border-top: 1px solid var(--tag-green); padding-top: 1.5mm; font-size: 9px; color: #333; white-space: nowrap; overflow: hidden; }
  .print-foot .print-company { font-weight: 650; color: var(--tag-green); }
  /* A sheet with a letterhead of its own (board statement, negotiation sheet: .sheet-brand in static/rebates.css) keeps
     its text; its logo is not printed a second time under the header above. */
  .sheet-logo { display: none !important; }

  .top { padding-top: 0; }
  a { color: inherit; text-decoration: none !important; }
  .card, .table-wrap, .table-scroll, .statement, .tile { border-color: #bbb; box-shadow: none; }
  .totals, .strip, .note, .tile.accent { border-top-color: #bbb; border-right-color: #bbb; border-bottom-color: #bbb; }   /* the accent edge stays */
  .tile.accent { border-left-color: var(--highlight); }
  .table-scroll { overflow: visible; max-height: none; }
  table.data thead th { position: static; background: #e9eee4 !important; color: #000; }
  table.data tr { break-inside: avoid; page-break-inside: avoid; }
  table.data tfoot { display: table-row-group; }      /* totals once, at the end - not at the foot of every sheet */
  table.data tr.detail[hidden] { display: table-row; }
  .statement { border: 0; padding: 0; max-width: none; }
  h2, h3, .section-title { break-after: avoid; page-break-after: avoid; }
  .card, .tile, .totals, .strip, .note, figure.chart { break-inside: avoid; }
  /* colours that carry meaning survive printing */
  table.data thead th, table.data tr.group th, table.data tr.subtotal td, table.data tr.subtotal th, table.data tfoot td, table.data tfoot th,
  table.matrix td, .swatch, .bar, .badge, .badge::before, .legend-ramp i, .chart-legend .key, .chart svg rect, .chart svg path, .chart svg circle,
  .tile.accent, .totals, .strip, .statement .figures > div, .print-head, .print-foot, ul.attention li::before {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
}
