/* The customer portal.
 *
 * A PHONE FIRST (PORTAL-PLAN.md section 4). Everything here is drawn at 360
 * to 430 pixels and then allowed to spread out; there is no breakpoint that
 * makes it fit a phone, only ones that let it use a bigger screen.
 *
 *   - One column. Nothing scrolls sideways, ever.
 *   - Anything you press is at least 44px tall: a thumb, in a truck.
 *   - Read outdoors, so light, high contrast, no thin grey text for anything
 *     that matters. (The operator console is dark because it is read all
 *     night in a dim room. This is the opposite room.)
 *   - Small on the wire: one stylesheet, the system's own fonts, no script.
 *   - Colour means what it means on the console: red is armed, amber is
 *     somebody having decided something, green is a thing that is fine.
 *
 * It goes on the home screen and opens with no browser bars, so the safe
 * areas matter: content stays out from under the notch and the home bar.
 */

:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #15202b;
  --quiet: #55616e;
  --line: #dde3ea;
  --brand: #10243c;
  --armed: #b3261e;      --armed-bg: #fdecea;
  --decided: #8a5a00;    --decided-bg: #fff4dd;
  --ok: #17703a;         --ok-bg: #e6f4ea;
  --radius: 14px;
  --tap: 44px;
  --gutter: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  overflow-x: hidden;
}
a { color: #0b57a4; }
h1, h2, p { margin: 0; }
.quiet { color: var(--quiet); }
.small { font-size: 14px; }

/* ---------- the bar ---------- */

.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--brand); color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) calc(var(--gutter) + env(safe-area-inset-right)) 10px calc(var(--gutter) + env(safe-area-inset-left));
}
.bar .brand { color: #fff; text-decoration: none; display: flex; flex-direction: column; justify-content: center; min-height: var(--tap); line-height: 1.2; min-width: 0; }
.bar .brand .who { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .brand .what { font-size: 12px; opacity: .8; letter-spacing: .04em; text-transform: uppercase; }
.bar form { margin: 0; flex: 0 0 auto; }
button.link {
  min-height: var(--tap); padding: 0 12px; border: 1px solid rgba(255,255,255,.35); border-radius: 10px;
  background: transparent; color: #fff; font: inherit; font-size: 15px; cursor: pointer;
}

/* The company strip: only for a sign-in with more than one company. */
.company {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; max-width: 640px; margin: 0 auto;
  padding: 0 calc(var(--gutter) + env(safe-area-inset-right)) 0 calc(var(--gutter) + env(safe-area-inset-left));
  min-height: var(--tap); font-size: 15px; color: var(--quiet);
  border-bottom: 1px solid var(--line, #dfe5ea);
}
.company a { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 600; color: #0b57a4; white-space: nowrap; }
.choice { display: block; width: 100%; box-sizing: border-box; margin: 0 0 12px; }
.choice button { width: 100%; gap: 10px; }
.choice .now { font-size: 14px; font-weight: 600; color: rgba(255,255,255,.75); }

/* ---------- the page ---------- */

main {
  flex: 1; width: 100%; max-width: 640px; margin: 0 auto;
  padding: 18px calc(var(--gutter) + env(safe-area-inset-right)) 8px calc(var(--gutter) + env(safe-area-inset-left));
}
h1.page { font-size: 22px; margin: 2px 0 14px; }
.back { margin: 0 0 10px; }
.back a { display: inline-flex; align-items: center; min-height: var(--tap); text-decoration: none; font-weight: 600; }

.card, .site {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 0 0 14px;
}
.card h2 { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--quiet); margin: 0 0 8px; }

/* ---------- a site ---------- */

.site { border-left: 6px solid var(--line); }
.site.armed { border-left-color: var(--armed); }
.site.ppe, .site.test, .site.off { border-left-color: var(--decided); }
.site h1 { font-size: 24px; line-height: 1.2; }
.site h2 { font-size: 19px; line-height: 1.25; }
.site-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: var(--tap); color: inherit; text-decoration: none;
}
.site-head .chev { font-size: 28px; color: var(--quiet); line-height: 1; }

.state { display: flex; align-items: center; gap: 10px; margin: 10px 0 4px; }
.state .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--quiet); flex: 0 0 auto; }
.state .word { font-size: 21px; font-weight: 700; line-height: 1.25; }
.site.armed .dot { background: var(--armed); }
.site.armed .word { color: var(--armed); }
.site.ppe .dot, .site.test .dot, .site.off .dot { background: var(--decided); }
.site.ppe .word, .site.test .word, .site.off .word { color: var(--decided); }
.detail { color: var(--ink); }
.next { margin-top: 6px; font-weight: 600; }
.meta { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--quiet); font-size: 15px; }
.meta .sep { margin: 0 4px; }
.warn { color: var(--armed); }

