/* Harry Reportter Digital, local web app. Direction 2 "dentsu colour, new type, new hat".
   Shell and screen styles taken from prototype/ui (app.css and screens/02-08); every value comes
   from theme/tokens.css (a copy of design/theme_directions/kit) or is marked DERIVED. */
@import url("theme/fonts.css");
@import url("theme/tokens.css");

:root {
  --rail: 232px;
  /* DERIVED (prototype/ui/app.css): alpha tints of --hr-ok / --hr-warn / --hr-err */
  --ui-ok-wash: rgba(20, 120, 92, .10);
  --ui-ok-edge: rgba(20, 120, 92, .30);
  --ui-ok-field: rgba(20, 120, 92, .45);
  --ui-warn-wash: rgba(162, 106, 26, .10);
  --ui-err-wash: rgba(184, 62, 54, .12);
  --ui-err-edge: rgba(184, 62, 54, .35);
  --ui-on-dark-edge: rgba(255, 255, 255, .24);
  --ui-on-accent-ring: rgba(255, 255, 255, .35);
  /* review fills that the kit does not name: the same values as reporter/engine/review.py */
  --ui-x-grey: #D9D9D9;    /* derived_from_carried, template_prev_disagrees */
  --ui-x-forced: #FF9999;  /* forced_gap */
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--hr-sans); font-weight: 400; font-size: var(--hr-fs-body); line-height: 1.45;
  letter-spacing: var(--hr-track-body); color: var(--hr-ink); background: var(--hr-bg);
  -webkit-font-smoothing: antialiased;
}
.mono, td.num, .num, pre, code {
  font-family: var(--hr-mono); font-weight: 400; letter-spacing: 0;
  font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0;
}
table.ledger th.num { font-family: var(--hr-sans); }
h1, h2, h3 { margin: 0; font-family: var(--hr-display); font-variant-numeric: lining-nums; color: var(--hr-ink); }
h1 { font-size: var(--hr-fs-display); font-weight: 700; letter-spacing: var(--hr-track-display); line-height: 1.15; }
h2, h3 { font-size: var(--hr-fs-section); font-weight: 600; letter-spacing: -0.005em; line-height: 1.3; }
p { margin: 0; max-width: 78ch; }
a { color: inherit; }
::selection { background: var(--hr-accent-tint); color: var(--hr-ink); }
:focus-visible { outline: none; box-shadow: var(--hr-focus); }

/* ---------- mark ---------- */
.mark { display: inline-flex; align-items: center; gap: 8px; color: var(--hr-surface); white-space: nowrap; text-decoration: none; }
.mark .hat { width: 16px; height: 16px; filter: invert(1); }
.mark .wm { font-family: var(--hr-display); font-style: var(--hr-mark-style); font-weight: 700; font-size: 12.5px; letter-spacing: -0.01em; }

