/* Waneta maintenance portal.
   Palette: ink slate, galvanized greys, one hi-vis yellow reserved for job tags and emergencies.
   Type: Barlow Semi Condensed for headings and job tags, Public Sans for everything read at length. */

@font-face { font-family: "Barlow SC"; font-weight: 500; font-display: swap; src: url("fonts/barlow-semi-condensed-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow SC"; font-weight: 600; font-display: swap; src: url("fonts/barlow-semi-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow SC"; font-weight: 700; font-display: swap; src: url("fonts/barlow-semi-condensed-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-weight: 400; font-display: swap; src: url("fonts/public-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-weight: 500; font-display: swap; src: url("fonts/public-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-weight: 600; font-display: swap; src: url("fonts/public-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-weight: 700; font-display: swap; src: url("fonts/public-sans-latin-700-normal.woff2") format("woff2"); }

:root {
  --ink: #16222e;
  --ink-2: #22313f;
  --steel: #55636f;
  --line: #d3dae0;
  --line-soft: #e4e9ed;
  --mist: #eef1f3;
  --paper: #ffffff;
  --hivis: #f4c20d;
  /* Brand colours. /brand.css overrides these with what was chosen under Branding. */
  --brand: #16222e;
  --brand-2: #22313f;
  --brand-fg: #c9d3db;
  --brand-fg-dim: #9fb0bd;
  --brand-fg-strong: #ffffff;
  --accent: #f4c20d;
  --accent-fg: #16222e;
  --accent-on-brand: #f4c20d;
  --signal: #0b5c8a;
  --good: #1e7b4c;      --good-bg: #e3f3ea;
  --bad: #b23a2f;       --bad-bg: #fbe9e6;
  --wait: #8a5a00;      --wait-bg: #fff3d0;
  --ask: #0b5c8a;       --ask-bg: #e2f0f8;
  --hold: #5b4b8a;      --hold-bg: #edeaf6;
  --display: "Barlow SC", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --body: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --side: 15.5rem;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 0.9375rem/1.55 var(--body); color: var(--ink); background: var(--mist); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: 0.005em; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.3rem; }
p { margin: 0 0 0.75rem; }
a { color: var(--signal); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
img, video { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 2px; }
.muted { color: var(--steel); }
.small { font-size: 0.8125rem; }
.sub { display: block; color: var(--steel); font-size: 0.8125rem; line-height: 1.4; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--hivis); color: var(--ink); padding: 0.5rem 1rem; z-index: 10; font-weight: 600; }
.skip:focus { left: 0; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--brand) var(--side), transparent var(--side)); }
.side { background: var(--brand); color: var(--brand-fg); padding: 1.5rem 0 1rem; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: block; padding: 0 1.25rem 1.25rem; text-decoration: none; color: var(--brand-fg-strong); border-bottom: 1px solid var(--brand-2); }
.brand:hover { color: var(--brand-fg-strong); }
.brand-logo { max-height: 2.6rem; max-width: 100%; width: auto; }
.brand-logo-lg { max-height: 5rem; }
.brand-site { display: block; font: 700 1.45rem/1.1 var(--display); }
.brand-sub { display: block; font-size: 0.8125rem; color: var(--brand-fg-dim); margin-top: 0.25rem; }
.nav { display: flex; flex-direction: column; flex: 1; padding-top: 0.75rem; }
.nav ul { list-style: none; margin: 0; padding: 0; }
.nav li a { display: block; padding: 0.5rem 1.25rem; color: var(--brand-fg); text-decoration: none; border-left: 4px solid transparent; }
.nav li a:hover { color: var(--brand-fg-strong); background: var(--brand-2); }
.nav li a[aria-current="page"] { color: var(--brand-fg-strong); border-left-color: var(--accent-on-brand); background: var(--brand-2); font-weight: 600; }
.nav-group { margin: 1.25rem 1.25rem 0.25rem; font-size: 0.8125rem; color: var(--brand-fg-dim); }
.nav-toggle { display: none; }
.who { margin-top: auto; padding: 1rem 1.25rem 0; border-top: 1px solid var(--brand-2); font-size: 0.875rem; display: grid; gap: 0.15rem; }
.who-name { color: var(--brand-fg-strong); font-weight: 600; }
.who-role { color: var(--brand-fg-dim); font-size: 0.8125rem; margin-bottom: 0.4rem; }
.who a, .who .linklike { color: var(--brand-fg); }
.who a:hover, .who .linklike:hover { color: var(--brand-fg-strong); }
main { padding: 2rem 2.5rem 4rem; max-width: 78rem; width: 100%; }
main:focus { outline: none; }

/* ---------- common pieces ---------- */
.page-head, .req-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.lede { margin: 0.4rem 0 0; color: var(--steel); max-width: 62ch; font-size: 1rem; }
.actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.actions-row { display: flex; gap: 0.5rem; }
.narrow { max-width: 42rem; }
.stack { display: grid; gap: 1rem; }
.stack > .field { margin: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; font: 600 0.9375rem/1 var(--body); padding: 0.65rem 1rem; border-radius: 4px; border: 1.5px solid var(--ink); background: var(--paper); color: var(--ink); text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--mist); color: var(--ink); }
.btn-primary { background: var(--brand); color: var(--brand-fg-strong); border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-2); color: var(--brand-fg-strong); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--signal); }
.btn-quiet:hover { background: var(--line-soft); }
.btn-danger { border-color: var(--bad); color: var(--bad); }
.btn-danger:hover { background: var(--bad-bg); color: var(--bad); }
.btn-small { padding: 0.45rem 0.7rem; font-size: 0.8125rem; }
.btn-wide { width: 100%; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--signal); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.linklike:hover { color: var(--ink); }
.linklike.danger, a.danger { color: var(--bad); }

