/* Pulse EHS — one stylesheet, no build step.

   THE SHELL IS FIXED. The :root tokens below are copied verbatim from
   Pulse MES (Documents/MES/app/static/css/style.css) so the two products
   read as one suite on a plant PC. Tweak individual components as needs
   come up; do not redesign the shell or drift the tokens.

   Two layout rules that are easy to get wrong:
     - .content has NO max-width. Lists and tables span the window.
     - Forms wrap in .form-page, which caps at 820px and centres.
   Capping .content instead left every page hugging the left edge on a
   1920px monitor. Check new pages at 1920 wide, not just 1280. */

:root {
    /* Surfaces */
    --bg: #eef1f4;
    --panel: #ffffff;
    --line: #d6dce2;
    --line-soft: #e7ebef;

    /* Text */
    --ink: #1f2933;
    --muted: #69757f;

    /* Accent */
    --accent: #1565c0;
    --accent-dark: #0d47a1;
    --danger: #c62828;
    --danger-soft: #fdecec;
    --on: #2e7d32;
    --off: #9e9e9e;
    --warn-bg: #fff8e1;
    --warn-line: #ffe08a;

    /* Sidebar (dark rail) */
    --rail: #1e2a38;
    --rail-2: #18222e;
    --rail-ink: #c4d0db;
    --rail-ink-dim: #7d8d9c;
    --rail-active: #2b3d50;
    /* Rail text at full strength, hairlines and hover on the rail, the marker
       beside the selected item, and the pulse mark's dot. Tokens so a light
       rail can flip them; see the schemes at the end of this file. */
    --rail-strong: #ffffff;
    --rail-line: rgba(255,255,255,.07);
    --rail-hover: rgba(255,255,255,.05);
    --rail-marker: #1565c0;
    --mark-dot: #6fb6ef;
    --mark-ink: #0d47a1;
    --mark-dot-light: #1565c0;
    --accent-soft: var(--accent-soft);
    --auth-bg: linear-gradient(160deg, #1e2a38 0%, #24374b 55%, #2b4661 100%);
    --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-head: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    --sidebar-w: 232px;
    --appbar-h: 52px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }
body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 14px;
    background: var(--bg);
    color: var(--ink);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- App shell ---------- */
/* The shell fills the viewport exactly and .content is the only thing that
   scrolls. This height MUST be definite: with only min-height, .content's
   overflow-y has no height to work against, so it grows past the viewport
   and the bottom of a long page becomes unreachable. */
.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--rail);
    color: var(--rail-ink);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    /* flex: 0 0 auto on the brand, user block and footer so they are never
       squeezed. Without it they default to 0 1 auto and a short window
       compresses them until only part of the text shows. The nav is the
       only region allowed to give, and it scrolls. */
    flex: 0 0 auto;
    display: flex; align-items: center; gap: .6rem;
    min-height: var(--appbar-h);
    padding: .7rem .9rem;
    background: var(--rail-2);
    border-bottom: 1px solid var(--rail-line);
}
/* The pulse mark from the brand guidelines: the line takes the text colour
   of wherever it sits, the dot is sky on a dark rail and blue on white. */
.brand-mark { display: inline-flex; width: 30px; height: 20px; color: var(--rail-strong); flex: 0 0 30px; }
.brand-mark svg { width: 100%; height: 100%; overflow: visible; }
.brand-mark .dot { fill: var(--mark-dot); }
.brand-mark-lg { width: 60px; height: 40px; flex-basis: 60px; color: var(--mark-ink); }
.brand-mark-lg .dot { fill: var(--mark-dot-light); }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { color: var(--rail-strong); font-family: var(--font-head); font-weight: 800; letter-spacing: .6px; line-height: 1.2; }
.brand-name .wm-2 { color: var(--mark-dot); }
.wordmark { font-family: var(--font-head); font-weight: 800; letter-spacing: 1px; }
.wordmark .wm-2 { color: var(--mark-dot-light); }
.brand-sub {
    font-size: .7rem; text-transform: uppercase; letter-spacing: .6px;
    color: var(--rail-ink-dim);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sidebar-nav { flex: 1 1 0; min-height: 0; padding: .9rem 0; overflow-y: auto; }
.nav-group {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .8px;
    color: var(--rail-ink-dim);
    padding: .5rem 1rem .35rem;
}
.nav-link {
    display: flex; align-items: center; gap: .6rem;
    padding: .55rem 1rem;
    color: var(--rail-ink); text-decoration: none;
    border-left: 3px solid transparent;
}
.nav-link:hover { background: var(--rail-hover); text-decoration: none; }
.nav-link.active { background: var(--rail-active); color: var(--rail-strong); border-left-color: var(--rail-marker); }
.nav-ico { display: inline-flex; width: 18px; height: 18px; flex: 0 0 18px; }
.nav-ico svg { width: 100%; height: 100%; }

.sidebar-user {
    flex: 0 0 auto;
    padding: .8rem 1rem;
    border-top: 1px solid var(--rail-line);
}
.su-name { color: var(--rail-strong); font-weight: 600; display: block; text-decoration: none; }
.su-name:hover { text-decoration: underline; }
.su-role { font-size: .72rem; color: var(--rail-ink-dim); text-transform: uppercase; letter-spacing: .6px; }
.su-links { display: flex; gap: .7rem; margin-top: .35rem; font-size: .78rem; }
.su-links a { color: var(--rail-ink); text-decoration: none; }
.su-links a:hover { color: var(--rail-strong); text-decoration: underline; }
.su-signout {
    margin-top: .5rem;
    background: none; border: 1px solid var(--rail-line);
    color: var(--rail-ink); border-radius: 6px;
    padding: .32rem .7rem; font: inherit; font-size: .8rem; cursor: pointer;
}
.su-signout:hover { background: var(--rail-hover); color: var(--rail-strong); }

.sidebar-foot {
    flex: 0 0 auto;
    padding: .6rem 1rem .8rem;
    font-size: .68rem; color: var(--rail-ink-dim);
    border-top: 1px solid var(--rail-line);
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.appbar {
    height: var(--appbar-h);
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.25rem;
    position: sticky; top: 0; z-index: 5;
}
.appbar-title { font-size: 1.05rem; font-weight: 700; font-family: var(--font-head); }
.appbar-actions { display: flex; gap: .5rem; align-items: center; }

.content { flex: 1; padding: 1.25rem; padding-bottom: 96px; overflow-y: auto; }
/* Forms cap and centre, lists span the window — the same split as Pulse MES. */
.form-page { max-width: 820px; margin: 0 auto; }

/* ---------- Flashes & errors ---------- */
.flashes { margin-bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; }
.flash { padding: .6rem .85rem; border-radius: 7px; border: 1px solid; }
.flash-ok { background: #e8f5e9; border-color: #b6dfb9; color: #1b5e20; }
.flash-error { background: var(--danger-soft); border-color: #f3c3c3; color: #8e1c1c; }

.errors {
    background: var(--danger-soft); border: 1px solid #f3c3c3; color: #8e1c1c;
    padding: .7rem .9rem; border-radius: 7px; margin-bottom: 1rem;
}
.errors ul { margin: .4rem 0 0; padding-left: 1.1rem; }
.warn-note {
    background: var(--warn-bg); border: 1px solid var(--warn-line);
    padding: .6rem .85rem; border-radius: 7px;
}
/* On its own at the top of a page, rather than inside a panel. */
.content > .warn-note { margin: 0 0 1.1rem; }
/* Inside a panel: breathing room above, and none below when it ends the
   panel, so it sits centred rather than pressed against what precedes it. */
.panel > .warn-note { margin-top: .9rem; }
.panel > .warn-note:last-child { margin-bottom: 0; }
/* Fields placed straight into a panel (a form whose panels are its sections)
   get the same gap a form's stack would give them. Without this, every
   field after the first sits hard against the one above. */
.panel > :not(h2) + .field, .panel > :not(h2) + .row,
.panel > .field + .form-actions, .panel > .row + .form-actions,
.panel > .field + details, .panel > .row + details { margin-top: .9rem; }

/* ---------- Panels ---------- */
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.1rem;
}
.panel-quiet { background: transparent; border-style: dashed; }
.panel h2 { margin: 0 0 .6rem; font-size: .95rem; letter-spacing: .2px; font-family: var(--font-head); }
.panel p { margin: 0 0 .7rem; color: var(--muted); }
.lede { font-size: 1.05rem; margin: 0 0 1rem; }
.rule { border: 0; border-top: 1px solid var(--line-soft); margin: 1.2rem 0; }

/* ---------- Forms ---------- */
.stack { display: flex; flex-direction: column; gap: .9rem; }
.row { display: flex; gap: .9rem; flex-wrap: wrap; }
.row .field { flex: 1 1 220px; min-width: 0; }
.field { display: flex; flex-direction: column; }
.field label { font-weight: 600; margin-bottom: .3rem; font-size: .85rem; }
.opt { font-weight: 400; color: var(--muted); font-size: .78rem; }

/* Style form controls by EXCLUSION, not by listing types.
   The previous selector enumerated input[type=text] and friends, and
   silently missed two whole classes of field:
     - inputs with no type attribute (they default to text, but an
       attribute selector needs the attribute to actually be present)
     - date and datetime-local
   Nineteen fields across six templates were rendering with browser
   defaults next to correctly styled ones. Listing types means every new
   field type is unstyled until someone notices; excluding the handful
   that must not be styled means new fields are right by default. */
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=submit]):not([type=button]):not([type=hidden]):not([type=range]):not([type=color]),
select,
textarea {
    font: inherit;
    padding: .5rem .65rem;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    color: var(--ink);
    width: 100%;
}
textarea { resize: vertical; }

/* Single-line controls share one height. Their intrinsic content heights
   differ — a select renders 37px, a text input 35px, a date picker 36px —
   which is plainly visible when three of them sit side by side in a .row.
   textarea is deliberately absent: it sizes to its rows attribute. */
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=submit]):not([type=button]):not([type=hidden]):not([type=range]):not([type=color]),
select {
    height: 37px;
}