/* ---------- app frame: dark title bar, light rail ---------- */
.app {
  display: grid; grid-template-columns: var(--rail) minmax(0, 1fr);
  grid-template-rows: var(--hr-titlebar-h) minmax(0, 1fr);
  height: 100vh; min-width: 1000px;
}
.topbar {
  grid-column: 1 / -1; grid-row: 1; position: relative;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 16px; background: var(--hr-titlebar); color: var(--hr-titlebar-text); font-size: var(--hr-fs-caption);
  min-width: 0;
}
.topbar .ctx { min-width: 0; max-width: calc(50% - 90px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .ctx b { color: var(--hr-titlebar-text-strong); font-weight: 500; }
.topbar .ctx .mono { font-size: var(--hr-fs-eyebrow); }
.topbar .mark { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.jobind { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: calc(50% - 90px); white-space: nowrap; }
.jobind a { display: inline-flex; align-items: center; gap: 8px; color: var(--hr-titlebar-text-strong); text-decoration: none;
  padding: 1px 8px; border: 1px solid var(--ui-on-dark-edge); border-radius: var(--hr-r-tag); overflow: hidden; text-overflow: ellipsis; }
.jobind a:hover { border-color: var(--hr-titlebar-text); }
.jobind .pulse { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--hr-titlebar-text-strong); animation: pulse 1.2s ease-in-out infinite; }
.jobind .q { color: var(--hr-titlebar-text); }
@keyframes pulse { 50% { opacity: .3; } }

.rail {
  grid-column: 1; grid-row: 2; background: var(--hr-rail); border-right: 1px solid var(--hr-line-2);
  display: flex; flex-direction: column; padding: 16px 12px; min-height: 0; overflow: auto;
}
.rail nav { display: flex; flex-direction: column; gap: 2px; }
.rail nav a, .rail nav .later {
  position: relative; display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 4px 12px;
  border-radius: var(--hr-r-btn); color: var(--hr-ink-2); text-decoration: none; font-weight: 500; font-size: var(--hr-fs-body);
}
.rail nav a:hover { background: var(--hr-line-2); }
.rail nav a.current { background: var(--hr-surface); color: var(--hr-ink); font-weight: 600; box-shadow: var(--hr-shadow-btn); }
.rail nav a.current::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 2px 2px 0; background: var(--hr-accent);
}
.rail nav .lbl { flex: 1; min-width: 0; }
.rail nav .st { font-size: var(--hr-fs-caption); font-weight: 500; color: var(--hr-muted); white-space: nowrap; }
.rail nav .st.ok { color: var(--hr-ok); }
.rail nav .st.err { color: var(--hr-err); }
.rail nav .st.info { color: var(--hr-info); }
.rail nav .st.warn { color: var(--hr-warn); }
.rail nav .dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--hr-line); }
.rail nav .dot.ok { background: var(--hr-ok); }
.rail nav .dot.err { background: var(--hr-err); }
.rail nav .dot.info { background: var(--hr-info); }
.rail nav .dot.warn { background: var(--hr-warn); }
.rail nav .dot.run { background: var(--hr-ink-2); animation: pulse 1.2s ease-in-out infinite; }
.rail nav .later { color: var(--hr-muted); cursor: default; }
.rail nav .later .st { white-space: normal; text-align: right; max-width: 84px; line-height: 1.2; }
.rail nav .later .dot { background: transparent; border: 1px dashed var(--hr-drop); }
.rail .eyebrow { margin: 16px 12px 4px; font: 600 var(--hr-fs-eyebrow)/1.3 var(--hr-sans); letter-spacing: var(--hr-track-eyebrow); text-transform: uppercase; color: var(--hr-muted); }
.rail .ed { margin: 0 12px 8px; font-size: 12px; color: var(--hr-ink-2); overflow-wrap: anywhere; }
.rail .ed .name { display: block; font-family: var(--hr-mono); font-size: var(--hr-fs-caption); color: var(--hr-ink); margin-top: 2px; }
.rail .rail-foot { margin-top: auto; padding: 12px 12px 0; border-top: 1px solid var(--hr-line); font-size: var(--hr-fs-caption); color: var(--hr-muted); }
.rail .rail-foot .mono { display: block; margin-top: 4px; font-size: var(--hr-fs-eyebrow); }

