:root{padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px);color-scheme:light}
body{margin:0;font-size:14px;-webkit-text-size-adjust:100%}img{max-width:100%}[hidden]{display:none!important}
/* Layout: a chart-table workspace. Navigation rail at the side on wide screens and along the bottom on a phone; one working column; references set in mono like clause numbers in a survey report. */
:root {
  --bg: #F2F6F5; --surface: #FFFFFF; --sunk: #E6EDEB; --line: #D1DCDA;
  --ink: #0C2A2B; --ink2: #47605F; --ink3: #768C8A;
  --accent: #095B5C; --accent-ink: #FFFFFF; --accent-soft: #D9ECEA; --gold: #F8B73C;
  --ok: #1F7A4D; --ok-soft: #DDF1E6; --warn: #A05A00; --warn-soft: #FBEBD2; --crit: #B3261E; --crit-soft: #FADDDA;
  --display: "IBM Plex Sans Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --r: 10px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #071A1B; --surface: #0E2A2B; --sunk: #0A2223; --line: #1F4243;
  --ink: #E8F2F0; --ink2: #A8C0BD; --ink3: #7C9794;
  --accent: #5CC7BC; --accent-ink: #052324; --accent-soft: #12393A; --gold: #F8B73C;
  --ok: #63C795; --ok-soft: #143325; --warn: #E7A851; --warn-soft: #3A2A10; --crit: #F0847C; --crit-soft: #40191A;
  color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #071A1B; --surface: #0E2A2B; --sunk: #0A2223; --line: #1F4243;
  --ink: #E8F2F0; --ink2: #A8C0BD; --ink3: #7C9794;
  --accent: #5CC7BC; --accent-ink: #052324; --accent-soft: #12393A; --gold: #F8B73C;
  --ok: #63C795; --ok-soft: #143325; --warn: #E7A851; --warn-soft: #3A2A10; --crit: #F0847C; --crit-soft: #40191A;
  color-scheme: dark }

* { box-sizing: border-box }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--body); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; margin: 0; text-wrap: balance; letter-spacing: .01em }
h1 { font-size: 1.7rem; line-height: 1.15 } h2 { font-size: 1.2rem } h3 { font-size: 1rem }
p { margin: 0 }
button, input, select, textarea { font: inherit; color: inherit }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }

.shell { display: grid; grid-template-columns: 208px minmax(0, 1fr); min-height: 100vh }
.rail { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh }
.brand { font: 600 1.05rem var(--display); letter-spacing: .06em; text-transform: uppercase; padding: 4px 10px 16px; display: flex; gap: 8px; align-items: center }
.brand img { flex: none; border-radius: 8px }
.brand span { display: flex; flex-direction: column; line-height: 1.05; text-transform: none; letter-spacing: 0; font-size: 1.12rem }
.brand small { font: 600 .62rem var(--mono); letter-spacing: .3em; text-transform: uppercase; color: var(--accent); margin-top: 3px }
.themebtn { margin-top: auto }
.stage[aria-current="step"] b { color: var(--gold) !important; opacity: 1 !important }
.nav { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; color: var(--ink2); font-weight: 500 }
.nav:hover { background: var(--sunk) }
.nav[aria-current="page"] { background: var(--accent-soft); color: var(--accent) }
.nav svg { width: 20px; height: 20px; flex: none }
.main { padding-block: 24px 96px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); min-width: 0 }
.col { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px }

@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr) }
  .rail { position: fixed; inset: auto 0 0 0; height: auto; flex-direction: row; justify-content: space-around; border-right: 0; border-top: 1px solid var(--line); z-index: 20;
    padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)) }
  .brand { display: none }
  .themebtn { display: none }
  .nav { flex-direction: column; gap: 2px; font-size: .68rem; padding: 6px 4px; flex: 1; align-items: center; min-width: 0 }
  .nav span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100% }
  .main { padding-block: 16px 110px }
}

.head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap }
.head > div { min-width: 0 }
.sub { color: var(--ink2); font-size: .9rem }
.eyebrow { font: 500 .72rem var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink3) }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center }
.grow { flex: 1; min-width: 0 }
.stack { display: flex; flex-direction: column; gap: 10px }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 13px; cursor: pointer; font-weight: 500; min-height: 38px; white-space: nowrap }
.btn:hover { border-color: var(--ink3) }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink) }
.btn.ghost { border-color: transparent; background: none; color: var(--accent); padding-inline: 6px }
.btn.danger { color: var(--crit) }
.btn.sm { min-height: 30px; padding: 4px 9px; font-size: .85rem }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; min-width: 0 }
.card.tap { cursor: pointer; text-align: left; width: 100%; display: block }
.card.tap:hover { border-color: var(--accent) }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden }
.item { padding: 12px 16px; border-top: 1px solid var(--line); min-width: 0 }
.item:first-child { border-top: 0 }
.empty { border: 1px dashed var(--line); border-radius: var(--r); padding: 22px; color: var(--ink2); text-align: center }

.pill { display: inline-flex; align-items: center; gap: 4px; font: 500 .72rem var(--mono); padding: 2px 8px; border-radius: 99px; background: var(--sunk); color: var(--ink2); white-space: nowrap }
.pill.ok { background: var(--ok-soft); color: var(--ok) } .pill.warn { background: var(--warn-soft); color: var(--warn) } .pill.crit { background: var(--crit-soft); color: var(--crit) } .pill.acc { background: var(--accent-soft); color: var(--accent) }
.ref { font: .78rem var(--mono); color: var(--ink2) }

