/* Tokens: benchmark section 4. Page code uses these names, never raw hex. */
:root {
  color-scheme: light;
  accent-color: #2a78d6;
  --page: #f9f9f7;
  --card: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --line: rgba(11, 11, 11, 0.10);
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --wash: #f0efec;

  --series-1: #2a78d6;  /* sales, money in */
  --series-2: #eb6834;  /* purchases, money out */
  --series-3: #1baf7a;
  --series-4: #eda100;

  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --good-text: #006300;

  --radius: 10px;
  --gap: 16px;
  --side-w: 216px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* .btn, .field etc. set display; hidden must still win */
html, body { margin: 0; height: 100%; background: var(--page); }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100%; }
.side { background: var(--card); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 16px 10px; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 700; font-size: 16px; padding: 4px 10px 16px; }
.brand span { color: var(--muted); font-weight: 500; }
#nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
#nav a { display: block; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--ink-2); }
#nav a:hover { background: var(--wash); }
#nav a[aria-current="page"] { background: var(--wash); color: var(--ink); font-weight: 600; }
/* Menu groups open and close (D35); the group of the open page always stays open. */
#nav .nav-group + .nav-group { margin-top: 2px; }
#nav .nav-head { display: flex; align-items: center; gap: 6px; width: 100%; background: none; border: 0; border-radius: 8px; cursor: pointer; font: inherit; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 10px 4px; text-align: left; }
#nav .nav-head:hover { color: var(--ink-2); }
#nav .nav-head > span:first-child { flex: 1; }
#nav .nav-head[data-here] { color: var(--ink-2); cursor: default; }
#nav .nav-chev { width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .15s ease; margin-right: 2px; }
#nav .nav-group.open .nav-chev { transform: rotate(45deg); }
#nav .nav-head[data-here] .nav-chev { opacity: .35; }
#nav .nav-links { display: flex; flex-direction: column; gap: 2px; }
#nav .nav-links[hidden] { display: none; }
/* ---------- Account menu (bottom of the side menu) ---------- */
.side-foot { border-top: 1px solid var(--line); padding: 8px; font-size: 13px; color: var(--ink-2); position: relative; }
.side-foot[hidden], .acct-panel[hidden], .acct-item[hidden] { display: none; }
.acct-btn { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; border-radius: 8px; padding: 6px 8px; cursor: pointer; color: var(--ink); font: inherit; text-align: left; }
.acct-btn:hover, .acct-btn[aria-expanded="true"] { background: var(--wash); }
.acct-btn .nav-chev { width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-135deg); transition: transform .15s ease; margin: 3px 2px 0 0; color: var(--ink-2); }
.acct-btn[aria-expanded="true"] .nav-chev { transform: rotate(45deg); margin-top: -3px; }
.acct-avatar { flex: none; width: 30px; height: 30px; border-radius: 50%; background: #0f2a4a; color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 650; letter-spacing: .02em; }
.acct-who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.acct-who b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-who span { font-size: 11.5px; color: var(--muted); }
.acct-panel { display: flex; flex-direction: column; gap: 1px; padding: 4px 0 6px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.acct-item { display: flex; align-items: center; justify-content: space-between; width: 100%; background: none; border: 0; border-radius: 6px; padding: 7px 10px; font: inherit; font-size: 13px; color: var(--ink-2); text-decoration: none; text-align: left; cursor: pointer; }
.acct-item[aria-current] { color: var(--ink); font-weight: 600; }
.acct-item:hover, .acct-item:focus-visible { background: var(--wash); color: var(--ink); }
.acct-out { color: var(--critical); }
.acct-out:hover { color: var(--critical); }
.acct-sep { height: 1px; background: var(--line); margin: 4px 10px; }
.acct-info { display: flex; flex-direction: column; gap: 1px; padding: 4px 10px 6px; font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
.acct-info b { color: var(--ink-2); font-weight: 600; font-size: 12px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--series-1); cursor: pointer; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 16px 24px 8px; flex-wrap: wrap; }
.top-title { flex: 1; min-width: 200px; }
.top h1 { font-size: 22px; font-weight: 650; }
.sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.back-btn { align-self: center; }
.back-btn[hidden] { display: none; }
/* Themed type-ahead for name boxes (picker.js) */
.pick-pop { position: absolute; z-index: 50; max-height: 320px; max-width: min(560px, calc(100vw - 16px)); overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 4px; font-size: 13.5px; }
.pick-pop[hidden] { display: none; }
.pick-opt { padding: 7px 10px; border-radius: 6px; cursor: pointer; color: var(--ink-2); }
.pick-opt b { color: var(--ink); font-weight: 650; }
.pick-opt:hover, .pick-opt.on { background: var(--wash); color: var(--ink); }
.pick-note { display: block; font-size: 12px; color: var(--muted); }
.pick-more { padding: 6px 10px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.icon-btn { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; width: 36px; height: 36px; cursor: pointer; }
/* Sub-tabs: one bar under the heading on every page that has views (drawn by the shell, app.js SECTIONS) */
.subtabs { display: flex; gap: 2px; margin: 4px 24px 8px; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.subtabs a { padding: 8px 12px; color: var(--ink-2); text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; border-radius: 6px 6px 0 0; }
.subtabs a:hover { background: var(--wash); color: var(--ink); }
.subtabs a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--series-1); }
#nav .nav-flat { padding-bottom: 4px; }
.xl-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
.xl-facts dt { color: var(--muted); }
.xl-facts dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.xl-actions { display: flex; gap: 8px; }
/* Feedback page */
.fb-form { display: flex; flex-direction: column; gap: 10px; }
.fb-form textarea { font: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; resize: vertical; width: 100%; box-sizing: border-box; }
.fb-kinds { display: flex; gap: 16px; }
.fb-form label.check { display: inline-flex; align-items: center; gap: 6px; }
.fb-photos { display: flex; gap: 8px; flex-wrap: wrap; }
.fb-thumb { width: 96px; height: 72px; object-fit: cover; border: 1px solid var(--line); border-radius: 6px; display: block; background: var(--wash); }
.fb-prev { position: relative; }
.fb-x { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); cursor: pointer; line-height: 1; }
.fb-filter { margin: 8px 0; }
.fb-list { list-style: none; margin: 0; padding: 0; }
.fb-item { padding: 12px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.fb-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.fb-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.fb-remark input { min-width: 260px; }
.view { padding: 8px 24px 40px; display: flex; flex-direction: column; gap: var(--gap); }

/* ---------- controls ---------- */
.btn { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { background: var(--wash); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.field { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 12.5px; }
.field input, .field select { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; min-height: 34px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; background: var(--card); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.good { background: var(--good); } .dot.warning { background: var(--warning); }
.dot.serious { background: var(--serious); } .dot.critical { background: var(--critical); }
.dot.info { background: var(--series-1); }

/* ---------- cards, tiles ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card h2 { font-size: 14px; font-weight: 600; }
.card .card-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--gap); }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; display: block; min-width: 0; }
a.tile:hover { border-color: var(--axis); }
.tile .label { color: var(--ink-2); font-size: 12.5px; }
.tile .term { color: var(--muted); font-size: 11px; }
.tile .value { font-size: 26px; font-weight: 650; margin: 6px 0 4px; letter-spacing: -0.01em; white-space: nowrap; }
.tile .value.neg { color: var(--critical); }
.tile .context { color: var(--ink-2); font-size: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: var(--gap); }

/* ---------- attention list ---------- */
.attention { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.attention li { display: flex; gap: 10px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line); }
.attention li:first-child { border-top: 0; padding-top: 0; }
.attention .sev { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; width: 64px; flex: none; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.attention a { text-decoration: underline; text-decoration-color: var(--axis); text-underline-offset: 3px; }

/* ---------- tables ---------- */
.table-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.table-tools .count { color: var(--muted); font-size: 12px; margin-left: auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
tr.sup-row td { background: var(--wash); }
tr.bill-row td { font-size: 13px; }
details > summary { cursor: pointer; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table.data { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { position: sticky; top: 0; background: var(--wash); font-weight: 600; font-size: 12.5px; white-space: nowrap; cursor: pointer; user-select: none; }
table.data th[aria-sort="ascending"]::after { content: " \25B2"; font-size: 9px; }
table.data th[aria-sort="descending"]::after { content: " \25BC"; font-size: 9px; }
table.data td.num, table.data th.num { text-align: right; white-space: nowrap; }
table.data td.nowrap { white-space: nowrap; }
/* Column filters (row under the header) */
table.data tr.filter-row td { padding: 4px 6px; background: var(--card); border-bottom: 1px solid var(--axis); }
table.data tr.filter-row input, table.data tr.filter-row select { width: 100%; min-width: 64px; font-size: 12px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--page); color: var(--ink); }
table.data tr.filter-row td.num input { text-align: right; }
table.data tr.filter-row input:not(:placeholder-shown), table.data tr.filter-row select:has(option:checked:not([value=""])) { border-color: var(--series-1); background: var(--card); }
table.data tbody tr:hover { background: var(--wash); }
table.data tfoot td { font-weight: 650; border-top: 1px solid var(--axis); border-bottom: 0; background: var(--card); }
table.data td a { text-decoration: underline; text-decoration-color: var(--axis); text-underline-offset: 3px; }
table.data td.wide { max-width: 360px; }
.more { margin-top: 10px; }

/* ---------- states ---------- */
.empty { color: var(--ink-2); padding: 24px 8px; text-align: center; }
.error { border-color: var(--critical); }
.skeleton { background: linear-gradient(90deg, var(--wash) 25%, #e9e8e3 37%, var(--wash) 63%); background-size: 400% 100%; animation: sk 1.4s ease infinite; border-radius: var(--radius); }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
.note { color: var(--muted); font-size: 12px; }

/* ---------- charts ---------- */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .lab { fill: var(--ink-2); }
.chart .val { fill: var(--ink); font-weight: 600; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover { fill: rgba(11, 11, 11, 0.04); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.tip { position: fixed; z-index: 20; pointer-events: none; background: var(--ink); color: #fff; border-radius: 8px; padding: 8px 10px; font-size: 12px; line-height: 1.5; max-width: 260px; box-shadow: 0 4px 16px rgba(0,0,0,.18); font-variant-numeric: tabular-nums; }
.tip b { font-weight: 600; }
.tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* ---------- login ---------- */
.login { max-width: 340px; margin: 12vh auto 0; display: flex; flex-direction: column; gap: 12px; }
.login label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--ink-2); }
.login input { border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; background: var(--card); }
.login .google { justify-content: center; padding: 11px 12px; }
.login .login-note { margin: -4px 0 4px; font-size: 12.5px; color: var(--ink-2); text-align: center; }
.login .msg { color: var(--critical); min-height: 18px; font-size: 12.5px; }

/* ---------- reports library ---------- */
.lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.lib a { text-decoration: none; }
.lib .card:hover { border-color: var(--axis); }
.lib p { color: var(--ink-2); font-size: 12.5px; margin-top: 4px; }
.group-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 6px; }

/* ---------- work forms (payment terms, bill flag) ---------- */
.notice { border-color: var(--warning); display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.edit-form { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.edit-form .grow { flex: 1 1 260px; }
.edit-form .grow input { flex: 1; min-width: 0; }
.edit-form textarea { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: inherit; min-width: 0; width: 100%; }
.card .msg { color: var(--ink-2); font-size: 12.5px; min-height: 18px; margin-top: 8px; }
.card h3 { font-size: 13px; margin: 14px 0 6px; }
ul.plain { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--ink-2); }
.terms-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-bottom: 10px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- phone ---------- */
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 10; left: 0; top: 0; width: 240px; transform: translateX(-100%); transition: transform .18s ease; box-shadow: 0 0 24px rgba(0,0,0,.15); }
  .side.open { transform: none; }
  .icon-btn { display: inline-block; }
  .top { padding: 12px 16px 6px; }
  .view { padding: 8px 16px 32px; }
  .subtabs { margin: 2px 16px 6px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .tile .value { font-size: 22px; }
}
@media print {
  .side, .tools, .table-tools, .icon-btn, .subtabs { display: none !important; }
  .shell { display: block; }
  .card, .tile { break-inside: avoid; }
  body { background: #fff; }
}

/* Financial summary sheet (FSS): section rows, total rows, label column stays in view while scrolling sideways */
table.data.fss td:first-child, table.data.fss th:first-child { position: sticky; left: 0; background: var(--card); min-width: 200px; z-index: 1; }
table.data.fss th:first-child { background: var(--wash); z-index: 2; }
table.data.fss tr.fss-head td { background: var(--wash); font-weight: 650; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; }
table.data.fss tr.fss-total td { font-weight: 650; border-top: 1px solid var(--axis); }
form.fss-input { display: flex; gap: 6px; align-items: center; }
form.fss-input input, #fss-map select { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; font: inherit; }
.row-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.nav-count { background: var(--warning); color: var(--ink); border-radius: 999px; font-size: 11px; padding: 0 6px; margin-left: 6px; }
.brand img { width: 26px; height: 26px; vertical-align: -7px; margin-right: 8px; border-radius: 6px; }
.wait-card { text-align: center; }

/* ---------- Keep me logged in, My devices ---------- */
.login label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; }
.login label.check input { width: 16px; height: 16px; padding: 0; }
dialog { border: 0; padding: 0; background: transparent; max-width: calc(100vw - 32px); }
dialog::backdrop { background: rgba(11, 11, 11, 0.35); }
.wide-dialog .card { width: min(640px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 10px; }

/* ---------- mail compose (Gmail / Outlook style) ---------- */
.mail-btn { padding: 6px 8px; }
.mail-btn svg { width: 16px; height: 16px; }
.compose { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.compose-head { display: flex; justify-content: space-between; align-items: center; background: #0f2a4a; color: #fff; padding: 10px 14px; font-weight: 600; }
.compose-head button { background: none; border: 0; color: #fff; font-size: 20px; cursor: pointer; line-height: 1; }
.compose-banner { background: var(--critical); color: #fff; padding: 10px 14px; font-size: 13px; }
.compose-banner b { font-weight: 700; }
.compose-row { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); padding: 4px 14px; }
.compose-row > span { color: var(--muted); font-size: 13px; min-width: 56px; }
.compose-row input, .compose-row select { flex: 1; border: 0; background: transparent; padding: 8px 0; font: inherit; color: var(--ink); min-width: 0; }
.compose-row input:focus, .compose-row select:focus { outline: none; }
.compose-row .link-btn { font-size: 13px; }
.compose textarea { flex: 1; min-height: 300px; border: 0; padding: 12px 14px; font: 13.5px/1.5 ui-monospace, Consolas, monospace; resize: vertical; background: transparent; color: var(--ink); }
.compose textarea:focus { outline: none; }
.compose-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--line); }
.compose-foot .note { margin-left: auto; color: var(--muted); font-size: 12px; }
.tag { font-size: 11px; background: var(--wash); border-radius: 6px; padding: 1px 6px; color: var(--ink-2); }
.compose [hidden] { display: none !important; }
/* Weekly cash plan (D21 part 2) */
tr.row-now td { background: var(--wash); }
td.num.neg { color: var(--critical); }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 6px 0; }
/* Balance sheet (D22) */
table.data td.indent { padding-left: 22px; }
table.data tr.warn-row td { background: color-mix(in srgb, var(--warning) 14%, transparent); }
/* Party groups */
.group-list details { border-top: 1px solid var(--line); padding: 10px 0; }
.group-list summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; }
.group-list summary b { min-width: 180px; }

/* Accounts desk */
.check-list { list-style: none; margin: 0; padding: 0; }
.check-row { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--border, #e5e7eb); }
.report-text { margin: 8px 0; }

/* ---------- Director brief ---------- */
.brief { display: flex; flex-direction: column; gap: var(--gap); }
.brief-print-head { display: none; }
.brief .chg.good { color: #1a7f4b; }
.brief .chg.bad { color: var(--critical); }
.brief .brief-foot { margin: 0; }
.brief ul.plain { margin: 6px 0 0; padding-left: 18px; }
@media print {
  @page { size: A4 portrait; margin: 9mm; }
  body { font-size: 10px; }
  .top, .subtabs, .btn { display: none !important; }
  .view { padding: 0; gap: 6px; }
  .brief { gap: 6px; }
  .brief-print-head { display: block; font-size: 11px; border-bottom: 1px solid #999; padding-bottom: 3px; }
  .brief .card, .brief .tile { padding: 5px 7px; border-radius: 4px; box-shadow: none; }
  .brief .card-head h2 { font-size: 11px; }
  .brief .tile .value { font-size: 15px; margin: 2px 0; }
  .brief .tile .label, .brief .tile .context, .brief .card-sub, .brief .note { font-size: 9px; }
  .brief table.data th, .brief table.data td { padding: 2px 5px; font-size: 9.5px; }
  .brief a { color: inherit; text-decoration: none; }
  .brief .grid-2 { grid-template-columns: 1fr 1fr; gap: 6px; }
  .brief .tiles { grid-template-columns: repeat(4, 1fr); gap: 6px; }
}

/* ---------- detail under a row (expand.js): opens downward, nothing above moves ---------- */
table.data tr.x-click { cursor: pointer; }
table.data tr.x-open > td { background: var(--wash); border-bottom-color: transparent; }
table.data tr.x-open > td:first-child { box-shadow: inset 3px 0 0 var(--series-1); }
table.data tr.x-row > td { padding: 0; background: var(--card); border-bottom: 1px solid var(--axis); }
table.data tr.x-row.x-closing > td { border-bottom-color: transparent; }
table.data tbody tr.x-row:hover { background: none; }
.x-wrap { display: grid; grid-template-rows: 0fr; opacity: .2; transition: grid-template-rows .26s cubic-bezier(.2, .7, .2, 1), opacity .2s ease; }
.x-wrap.open { grid-template-rows: 1fr; opacity: 1; }
.x-wrap.now { transition: none; }
.x-inner { overflow: hidden; min-height: 0; }
.x-body { padding: 12px 14px 14px; border-left: 3px solid var(--series-1); }
.x-body h3 { font-size: 13px; margin: 12px 0 6px; }
.x-body .x-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.x-body .edit-form { margin-top: 8px; }
.x-body .table-wrap { background: var(--card); }
.x-chev { display: inline-block; width: 12px; color: var(--muted); transition: transform .2s ease; }
tr.x-open .x-chev { transform: rotate(90deg); color: var(--series-1); }
button.x-name { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; text-decoration: underline; text-decoration-color: var(--axis); text-underline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .x-wrap, .x-chev { transition: none; } }