/* ---------- content ---------- */
.content {
  grid-column: 2; grid-row: 2; overflow: auto; padding: 24px 32px;
  display: flex; flex-direction: column; gap: 20px; min-height: 0; min-width: 0; counter-reset: sec;
}
.loading { color: var(--hr-muted); }
.page-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.page-head .sub { color: var(--hr-ink-2); font-size: var(--hr-fs-body-lg); min-width: 0; overflow-wrap: anywhere; }
.page-head .sub .mono { color: var(--hr-ink); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* ---------- cards, section heads and ledger tables ---------- */
.panel {
  background: var(--hr-surface); border: 1px solid var(--hr-line-2); border-radius: var(--hr-r-card);
  box-shadow: var(--hr-shadow-panel); padding: 16px 20px; min-width: 0;
}
.panel h2 { margin-bottom: 4px; }
.panel h2::before {
  counter-increment: sec; content: counter(sec, decimal-leading-zero); margin-right: 8px;
  font: 400 var(--hr-fs-mono) var(--hr-mono); letter-spacing: 0; font-style: normal; color: var(--hr-muted);
}
.panel > .note { color: var(--hr-muted); font-size: 12px; margin-bottom: 12px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
table.ledger { width: 100%; border-collapse: collapse; font-size: var(--hr-fs-body); }
table.ledger th {
  text-align: left; font: 600 var(--hr-fs-stat-label)/1.3 var(--hr-sans); letter-spacing: .08em; text-transform: uppercase;
  color: var(--hr-muted); padding: 8px; border-bottom: 1px solid var(--hr-line-2); white-space: nowrap;
}
table.ledger td { padding: 8px; border-bottom: 1px solid var(--hr-line-soft); vertical-align: middle; }
table.ledger tr:last-child td { border-bottom: none; }
table.ledger th.num, table.ledger td.num { text-align: right; }
table.ledger td.mono, table.ledger td.num { font-size: var(--hr-fs-mono); }
.muted { color: var(--hr-muted); }
.small { font-size: 12px; }
.wrapany { overflow-wrap: anywhere; }

/* ---------- tags ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 8px; padding: 3px 8px; border-radius: var(--hr-r-tag);
  border: 1px solid var(--hr-line); background: var(--hr-surface); color: var(--hr-ink-2);
  font: 500 var(--hr-fs-label)/1.3 var(--hr-sans); white-space: nowrap;
}
.tag.demo { border-color: var(--hr-ink-2); color: var(--hr-ink); }
.tag.planned { border-style: dashed; border-color: var(--hr-drop); background: transparent; }
.tag.lvl-refuse { color: var(--hr-err); border-color: var(--ui-err-edge); background: var(--ui-err-wash); }
.tag.lvl-warn { color: var(--hr-warn); border-color: var(--hr-warn-tint); background: var(--ui-warn-wash); }
.chip.hr-tag { vertical-align: middle; }

/* ---------- result chip (replaces toasts) ---------- */
.result {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px 8px 12px; background: var(--ui-ok-wash);
  border: 1px solid var(--ui-ok-edge); border-radius: var(--hr-r-pill); color: var(--hr-ink); font-size: 12.5px; font-weight: 500;
  align-self: flex-start; max-width: 100%; overflow-wrap: anywhere;
}
.result::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--hr-ok); }
.result.bad { background: var(--ui-err-wash); border-color: var(--ui-err-edge); }
.result.bad::before { background: var(--hr-err); }
.result.run { background: var(--hr-panel); border-color: var(--hr-line); }
.result.run::before { background: var(--hr-ink-2); animation: pulse 1.2s ease-in-out infinite; }
.result .mono { font-size: var(--hr-fs-caption); }

/* ---------- error box ---------- */
.errbox {
  border: 1px solid var(--ui-err-edge); background: var(--hr-err-tint); color: var(--hr-ink); border-radius: var(--hr-r-btn);
  padding: 12px 16px; font-size: var(--hr-fs-body); overflow-wrap: anywhere;
}
.errbox .code { font-family: var(--hr-mono); font-size: var(--hr-fs-mono); color: var(--hr-err); font-weight: 400; margin-right: 8px; }
.errbox .detail { margin-top: 4px; font-size: 12px; color: var(--hr-ink-2); }

/* ---------- fields and buttons ---------- */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label, .field .lab { font-size: var(--hr-fs-label); font-weight: 500; color: var(--hr-ink-2); }
.input {
  font: 400 var(--hr-fs-mono)/1.3 var(--hr-mono); color: var(--hr-ink); border: 1px solid var(--hr-line);
  border-radius: var(--hr-r-btn); background: var(--hr-surface); padding: 0 12px; height: var(--hr-field-h); width: 100%;
  font-variant-ligatures: none;
}
div.input { display: flex; align-items: center; gap: 8px; height: auto; min-height: var(--hr-field-h); padding: 6px 12px; overflow-wrap: anywhere; }
div.input.ok { border-color: var(--ui-ok-field); }
select.input { font-family: var(--hr-sans); font-size: var(--hr-fs-body); padding: 0 8px; }
.input:focus-visible { border-color: var(--hr-accent); box-shadow: var(--hr-focus); }
.input::placeholder { color: var(--hr-muted); }
.origin { font-size: 12px; color: var(--hr-muted); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--hr-btn-primary-h); padding: 0 20px;
  border: 0; border-radius: var(--hr-r-btn); background: var(--hr-accent); color: var(--hr-surface);
  font: 600 var(--hr-fs-body-lg)/1 var(--hr-sans); letter-spacing: var(--hr-track-body);
  box-shadow: var(--hr-shadow-btn), inset 0 0 0 .5px rgba(0, 0, 0, .10); /* DERIVED (prototype): inner edge */
  white-space: nowrap; cursor: pointer; text-decoration: none; transition: background-color 200ms ease-out;
}
.btn:hover { background: var(--hr-accent-hover); }
.btn:focus-visible { box-shadow: var(--hr-focus); }
.btn.ghost {
  height: var(--hr-btn-h); padding: 0 16px; border: 1px solid var(--hr-line); background: var(--hr-surface); color: var(--hr-ink);
  font-weight: 500; font-size: var(--hr-fs-body); box-shadow: none;
}
.btn.ghost:hover { background: var(--hr-line-2); }
.btn .ico { width: 16px; height: 16px; }
.btn:not(.ghost) .ico { filter: invert(1); }
.btn[disabled], .btn.disabled {
  background: var(--hr-panel); color: var(--hr-muted); box-shadow: inset 0 0 0 1px var(--hr-line); cursor: not-allowed;
}
.btn[disabled] .ico { filter: none; opacity: .5; }
.btnbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.elapsed { font-family: var(--hr-mono); font-size: var(--hr-fs-mono); color: var(--hr-muted); }