/* ---------- rows ---------- */

.rows { list-style: none; margin: 0; padding: 0; }
.rows li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: var(--tap); padding: 6px 0; border-top: 1px solid var(--line);
}
.rows li:first-child { border-top: 0; }
.pill { font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--armed-bg); color: var(--armed); }

/* ---------- forms, sign-in ---------- */

/* Before signing in (2 Oct 2026): a night-blue gate with the lens mark, and
   the form on a card lifted over its edge. On a wide screen the gate becomes
   the left half. No script, no web font: the system's own, as everywhere. */
.gate {
  position: relative; overflow: hidden; color: #fff;
  padding: calc(34px + env(safe-area-inset-top)) calc(var(--gutter) + env(safe-area-inset-right)) 78px calc(var(--gutter) + env(safe-area-inset-left));
  background:
    radial-gradient(120% 90% at 85% -10%, rgba(88, 160, 255, .35), transparent 60%),
    radial-gradient(90% 70% at -10% 110%, rgba(31, 138, 120, .35), transparent 60%),
    linear-gradient(160deg, #10243c 0%, #0a1729 100%);
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
}
/* Concentric rings, like a lens, spreading off the edge. */
.gate::before {
  content: ""; position: absolute; width: 760px; height: 760px; left: 50%; top: -200px; transform: translateX(-50%);
  border-radius: 50%; pointer-events: none;
  background: repeating-radial-gradient(circle, transparent 0 46px, rgba(255, 255, 255, .055) 47px 48px);
  mask-image: radial-gradient(circle, #000 20%, transparent 65%);
}
.gate > * { position: relative; }
.gate-mark { width: 56px; height: 56px; margin-bottom: 6px; }
.gate-mark .ring { fill: none; stroke: rgba(255, 255, 255, .35); stroke-width: 2; }
.gate-mark .ring.two { stroke: rgba(255, 255, 255, .6); }
.gate-mark .lens { fill: #58a0ff; }
.gate-mark .glint { fill: #fff; opacity: .85; }
.gate-name { font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; opacity: .82; }
.gate-title { font-size: 25px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; margin-top: 4px; }
.gate-list { display: none; }

.signin { display: block; margin-top: -56px; padding-top: 0; position: relative; }
.signin .card {
  width: 100%; border: 0; border-radius: 20px; padding: 24px 20px 20px;
  box-shadow: 0 1px 2px rgba(16, 36, 60, .06), 0 18px 44px -18px rgba(16, 36, 60, .35);
}
.signin h1 { font-size: 26px; margin-bottom: 6px; letter-spacing: -.01em; }
.signin .btn.primary { min-height: 52px; font-size: 17px; border-radius: 12px; }

@media (min-width: 900px) {
  body:has(> .gate) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
  .gate { justify-content: center; align-items: flex-start; text-align: left; padding: 64px clamp(40px, 6vw, 96px); gap: 10px; }
  .gate::before { width: 1100px; height: 1100px; left: auto; right: -560px; top: 50%; transform: translateY(-50%); }
  .gate-mark { width: 72px; height: 72px; }
  .gate-title { font-size: clamp(34px, 3.6vw, 48px); max-width: 12ch; margin-top: 8px; }
  .gate-list { display: flex; flex-direction: column; gap: 14px; list-style: none; margin: 22px 0 0; padding: 22px 0 0; border-top: 1px solid rgba(255, 255, 255, .16); font-size: 17px; }
  .gate-list li { display: flex; align-items: center; gap: 14px; opacity: .92; }
  .gate-list svg { width: 26px; height: 26px; flex: 0 0 auto; fill: none; stroke: #9cc4f0; stroke-width: 1.8; stroke-linecap: round; }
  .gate-list svg .fill { fill: #9cc4f0; stroke: none; }
  .signin { margin: 0; display: flex; align-items: center; justify-content: center; max-width: none; padding: 48px clamp(24px, 5vw, 72px); }
  .signin .card { max-width: 440px; padding: 34px 32px 26px; }
}
label { display: block; font-weight: 600; margin: 16px 0 6px; }
input[type=email], input[type=password], input[type=text], input[type=tel], input[type=datetime-local], input[type=time], select {
  width: 100%; min-height: 48px; padding: 10px 12px;
  /* 16px or larger, or an iPhone zooms the whole page when the box is tapped. */
  font: inherit; font-size: 17px; color: var(--ink);
  background: #fff; border: 1.5px solid #aeb8c4; border-radius: 10px;
}
input:focus { outline: 3px solid #9cc4f0; outline-offset: 1px; border-color: #0b57a4; }
.btn {
  display: flex; align-items: center; justify-content: center; width: 100%;
  min-height: 50px; margin-top: 18px; padding: 0 16px; border-radius: 12px; border: 0;
  font: inherit; font-size: 17px; font-weight: 700; cursor: pointer; text-decoration: none;
}
.btn.primary { background: var(--brand); color: #fff; }
/* The one button in the portal that switches monitoring off. */
.btn.danger { background: var(--armed); color: #fff; }
.btn.spaced { margin-top: 14px; }
.notice { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--decided-bg); color: var(--decided); font-weight: 600; }
.notice.bad, .notice.error { background: var(--armed-bg); color: var(--armed); }
.signin .small { margin-top: 16px; }
.center { text-align: center; margin-top: 8px; }
a.tap { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 600; }

/* ---------- a temporary disarm ---------- */

/* A form sent back with a mistake opens at #disarm: clear of the bar on top. */
.card[id] { scroll-margin-top: calc(84px + env(safe-area-inset-top)); }
.notice.first { margin-top: 0; }
.notice.success { background: var(--ok-bg); color: var(--ok); }
.after { margin-top: 10px; }
.after a, .card p a[href^="tel:"] { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 600; }
.err { color: var(--armed); font-weight: 600; margin: 4px 0 6px; }
.disarm-line { padding: 12px 0; border-top: 1px solid var(--line); }
.disarm-line:first-of-type { border-top: 0; padding-top: 0; }
.disarm-line .what { font-size: 17px; }
.disarm-line .btn { margin-top: 10px; }
fieldset.lengths { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.lengths legend { font-weight: 600; padding: 0; margin: 0 0 6px; }
.lengths .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.len { position: relative; }
/* The radio is still there for the keyboard, a screen reader and the
   browser's own "choose one"; the label is what a thumb presses. */
.len input { position: absolute; opacity: 0; left: 12px; top: 50%; width: 1px; height: 1px; margin: 0; }
.len label {
  display: flex; flex-direction: column; justify-content: center; margin: 0;
  min-height: 60px; padding: 8px 12px; cursor: pointer;
  background: #fff; border: 1.5px solid #aeb8c4; border-radius: 10px;
}
.len label b { font-size: 17px; }
.len label span { font-size: 13.5px; font-weight: 400; color: var(--quiet); }
.len input:checked + label { border-color: var(--brand); background: #e8eef6; box-shadow: inset 0 0 0 1.5px var(--brand); }
.len input:focus-visible + label { outline: 3px solid #9cc4f0; outline-offset: 1px; }
details.later { margin-top: 14px; }
details.later summary { display: flex; align-items: center; min-height: var(--tap); color: #0b57a4; font-weight: 600; cursor: pointer; }
details.later label { margin-top: 6px; }
details.later .small { margin-top: 6px; }
/* Dots as it is typed, without being a password box: a phone offers to save
   a password box over the password they signed in with. */
input.pin { -webkit-text-security: disc; letter-spacing: .25em; font-size: 20px; }

/* ---------- a site manager's pages: the call list, and the schedule ---------- */

select { appearance: auto; }
/* A tick or a choice with its words: the whole row is the thing to press. */
label.check { display: flex; align-items: flex-start; gap: 12px; min-height: var(--tap); margin: 12px 0 0; padding: 10px 12px; font-weight: 400; cursor: pointer; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; }
label.check input { flex: 0 0 auto; width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--brand); }
label.check:has(input:checked) { border-color: var(--brand); background: #e8eef6; }
fieldset.choice, fieldset.hours { border: 0; margin: 16px 0 0; padding: 0; min-width: 0; }
fieldset.choice legend, fieldset.hours legend { font-weight: 600; padding: 0; }
.hour-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.hour-row .wide { grid-column: 1 / -1; }
.hour-row .also { margin: 12px 0 0; }
.explain { margin: -6px 0 14px; }
.hour-row label { margin-top: 10px; }
.daypick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
label.small-check { margin: 8px 0 0; align-items: center; }
.days { list-style: none; margin: 0 0 14px; padding: 0; }
.days li { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 10px; }
.days .btn { width: auto; min-width: 96px; margin-top: 0; min-height: var(--tap); }
.dayword { color: var(--quiet); }
.dayword.armed { color: var(--armed); font-weight: 600; }
.dayword.off, .dayword.ppe { color: var(--decided); font-weight: 600; }
.people.manage li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 14px 52px; margin-bottom: 10px; }
.people.manage li::before { left: 14px; top: 16px; }
.people.manage .flags { margin-top: 6px; }
.btn.first-btn { margin: 0 0 8px; }

/* ---------- the foot ---------- */

.foot {
  width: 100%; max-width: 640px; margin: 0 auto; color: var(--quiet); font-size: 14px;
  padding: 10px calc(var(--gutter) + env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) calc(var(--gutter) + env(safe-area-inset-left));
}
/* A phone number is for pressing: the same 44px as any button. */
.foot a { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 600; }

/* ---------- the tabs: at the bottom, where a thumb is ---------- */

.tabs {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; justify-content: space-around;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 4px calc(4px + env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) calc(4px + env(safe-area-inset-left));
}
.tabs a {
  flex: 1 1 0; min-width: 0; min-height: 52px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--quiet); text-decoration: none; font-size: 12.5px; font-weight: 600; border-radius: 10px;
}
.tabs a svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a svg .fill { fill: currentColor; stroke: none; }
.tabs a.on { color: var(--brand); background: #e8eef6; }

/* ---------- the week ahead ---------- */

.week { display: grid; gap: 8px; }
.day { display: grid; grid-template-columns: 58px 1fr; align-items: center; gap: 10px; }
.day .d { font-size: 14px; color: var(--quiet); font-variant-numeric: tabular-nums; }
.day.today .d { color: var(--ink); font-weight: 700; }
.strip { display: flex; height: 18px; border-radius: 5px; overflow: hidden; background: var(--line); }
.strip i { display: block; min-width: 1px; }
.strip i.armed, .legend i.armed { background: var(--armed); }
.strip i.ppe, .legend i.ppe { background: #e0a526; }
.strip i.off, .legend i.off, .strip i.test { background: #c9d2dc; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 12px 0 8px; font-size: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
/* For a screen reader, and printed: the same week, in words. */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- who we call ---------- */

.people { list-style: none; margin: 0; padding: 0; counter-reset: call; }
.people li { counter-increment: call; position: relative; padding: 10px 0 10px 38px; border-top: 1px solid var(--line); }
.people li:first-child { border-top: 0; }
.people li::before {
  content: counter(call); position: absolute; left: 0; top: 12px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; background: var(--brand); color: #fff; font-size: 13px; font-weight: 700;
}
.people .how a { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 600; font-size: 17px; }
.people .flags { display: flex; flex-wrap: wrap; gap: 6px; }
.pill.quiet-pill { background: #eef1f5; color: var(--quiet); }
.right { text-align: right; }

/* ---------- activity, and lists of reports ---------- */

.tally p + p { margin-top: 6px; }
.events { list-style: none; margin: 0 0 14px; padding: 0; }
.event { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.event.open { border-left: 6px solid var(--armed); }
.event .when { font-size: 14px; color: var(--quiet); }
.event .what { margin-top: 2px; }
.event .ending { margin-top: 4px; }
.event .more, a.whole .more { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 700; text-decoration: none; color: #0b57a4; }
a.whole { display: block; color: inherit; text-decoration: none; margin: -14px -16px; padding: 14px 16px; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.btn.ghost { background: var(--card); color: var(--brand); border: 1.5px solid var(--brand); margin-top: 0; }

/* ---------- a report, as sent ---------- */

.letter { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 16px; margin-bottom: 14px; }
.letter h1 { font-size: 21px; line-height: 1.3; margin-bottom: 4px; }
.letter h2 { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--quiet); margin: 22px 0 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.prose { white-space: pre-line; }
.closing { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.letter figure { margin: 0 0 16px; }
.letter img, .letter video, .shots img { display: block; width: 100%; height: auto; border-radius: 8px; background: #e7ebf0; }
.letter figcaption { font-size: 14px; color: var(--quiet); margin-top: 5px; }
.todo { margin: 0; padding-left: 22px; }
.todo li { margin-bottom: 8px; }
.letter .small { margin-top: 18px; }

/* ---------- PPE ---------- */

.lead { margin-bottom: 14px; }
.ppe-week { padding: 12px 0; border-top: 1px solid var(--line); }
.ppe-week h3, h3.sub { font-size: 15px; margin: 0 0 8px; }
h3.sub { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin: 0; }
.figures div { background: #f1f4f7; border-radius: 10px; padding: 8px 10px; }
.figures dt { font-size: 12.5px; color: var(--quiet); }
.figures dd { margin: 0; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.figures .good dd { color: var(--ok); }
.figures .bad dd { color: var(--armed); }
.shots { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.shots li { display: grid; grid-template-columns: 112px 1fr; gap: 12px; align-items: center; }
.noimg { height: 63px; display: grid; place-items: center; background: #f1f4f7; border-radius: 8px; }

@media print {
  .bar, .tabs, .foot, .back, .printhint, .pager { display: none; }
  body { background: #fff; }
  .letter, .card { border: 0; padding: 0; }
  .sr { position: static; width: auto; height: auto; clip: auto; white-space: normal; }
}

/* A bigger screen is allowed to breathe. Nothing above depends on this. */
@media (min-width: 700px) {
  main { padding-top: 28px; }
  h1.page { font-size: 26px; }
}
