/* IAN visual system (spec §5): OCH navy and green, Montserrat headings, Open Sans
   body, IBM Plex Mono for codes. One light look on purpose: it is read outdoors. */
:root {
  --navy: #002A4E; --navy-2: #0B3C66; --green: #055A49; --green-soft: #E3F1EC;
  --paper: #F7F6F2; --card: #FFFFFF; --ink: #0F1B2A; --muted: #5B6470; --line: #D6D9DD;
  --amber: #8A5200; --amber-soft: #FFF3D6; --red: #B7301F; --red-soft: #FDEBE8;
  --sys-fire: #C8102E; --sys-water: #1B7F3B; --sys-gas: #E8B400; --sys-electrical: #002A4E; --sys-other: #6B7280;
  --font-head: Montserrat, "Segoe UI", Arial, sans-serif;
  --font-body: "Open Sans", "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", Consolas, "Courier New", monospace;
  --tap: 48px; --radius: 10px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 16px/1.5 var(--font-body); -webkit-text-size-adjust: 100%; }
h1, h2, h3 { font-family: var(--font-head); color: var(--navy); margin: 0; }
a { color: var(--green); }
code, .mono { font-family: var(--font-mono); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--navy); color: #fff; }
.mark { font: 700 1.05rem var(--font-head); letter-spacing: .1em; display: inline-flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; }
.mark i { width: 8px; height: 22px; background: var(--green); display: inline-block; border-radius: 2px; box-shadow: 0 0 0 2px rgba(255,255,255,.15); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 0 18px;
  border: 0; border-radius: 8px; background: var(--green); color: #fff; font: 600 1rem var(--font-body); cursor: pointer; text-decoration: none; }
.btn:disabled { opacity: .6; cursor: default; }
.btn.ghost { background: transparent; color: var(--green); border: 1px solid var(--green); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.field { width: 100%; min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font: 1rem var(--font-body); background: #fff; color: var(--ink); }
.field:focus-visible, .btn:focus-visible, .linkish:focus-visible, a:focus-visible { outline: 3px solid #7FB8A9; outline-offset: 1px; }
.linkish { background: none; border: 0; padding: 0; color: var(--green); font: inherit; text-decoration: underline; cursor: pointer; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; }
/* Plan 3: dialogs (sign-out question, answer sheet) and the destructive button. */
dialog { border: 0; border-radius: var(--radius); padding: 20px; width: min(94vw, 560px); max-height: 92vh; overflow: auto;
  color: var(--ink); background: var(--card); box-shadow: 0 12px 40px rgba(0, 20, 40, .3); }
dialog::backdrop { background: rgba(0, 20, 40, .55); }
/* I2: the sign-out question hides the page completely - nothing a redraw puts behind it is readable.
   #F7F6F2 is --paper written out: ::backdrop doesn't inherit custom properties in older Safari/Chrome. */
dialog.ask::backdrop { background: #F7F6F2; }
dialog.ask p { margin: 0 0 18px; font-size: 1.05rem; }
.ask-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.btn.danger { background: var(--red); }
.fresh.red, .status.red { color: var(--red); }

/* Plan 3: the answer sheet (both layouts). A fixed header and status line with the form scrolling
   between them; full screen on a phone, with 48-56px targets for gloved hands. */
dialog.sheet { width: min(94vw, 640px); padding: 0; overflow: hidden; }
dialog.sheet[open] { display: flex; flex-direction: column; }
@media (max-width: 600px) {
  dialog.sheet { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
}
.sheet-head { flex: none; display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 12px 12px 12px 16px; background: var(--navy); color: #fff; }
.sheet-title { min-width: 0; }
.sheet-head h2 { color: #fff; font-size: 1.1rem; overflow-wrap: anywhere; }
.sheet-head p { margin: 2px 0 0; color: #C9D6E3; font-size: .9rem; }
.btn.sheet-close { flex: none; min-height: 44px; border-color: rgba(255, 255, 255, .6); color: #fff; }
.sheet-body { flex: 1 1 auto; overflow-y: auto; padding: 16px; -webkit-overflow-scrolling: touch; }
.sheet-kicker { font: 700 .72rem var(--font-head); letter-spacing: .12em; text-transform: uppercase; color: #4A5260; }
.sheet-now { margin: 0 0 12px; padding: 12px 14px; border: 1px solid #C9C3B6; border-left: 6px solid var(--green); border-radius: var(--radius);
  background: linear-gradient(180deg, #FDFCF9, #EFEBE2); }
.sheet-now .val { display: block; margin: 4px 0 0; font-weight: 600; font-size: 1.08rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.sheet-now code.val { font-family: var(--font-mono); font-size: 1.15rem; letter-spacing: .04em; }
.sheet-now.state-unknown { border-left-color: var(--line); }
.sheet-now.state-unknown .val { color: var(--muted); font-weight: 400; font-style: italic; }
.sheet-now .fresh { margin: 6px 0 0; font-size: .8rem; font-weight: 600; }
.sheet-now .fresh.green { color: var(--green); }
.sheet-now .fresh.amber { color: var(--amber); }
.sheet-now .fresh.grey { color: var(--muted); }
.sheet-prompt, .sheet-hint { margin: 0 0 12px; color: var(--muted); font-size: .92rem; }
.sheet-hint.needed { color: var(--amber); font-weight: 600; }
.sheet-thanks { margin: 4px 0 8px; font: 600 1.05rem var(--font-head); color: var(--navy); }
.sheet-choices { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 6px; }
.sheet-choices .btn { flex: 1 1 180px; min-height: 56px; font-size: 1.05rem; }
.sheet-states { border: 0; padding: 0; margin: 0 0 14px; display: grid; gap: 8px; }
.sheet-states legend { font: 700 .95rem var(--font-head); color: var(--navy); margin-bottom: 8px; padding: 0; }
.radio { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; cursor: pointer; }
.radio input { width: 22px; height: 22px; margin: 0; accent-color: var(--green); flex: none; }
.radio:has(input:checked) { border-color: var(--green); background: var(--green-soft); font-weight: 600; }
.sheet-field { display: grid; gap: 6px; margin: 0 0 14px; font-weight: 600; font-size: .95rem; }
.sheet-field textarea.field { resize: vertical; line-height: 1.4; }
.sheet-photos { display: grid; gap: 10px; justify-items: start; margin: 4px 0 0; }
.sheet-photos .btn { min-height: var(--tap); }
.photo-list { display: flex; flex-wrap: wrap; gap: 12px; }
.thumb { margin: 0; display: grid; gap: 2px; justify-items: center; }
.thumb img { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.thumb .linkish { min-height: 44px; padding: 0 8px; }
.status { flex: none; margin: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
  background: var(--card); font-weight: 600; }
/* Empty but still rendered (Task 10 review M5): a live region that only appears with its text isn't
   announced by every screen reader, so it collapses to nothing instead of leaving the page. */
.status:empty { padding: 0; border-top: 0; }
.status.green { color: var(--green); }
.status.amber { color: var(--amber); background: var(--amber-soft); }
.status.grey { color: var(--muted); }
.status.red { background: var(--red-soft); }

/* Plan 3: My reports and review (both layouts). */
.reports h1 { font-size: 1.3rem; margin-bottom: 4px; }
.report-block { margin: 0 0 20px; }
.report-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 10px; }
.report, .review-group { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.report p { margin: 2px 0; }
.report-where { font-weight: 600; color: var(--navy); overflow-wrap: anywhere; }
.report-what, .report-note, .review-note { white-space: pre-wrap; overflow-wrap: anywhere; }
.report-actions, .review-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
/* The sheet's status line is a footer; in a list it is a tinted line inside the card. */
.report .status, .review .status { margin: 6px 0 0; padding: 6px 10px; border-top: 0; border-radius: 6px; background: transparent;
  white-space: pre-wrap; overflow-wrap: anywhere; }
.report .status:empty, .review .status:empty { padding: 0; margin: 0; }
.report .status.amber, .review .status.amber { background: var(--amber-soft); }
.report .status.red, .review .status.red { background: var(--red-soft); }
.review { display: grid; gap: 12px; }
.review-group.emergency { border-left: 6px solid var(--sys-fire); }
.review-head h3 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 1.05rem; }
.review-head p { margin: 2px 0; }
.emergency-pill { background: var(--red-soft); color: var(--red); }
.review-body { display: grid; gap: 10px; margin-top: 8px; }
.review-now, .review-proposed { background: var(--paper); border-radius: 8px; padding: 10px 12px; }
.review-now .val, .review-proposed .val { margin: 2px 0; font-weight: 600; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-now .fresh { margin: 2px 0 0; }
.review-report { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; display: grid; gap: 6px; }
.review-report p { margin: 0; }
.photo-open { padding: 0; border: 0; background: none; cursor: zoom-in; line-height: 0; }
.photo-open.big { flex-basis: 100%; cursor: zoom-out; }
.review-photo { width: 120px; height: 120px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.photo-open.big .review-photo { width: 100%; height: auto; max-height: 80vh; object-fit: contain; }
.review-edit { display: grid; gap: 8px; }
.review-edit label { display: grid; gap: 4px; font-weight: 600; }

/* Plan 3b: My approvals and the Overdue list, both layouts. */
.approvals-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 0; }
.approvals-form .field { flex: 1 1 14rem; }
.approvals .status { margin: 6px 0 0; padding: 6px 10px; border-top: 0; border-radius: 6px; background: transparent; }
.approvals .status:empty { padding: 0; margin: 0; }
.approvals .status.red { background: var(--red-soft); }
.overdue-list { list-style: none; margin: 0; padding: 0; }
.overdue-item { padding: 8px 0; border-top: 1px solid var(--line); }
.overdue-item .report-where, .overdue-item .muted { margin: 0; }
.overdue-item.emergency .report-where { color: var(--red); }