/* ---------- log rows (design: tint only on warn and err) ---------- */
.log { display: flex; flex-direction: column; gap: 2px; padding: 4px; margin-top: 8px; background: var(--hr-surface);
  border: 1px solid var(--hr-line-soft); border-radius: var(--hr-r-window); max-height: 460px; overflow: auto; }
.log .row { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 8px; padding: 4px 8px; border-radius: var(--hr-r-chip);
  font-family: var(--hr-mono); font-size: var(--hr-fs-caption); line-height: 1.45; color: var(--hr-ink-2); }
.log .row .lv { font-weight: 500; color: var(--hr-muted); }
.log .row .tx { white-space: pre-wrap; overflow-wrap: anywhere; }
.log .row.tab { width: max-content; min-width: 100%; }
.log .row.tab .tx { white-space: pre; overflow-wrap: normal; }
.log .row.OK .lv { color: var(--hr-ok); }
.log .row.WARN { background: var(--ui-warn-wash); }
.log .row.WARN .lv { color: var(--hr-warn); }
.log .row.ERROR { background: var(--ui-err-wash); }
.log .row.ERROR .lv { color: var(--hr-err); }
.log .row.state .tx { color: var(--hr-muted); }
.log .empty { padding: 8px; color: var(--hr-muted); font-size: 12px; }

/* ---------- stat trio and key/value facts ---------- */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.stat { padding: 8px 12px; background: var(--hr-panel); border: 1px solid var(--hr-line-soft); border-radius: var(--hr-r-stat); }
.stat .v { font-family: var(--hr-display); font-variant-numeric: lining-nums; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.stat .k { font-size: var(--hr-fs-stat-label); color: var(--hr-muted); text-transform: uppercase; letter-spacing: .08em; margin-top: 2px; }
.facts { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 16px; font-size: var(--hr-fs-body); margin-top: 16px; }
.facts .k { color: var(--hr-muted); }
.facts .mono { font-size: var(--hr-fs-mono); overflow-wrap: anywhere; }
.prov { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; margin-top: 12px; font-size: 12px; color: var(--hr-ink-2); }
.prov > span { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--hr-line-soft); padding: 2px 0; }
.prov span.mono { font-size: var(--hr-fs-mono); color: var(--hr-ink); }
.files { margin: 8px 0 0; padding: 0; list-style: none; }
.files li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--hr-line-2); }
.files li:first-child { border-top: none; }
.files .fn { font-family: var(--hr-mono); font-size: var(--hr-fs-mono); overflow-wrap: anywhere; }
.files .what { font-size: 12px; color: var(--hr-muted); }

/* ---------- first run ---------- */
.pg-first .panel { max-width: 860px; }
.pg-first p { color: var(--hr-ink-2); font-size: var(--hr-fs-body-lg); margin-top: 8px; }

/* ---------- home (prototype screens/02-home.html) ---------- */
.pg-home .grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 20px; align-items: start; }
.due { list-style: none; margin: 8px 0 0; padding: 0; }
.due li { border-top: 1px solid var(--hr-line-2); }
.due li:first-child { border-top: none; }
.due a { display: grid; grid-template-columns: 150px minmax(0, 1fr) 110px; gap: 4px 16px; padding: 12px 8px; margin: 0 -8px;
  align-items: start; text-decoration: none; border-radius: var(--hr-r-btn); }