/* draught-mark progress: ticks like the marks on a stem */
.marks { height: 8px; border-radius: 2px; background: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 10%), var(--sunk); position: relative; overflow: hidden }
.marks i { position: absolute; inset: 0 auto 0 0; background: var(--accent); opacity: .85 }

.fld { display: flex; flex-direction: column; gap: 4px; min-width: 0 }
.fld > span { font-size: .78rem; font-weight: 500; color: var(--ink2) }
input[type=text], input[type=number], input[type=date], input[type=time], input[type=email], select, textarea {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; min-height: 38px; min-width: 0 }
/* iOS Safari gives date and time fields an intrinsic width that ignores width:100% */
input[type=date], input[type=time] { -webkit-appearance: none; appearance: none; display: block; max-width: 100%; min-width: 0; text-align: left; line-height: 1.3 }
input[type=date]::-webkit-date-and-time-value, input[type=time]::-webkit-date-and-time-value { text-align: left; margin: 0 }
input[type=date]::-webkit-calendar-picker-indicator { opacity: .6 }
.fld, .grid2 > * { max-width: 100% }
textarea { min-height: 70px; resize: vertical; line-height: 1.45 }
input[type=color] { width: 46px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface) }
.chk { display: flex; gap: 10px; align-items: flex-start; cursor: pointer }
.chk input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--accent) }

.stages { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin }
.stage { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 13px; cursor: pointer; font-weight: 500; color: var(--ink2); display: flex; gap: 7px; align-items: center }
.stage b { font: 500 .72rem var(--mono); color: var(--ink3) }
.stage[aria-current="step"] { background: var(--ink); color: var(--bg); border-color: var(--ink) }
.stage[aria-current="step"] b { color: var(--bg); opacity: .7 }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface) }
.seg button { border: 0; background: none; padding: 7px 13px; cursor: pointer; font-weight: 500; border-left: 1px solid var(--line); min-height: 36px }
.seg button:first-child { border-left: 0 }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink) }
.seg button.y[aria-pressed="true"] { background: var(--ok); color: var(--surface) }
.seg button.n[aria-pressed="true"] { background: var(--crit); color: var(--surface) }

.q { display: flex; flex-direction: column; gap: 10px }
.q .num { font: 500 .78rem var(--mono); color: var(--ink3) }
.q .txt { font-weight: 500; max-width: 68ch }
.guide { background: var(--sunk); border-radius: 8px; padding: 10px 12px; font-size: .9rem; color: var(--ink2); max-width: 70ch }
.finding { border: 1px solid var(--warn); background: var(--warn-soft); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 10px }
.finding .fld > span { color: var(--ink) }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap }
.thumb { position: relative; width: 92px; height: 72px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); background: var(--sunk) }
.thumb img { width: 100%; height: 100%; object-fit: cover }
.thumb button { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--ink); color: var(--bg); cursor: pointer; line-height: 1 }
.sechead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 8px; border-bottom: 2px solid var(--ink); padding-bottom: 4px }

.stats { display: flex; gap: 18px; flex-wrap: wrap }
.stat b { display: block; font: 600 1.5rem var(--display); font-variant-numeric: tabular-nums }
.stat span { font-size: .78rem; color: var(--ink2) }

.tablewrap { overflow-x: auto }
table { border-collapse: collapse; width: 100%; font-size: .9rem }
th { text-align: left; font: 500 .72rem var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--ink3); padding: 6px 8px; border-bottom: 1px solid var(--line) }
td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap }

.paper { background: #FFFFFF; color: #16222C; border: 1px solid var(--line); border-radius: 4px; padding: 26px; font-size: .88rem; overflow-x: auto }
.paper h1 { font-size: 1.4rem; color: #16222C } .paper h2 { font-size: 1rem; margin-top: 18px; padding-bottom: 3px; border-bottom: 2px solid var(--rc, #095B5C); color: #16222C }
.paper td, .paper th { border-color: #D9E0E6; color: #16222C } .paper th { color: #5C6E7B }
.paper .muted { color: #5C6E7B } .paper img { max-width: 240px; display: block; margin: 6px 0; border-radius: 3px }
.paper p { margin: 5px 0; max-width: 75ch }

.sheet { position: fixed; inset: 0; background: rgba(8, 20, 30, .55); z-index: 40; display: flex; align-items: flex-end; justify-content: center; padding: 0 }
.sheet > div { background: var(--bg); width: min(640px, 100%); max-height: 92%; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 20px max(16px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 14px }
@media (min-width: 761px) { .sheet { align-items: center } .sheet > div { border-radius: 16px } }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 99px; z-index: 60; font-weight: 500; max-width: 90%; text-align: center }
.note { font-size: .85rem; color: var(--ink2); background: var(--accent-soft); border-radius: 8px; padding: 10px 12px }
.timer { font: 600 1.8rem var(--mono); font-variant-numeric: tabular-nums }
@media (prefers-reduced-motion: no-preference) { .marks i { transition: width .3s } }

.edsec { align-items: center }
.secname { font: 600 1.2rem var(--display) !important; border: 1px solid transparent !important; background: transparent !important; padding: 2px 6px !important; min-height: 34px !important; flex: 1; min-width: 0 }
.secname:hover, .secname:focus { border-color: var(--line) !important; background: var(--surface) !important }
.eqrow { align-items: flex-start; flex-wrap: nowrap }
.eqrow .ref { padding-top: 2px; min-width: 2.4em }
.btn:disabled { opacity: .35; cursor: default }
.eqrow .pill { white-space: normal }
.btn { max-width: 100% }
@media (max-width: 760px) { .edsec { flex-wrap: wrap } .secname { flex-basis: 100% } }