.flash { padding: 0.75rem 1rem; border-radius: 4px; margin-bottom: 1rem; border-left: 4px solid var(--good); background: var(--good-bg); max-width: 62rem; }
.flash-bad { border-left-color: var(--bad); background: var(--bad-bg); }
.banner { padding: 0.9rem 1.1rem; border-radius: 4px; margin-bottom: 1.25rem; border-left: 4px solid var(--steel); background: var(--paper); }
.banner-todo { border-left-color: var(--wait); background: var(--wait-bg); }
.banner-question { border-left-color: var(--ask); background: var(--ask-bg); }
.banner-question blockquote { margin: 0 0 1rem; padding-left: 0.9rem; border-left: 2px solid var(--ask); }
.banner-note, .note { color: var(--steel); font-size: 0.875rem; }
.note { margin: 0.75rem 0 0; padding-left: 0.75rem; border-left: 2px solid var(--line); }
.empty { background: var(--paper); border: 1px dashed var(--line); border-radius: 6px; padding: 2.5rem 1.5rem; text-align: center; color: var(--steel); }
.empty p:last-child { margin-bottom: 0; }

/* job tag: the one place the hi-vis yellow lives */
.plate { display: inline-flex; align-items: stretch; font: 700 0.875rem/1 var(--display); border: 1.5px solid var(--ink); border-radius: 3px; overflow: hidden; white-space: nowrap; vertical-align: middle; letter-spacing: 0.03em; }
.plate-prefix { background: var(--accent); color: var(--accent-fg); padding: 0.3rem 0.4rem; }
.plate-num { background: var(--brand); color: var(--accent-on-brand); padding: 0.3rem 0.45rem; font-variant-numeric: tabular-nums; }
.plate-lg { font-size: 1.35rem; border-width: 2px; border-radius: 4px; }
.plate-lg .plate-prefix, .plate-lg .plate-num { padding: 0.5rem 0.65rem; }
.plate-link { text-decoration: none; display: inline-block; }
.plate-link:hover .plate { box-shadow: 0 0 0 2px var(--signal); }