.due a:hover { background: var(--hr-panel); }
.due .name { font-family: var(--hr-mono); font-size: 12px; color: var(--hr-ink); overflow-wrap: anywhere; }
.due .meta { color: var(--hr-muted); font-size: 12px; margin-top: 4px; }
.due .meta .mono { font-size: var(--hr-fs-caption); }
.due .when { text-align: right; font-size: var(--hr-fs-caption); color: var(--hr-muted); }
.due .when .mono { color: var(--hr-ink); font-size: 12px; }
.legend-states { display: grid; grid-template-columns: 170px 1fr 48px; gap: 8px 16px; align-items: center; margin-top: 8px; font-size: 12.5px; color: var(--hr-ink-2); }
.legend-states .num { text-align: right; font-size: 12px; color: var(--hr-ink); }
.archive { display: flex; align-items: center; gap: 20px; }
.archive .big { font-family: var(--hr-display); font-variant-numeric: lining-nums; font-size: var(--hr-fs-display); font-weight: 700; letter-spacing: var(--hr-track-display); }
.filters { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 12px; margin: 8px 0 4px; }
.fam-sum { display: flex; gap: 20px; font-size: 12px; color: var(--hr-muted); margin: 4px 0 8px; flex-wrap: wrap; }
.fam-sum .mono { color: var(--hr-ink); }
.edlist { max-height: calc(100vh - 290px); min-height: 240px; overflow: auto; margin: 0 -8px; }
.edlist table.ledger td { padding: 4px 8px; }
.edlist table.ledger th { position: sticky; top: 0; background: var(--hr-surface); z-index: 1; }
.edlist tr.grp td { padding-top: 12px; font-weight: 600; color: var(--hr-ink); border-bottom: 1px solid var(--hr-line-2); }
.edlist tr.grp td .muted { font-weight: 400; }
.edlist tr.ed { cursor: pointer; }
.edlist tr.ed:hover td { background: var(--hr-panel); }
.edlist tr.ed a { text-decoration: none; font-family: var(--hr-mono); font-size: var(--hr-fs-mono); overflow-wrap: anywhere; }
.edlist tr.ed a:hover { text-decoration: underline; text-decoration-color: var(--hr-drop); }
.edlist td.per { white-space: nowrap; font-size: 12px; color: var(--hr-ink-2); }

/* ---------- readiness (prototype screens/04-readiness.html) ---------- */
table.matrix { width: 100%; border-collapse: separate; border-spacing: 8px; margin: 4px -8px 0; font-size: var(--hr-fs-body); }
table.matrix th { text-align: left; font-weight: 600; color: var(--hr-ink); padding: 4px 8px; font-size: var(--hr-fs-body); }
table.matrix th .mono { display: block; font-weight: 400; color: var(--hr-muted); font-size: var(--hr-fs-caption); }
table.matrix td.ch { font-weight: 600; padding-right: 12px; white-space: nowrap; }
table.matrix td.cell { border-radius: var(--hr-r-btn); padding: 8px 12px; background: var(--hr-panel); border: 1px solid var(--hr-line-2); }
table.matrix td.cell .s { font-weight: 600; font-size: 12.5px; color: var(--hr-muted); }
table.matrix td.cell .r { font-family: var(--hr-mono); font-size: var(--hr-fs-mono); color: var(--hr-ink-2); }
table.matrix td.cell.ok { background: var(--ui-ok-wash); border-color: var(--ui-ok-edge); }
table.matrix td.cell.ok .s { color: var(--hr-ok); }
.verdict { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.verdict .v { font-family: var(--hr-display); font-size: var(--hr-fs-display); font-weight: 700; letter-spacing: var(--hr-track-display); line-height: 1.15; }
.verdict .v.no { color: var(--hr-err); }
.verdict .v.yes { color: var(--hr-ok); }
.verdict .v.wait { color: var(--hr-muted); }
.checks td.det { overflow-wrap: anywhere; font-size: 12px; color: var(--hr-ink-2); }
.checks td.id { font-family: var(--hr-mono); font-size: var(--hr-fs-mono); white-space: nowrap; }
.accept { margin-top: 16px; padding: 12px 16px; border: 1px solid var(--ui-err-edge); border-radius: var(--hr-r-btn); background: var(--hr-err-tint); }
.accept p { font-size: 12.5px; color: var(--hr-ink); }
.accept label { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; font-size: var(--hr-fs-body); cursor: pointer; }
.accept label .mono { font-size: var(--hr-fs-mono); }
.accept input { accent-color: var(--hr-accent); margin-top: 2px; }

/* ---------- build (prototype screens/06-build.html) ---------- */
.picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin-top: 12px; }
.picker .wide { grid-column: span 2; }
.forced { margin-top: 12px; font-size: 12.5px; color: var(--hr-ink-2); }