input:not([type=checkbox]):not([type=radio]):not([type=file]):focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.hint { font-size: .8rem; color: var(--muted); margin: .35rem 0 0; }
.hint code, .mono, code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .93em; }
/* A code like POL-001 is one token and must not break at its hyphen. */
.hint .mono { white-space: nowrap; }

.prefixed { display: flex; align-items: stretch; }
.prefixed .prefix {
    display: flex; align-items: center;
    padding: 0 .55rem;
    background: var(--line-soft);
    border: 1px solid var(--line); border-right: 0;
    border-radius: 7px 0 0 7px;
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .82rem;
    white-space: nowrap;
}
.prefixed input { border-radius: 0 7px 7px 0; flex: 1 1 auto; min-width: 0; }

.form-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline-form { display: inline; }

.searchbar { display: flex; gap: .5rem; margin-bottom: 1rem; max-width: 520px; }

.disclose { margin-top: .9rem; border-top: 1px solid var(--line-soft); padding-top: .7rem; }
.disclose summary { cursor: pointer; font-weight: 600; }
.disclose > .stack { margin-top: .9rem; }
/* Fields and rows placed directly inside a disclosure get the same gap the
   form's stack would have given them. Without this they touch. */
.disclose > .field, .disclose > .row, .disclose > .stack, .disclose > .disclose { margin-top: .9rem; }
.disclose > .hint { margin-top: .5rem; }
/* The 5 Whys are a tight list of their own; keep their original rhythm. */
.disclose > .why-field { margin-top: 0; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    font: inherit; font-size: .87rem;
    padding: .45rem .85rem;
    border: 1px solid var(--line);
    background: #fff; color: var(--ink);
    border-radius: 7px; cursor: pointer;
    text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #f6f8fa; text-decoration: none; }
/* File inputs, everywhere. The native control is the one thing the form
   rules cannot reach by exclusion, so it is styled here: the button matches
   .btn and the chosen file name reads as plain text beside it. */
input[type=file] { border: 0; padding: .15rem 0; background: transparent; box-shadow: none;
                   font-size: .87rem; color: var(--muted); }
input[type=file]:focus { outline: none; box-shadow: none; }
input[type=file]::file-selector-button {
    font: inherit; font-size: .87rem; font-weight: 600;
    padding: .42rem .85rem; margin-right: .7rem;
    border: 1px solid var(--accent); border-radius: 7px;
    background: #fff; color: var(--accent); cursor: pointer;
}
input[type=file]::file-selector-button:hover { background: var(--accent-soft); }
input[type=file]:focus-visible::file-selector-button { box-shadow: 0 0 0 3px var(--accent-soft); }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--accent); }
.btn-quiet:hover { background: var(--accent-soft); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #a71d1d; }
.btn-danger-quiet { background: transparent; border-color: transparent; color: var(--danger); }
.btn-danger-quiet:hover { background: var(--danger-soft); }
.btn-block { width: 100%; text-align: center; padding: .6rem; font-size: .95rem; }

/* ---------- Tables ---------- */
.grid {
    width: 100%; border-collapse: collapse;
    background: var(--panel);
    border: 1px solid var(--line); border-radius: 10px;
    overflow: hidden;
}
.grid th, .grid td { padding: .65rem .8rem; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.grid.tight th, .grid.tight td { padding: .45rem .7rem; }
.grid thead th {
    background: #f5f7f9; font-size: .72rem; text-transform: uppercase;
    letter-spacing: .6px; color: var(--muted); font-weight: 700;
}
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover { background: #fafcfd; }
.grid .num { text-align: right; }
.grid .actions { text-align: right; white-space: nowrap; }
.grid .strong { font-weight: 600; color: var(--ink); }
.grid .sub { font-size: .8rem; color: var(--muted); margin-top: .15rem; }
.row-off { opacity: .58; }

.tag {
    display: inline-block; margin-left: .35rem;
    font-size: .68rem; text-transform: uppercase; letter-spacing: .5px;
    background: var(--line-soft); color: var(--muted);
    padding: .08rem .35rem; border-radius: 4px;
}

.tag-plain { margin-left: 0; }
.wording-note { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.wording-note form { display: inline; margin: 0; }
/* The Setup list saves as one form. */
.save-list { margin: .8rem 0 0; }
.row-error td { background: #fdf3f3; }
.field-error { color: var(--danger); font-size: .8rem; font-weight: 600; margin-top: .3rem; }
/* One reset per list for a site's rewordings, under the table, quiet. */
.reset-all-wording { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin: .7rem 0 0; }
.reset-all-wording .hint { margin: 0; }
.tag-reworded { margin-left: .3rem; }
.btn-xs { font-size: .72rem; padding: .12rem .5rem; }

.pill {
    display: inline-block; font-size: .72rem; font-weight: 700;
    padding: .16rem .5rem; border-radius: 999px;
    text-transform: uppercase; letter-spacing: .5px;
}
.pill-on { background: #e8f5e9; color: #1b5e20; }
.pill-off { background: #eceff1; color: #546e7a; }
.pill-warn { background: #fff3e0; color: #8a4b00; }

/* Impersonation banner — deliberately loud. It sits above the appbar and
   outside .content, so it stays on screen for the whole borrowed session. */
.imp-banner {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem;
    padding: .55rem 1.25rem;
    background: #fff3e0;
    border-bottom: 1px solid #ffcc80;
    color: #7a4b00;
    font-size: .86rem;
    line-height: 1.45;
}
.imp-banner strong { color: #5d3900; }
.btn-warn { background: #8a4b00; border-color: #8a4b00; color: #fff; }
.btn-warn:hover { background: #6d3b00; border-color: #6d3b00; }
.muted-line { color: var(--muted); }

/* ---------- Build 2: incidents, actions, setup ---------- */

.prose { white-space: pre-wrap; color: var(--ink); margin: 0 0 .8rem; line-height: 1.55; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.overdue { color: var(--danger); font-weight: 600; }
.searchbar-wide { max-width: none; flex-wrap: wrap; align-items: center; }
.searchbar-wide input[type=search] { flex: 1 1 240px; }
.searchbar-wide select { width: auto; flex: 0 0 auto; }
.check { display: flex; align-items: center; gap: .35rem; font-size: .87rem; white-space: nowrap; }
.check input { width: auto; }

/* Severity 1-5. Colour carries the same meaning everywhere, while the
   wording beside it stays whatever the company chose. */
.sev {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 6px;
    font-weight: 800; font-size: .82rem; color: #fff; flex: 0 0 26px;
}
.sev-1 { background: #2e7d32; }
.sev-2 { background: #7cb342; }
.sev-3 { background: #f9a825; }
.sev-4 { background: #ef6c00; }
.sev-5 { background: #c62828; }

.sev-picker { display: flex; flex-direction: column; gap: .35rem; }
.sev-choice {
    display: flex; align-items: center; gap: .6rem;
    padding: .4rem .6rem; border: 1px solid var(--line);
    border-radius: 7px; cursor: pointer; background: #fff;
}
.sev-choice:hover { background: #f6f8fa; }
.sev-choice input { width: auto; margin: 0; }
.sev-choice .sev-label { font-size: .88rem; }
.sev-choice:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

.prio { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.prio-low { color: var(--muted); }
.prio-medium { color: #ef6c00; }
.prio-high { color: var(--danger); }

.detail-head {
    display: flex; align-items: center; gap: .9rem;
    background: var(--panel); border: 1px solid var(--line);
    border-radius: 10px; padding: 1rem 1.25rem; margin-bottom: 1.1rem;
}
.detail-title { font-size: 1.05rem; font-weight: 700; }
.detail-status { margin-left: auto; }

.stat-alert .stat-num { color: var(--danger); }
.nav-count {
    margin-left: auto; background: var(--accent); color: #fff;
    font-size: .7rem; font-weight: 700; border-radius: 999px;
    padding: .05rem .4rem; min-width: 18px; text-align: center;
}
/* Something is past its due date. Worth a different colour, not just a
   bigger number. */
.nav-count-late { background: var(--danger); }

.setup-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: .9rem;
}
.setup-card {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: 10px; padding: 1rem 1.1rem;
    text-decoration: none; color: var(--ink); display: block;
}
.setup-card:hover { border-color: var(--accent); text-decoration: none; }
.setup-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.setup-card-name { font-weight: 700; }
.setup-card-count {
    font-size: 1.3rem; font-weight: 800; color: var(--accent);
}
.setup-card-blurb { font-size: .83rem; color: var(--muted); margin: .4rem 0 0; line-height: 1.45; }

/* Investigation stage */
.panel-gaps { border-left: 3px solid #f9a825; background: var(--warn-bg); }
.panel-gaps h2 { color: #7a4b00; }
.gap-list { margin: .2rem 0 .7rem; padding-left: 1.1rem; color: #7a4b00; }
.gap-list li { margin-bottom: .15rem; }

.cause-list { display: flex; flex-direction: column; gap: .7rem; margin-bottom: 1rem; }
.cause { border: 1px solid var(--line-soft); border-radius: 8px; padding: .7rem .85rem; background: #fbfcfd; }
.cause-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .45rem; }
.cause-label { font-weight: 600; }
.cause textarea { margin-bottom: .4rem; }
.cause .form-actions { margin: 0; }

.why-field { flex-direction: row; align-items: center; gap: .6rem; margin-bottom: .45rem; }
.why-field label {
    flex: 0 0 22px; margin: 0; text-align: center;
    background: var(--line-soft); border-radius: 5px; padding: .18rem 0;
    font-size: .8rem; color: var(--muted);
}

/* End-of-page marker. Visually quieter than a working panel so it reads as
   a full stop rather than another thing to fill in. */
.panel-finish {
    background: transparent;
    border-style: dashed;
    border-color: var(--line);
}
.panel-finish h2 { color: var(--muted); }

/* Amendment trail */
.amendment { border-left: 3px solid var(--line); padding: .1rem 0 .1rem .8rem; margin-bottom: .9rem; }
.amendment-head { font-size: .88rem; }
.amendment-reason { margin: .3rem 0; color: var(--muted); font-style: italic; }
.amendment-fields { list-style: none; margin: .4rem 0 0; padding: 0; }
.amendment-fields li {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: .45rem;
    font-size: .87rem; margin-bottom: .25rem;
}
.amendment-field { font-weight: 600; min-width: 150px; }
.amendment-fields .was { color: var(--danger); text-decoration: line-through; }
.amendment-fields .arrow { color: var(--muted); }
.amendment-fields .now { color: var(--on); font-weight: 600; }

/* ---------- Observations ---------- */
.obs-intro { margin: 0 0 1rem; }

.type-picker { display: flex; gap: .7rem; flex-wrap: wrap; }
/* The picker is often followed by a field it reveals; give it the same
   breathing room a .field gets from .stack. */
.type-choice {
    flex: 1 1 220px; display: flex; flex-direction: column; gap: .1rem;
    border: 1px solid var(--line); border-radius: 8px;
    padding: .7rem .85rem; cursor: pointer; background: #fff;
}
.type-choice input { width: auto; margin: 0 0 .3rem; }
.type-choice:hover { background: #f6f8fa; }
.type-name { font-weight: 700; }
.type-blurb { font-size: .82rem; color: var(--muted); }
.type-safe:has(input:checked) { border-color: var(--on); box-shadow: 0 0 0 2px rgba(46,125,50,.16); }
.type-unsafe:has(input:checked) { border-color: #ef6c00; box-shadow: 0 0 0 2px rgba(239,108,0,.18); }

.example-line { margin: -.3rem 0 .2rem; }
/* A button that reads as a link, for small in-line actions that must not
   submit the form and do not deserve a button's weight. */
.linkish { background: none; border: 0; padding: 0; font: inherit; font-size: inherit;
           color: var(--accent); cursor: pointer; text-decoration: underline; }
.linkish:hover { color: var(--accent-dark); }

.counter { font-size: .76rem; color: var(--muted); text-align: right; margin-top: .2rem; }
.check-block { align-items: flex-start; white-space: normal; }

.obs-list { display: flex; flex-direction: column; gap: .7rem; }
.obs-card {
    display: block; text-decoration: none; color: var(--ink);
    background: var(--panel); border: 1px solid var(--line);
    border-left: 3px solid var(--line); border-radius: 10px; padding: .8rem 1rem;
}
.obs-card:hover { border-color: var(--accent); text-decoration: none; }
.obs-safe { border-left-color: var(--on); }
.obs-unsafe { border-left-color: #ef6c00; }
.obs-hidden { opacity: .6; }
.obs-card-head { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-bottom: .4rem; }
.obs-ref { margin-left: auto; font-size: .8rem; color: var(--muted); }
.obs-tag {
    font-size: .72rem; background: var(--line-soft); color: var(--muted);
    padding: .1rem .45rem; border-radius: 4px;
}
.obs-state { background: #fff3e0; color: #8a4b00; }
.obs-spoke { background: #e8f5e9; color: #1b5e20; }
.obs-tag-hidden { background: var(--danger-soft); color: #8e1c1c; }
.obs-text { margin: 0 0 .35rem; }
.obs-meta { font-size: .8rem; color: var(--muted); }
.obs-new { background: var(--accent); color: #fff; border-radius: 4px; padding: .05rem .35rem;
           font-size: .7rem; font-weight: 700; margin-left: .35rem; }

.stat-good { color: var(--on); }
.stat-warn { color: #ef6c00; }

.bars { display: flex; flex-direction: column; gap: .4rem; }
.bar-row { display: flex; align-items: center; gap: .6rem; font-size: .87rem; }
.bar-label { flex: 0 0 150px; }
.bar { flex: 1; height: 14px; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: #ef6c00; }
.bar-n { flex: 0 0 30px; text-align: right; color: var(--muted); }

/* ---------- Training ---------- */
.tm-list { display: flex; flex-direction: column; gap: .7rem; }
.tm-card {
    display: flex; align-items: center; gap: 1rem; text-decoration: none; color: var(--ink);
    background: var(--panel); border: 1px solid var(--line);
    border-left: 3px solid var(--line); border-radius: 10px; padding: .9rem 1.1rem;
}
.tm-card:hover { border-color: var(--accent); text-decoration: none; }
.tm-card-main { flex: 1; min-width: 0; }
.tm-completed { border-left-color: var(--on); }
.tm-in_progress { border-left-color: var(--accent); }
.tm-expired { border-left-color: var(--danger); }
.tm-code { font-size: .74rem; color: var(--muted); letter-spacing: .5px; }
.tm-title { font-weight: 700; }
.tm-meta { font-size: .8rem; color: var(--muted); margin-top: .2rem; }
.tm-status { font-size: .74rem; font-weight: 700; text-transform: uppercase;
             letter-spacing: .5px; padding: .2rem .55rem; border-radius: 999px; white-space: nowrap; }
.tm-status-completed { background: #e8f5e9; color: #1b5e20; }
.tm-status-in_progress { background: #e3f2fd; color: #0d47a1; }
.tm-status-expired { background: var(--danger-soft); color: #8e1c1c; }
.tm-status-not_started { background: var(--line-soft); color: var(--muted); }
/* Document acknowledgment statuses, same card as training. */
.tm-doc-current { border-left-color: var(--on); }
.tm-doc-expiring { border-left-color: #f9a825; }
.tm-doc-expired, .tm-doc-superseded { border-left-color: var(--danger); }
.tm-doc-status-current { background: #e8f5e9; color: #1b5e20; }
.tm-doc-status-expiring { background: #fff3e0; color: #8a4b00; }
.tm-doc-status-expired, .tm-doc-status-superseded { background: var(--danger-soft); color: #8e1c1c; }
.tm-doc-status-not_done { background: var(--line-soft); color: var(--muted); }
.mk-superseded { background: #fdeaea; color: #8e1c1c; }
.doc-body { padding: 1.4rem 1.6rem; }
.doc-section h2 { font-size: 1.05rem; margin: 1.1rem 0 .4rem; color: var(--accent-dark); }
.doc-section:first-child h2 { margin-top: 0; }
.doc-section p { color: var(--ink); line-height: 1.55; margin: 0 0 .7rem; }
.doc-section ul { margin: 0 0 .7rem 1.2rem; padding: 0; line-height: 1.55; }
/* The header block: label and value pairs in two columns, boxed like a
   policy cover. Collapses to one column on a narrow window. */
.doc-status-main { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-bottom: .6rem; }
.doc-status .form-actions { margin-top: .2rem; }
.extra-rows { display: flex; flex-direction: column; gap: .4rem; }
.extra-row { display: grid; grid-template-columns: 1fr 2fr auto; gap: .5rem; align-items: center; }
.extra-row input { width: 100%; }
@media (max-width: 720px) { .extra-row { grid-template-columns: 1fr; } }
.doc-facts-panel { padding: .6rem .9rem; }
.doc-facts { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 0; margin: 0;
             border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.doc-facts dt, .doc-facts dd { margin: 0; padding: .45rem .7rem; border-bottom: 1px solid var(--line-soft); }
.doc-facts dt { font-size: .78rem; font-weight: 700; color: var(--muted); background: var(--bg); white-space: nowrap; }
.doc-facts dd { font-size: .92rem; color: var(--ink); }
.doc-facts dt:nth-last-child(-n+2), .doc-facts dd:nth-last-child(-n+2) { border-bottom: 0; }
@media (max-width: 720px) { .doc-facts { grid-template-columns: auto 1fr; } }
.doc-frame-panel { padding: 0; overflow: hidden; }
.doc-frame { width: 100%; height: 75vh; display: block; }
/* Explicit width: auto, because the form rules give every control 100% width
   and a height cap on a full-width image squashes it. */
.colour-pick { display: flex; align-items: center; gap: .6rem; }
.colour-pick input[type=color] { width: 3.2rem; height: 2rem; padding: .1rem; }
.brand-logo-preview { display: block; width: auto; max-width: 260px; height: auto;
                      max-height: 60px; object-fit: contain; margin-top: .5rem; }
.grid-group td { background: var(--bg); font-weight: 700; font-size: .78rem; text-transform: uppercase;
                 letter-spacing: .5px; color: var(--muted); }
.tm-done { background: #e8f5e9; border: 1px solid #b6dfb9; color: #1b5e20;
           padding: .55rem .8rem; border-radius: 7px; }

/* Player */
.player { max-width: 1000px; margin: 0 auto; }
.player-progress { display: flex; align-items: center; gap: .25rem; margin-bottom: 1rem; }
.pp { flex: 1; height: 5px; border-radius: 999px; background: var(--line); }
.pp-done { background: var(--on); }
.pp-now { background: var(--accent); }
.player-count { flex: 0 0 auto; margin-left: .7rem; font-size: .78rem; color: var(--muted); }
.player-stage {
    background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
    overflow: hidden; display: flex; flex-direction: column;
}
.player-image { background: #fff; overflow: hidden; }
.player-image img { display: block; width: 100%; height: auto; max-height: 46vh; object-fit: contain;
    transform-origin: center center; }
/* The player stays still. A slow drift and zoom was tried on 13 Sep 2026
   and Chris found it too much; what remains is a short fade as each slide
   arrives, and nothing moves. Off entirely under prefers-reduced-motion. */
.player-image.motion img { animation: slide-in .5s ease-out both; }
.player-bullets li { animation: slide-in .45s ease-out both; }
@keyframes slide-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
    .player-image.motion img, .player-bullets li { animation: none; }
}
.player-body { padding: 1.2rem 1.4rem 1.4rem; }
.player-title { font-size: 1.35rem; margin: 0 0 .7rem; }
.player-bullets { margin: 0; padding-left: 1.2rem; }
.player-bullets li { margin-bottom: .45rem; font-size: 1.02rem; line-height: 1.5; }
.player audio { width: 100%; margin-top: 1rem; }
.player-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 1.2rem; }
#next-btn:disabled, #back-btn:disabled { opacity: .4; cursor: not-allowed; }
.player-start { display: flex; align-items: center; gap: .7rem; margin-top: .8rem; }
.player-nav-right { display: flex; align-items: center; gap: .5rem; }

/* Preview */
.preview-banner {
    display: flex; align-items: center; gap: .6rem;
    background: #ede7f6; border: 1px solid #b39ddb; color: #4527a0;
    border-radius: 8px; padding: .6rem .9rem; margin-bottom: 1rem; font-size: .88rem;
}
.mark-block { border-top: 1px solid var(--line-soft); padding-top: .8rem; margin-top: .8rem; }
.mark-block:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.mark-q { display: flex; gap: .5rem; font-weight: 600; margin-bottom: .4rem; }
.mark-badge { flex: 0 0 22px; height: 22px; border-radius: 5px; color: #fff;
              font-size: .76rem; display: inline-flex; align-items: center; justify-content: center; }
.mark-ok { background: var(--on); }
.mark-no { background: #ef6c00; }
.mark-options { list-style: none; margin: 0; padding: 0 0 0 1.8rem; }
.mark-options li { padding: .18rem 0; font-size: .89rem; color: var(--muted); }
.mark-correct { color: var(--on); font-weight: 600; }
.mark-chosen.mark-correct { color: var(--on); }
.mark-chosen:not(.mark-correct) { color: var(--danger); }
.mark-tag { font-size: .72rem; text-transform: uppercase; letter-spacing: .5px;
            background: #e8f5e9; color: #1b5e20; padding: .05rem .35rem; border-radius: 4px; margin-left: .4rem; }
.mark-tag-no { background: var(--danger-soft); color: #8e1c1c; }

/* Quiz */
.quiz-text { font-size: 1.08rem; font-weight: 600; margin: .3rem 0 .9rem; }
.quiz-options { display: flex; flex-direction: column; gap: .5rem; }
.quiz-option {
    display: flex; align-items: flex-start; gap: .6rem; padding: .6rem .8rem;
    border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: #fff;
}
.quiz-option:hover { background: #f6f8fa; }
.quiz-option input { width: auto; margin: .15rem 0 0; }
.quiz-option:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.quiz-unanswered { border-color: var(--danger); }
.quiz-opt-row { flex-direction: row; align-items: center; gap: .6rem; }
.quiz-opt-row .check { flex: 0 0 auto; }
.sr-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.result-panel { text-align: center; padding: 2rem 1.5rem; }
.result-score { font-size: 3.2rem; font-weight: 800; line-height: 1; }
.result-pass .result-score { color: var(--on); }
.result-fail .result-score { color: #ef6c00; }
.result-panel .form-actions { justify-content: center; }

/* Builder */
.slide-editor { border: 1px solid var(--line-soft); border-radius: 8px;
                padding: .6rem .85rem; margin-bottom: .6rem; background: #fbfcfd; }
.slide-editor summary { cursor: pointer; display: flex; align-items: center; gap: .6rem; }
.slide-n { flex: 0 0 24px; height: 24px; border-radius: 6px; background: var(--line-soft);
           color: var(--muted); font-size: .78rem; font-weight: 700;
           display: inline-flex; align-items: center; justify-content: center; }
.slide-name { flex: 1; font-weight: 600; }
.slide-flags { display: flex; gap: .3rem; }
.slide-editor form { margin-top: .8rem; }
.slide-media { border-top: 1px solid var(--line-soft); padding-top: .8rem; }
.slide-thumb { max-width: 200px; border: 1px solid var(--line); border-radius: 6px; margin-top: .4rem; }
.pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
             gap: .3rem; max-height: 320px; overflow-y: auto; padding: .5rem;
             border: 1px solid var(--line); border-radius: 8px; }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: .2rem 0; }

/* Skills matrix */
.matrix-key { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.matrix-key i { display: inline-block; width: 13px; height: 13px; border-radius: 3px;
                vertical-align: -2px; margin-right: .3rem; border: 1px solid rgba(0,0,0,.08); }
.matrix-wrap { overflow-x: auto; }
.matrix { min-width: 600px; }
.matrix-name { position: sticky; left: 0; background: var(--panel); z-index: 1; min-width: 190px; }
.matrix-col { min-width: 118px; max-width: 150px; white-space: normal; vertical-align: bottom; line-height: 1.25; }
.matrix-col span { display: inline-block; font-family: inherit; font-size: .74rem; font-weight: 700; text-transform: none; letter-spacing: 0; }
.matrix-cell { text-align: center; font-size: .76rem; white-space: nowrap; }
.matrix-cell a { color: inherit; text-decoration: none; }
.mk-current  { background: #e8f5e9; color: #1b5e20; }
.mk-expiring { background: #fff3e0; color: #8a4b00; }
.mk-expired  { background: var(--danger-soft); color: #8e1c1c; }
.mk-none     { background: #eceff1; }
.mk-na       { background: transparent; }
/* Required by this person's job role and never completed. Loud on purpose:
   the whole point of requirements is that a gap stops looking like a blank. */
.mk-gap      { background: #fdeaea; color: var(--danger); font-weight: 700; }

/* Certificate, built to print */
.cert-page { min-height: 100vh; background: var(--bg); padding: 1.5rem; }
.cert-actions { display: flex; gap: .5rem; align-items: center; max-width: 800px;
                margin: 0 auto 1.2rem; }
.cert {
    max-width: 800px; margin: 0 auto; background: #fff; border: 1px solid var(--line);
    border-top: 6px solid var(--accent-dark); border-radius: 4px;
    padding: 3rem 3.5rem; text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,.08);
}
.cert-head { display: flex; align-items: center; justify-content: center; gap: .6rem; margin-bottom: 2rem; }
.cert-mark { width: 34px; height: 34px; color: var(--accent-dark); display: inline-flex; }
.cert-mark svg { width: 100%; height: 100%; }
.cert-brand { font-size: 1.15rem; font-weight: 700; }
.cert-kicker { font-size: .78rem; text-transform: uppercase; letter-spacing: 2.5px; color: var(--muted); }
.cert-lead { color: var(--muted); margin: 1.4rem 0 .3rem; }
.cert-name { font-size: 2.1rem; font-weight: 700; }
.cert-module { font-size: 1.5rem; font-weight: 700; color: var(--accent-dark); }
.cert-code { color: var(--muted); font-size: .85rem; margin-top: .2rem; }
/* Setup sections. The page grows with every module, so the cards need
   headers to stay navigable rather than being one undifferentiated wall. */
.setup-section { margin: 0 0 1.6rem; }
.setup-section-head { margin: 0 0 .6rem; }
.setup-section-head h2 { margin: 0; font-size: 1.02rem; }
.setup-section-head p { margin: .15rem 0 0; color: var(--muted); font-size: .85rem; }

/* A scrollable column list of checkboxes, for picking several modules at
   once without the panel growing without limit as the library does. */
/* The requirements editor: one row per module, code column aligned so the
   titles line up, ticked rows tinted so the current set reads at a glance.
   .check is nowrap flex by default; grid here so long titles wrap in place. */
.modlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: .35rem .9rem; }
.modlist .check { display: grid; grid-template-columns: auto 5.4rem 1fr; align-items: start; gap: .5rem;
                  white-space: normal; font-size: .9rem; line-height: 1.35; padding: .45rem .6rem;
                  border: 1px solid var(--line-soft); border-radius: 7px; background: var(--panel); cursor: pointer; }
.modlist .check:hover { background: #f6f8fa; }
.modlist .check:has(input:checked) { border-color: var(--accent); background: #eef4fb; }
.modlist .check input { margin-top: .15rem; }
.modlist .mod-code { white-space: nowrap; color: var(--muted); }
.modlist .mod-title { min-width: 0; overflow-wrap: anywhere; }
.modlist .mod-locked { opacity: .75; cursor: default; }
.modlist .mod-locked:hover { background: #eef4fb; }
.modlist-heading { font-size: .82rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: .4rem 0 .4rem; }
.matrix-col-ext span { color: var(--muted); }
.matrix-col .sub { font-size: .68rem; text-transform: uppercase; letter-spacing: .4px; }
.gone-list { margin-top: 1rem; }
.gone-list > summary { color: var(--muted); font-weight: 600; }
.gone-list table { margin-top: .6rem; }
.tag-ind { background: #eef4fb; color: var(--accent-dark); }
.tag-warn { background: #fff3e0; color: #8a4b00; }
.mod-gone { border-style: dashed; }
.mod-chip { display: inline-block; font-size: .78rem; background: var(--line-soft); border-radius: 4px;
            padding: .05rem .4rem; margin: 0 .15rem .2rem 0; }
.row-selected td { background: #eef4fb; }
.picker { align-items: flex-end; margin-bottom: 1rem; }
.picker .field { flex: 0 1 260px; }

/* Required by role but never completed. Distinct from an empty cell, which
   only means nobody expects it of that person. */
.cell-gap { background: #fdeaea; color: var(--danger); font-weight: 700; }
.warn-text { color: var(--danger); font-weight: 600; }
.matrix-summary { display: flex; gap: 1.4rem; margin: 0 0 1rem; }
.matrix-summary .num { font-size: 1.4rem; font-weight: 700; }

/* In-app twin of .cert-qualifier. Same message, shown before a learner
   starts and on the result page, not only on the printed certificate. */
.limit-note { border: 1px solid var(--danger); border-left-width: 4px; border-radius: 7px;
              background: #fdf3f3; padding: .75rem .9rem; margin: .9rem 0 1.1rem; }
.limit-tag { display: inline-block; font-size: .68rem; font-weight: 700;
             text-transform: uppercase; letter-spacing: 1.5px; color: #fff;
             background: var(--danger); padding: .15rem .5rem; border-radius: 4px; }
.limit-note p { margin: .45rem 0 0; font-size: .86rem; line-height: 1.45; }

/* What a pass does not prove. Deliberately loud: this is the part that stops
   a certificate being read as clearance to do the job. Uses existing tokens
   only, per the shell rule in CLAUDE.md. */
.cert-qualifier { margin: 1.5rem auto 0; max-width: 46rem; padding: .9rem 1.1rem;
                  border: 2px solid var(--danger); border-radius: 8px;
                  background: #fdf3f3; }
.cert-stamp { display: inline-block; font-size: .72rem; font-weight: 700;
              text-transform: uppercase; letter-spacing: 2px; color: #fff;
              background: var(--danger); padding: .2rem .6rem; border-radius: 4px; }
.cert-qualifier p { margin: .55rem 0 0; font-size: .84rem; line-height: 1.45;
                    color: var(--ink); }

.cert-facts { display: flex; justify-content: center; flex-wrap: wrap; gap: 1.8rem;
              margin: 2.2rem 0 1.6rem; text-align: center; }
.cert-facts dt { font-size: .7rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.cert-facts dd { margin: .2rem 0 0; font-weight: 600; }
.cert-foot { display: flex; justify-content: space-between; border-top: 1px solid var(--line-soft);
             padding-top: 1rem; font-size: .78rem; color: var(--muted); }

@media print {
    .no-print { display: none !important; }
    .cert-page { padding: 0; background: #fff; min-height: auto; }
    .cert { border: 0; box-shadow: none; max-width: none; padding: 2rem; }
    @page { size: A4 landscape; margin: 14mm; }
    /* Print drops background colours by default, so the qualifier must survive
       on its border and weight alone, not on the pink fill. */
    .cert-qualifier { border-color: #000; background: transparent; }
    .cert-stamp { background: transparent; color: #000; border: 1.5px solid #000; }
}

/* Shown by app.js the moment a form is edited, next to its Save button. */
.unsaved {
    font-size: .8rem; font-weight: 600; color: #8a4b00;
    background: #fff3e0; border: 1px solid #ffcc80;
    border-radius: 999px; padding: .18rem .6rem;
}
form.is-dirty .btn-primary,
form.is-dirty button[type=submit] { box-shadow: 0 0 0 3px rgba(249, 168, 37, .35); }

.empty {
    background: var(--panel); border: 1px dashed var(--line);
    border-radius: 10px; padding: 2.5rem 1.25rem; text-align: center; color: var(--muted);
}

/* ---------- Stats ---------- */
.stat-row { display: flex; gap: .9rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.stat {
    flex: 1 1 150px;
    background: var(--panel); border: 1px solid var(--line);
    border-radius: 10px; padding: .9rem 1.1rem;
}
.stat-num { font-size: 1.9rem; font-weight: 800; line-height: 1.1; font-family: var(--font-head); }
.stat-sub { font-size: .78rem; color: var(--muted); margin-top: .3rem; }
/* A stat that is also the way to the page that resolves it. */
a.stat-link { color: var(--ink); text-decoration: none; display: block; }
a.stat-link:hover { border-color: var(--accent); }
/* Access log, one collapsible section per company. */
.log-group { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; margin-bottom: .7rem; }
.log-group > summary { cursor: pointer; display: flex; align-items: center; justify-content: space-between;
                       gap: 1rem; padding: .85rem 1.1rem; list-style: none; }
.log-group > summary::-webkit-details-marker { display: none; }
.log-group > summary::before { content: "▸"; color: var(--muted); margin-right: .6rem; }
.log-group[open] > summary::before { content: "▾"; }
.log-group-name { font-weight: 700; flex: 1; }
.log-group-meta { display: flex; gap: 1rem; align-items: center; font-size: .85rem; color: var(--muted); }
.log-failed { color: var(--danger); font-weight: 600; }
.log-group > table, .log-group > .table-scroll, .log-group > .hint { margin: 0 1.1rem 1rem; width: calc(100% - 2.2rem); }
.log-group > .table-scroll > table { width: 100%; }
.feature-list { display: flex; flex-direction: column; gap: .5rem; }
.feature-row { display: flex; align-items: flex-start; gap: .6rem; white-space: normal; padding: .55rem .7rem;
               border: 1px solid var(--line-soft); border-radius: 7px; }
.feature-row input { margin-top: .2rem; }
.feature-row:has(input:checked) { border-color: var(--accent); background: #eef4fb; }
.feature-off { opacity: .6; }
.feature-data { color: var(--accent-dark); }
.attention-list { list-style: none; margin: 0; padding: 0; }
.attention-list li { padding: .45rem 0; border-bottom: 1px solid var(--line-soft); display: flex;
                     justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.attention-list li:last-child { border-bottom: 0; }
.stat-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-top: .2rem; }

.detail-list { display: grid; grid-template-columns: auto 1fr; gap: .4rem 1.1rem; margin: 0 0 .8rem; }
.detail-list dt { color: var(--muted); font-size: .82rem; }
.detail-list dd { margin: 0; }

/* ---------- Sign-in / error pages ---------- */
.auth-page {
    min-height: 100vh;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 2rem 1rem;
    background: var(--auth-bg);
}
.auth-card {
    background: var(--panel);
    border-radius: 12px;
    box-shadow: 0 18px 40px rgba(0,0,0,.28);
    padding: 2rem 2rem 1.6rem;
    width: 100%; max-width: 400px;
}
.auth-card-narrow { max-width: 460px; text-align: center; }
.auth-brand { text-align: center; margin-bottom: 1.4rem; }
.auth-brand h1 { font-size: 1.3rem; margin: .5rem 0 .15rem; color: var(--mark-ink); }
.auth-sub { color: var(--muted); margin: 0; font-size: .9rem; }
.auth-form { display: flex; flex-direction: column; }
.auth-form label { font-weight: 600; font-size: .85rem; margin-bottom: .3rem; }
.auth-form input { margin-bottom: .9rem; }
.auth-form .hint { margin: -.5rem 0 .9rem; }
.auth-foot { text-align: center; margin: 1.1rem 0 0; font-size: .85rem; color: var(--muted); }
.auth-who { text-align: center; margin: 0 0 1.1rem; line-height: 1.6; }
.auth-who .muted-line { color: var(--muted); font-size: .85rem; }
.auth-form .btn-block + .btn-block, .auth-card > .btn-block + .auth-form { margin-top: .6rem; }
.auth-card > .btn-block { margin-bottom: .6rem; }
.error-who { color: var(--muted); font-size: .88rem; margin: .9rem 0 0; }
.error-actions { display: flex; gap: .5rem; justify-content: center; align-items: center; margin-top: 1rem; }
.auth-legal { color: rgba(255,255,255,.5); font-size: .75rem; margin-top: 1.2rem; }

.error-code { font-size: 3rem; font-weight: 800; color: var(--line); line-height: 1; }
.error-title { font-size: 1.2rem; margin: .3rem 0 .5rem; }
.error-message { color: var(--muted); margin: 0; }

/* ---------- Getting started: the welcome tour and the checklist ----------
   One card over the dashboard the first time an administrator lands after
   accepting the terms (app/onboarding.py). Tokens only, like everything
   else; the images are generated screenshots in the Classic scheme. */
.tour-backdrop {
    position: fixed; inset: 0; z-index: 40;
    background: rgba(15,23,32,.55);
    display: flex; align-items: center; justify-content: center;
    padding: 1.5rem;
}
.tour {
    position: relative;
    width: 100%; max-width: 720px; max-height: calc(100vh - 3rem);
    background: var(--panel); border-radius: 14px;
    box-shadow: 0 30px 80px rgba(0,0,0,.35);
    display: flex; flex-direction: column; overflow: hidden;
}
.tour-skip-form { position: absolute; top: .6rem; right: .6rem; z-index: 2; margin: 0; }
.tour-skip {
    font: inherit; font-size: .8rem; font-weight: 600;
    background: rgba(255,255,255,.9); color: var(--muted);
    border: 1px solid var(--line); border-radius: 999px;
    padding: .3rem .75rem; cursor: pointer;
}
.tour-skip:hover { color: var(--ink); background: #fff; }
.tour-steps { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.tour-step { display: none; }
.tour-step.is-current { display: block; }
/* No script: every step shows, one under the other, and the card scrolls. */
.no-js .tour-step { display: block; border-bottom: 1px solid var(--line-soft); }
.tour-image { background: var(--bg); border-bottom: 1px solid var(--line-soft); aspect-ratio: 16 / 9; overflow: hidden; }
.tour-image img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top left; }
.tour-body { padding: 1.1rem 1.5rem 1.2rem; }
.tour-kicker { font-size: .72rem; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.tour-title { margin: .2rem 0 .5rem; font-size: 1.25rem; font-family: var(--font-head); }
.tour-blurb { margin: 0; color: var(--ink); line-height: 1.55; }
.tour-go { display: inline-block; margin-top: .7rem; padding-left: 0; }
.tour-nav {
    display: flex; align-items: center; justify-content: space-between; gap: .6rem;
    padding: .8rem 1.1rem; border-top: 1px solid var(--line);
    background: var(--panel); flex: 0 0 auto;
}
.no-js .tour-nav .tour-back, .no-js .tour-nav .tour-next, .no-js .tour-dots { display: none; }
.no-js .tour-done-form { display: block !important; margin-left: auto; }
.tour-dots { display: flex; gap: .4rem; }
.tour-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--line); }
.tour-dot.is-current { background: var(--accent); }
.tour-dot.is-done { background: var(--accent-soft); }
.tour-back[disabled] { visibility: hidden; }
.tour-done-form { margin: 0; }
body.tour-open { overflow: hidden; }

.gs-panel { border-left: 3px solid var(--accent); }
.gs-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.gs-head h2 { margin: 0 0 .4rem; }
.gs-hide { font-size: .82rem; text-decoration: none; color: var(--muted); }
.gs-hide:hover { text-decoration: underline; }
.gs-list { list-style: none; margin: .3rem 0 0; padding: 0; display: flex; flex-direction: column; }
.gs-item { display: flex; align-items: center; gap: .75rem; padding: .55rem 0; border-top: 1px solid var(--line-soft); }
.gs-tick {
    flex: 0 0 24px; width: 24px; height: 24px; border-radius: 999px;
    border: 2px solid var(--line); display: inline-flex; align-items: center; justify-content: center;
    font-size: .85rem; font-weight: 800; color: #fff;
}
.gs-item.is-done .gs-tick { background: var(--on); border-color: var(--on); }
.gs-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.gs-title { font-weight: 600; }
.gs-item.is-done .gs-title { color: var(--muted); text-decoration: line-through; font-weight: 500; }
.gs-blurb { font-size: .84rem; color: var(--muted); }
.gs-go { flex: 0 0 auto; white-space: nowrap; }
.gs-foot { margin: .6rem 0 0; }

/* Inspections index: the summary bars are links into the findings list, and
   a walk with a medium or worse finding still open carries a colour bar on
   its row. Chris asked for both (16 Sep 2026). */
.bar-hit { display: contents; color: inherit; text-decoration: none; }
a.bar-hit:hover .bar-label { color: var(--accent); text-decoration: underline; }
a.bar-hit:hover .bar-fill { filter: brightness(.9); }
a.bar-open { color: var(--accent); }
a.bar-open:hover { text-decoration: underline; }
.row-sev-medium td:first-child { box-shadow: inset 4px 0 0 #f9a825; }
.row-sev-high td:first-child { box-shadow: inset 4px 0 0 #ef6c00; }
.row-sev-critical td:first-child { box-shadow: inset 4px 0 0 #c62828; }
.row-sev-critical td { background: #fdf6f6; }

/* Inspections: a tour of several areas, one walk each. */
.tour-row { display: flex; gap: .7rem; align-items: baseline; flex-wrap: wrap; margin-top: .6rem; font-size: .88rem; }
.tour-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.tour-chain { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem .5rem; }
.tour-chain li { display: inline-flex; align-items: center; gap: .35rem; }
.tour-chain li + li::before { content: "\2192"; color: var(--muted); margin-right: .4rem; }
.tour-chain li.is-current { font-weight: 700; }
.tour-list { margin: .2rem 0 .8rem; padding-left: 1.2rem; color: var(--muted); font-size: .88rem; }
.tour-list li { margin: .1rem 0; }

/* ---------- Narrow screens (phones) ----------
   Below 720px the rail becomes a drawer: parked off the left edge and slid
   in by the menu button in the appbar. The #nav-toggle checkbox carries the
   open state so it needs no JavaScript (app.js only adds the keyboard). The
   shell above this width is exactly as before; nothing here applies to it.
   Also here: 16px controls so iOS does not zoom on focus, 40px tap heights,
   an appbar that wraps, and tables that scroll sideways in .table-scroll
   instead of widening the page.
   The old stacked layout had a bug worth remembering: .sidebar-nav is
   flex: 1 1 0 with min-height: 0, so once the sidebar lost its definite
   height the nav collapsed to nothing and phones had no menu at all. */
.nav-toggle-box, .nav-toggle, .nav-backdrop, .page-actions { display: none; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 720px) {
    /* Normal document scrolling; the drawer floats over it. */
    .app { display: block; height: auto; min-height: 100vh; overflow: visible; }
    .main { min-height: 100vh; }
    .content { overflow-y: visible; padding: .9rem; padding-bottom: 96px; }

    /* The drawer. A definite height again, so the nav inside can flex. */
    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0;
        height: 100vh; height: 100dvh;
        width: min(300px, 86vw); flex: none;
        transform: translateX(-104%);
        /* Hidden while parked, so its shadow does not bleed onto the page
           and its links are out of the tab order; visibility flips after
           the slide-out finishes. */
        visibility: hidden;
        transition: transform .22s ease, visibility 0s linear .22s;
        z-index: 30;
        padding-top: env(safe-area-inset-top);
    }
    .nav-toggle-box:checked ~ .sidebar {
        transform: none; visibility: visible;
        transition: transform .22s ease;
        box-shadow: 0 0 44px rgba(0,0,0,.35);
    }
    .nav-backdrop {
        display: block; position: fixed; inset: 0; z-index: 25;
        background: rgba(15,23,32,.5);
        opacity: 0; pointer-events: none; transition: opacity .22s ease;
    }
    .nav-toggle-box:checked ~ .nav-backdrop { opacity: 1; pointer-events: auto; }
    body:has(.nav-toggle-box:checked) { overflow: hidden; }
    .nav-link { padding: .75rem 1rem; font-size: .95rem; }
    .sidebar-user { padding: .9rem 1rem; }
    .su-links { gap: 1rem; font-size: .85rem; }
    .su-links a, .su-name { padding: .3rem 0; display: inline-block; }
    .su-signout { min-height: 40px; padding: .4rem .9rem; font-size: .88rem; }

    /* The menu button, at the left of the appbar. */
    .nav-toggle {
        display: inline-flex; flex: 0 0 40px; flex-direction: column;
        justify-content: center; align-items: center; gap: 5px;
        width: 40px; height: 40px; margin-left: -.35rem;
        border-radius: 8px; cursor: pointer;
    }
    .nav-toggle span { display: block; width: 20px; height: 2px; border-radius: 2px; background: var(--ink); }
    .nav-toggle:hover, .nav-toggle:focus-visible { background: var(--bg); outline: none; }
    .nav-toggle:focus-visible { box-shadow: 0 0 0 3px var(--accent-soft); }

    /* The appbar stays one row: menu button and title, sticky. A page's
       actions leave the header and sit at the top of the page instead,
       in .page-actions (base.html renders the toolbar block there too),
       where they scroll away rather than take a second sticky row on
       every screen. Chris noticed the dashboard's two buttons wrapped
       under the title on 16 Sep 2026; this is the answer. */
    .appbar { gap: .5rem; padding: 0 .9rem; }
    .appbar-title { flex: 1 1 auto; min-width: 0; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .appbar-actions { display: none; }
    .page-actions { display: flex; flex-wrap: wrap; gap: .5rem; padding: .9rem .9rem 0; }
    .page-actions .btn { flex: 1 1 auto; }
    .page-actions + .content { padding-top: .9rem; }

    /* Controls: 16px stops iOS zooming on focus; 40px is a comfortable tap. */
    input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=submit]):not([type=button]):not([type=hidden]):not([type=range]):not([type=color]),
    select, textarea { font-size: 16px; }
    input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=submit]):not([type=button]):not([type=hidden]):not([type=range]):not([type=color]),
    select { height: 40px; }
    .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: .5rem .9rem; font-size: .92rem; }
    .btn-xs { min-height: 30px; padding: .2rem .55rem; font-size: .76rem; }
    .form-actions { gap: .6rem; }
    .form-actions .btn-primary { flex: 1 1 auto; }
    input[type=checkbox], input[type=radio] { width: 20px; height: 20px; }

    /* Lists span the window; tables scroll inside their wrapper rather than
       widening the page. Action cells may wrap. */
    .grid .actions { white-space: normal; }
    .grid th, .grid td { padding: .6rem .65rem; }
    .stat { flex-basis: calc(50% - .45rem); padding: .8rem .9rem; }
    .stat-num { font-size: 1.6rem; }
    .detail-head { flex-wrap: wrap; gap: .5rem .9rem; padding: .9rem 1rem; }
    .detail-status { margin-left: 0; }
    .panel { padding: .95rem 1rem; }
    .doc-body { padding: 1.1rem 1rem; }
    .searchbar, .searchbar-wide { flex-wrap: wrap; max-width: none; }
    .searchbar input, .searchbar-wide input[type=search] { flex: 1 1 200px; }
    .imp-banner { flex-wrap: wrap; padding: .55rem .9rem; }
    .bar-label { flex-basis: 110px; }
    .player-body { padding: 1rem; }
    .player-title { font-size: 1.15rem; }
    .tour-backdrop { padding: 0; align-items: stretch; }
    .tour { max-width: none; max-height: none; height: 100vh; height: 100dvh; border-radius: 0; }
    .tour-image { aspect-ratio: 4 / 3; }
    .tour-body { padding: 1rem 1rem 1.1rem; }
    .tour-nav { padding: .7rem .9rem calc(.7rem + env(safe-area-inset-bottom)); }
    .gs-item { flex-wrap: wrap; }
    .gs-go { margin-left: calc(24px + .75rem); }
    .cert-page { padding: .6rem; }
    .cert { padding: 1.6rem 1.2rem; }
    .cert-actions { flex-wrap: wrap; }
}

/* The terms page before acceptance: the sign-in card, wide enough to read a
   document in. The text keeps the document read page's own styling. */
.auth-card-wide { max-width: 820px; }
.auth-card-wide .doc-body { margin: 0 0 1rem; max-height: 55vh; overflow-y: auto; }
.auth-card-wide .detail-head { margin-bottom: .8rem; }
.auth-card-wide .warn-note { margin: 0 0 1rem; }
.auth-card-wide .stack { margin-bottom: 1rem; }
.auth-card-wide .auth-form { margin-top: .4rem; }
.terms-summary { display: flex; gap: 1.6rem; flex-wrap: wrap; margin: 0 0 .4rem; }
.terms-summary .stat { min-width: 150px; }
.imp-banner .imp-terms { display: block; font-size: .85rem; margin-top: .2rem; }


/* ---------- Schemes ----------
   Every scheme is the same shell painted from the Boab brand palette:
   Navy #1C2D59, Blue #0071BC, Sky #6FB6EF, Ink #1A2233, Muted #5B6678.
   Chosen platform wide under Platform, Appearance; see app/branding.py.
   Classic is the :root above, the Pulse MES tokens, and needs no block. */
html[data-scheme="boab"] {
    --bg: #eef1f6; --line: #d4dbe6; --line-soft: #e6ebf2;
    --ink: #1a2233; --muted: #5b6678;
    --accent: #0071bc; --accent-dark: #005c99; --accent-soft: rgba(0,113,188,.14);
    --rail: #1c2d59; --rail-2: #162449; --rail-active: #24386d;
    --rail-ink: #c9d4ea; --rail-ink-dim: #8593b8;
    --rail-marker: #6fb6ef; --mark-dot: #6fb6ef; --mark-ink: #1c2d59; --mark-dot-light: #0071bc;
    --auth-bg: linear-gradient(160deg, #162449 0%, #1c2d59 55%, #24386d 100%);
}
html[data-scheme="ink"] {
    --bg: #eef1f6; --line: #d4dbe6; --line-soft: #e6ebf2;
    --ink: #1a2233; --muted: #5b6678;
    --accent: #0071bc; --accent-dark: #005c99; --accent-soft: rgba(0,113,188,.14);
    --rail: #1a2233; --rail-2: #131a29; --rail-active: #1c2d59;
    --rail-ink: #c4cee0; --rail-ink-dim: #7f8ba3;
    --rail-marker: #6fb6ef; --mark-dot: #6fb6ef; --mark-ink: #1c2d59; --mark-dot-light: #0071bc;
    --auth-bg: linear-gradient(160deg, #131a29 0%, #1a2233 55%, #1c2d59 100%);
}
html[data-scheme="light"] {
    --bg: #f3f5f9; --line: #d4dbe6; --line-soft: #e6ebf2;
    --ink: #1a2233; --muted: #5b6678;
    --accent: #0071bc; --accent-dark: #005c99; --accent-soft: rgba(0,113,188,.14);
    --rail: #ffffff; --rail-2: #ffffff; --rail-active: #e8f1fb;
    --rail-ink: #3b4a6b; --rail-ink-dim: #7a869f; --rail-strong: #1c2d59;
    --rail-line: rgba(28,45,89,.12); --rail-hover: rgba(0,113,188,.06);
    --rail-marker: #0071bc; --mark-dot: #0071bc; --mark-ink: #1c2d59; --mark-dot-light: #0071bc;
    --auth-bg: linear-gradient(160deg, #162449 0%, #1c2d59 55%, #24386d 100%);
}
html[data-scheme="light"] .sidebar { border-right: 1px solid var(--rail-line); }
html[data-scheme="light"] .nav-count { color: #fff; }

/* Brand typefaces: Montserrat carries headings and the wordmark, Manrope the
   words. Loaded from Google Fonts only when switched on; the fallbacks are
   the system stack, so an offline plant PC loses nothing but the face. */
html[data-fonts="brand"] {
    --font-body: Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-head: Montserrat, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
html[data-fonts="brand"] h1, html[data-fonts="brand"] .detail-title,
html[data-fonts="brand"] .auth-brand h1 { font-family: var(--font-head); }

/* Appearance page: one card per scheme, with a small painted preview. */
.scheme-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .9rem; margin: .4rem 0 .9rem; }
.scheme-card { display: block; border: 2px solid var(--line); border-radius: 10px; padding: .7rem; cursor: pointer; background: var(--panel); }
.scheme-card:hover { border-color: var(--accent); }
.scheme-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.scheme-card input { position: absolute; opacity: 0; width: 0; height: 0; }
.scheme-preview { display: flex; height: 92px; border-radius: 7px; overflow: hidden; border: 1px solid var(--line-soft); margin-bottom: .6rem; }
.scheme-rail { width: 34%; padding: .5rem .55rem; display: flex; flex-direction: column; gap: .35rem; }
.scheme-rail i { display: block; height: 6px; border-radius: 3px; opacity: .45; background: currentColor; }
.scheme-rail .sp-mark { display: flex; align-items: center; gap: .3rem; height: 12px; margin-bottom: .2rem; }
.scheme-rail .sp-mark svg { width: 18px; height: 12px; overflow: visible; }
.scheme-rail .sp-mark b { font-size: .55rem; letter-spacing: .4px; font-family: var(--font-head); white-space: nowrap; }
.scheme-body { flex: 1; padding: .55rem .6rem; }
.scheme-body .sp-bar { height: 8px; border-radius: 3px; width: 55%; opacity: .5; margin-bottom: .45rem; background: #1a2233; }
.scheme-body .sp-btn { display: inline-block; width: 46px; height: 12px; border-radius: 4px; }
.scheme-body .sp-panel { height: 26px; border-radius: 5px; background: #fff; border: 1px solid #d4dbe6; margin-top: .45rem; }
.scheme-name { font-weight: 700; }
.scheme-blurb { font-size: .82rem; color: var(--muted); margin-top: .15rem; }
.scheme-default { align-items: center; justify-content: center; text-align: center; font-size: .82rem; color: var(--muted); background: var(--bg); padding: .5rem; }
.panel-danger { border-left: 3px solid var(--danger); }
.panel-danger h2 { margin-top: .9rem; }
.panel-danger h2:first-child { margin-top: 0; color: var(--danger); }
.impact-list { margin: 0 0 .6rem; padding-left: 1.2rem; color: var(--ink); }
.impact-list li { margin-bottom: .3rem; }
.date-pair { display: inline-flex; gap: .4rem; align-items: center; }
.date-pair[hidden] { display: none; }
.date-pair input[type=date] { width: auto; }
.bar-fill-safe { background: var(--on); }
.bars-areas .bar-label { flex-basis: 220px; }
.matrix-cell a.matrix-fix { color: inherit; font-weight: 600; text-decoration: none; }
.matrix-cell a.matrix-fix:hover { text-decoration: underline; }

/* ---------- Inspections ----------
   The walk screen is used on a phone on the floor. Big targets, one column,
   and nothing that needs precision. Everything else in the module uses the
   shared components above. */
.walk-page .tap, .walk-page select.tap { min-height: 44px; font-size: 1rem; }
.btn-tap { min-height: 46px; padding: .6rem 1rem; font-size: 1rem; }
.walk-head .walk-title { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; font-size: 1.05rem; margin-bottom: .2rem; }
.walk-title { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; font-size: 1.05rem; margin-bottom: .5rem; }
.walk-area { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; background: var(--bg); border: 1px solid var(--line);
        border-radius: 999px; padding: .25rem .7rem; font-size: .86rem; }
.chip-note { color: var(--muted); font-size: .76rem; }
.chip-x { background: none; border: 0; color: var(--muted); font-size: 1.05rem; line-height: 1; padding: 0 .1rem; cursor: pointer; }
.chip-x:hover { color: var(--danger); }
.walk-addperson { display: flex; gap: .5rem; margin-top: .7rem; align-items: center; }
.walk-addperson select { flex: 1 1 auto; }
.walk-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.walk-item { border: 1px solid var(--line); border-radius: 10px; padding: .75rem .85rem; background: var(--panel); }
.walk-item.is-ok { border-color: #b6dfb9; background: #f3faf3; }
.walk-item.is-issue { border-color: #f5b7b1; background: #fdf3f2; }
.walk-item.is-na { border-color: var(--line); background: var(--bg); }
.walk-item-text { font-size: 1rem; margin-bottom: .55rem; }
.walk-item-text .hint { margin-top: .15rem; }
.walk-item-finding { display: inline-block; margin-top: .25rem; font-size: .85rem; }
.seg { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .4rem; align-items: stretch; }
.seg-btn { min-height: 46px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
           color: var(--ink); font: inherit; font-weight: 700; font-size: .95rem; cursor: pointer; }
.seg-btn:hover { background: #f6f8fa; }
.seg-ok.on { background: var(--on); border-color: var(--on); color: #fff; }
.seg-issue.on { background: var(--danger); border-color: var(--danger); color: #fff; }
.seg-na.on { background: var(--muted); border-color: var(--muted); color: #fff; }
.walk-note { grid-column: 1 / -1; font-size: .85rem; color: var(--muted); }
.walk-note summary { cursor: pointer; }
.walk-note input { margin-top: .4rem; }
.walk-status { font-size: .82rem; color: var(--muted); min-height: 1em; margin-top: .3rem; }
.walk-status.is-error { color: var(--danger); font-weight: 600; }
.walk-status.is-ok { color: var(--on); }
.walk-actions { position: sticky; bottom: 0; background: var(--panel); padding-top: .7rem; margin-top: .7rem;
                border-top: 1px solid var(--line-soft); }
.walk-actions .btn { flex: 1 1 200px; text-align: center; }

.finding-list { list-style: none; margin: 0 0 .8rem; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.finding-row { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.finding-link { display: flex; gap: .8rem; padding: .65rem .8rem; color: inherit; text-decoration: none; align-items: flex-start; }
.finding-link:hover { text-decoration: none; border-color: var(--accent); }
.finding-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; flex: 0 0 64px; background: var(--bg); display: block; }
.finding-thumb-empty { border: 1px dashed var(--line); }
.finding-body { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.finding-top { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.finding-desc { font-size: .98rem; }
.finding-text { font-size: 1.08rem; margin: .5rem 0 .8rem; color: var(--ink); }
.finding-cell { display: flex; gap: .6rem; align-items: flex-start; }
.finding-cell .finding-thumb { width: 44px; height: 44px; flex-basis: 44px; }

.sevtag { display: inline-block; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .4px;
          color: #fff; border-radius: 4px; padding: .12rem .45rem; }
.sevtag.sev-low { background: #2e7d32; } .sevtag.sev-medium { background: #f9a825; color: #3a2b00; }
.sevtag.sev-high { background: #ef6c00; } .sevtag.sev-critical { background: #c62828; }
.sevtag.sev-positive { background: #1565c0; }
.sevdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .4rem; vertical-align: middle; }
.sevdot.sev-low { background: #2e7d32; } .sevdot.sev-medium { background: #f9a825; }
.sevdot.sev-high { background: #ef6c00; } .sevdot.sev-critical { background: #c62828; }
.bar-sev-low { background: #2e7d32; } .bar-sev-medium { background: #f9a825; }
.bar-sev-high { background: #ef6c00; } .bar-sev-critical { background: #c62828; }
.restag { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.res-ok { color: var(--on); } .res-issue { color: var(--danger); } .res-na { color: var(--muted); }
.panel-critical { border-left: 4px solid var(--danger); }

.sev-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: .45rem; }
.sev-chip { display: block; border: 2px solid var(--line); border-radius: 10px; text-align: center; padding: .7rem .3rem;
            cursor: pointer; font-weight: 700; background: var(--panel); min-height: 46px; }
.sev-chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.sev-chip:hover { background: #f6f8fa; }
.sev-chip-low:has(input:checked) { border-color: #2e7d32; background: #e8f5e9; color: #1b5e20; }
.sev-chip-medium:has(input:checked) { border-color: #f9a825; background: #fff8e1; color: #6d4c00; }
.sev-chip-high:has(input:checked) { border-color: #ef6c00; background: #fff3e0; color: #8a4b00; }
.sev-chip-critical:has(input:checked) { border-color: #c62828; background: #fdecec; color: #8e1b1b; }
@media (max-width: 420px) { .sev-chips { grid-template-columns: 1fr 1fr; } }

.photo-buttons { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.photo-btn { cursor: pointer; }
.photo-btn input[type=file][hidden] { display: none; }
.photo-picked { display: flex; gap: .45rem; flex-wrap: wrap; margin-top: .6rem; }
.photo-picked:empty { display: none; }
.photo-picked img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.photo-picked .pp-count { align-self: center; font-size: .85rem; color: var(--muted); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; margin-bottom: .6rem; }
.photo-tile { margin: 0; }
.photo-tile img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.photo-tile figcaption { display: flex; justify-content: space-between; align-items: center; margin-top: .25rem; gap: .4rem; }
.photo-add { margin-top: .6rem; }

.due-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.due-row { display: flex; align-items: center; gap: .8rem; padding: .45rem 0; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.due-row:last-child { border-bottom: 0; }
.due-when { flex: 0 0 90px; font-weight: 600; }
.due-what { flex: 1 1 200px; }
.due-what .sub { display: block; }
.due-act { display: flex; gap: .4rem; align-items: center; }
.stat-of { font-size: .9rem; color: var(--muted); font-weight: 600; }
.ins-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.2rem; }
.ins-h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 0 0 .5rem; }
.ins-summary .bar-row .sub { flex: 0 0 52px; font-size: .76rem; }
.item-row { grid-template-columns: 2fr 2fr auto; }
@media (max-width: 720px) {
    .item-row { grid-template-columns: 1fr; }
    .walk-addperson { flex-direction: column; align-items: stretch; }
    .finding-cell .finding-thumb { display: none; }
    .due-when { flex-basis: 100%; }
}