.chip { display: inline-block; font-size: 0.78rem; font-weight: 600; line-height: 1; padding: 0.3rem 0.5rem; border-radius: 3px; background: var(--line-soft); color: var(--steel); white-space: nowrap; margin-right: 0.3rem; }
.chip-in_review { background: var(--wait-bg); color: var(--wait); }
.chip-more_info { background: var(--ask-bg); color: var(--ask); }
.chip-approved, .chip-work-complete { background: var(--good-bg); color: var(--good); }
.chip-not_approved { background: var(--bad-bg); color: var(--bad); }
.chip-deferred { background: var(--hold-bg); color: var(--hold); }
.chip-work-in_progress { background: var(--ask-bg); color: var(--ask); }
.chip-internal { background: var(--ink); color: #fff; margin-top: 0.3rem; }
.chip-emergency { background: var(--hivis); color: var(--ink); padding-left: 1.1rem; position: relative; overflow: hidden; }
.chip-emergency::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 0.7rem; background: repeating-linear-gradient(-45deg, var(--ink) 0 3px, var(--hivis) 3px 6px); }

.rating { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; font-size: 0.875rem; white-space: nowrap; }
.rating-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.rating-bars i { width: 5px; background: var(--line); border-radius: 1px; }
.rating-bars i:nth-child(1) { height: 6px; }
.rating-bars i:nth-child(2) { height: 10px; }
.rating-bars i:nth-child(3) { height: 14px; }
.rating-low .on { background: var(--steel); }
.rating-medium .on { background: #c98a00; }
.rating-high .on { background: var(--bad); }
.rating-high { color: var(--bad); }

.clock { display: inline-grid; gap: 0.25rem; min-width: 7.5rem; }
.clock progress { appearance: none; -webkit-appearance: none; width: 100%; height: 6px; border: 0; border-radius: 3px; background: var(--line); overflow: hidden; display: block; }
.clock progress::-webkit-progress-bar { background: var(--line); }
.clock progress::-webkit-progress-value { background: var(--signal); }
.clock progress::-moz-progress-bar { background: var(--signal); }
.clock-near progress::-webkit-progress-value { background: #c98a00; }
.clock-near progress::-moz-progress-bar { background: #c98a00; }
.clock-late progress::-webkit-progress-value { background: var(--bad); }
.clock-late progress::-moz-progress-bar { background: var(--bad); }
.clock-text { font-size: 0.8125rem; color: var(--steel); font-variant-numeric: tabular-nums; }
.clock-late .clock-text { color: var(--bad); font-weight: 600; }

/* ---------- forms ---------- */
.field { display: grid; gap: 0.3rem; margin-bottom: 1rem; min-width: 0; align-content: start; }
.field label, .field > .label { font-weight: 600; font-size: 0.875rem; }
.hint { color: var(--steel); font-size: 0.8125rem; margin: 0; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"], input[type="search"], input[type="url"], select, textarea {
  font: inherit; color: var(--ink); background: var(--paper); border: 1.5px solid #9aa6b0; border-radius: 4px; padding: 0.55rem 0.65rem; width: 100%; min-width: 0;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--signal); outline-offset: 0; border-color: var(--signal); }
input[type="file"] { font: inherit; max-width: 100%; }
.input-short { max-width: 9rem; }
.input-medium { max-width: 26rem; }
.input-code-entry { font: 600 1.5rem/1 var(--display) !important; letter-spacing: 0.3em; text-align: center; max-width: 13rem; }
.keyline { display: inline-block; font: 600 1rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--mist); padding: 0.4rem 0.6rem; border-radius: 4px; overflow-wrap: anywhere; }
.keyline-small { font-size: 0.75rem; font-weight: 400; margin-top: 0.5rem; }
.setup-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: 1.5rem; max-width: 62rem; }
.uri { margin-top: 1rem; }
.uri summary { cursor: pointer; color: var(--signal); font-size: 0.875rem; }
.panel-gap { margin-top: 1.5rem; }
.viewer-table .table { width: auto; min-width: 100%; }
.viewer-table td { font-size: 0.875rem; padding: 0.45rem 0.7rem; min-width: 4rem; max-width: 26rem; overflow-wrap: anywhere; }
.viewer-table tr:first-child td { font-weight: 600; background: #f7f9fa; }
.viewer-doc section { max-width: 75ch; }
.viewer-doc h3 { margin: 1rem 0 0.4rem; font-size: 1.1rem; }
.input-code { max-width: 11rem; font-weight: 600; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0 1.25rem; }
.field-grow { flex: 1 1 14rem; }
.check { display: flex; gap: 0.6rem; align-items: flex-start; font-weight: 500; }
.check input { margin-top: 0.25rem; width: 1.05rem; height: 1.05rem; accent-color: var(--ink); flex: none; }
.filters, .inline-form { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: flex-end; margin-bottom: 1.25rem; }
.filters .field, .inline-form .field { margin: 0; }
.filters .check { padding-bottom: 0.6rem; }
.inline-tight { margin: 0; gap: 0.5rem; align-items: center; }
.choice { border: 0; padding: 0; margin: 0; display: grid; gap: 0.4rem; }
.choice label { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.75rem; border: 1.5px solid var(--line); border-radius: 4px; font-weight: 600; cursor: pointer; background: var(--paper); }
.choice label:has(input:checked) { border-color: var(--ink); box-shadow: inset 4px 0 0 var(--ink); }
.choice input { accent-color: var(--ink); width: 1.05rem; height: 1.05rem; }

/* ---------- tables ---------- */
.table-wrap { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; overflow-x: auto; margin-bottom: 1rem; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 0.75rem 0.9rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line-soft); }
.table th.num, .table td.num { text-align: right; }
.table thead th { font-size: 0.8125rem; font-weight: 600; color: var(--steel); background: #f7f9fa; border-bottom-color: var(--line); white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #f9fbfc; }
.cell-main a { font-weight: 600; color: var(--ink); text-decoration: none; }
.cell-main a:hover { text-decoration: underline; }
.cell-main { min-width: 14rem; }
tr.needs-me td:first-child { box-shadow: inset 4px 0 0 var(--accent); }
tr.is-off { opacity: 0.6; }
.row-actions { white-space: nowrap; }
.row-actions > *, .file-actions > * { display: inline-block; margin-right: 0.8rem; }
.row-actions form, .file-actions form { display: inline; }
.group-title { margin: 1.75rem 0 0.6rem; }

/* ---------- request page ---------- */
.req-id { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.req-meta { margin: 0.5rem 0 0; display: flex; flex-wrap: wrap; gap: 0.35rem 0.75rem; align-items: center; color: var(--steel); font-size: 0.875rem; }
.req-meta .chip { margin-right: 0; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 21rem; gap: 1.5rem; align-items: start; }
.col-main, .col-side { display: grid; gap: 1.5rem; min-width: 0; }
.sheet, .panel { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; }
.sheet > section { padding: 1.4rem 1.6rem; border-bottom: 1px solid var(--line-soft); }
.sheet > section:last-of-type { border-bottom: 0; }
.sheet h2, .panel h2 { margin-bottom: 0.9rem; }
.sheet-text { font-size: 1rem; max-width: 70ch; }
.panel { padding: 1.25rem 1.4rem; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.panel-flat { margin-bottom: 1rem; }
.panel-decide { border: 2px solid var(--ink); }
.panel-edit { border-left: 4px solid var(--signal); margin-bottom: 1.5rem; }
.panel-quiet { background: transparent; border-style: dashed; }
.panel-quiet summary { cursor: pointer; color: var(--steel); font-weight: 600; }
.panel-quiet form { margin-top: 1rem; }
.facts { margin: 0; display: grid; gap: 0.7rem; }
.facts > div { display: grid; gap: 0.1rem; }
.facts dt { font-size: 0.8125rem; color: var(--steel); }
.facts dd { margin: 0; font-weight: 500; }
.facts-grid { grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 1rem 1.5rem; margin-top: 1.1rem; }
.facts-wide > div { grid-template-columns: 15rem minmax(0, 1fr); gap: 1rem; padding-bottom: 0.7rem; border-bottom: 1px solid var(--line-soft); }
.facts-wide > div:last-child { border-bottom: 0; padding-bottom: 0; }
.facts-wide dt { font-size: 0.875rem; }
.figure { font: 600 1.35rem/1.1 var(--display); font-variant-numeric: tabular-nums; }
.risk { width: 100%; border-collapse: collapse; }
.risk th, .risk td { text-align: left; vertical-align: top; padding: 0.7rem 0.75rem 0.7rem 0; border-bottom: 1px solid var(--line-soft); }
.risk tr:last-child th, .risk tr:last-child td { border-bottom: 0; }
.risk th { width: 11rem; font-weight: 600; font-size: 0.875rem; }
.risk td:nth-child(2) { width: 7.5rem; }

.signature { margin-top: 1rem; padding: 0.8rem 0 0.2rem 0.9rem; border-left: 4px solid var(--steel); }
.signature p { margin: 0; }
.signature-approve { border-left-color: var(--good); }
.signature-not_approve { border-left-color: var(--bad); }
.signature-defer { border-left-color: var(--hold); }
.signature-old { opacity: 0.65; }
.signature-what { font-size: 0.8125rem; font-weight: 700; }
.signature-approve .signature-what { color: var(--good); }
.signature-not_approve .signature-what { color: var(--bad); }
.signature-defer .signature-what { color: var(--hold); }
.signature-name { font: 600 1.5rem/1.2 var(--display); border-bottom: 1px solid var(--ink); display: inline-block; padding-right: 1.5rem; margin: 0.15rem 0 0.3rem !important; }
.signature-comment { margin-top: 0.5rem !important; }
.sign-box { background: var(--mist); border-radius: 4px; padding: 0.9rem; display: grid; gap: 0.75rem; }
.sign-box .field { margin: 0; }
.sign-title { font: 600 1.05rem/1 var(--display); margin: 0; }
.hashline { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.75rem; color: var(--steel); word-break: break-all; }

.timeline { list-style: none; margin: 0 0 1.25rem; padding: 0; }
.tl { padding: 0.65rem 0 0.65rem 1.1rem; border-left: 2px solid var(--line); position: relative; }
.tl::before { content: ""; position: absolute; left: -5px; top: 1.05rem; width: 8px; height: 8px; border-radius: 50%; background: var(--steel); }
.tl-decision::before { background: var(--ink); width: 10px; height: 10px; left: -6px; }
.tl-question::before, .tl-resubmitted::before { background: var(--ask); }
.tl-submitted::before { background: #c98a00; }
.tl-head { margin: 0; font-size: 0.875rem; color: var(--steel); }
.tl-head strong { color: var(--ink); }
.tl-head time { margin-left: 0.35rem; white-space: nowrap; }
.tl-body { margin: 0.2rem 0 0; max-width: 68ch; }
.tl-comment .tl-body, .tl-question .tl-body { background: var(--mist); padding: 0.55rem 0.75rem; border-radius: 4px; display: inline-block; }
.comment-form { border-top: 1px solid var(--line-soft); padding-top: 1rem; }

/* form version of the sheet */
.sheet-form { margin-bottom: 1.5rem; }
.risk-row { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 0 1.25rem; }
.emergency-box { border: 1.5px dashed var(--line); border-radius: 4px; padding: 0.9rem 1rem; display: grid; gap: 0.8rem; }
.emergency-box:has(input:checked) { border-style: solid; border-color: var(--ink); box-shadow: inset 6px 0 0 var(--hivis); }
.emergency-box .field { margin: 0; max-width: 16rem; }
.form-foot { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: center; padding: 1.1rem 1.6rem; background: #f7f9fa; border-top: 1px solid var(--line); border-radius: 0 0 6px 6px; position: sticky; bottom: 0; }
.form-foot .hint { flex: 1 1 16rem; }

/* ---------- files ---------- */
.gallery { list-style: none; margin: 0 0 1.25rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr)); gap: 1rem; }
.gallery li { border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: var(--paper); }
.gallery img, .gallery video { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--ink); }
.gallery a:hover img { opacity: 0.9; }
.gallery-meta { padding: 0.55rem 0.7rem 0.65rem; display: grid; gap: 0.15rem; font-size: 0.8125rem; }
.gallery-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list { list-style: none; margin: 0 0 1.25rem; padding: 0; }
.file-list li { display: flex; gap: 0.9rem; align-items: flex-start; padding: 0.75rem 0; border-bottom: 1px solid var(--line-soft); }
.file-list li:last-child { border-bottom: 0; }
.file-body { flex: 1; min-width: 0; }
.file-name { font-weight: 600; overflow-wrap: anywhere; }
.file-actions { font-size: 0.8125rem; white-space: nowrap; }
.gallery-meta .file-actions { white-space: normal; }
.is-internal { background-image: repeating-linear-gradient(-45deg, transparent 0 10px, rgba(22, 34, 46, 0.035) 10px 20px); }
.ext { flex: none; width: 3.1rem; text-align: center; font: 700 0.75rem/1 var(--display); letter-spacing: 0.04em; padding: 0.55rem 0; border-radius: 3px; background: var(--steel); color: #fff; }
.ext-pdf { background: #a8322a; }
.ext-xlsx, .ext-xls, .ext-csv { background: #1e7b4c; }
.ext-docx, .ext-doc { background: #1f5fa8; }
.ext-link { background: var(--paper); color: var(--signal); box-shadow: inset 0 0 0 1.5px var(--signal); }
.ext-form { background: var(--brand); color: var(--accent-on-brand); }
.add-files { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1.5rem; padding-top: 1.1rem; border-top: 1px solid var(--line-soft); }
.add-files .field { margin-bottom: 0.75rem; }

.folders { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1.25rem; }
.folder { display: block; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; text-decoration: none; color: var(--ink); }
.folder:hover { border-color: var(--ink); color: var(--ink); }
.folder-cover { display: block; aspect-ratio: 16 / 9; background: var(--ink-2); }
.folder-cover img { width: 100%; height: 100%; object-fit: cover; }
.folder-nocover { display: grid; place-items: center; height: 100%; color: #8ea0ae; font-size: 0.875rem; }
.folder-body { display: grid; gap: 0.45rem; padding: 0.9rem 1rem 1rem; justify-items: start; }
.folder-title { font: 600 1.15rem/1.2 var(--display); }

/* lightbox */
dialog.lightbox { border: 0; padding: 0; background: var(--ink); color: #fff; max-width: min(96vw, 80rem); max-height: 94vh; border-radius: 4px; }
dialog.lightbox::backdrop { background: rgba(10, 16, 22, 0.85); }
dialog.lightbox img { max-height: 84vh; width: auto; margin: 0 auto; }
dialog.lightbox .lb-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.6rem 0.9rem; font-size: 0.875rem; }
dialog.lightbox button { font: inherit; background: none; border: 1px solid #55636f; color: #fff; border-radius: 3px; padding: 0.3rem 0.7rem; cursor: pointer; }

/* ---------- meeting, backlog, outbox ---------- */
.agenda { margin-bottom: 2rem; }
.agenda h2 { margin-bottom: 0.75rem; }
.agenda-list, .backlog, .outbox { list-style: none; margin: 0; padding: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; }
.agenda-list li, .backlog li { display: flex; gap: 1rem; align-items: flex-start; padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--line-soft); }
.agenda-list li:last-child, .backlog li:last-child, .outbox li:last-child { border-bottom: 0; }
.agenda-body { flex: 1; min-width: 0; display: grid; gap: 0.2rem; }
.agenda-title { font-weight: 600; color: var(--ink); text-decoration: none; font-size: 1rem; }
.agenda-title:hover { text-decoration: underline; }
.agenda-meta { display: flex; flex-wrap: wrap; gap: 0.3rem 0.6rem; align-items: center; margin-top: 0.2rem; }
.agenda-clock { flex: none; text-align: right; }
.backlog-main { flex: 1; min-width: 0; }
.backlog-main p { margin: 0 0 0.2rem; }
.backlog-title { font-weight: 600; }
.backlog-desc { max-width: 75ch; }
.backlog-side { flex: none; display: grid; gap: 0.5rem; justify-items: end; }
.outbox li { border-bottom: 1px solid var(--line-soft); }
.outbox summary { padding: 0.8rem 1.1rem; cursor: pointer; display: grid; gap: 0.1rem; }
.outbox-subject { font-weight: 600; }
.outbox-body { margin: 0; padding: 1rem 1.1rem; background: var(--mist); white-space: pre-wrap; font: 0.8125rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; border-top: 1px solid var(--line-soft); overflow-x: auto; }

/* ---------- branding page ---------- */
.brand-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.swatches { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.swatch { display: inline-flex; align-items: center; gap: 0.45rem; font: 500 0.8125rem/1 var(--body); color: var(--ink); background: var(--paper); border: 1.5px solid var(--line); border-radius: 4px; padding: 0.35rem 0.6rem 0.35rem 0.35rem; cursor: pointer; }
.swatch:hover { border-color: var(--ink); }
.swatch i { width: 1.1rem; height: 1.1rem; border-radius: 2px; display: block; }
.swatch i + i { margin-left: -0.3rem; }
.colour-row { display: flex; gap: 0.6rem; align-items: center; }
.colour-row input[type="color"] { width: 3rem; height: 2.5rem; padding: 0.15rem; border: 1.5px solid #9aa6b0; border-radius: 4px; background: var(--paper); cursor: pointer; flex: none; }
.colour-row input[type="text"] { max-width: 8rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.preview { display: grid; grid-template-columns: 10.5rem minmax(0, 1fr); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--mist); min-height: 13rem; }
.preview-side { background: var(--brand); color: var(--brand-fg); padding: 0.9rem 0; font-size: 0.8125rem; }
.preview-name { display: block; font: 700 1.05rem/1.1 var(--display); color: var(--brand-fg-strong); padding: 0 0.8rem; overflow-wrap: anywhere; }
.preview-tag { display: block; color: var(--brand-fg-dim); padding: 0.15rem 0.8rem 0.7rem; font-size: 0.75rem; border-bottom: 1px solid var(--brand-2); margin-bottom: 0.5rem; }
.preview-item { display: block; padding: 0.35rem 0.8rem; border-left: 3px solid transparent; }
.preview-item.on { color: var(--brand-fg-strong); background: var(--brand-2); border-left-color: var(--accent-on-brand); font-weight: 600; }
.preview-body { padding: 0.9rem; display: grid; gap: 0.7rem; align-content: start; }
.preview-card { background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: 0.6rem 0.7rem; font-size: 0.8125rem; display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.preview-note { margin: 0.6rem 0 0; font-size: 0.8125rem; color: var(--steel); min-height: 1.2rem; }
.image-slot { padding: 1rem 0; border-top: 1px solid var(--line-soft); }
.image-slot:first-of-type { border-top: 0; padding-top: 0; }
.image-slot h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.image-now { display: flex; gap: 1rem; align-items: center; margin: 0.6rem 0; }
.image-frame { padding: 0.75rem 1rem; border-radius: 4px; border: 1px solid var(--line); display: inline-flex; align-items: center; }
.image-frame-brand { background: var(--brand); border-color: var(--brand); }
.image-frame img { max-height: 3rem; max-width: 14rem; width: auto; }
.image-frame-icon img { max-height: 2.5rem; }
.record-logo { margin: 0 0 0.6rem; }
.record-logo-img { max-height: 3.2rem; max-width: 16rem; width: auto; }
@media (max-width: 62rem) { .brand-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- sign-in ---------- */
body.bare { background: var(--mist); }
body.bare main { max-width: none; padding: 0; }
body.bare .flash { margin: 1rem auto 0; max-width: 56rem; }
.door { max-width: 56rem; margin: 8vh auto 2rem; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.door-narrow { max-width: 28rem; grid-template-columns: 1fr; }
.door-sign { background: var(--brand); color: var(--brand-fg-strong); padding: 2.5rem 2.25rem 3.25rem; position: relative; }
.door-sign::after { content: ""; position: absolute; inset: auto 0 0 0; height: 0.85rem; background: repeating-linear-gradient(-45deg, var(--accent) 0 14px, var(--brand) 14px 28px); }
.door-site { font: 700 2.9rem/0.95 var(--display); margin: 0 0 1.25rem; color: var(--accent-on-brand); }
.door-sign h1 { font-size: 1.5rem; font-weight: 500; margin-bottom: 1rem; }
.door-who { color: var(--brand-fg); margin: 0; max-width: 28ch; }
.door-form { padding: 2.5rem 2.25rem; }
.door-form h1 { font-size: 1.6rem; margin-bottom: 0.75rem; }
.door-help { margin: 1rem 0 0; font-size: 0.875rem; }
.notice-page { max-width: 36rem; margin: 12vh auto; padding: 0 1.5rem; }
.shell .notice-page { margin: 3rem 0; padding: 0; }
.notice-page h1 { margin-bottom: 0.75rem; }

/* ---------- printable record ---------- */
.record { max-width: 50rem; margin: 2rem auto; background: var(--paper); border: 1px solid var(--line); padding: 2.5rem; }
.record-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; border-bottom: 2px solid var(--ink); padding-bottom: 1rem; margin-bottom: 1rem; }
.record-site { margin: 0 0 0.3rem; color: var(--steel); font-size: 0.875rem; }
.record h2 { margin: 1.75rem 0 0.6rem; font-size: 1.15rem; }
.record-table { width: 100%; border-collapse: collapse; }
.record-table th, .record-table td { text-align: left; vertical-align: top; padding: 0.45rem 0.75rem 0.45rem 0; border-bottom: 1px solid var(--line-soft); }
.record-table th { width: 15rem; font-weight: 600; font-size: 0.875rem; color: var(--steel); }
.record-files { margin: 0; padding-left: 1.1rem; }
.record-foot { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--steel); font-size: 0.8125rem; }
.record-foot p { margin-bottom: 0.4rem; }

/* ---------- small screens ---------- */
@media (max-width: 62rem) {
  .two-col { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 48rem) {
  .shell { grid-template-columns: minmax(0, 1fr); background: none; }
  .side { position: static; height: auto; padding: 0.9rem 0 0; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; }
  .brand { border: 0; padding: 0 1rem 0.9rem; }
  .nav-toggle { display: inline-flex; margin: 0 1rem 0.9rem; font: 600 0.875rem/1 var(--body); background: none; color: var(--brand-fg-strong); border: 1.5px solid var(--brand-fg-dim); border-radius: 4px; padding: 0.5rem 0.8rem; cursor: pointer; }
  .nav { display: none; flex-basis: 100%; padding-bottom: 1rem; }
  .nav.is-open { display: flex; }
  .who { margin-top: 1rem; }
  main { padding: 1.25rem 1rem 3rem; }
  h1 { font-size: 1.6rem; }
  .door { grid-template-columns: 1fr; margin: 0; border: 0; border-radius: 0; min-height: 100vh; align-content: start; }
  .door-site { font-size: 2.2rem; }
  .facts-wide > div, .risk-row { grid-template-columns: minmax(0, 1fr); gap: 0.2rem; }
  .risk th, .risk td { display: block; width: auto !important; padding: 0.2rem 0; border: 0; }
  .risk tr { display: block; padding: 0.6rem 0; border-bottom: 1px solid var(--line-soft); }
  .agenda-list li, .backlog li { flex-wrap: wrap; }
  .record { margin: 0; border: 0; padding: 1.25rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn, .nav li a, .folder { transition: background-color 0.12s, border-color 0.12s, color 0.12s; }
}

@media print {
  body { background: #fff; font-size: 11pt; }
  .side, .actions, .flash, .filters, form, .record-actions, .skip { display: none !important; }
  .shell { display: block; }
  main { padding: 0; max-width: none; }
  .record { border: 0; margin: 0; padding: 0; max-width: none; }
  .agenda-list, .sheet, .panel { border-color: #999; }
  a { color: inherit; text-decoration: none; }
  .plate-prefix, .plate-num, .chip, .signature { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