/* ---------- review (prototype screens/07-review.html) ---------- */
.content.pg-review { padding: 16px 20px; gap: 12px; overflow: hidden; }
.pg-review .grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; flex: 1; min-height: 0; }
.sheetp { padding: 12px 16px; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.sheet-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.sheet-head h2 { white-space: nowrap; }
.sheet-head h2 .mono { font-size: var(--hr-fs-mono); color: var(--hr-muted); font-weight: 400; }
.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--hr-line-2); margin-bottom: 8px; flex: none; }
.tabs button { flex: none; border: 0; background: transparent; padding: 6px 12px 7px; font: 500 12px/1.3 var(--hr-sans); color: var(--hr-ink-2);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; border-radius: var(--hr-r-tag) var(--hr-r-tag) 0 0; }
.tabs button:hover { background: var(--hr-panel); }
.tabs button.current { color: var(--hr-ink); font-weight: 600; border-bottom-color: var(--hr-accent); }
.tabs button.hid { color: var(--hr-muted); font-style: italic; }
.tabs button .n { font-family: var(--hr-mono); font-size: var(--hr-fs-caption); color: var(--hr-info); margin-left: 4px; }
.xlegend { display: flex; gap: 12px; font-size: var(--hr-fs-label); color: var(--hr-muted); align-items: center; flex-wrap: wrap; }
.xlegend i { display: inline-block; width: 14px; height: 11px; border: 1px solid var(--hr-line); vertical-align: -1px; margin-right: 4px; }
.xlegend i.red { border-color: #FF0000; } /* review.py RED_BORDER */
.gridwrap { position: relative; flex: 1; min-height: 0; border: 1px solid var(--hr-line-2); border-radius: var(--hr-r-tag); overflow: hidden; }
.gridwrap .msg { padding: 16px; color: var(--hr-muted); }

/* the sheet keeps the workbook's own colours; #000 is the workbook's default cell text */
.xg { position: absolute; inset: 0; overflow: auto; background: var(--hr-surface); }
.xg-canvas { position: relative; }
.xg-body { position: absolute; left: 0; top: 0; z-index: 1; }
.xg-top { position: sticky; top: 0; z-index: 3; }
.xg-corner { position: sticky; left: 0; z-index: 4; background: var(--hr-surface); }
.xg-left { position: sticky; left: 0; z-index: 2; background: var(--hr-surface); }
.xg .c {
  position: absolute; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 0 3px;
  border-right: 1px solid var(--hr-line-2); border-bottom: 1px solid var(--hr-line-2);
  font-family: var(--hr-mono); font-size: 11px; line-height: 15px; letter-spacing: -0.2px; color: #000; background: #fff;
  font-variant-ligatures: none; display: flex; align-items: flex-end; cursor: default;
}
.xg .gl { position: absolute; background: var(--hr-line-2); }
.xg .c > span { overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.xg .c.n > span { text-align: right; }
.xg .c.b { font-weight: 700; }
.xg .c.w > span { white-space: normal; overflow-wrap: anywhere; align-self: flex-start; }
.xg .c.sp { z-index: 1; }
.xg .c.fl { cursor: pointer; }
.xg .c.fl::after { content: ""; position: absolute; right: 0; top: 0; border-style: solid; border-width: 0 6px 6px 0; border-color: transparent var(--hr-info) transparent transparent; }
.xg .c.fl.red { box-shadow: inset 0 0 0 1px #FF0000; }
.xg .c.sel { box-shadow: inset 0 0 0 2px var(--hr-accent); z-index: 2; }
.xg .h { position: absolute; background: var(--hr-panel); color: var(--hr-muted); font: 500 10px/1 var(--hr-sans); display: flex; align-items: center;
  justify-content: center; border-right: 1px solid var(--hr-line-2); border-bottom: 1px solid var(--hr-line-2); }
.xg .h.on { color: var(--hr-ink); background: var(--hr-accent-tint); }
.xg-tip { position: absolute; z-index: 6; background: var(--hr-titlebar); color: var(--hr-titlebar-text-strong); border-radius: var(--hr-r-btn);
  padding: 8px 12px; font-size: 12px; width: 380px; box-shadow: var(--hr-shadow-panel); pointer-events: none; }
.xg-tip b { font-weight: 600; }
.xg-tip .mono { color: var(--hr-titlebar-text); font-size: var(--hr-fs-caption); }
.xg-tip div + div { margin-top: 4px; }

.rv { padding: 12px 16px; display: flex; flex-direction: column; min-height: 0; }
.rvsel { margin-top: 8px; padding: 8px 12px; border: 1px solid var(--hr-line-2); border-radius: var(--hr-r-btn); background: var(--hr-panel); font-size: 12px; }
.rvsel .kv { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 2px 8px; margin-top: 4px; }
.rvsel .kv .k { color: var(--hr-muted); }
.rvsel .kv .mono { font-size: var(--hr-fs-caption); overflow-wrap: anywhere; }
.rvsel .cellid { font-family: var(--hr-mono); font-size: var(--hr-fs-mono); font-weight: 400; }
.rvlist { overflow: auto; flex: 1; min-height: 0; margin-top: 8px; }
table.rvt { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: fixed; }
table.rvt col.w-cell { width: 27%; }
table.rvt col.w-win { width: 17%; }
table.rvt col.w-val { width: 17%; }
table.rvt th { text-align: left; font: 600 var(--hr-fs-stat-label)/1.3 var(--hr-sans); letter-spacing: .08em; text-transform: uppercase; color: var(--hr-muted);
  padding: 4px; border-bottom: 1px solid var(--hr-line-2); position: sticky; top: 0; background: var(--hr-surface); z-index: 1; }
table.rvt tbody { cursor: pointer; }
table.rvt tbody:hover td { background: var(--hr-panel); }
table.rvt tbody.sel td { background: var(--hr-accent-tint); }
table.rvt td { padding: 4px 4px 0; font-family: var(--hr-mono); font-size: var(--hr-fs-caption); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.rvt td.num, table.rvt th.num { text-align: right; }
table.rvt tr.why td { padding: 0 4px 4px; font-family: var(--hr-sans); font-size: var(--hr-fs-label); color: var(--hr-muted); white-space: normal; border-bottom: 1px solid var(--hr-line-soft); overflow-wrap: anywhere; }
table.rvt td .sw { display: inline-block; width: 8px; height: 8px; border: 1px solid var(--hr-line); margin-right: 4px; vertical-align: 0; }

/* ---------- send (prototype screens/08-approve-send.html) ---------- */
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 8px 16px; font-size: var(--hr-fs-body); margin-top: 12px; }
.kv .k { color: var(--hr-muted); }
.kv .mono { font-size: var(--hr-fs-mono); overflow-wrap: anywhere; }
.sendnote { margin-top: 8px; font-size: var(--hr-fs-body-lg); color: var(--hr-ink-2); }
table.ov td { overflow-wrap: anywhere; }

/* ---------- narrower windows ---------- */
@media (max-width: 1360px) {
  :root { --rail: 208px; }
  .content { padding: 20px 24px; }
  .pg-home .grid, .grid2 { grid-template-columns: minmax(0, 1fr); }
  .edlist { max-height: none; }
  .pg-review .grid { grid-template-columns: minmax(0, 1fr) 320px; }
}
@media (max-width: 1100px) {
  :root { --rail: 184px; }
  .due a { grid-template-columns: 170px minmax(0, 1fr); }
  .due .when { grid-column: 2; text-align: left; }
  .pg-review .grid { grid-template-columns: minmax(0, 1fr) 280px; }
  .facts { grid-template-columns: 120px minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
