/* HOME by EYASTRA — app styles.
   Mobile first. The design keeps the EYASTRA identity (deep teal, warm paper, brass, a letter-spaced
   wordmark) and drops what made the original hard to use: dense dark panels, tiny grey text and
   low-contrast controls. Light by default, dark when the device asks for it.
   All colours are tokens; contrast for text pairs is checked in tests/contrast.test.js. */

:root {
  --paper: #f7f7f3;
  --card: #ffffff;
  --sunk: #eef1ec;
  --ink: #172e36;
  --muted: #4b6165;
  --line: #d3dcda;
  --line-strong: #7b8d8a;
  --deep: #102a33;
  --deep-2: #1a3d48;
  --on-deep: #f3efe6;
  --on-deep-muted: #b9cac7;
  --brass: #c9a46d;
  --brass-ink: #765a33;
  --ok: #1d5a52;
  --ok-bg: #e2eeea;
  --emergency: #9b2f27;
  --defect: #7c5410;
  --snag: #3f5f69;
  --emergency-bg: #f6e6e3;
  --defect-bg: #f4ecd9;
  --snag-bg: #e3ecee;
  --focus: #0b5fa5;
  --shadow: 0 1px 2px rgba(16, 42, 51, .06), 0 8px 24px rgba(16, 42, 51, .06);
  --radius: 12px;
  --radius-sm: 8px;
  --font: var(--ey-font);
  --action: var(--deep); --on-action: var(--on-deep); --action-hover: var(--deep-2);
  --hero: var(--deep); --hero-hover: var(--deep-2); --icon: var(--deep); --on-ok: var(--on-deep);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0d1b20; --card: #142830; --sunk: #102128; --ink: #edf1ed; --muted: #a9bcb8;
    --line: #2b4149; --line-strong: #5f7f88; --deep: #081318; --deep-2: #163640;
    --on-deep: #f3efe6; --on-deep-muted: #a9bcb8;
    --brass: #d8b77f; --brass-ink: #d8b77f;
    --ok: #7fc7b8; --ok-bg: #163a36; --emergency: #ff9a90; --defect: #e8c06a; --snag: #9ec6d2;
    --emergency-bg: #3a1c1a; --defect-bg: #382d14; --snag-bg: #152f38;
    --focus: #7fb9ee; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --action: #d8b77f; --on-action: #081318; --action-hover: #e6c994;
    --hero: #1c4753; --hero-hover: #245866; --icon: #d8b77f; --on-ok: #081318;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html { overflow-x: hidden; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.5 var(--font); -webkit-font-smoothing: antialiased;
  min-height: 100vh; min-height: 100dvh; overflow-x: hidden;
  overflow-wrap: break-word;
}
h1, h2, h3 { font-weight: 600; letter-spacing: -.02em; line-height: 1.2; margin: 0; color: var(--ink); overflow-wrap: anywhere; }
h1 { font-size: clamp(28px, 7vw, 38px); letter-spacing: -.035em; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
p { margin: 0 0 .75em; }
a { color: var(--ink); text-decoration-color: var(--brass); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--deep); color: var(--on-deep); padding: 12px 16px; border-radius: 8px; z-index: 100; }
.skip:focus { top: 8px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--brass-ink); }

main { max-width: 680px; margin: 0 auto; padding: 20px 16px 120px; }
main:focus { outline: none; }
.wide { max-width: 1040px; }
.page-title { margin: 8px 0 6px; }
.lede { font-size: 17px; color: var(--muted); max-width: 46ch; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 4px; margin-left: -4px; color: var(--muted); background: none; border: 0; cursor: pointer; text-decoration: none; font-size: 15px; }
.back:hover { color: var(--ink); }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 20px; border-radius: 10px; border: 1.5px solid var(--action);
  background: var(--card); color: var(--ink); font-weight: 600; font-size: 16px; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--sunk); }
.btn.primary { background: var(--action); color: var(--on-action); }
.btn.primary:hover { background: var(--action-hover); }
.btn.brass { background: var(--brass); border-color: var(--brass); color: #172e36; }
.btn.brass:hover { filter: brightness(1.05); }
.btn.quiet { border-color: var(--line-strong); font-weight: 500; }
.btn.danger { border-color: var(--emergency); color: var(--emergency); }
.btn.danger-quiet { border-color: transparent; background: transparent; color: var(--emergency); font-weight: 600; }
.btn.danger-quiet:hover { background: var(--emergency-bg); }
.btn.block { display: flex; width: 100%; }
.btn.small { min-height: 44px; padding: 0 14px; font-size: 15px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 8px 0; min-height: 44px; color: var(--ink); text-decoration: underline; text-decoration-color: var(--brass); text-underline-offset: 4px; cursor: pointer; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.callout { border-left: 4px solid var(--brass); background: var(--sunk); padding: 12px 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.callout.warn { border-color: var(--defect); background: var(--defect-bg); }
.callout.danger { border-color: var(--emergency); background: var(--emergency-bg); }

/* form fields */
.field { display: block; margin: 0 0 16px; }
.field > .label, .field > label, legend.label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 15px; }
.hint { color: var(--muted); font-size: 14px; margin-top: 4px; }
input[type=text], input[type=search], select, textarea {
  width: 100%; min-height: 50px; padding: 10px 12px; border: 1.5px solid var(--line-strong); border-radius: 10px; background: var(--card); color: var(--ink);
}
textarea { min-height: 96px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #66797c; }
fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.field.step-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field.step-row > .label { margin: 0; }
.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--line-strong); border-radius: 10px; background: var(--card); }
.stepper button { width: 52px; height: 50px; border: 0; background: none; font-size: 22px; cursor: pointer; }
.stepper output { min-width: 40px; text-align: center; font-weight: 600; font-size: 18px; }

/* choice cards (radio / checkbox) */
.choices { display: grid; gap: 10px; }
.choice { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1.5px solid var(--line-strong); border-radius: 12px; background: var(--card); cursor: pointer; min-height: 56px; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice .box { flex: none; width: 24px; height: 24px; border: 2px solid var(--line-strong); border-radius: 50%; margin-top: 1px; display: grid; place-items: center; }
.choice.check .box { border-radius: 6px; }
.choice input:checked ~ .box { background: var(--action); border-color: var(--action); }
.choice input:checked ~ .box::after { content: ""; width: 11px; height: 6px; border-left: 2.5px solid var(--on-action); border-bottom: 2.5px solid var(--on-action); transform: rotate(-45deg) translate(1px, -1px); }
.choice:has(input:checked) { border-color: var(--action); background: var(--sunk); box-shadow: inset 0 0 0 1px var(--action); }
.choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice b { display: block; font-weight: 600; }
.choice small { display: block; color: var(--muted); font-size: 14px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg .choice { padding: 10px 16px; min-height: 48px; flex: 1 1 auto; align-items: center; justify-content: center; text-align: center; }
.seg .choice .box { display: none; }
.seg .choice:has(input:checked) { background: var(--action); color: var(--on-action); }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 700; letter-spacing: .02em; border: 1.5px solid currentColor; line-height: 1.5; white-space: nowrap; }
.pill.emergency { color: var(--emergency); background: var(--emergency-bg); }
.pill.defect { color: var(--defect); background: var(--defect-bg); }
.pill.snag { color: var(--snag); background: var(--snag-bg); }
.pill.ok { color: var(--ok); background: var(--ok-bg); }
.pill.plain { color: var(--muted); background: transparent; }

/* ---------- progress ---------- */
.meter { height: 6px; background: var(--line); border-radius: 6px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--brass); border-radius: 6px; transition: width .3s ease; }

/* ---------- welcome ---------- */
.welcome h1 { margin: 20px 0 12px; }
.promise { display: grid; gap: 14px; margin: 26px 0; }
.promise > div { display: flex; gap: 14px; align-items: flex-start; }
.promise .n { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--action); color: var(--on-action); display: grid; place-items: center; font-weight: 700; font-size: 14px; }

/* ---------- setup wizard ---------- */
.steps { display: flex; gap: 6px; margin: 4px 0 20px; }
.steps i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.steps i.on { background: var(--brass); }
.wizard-nav { display: flex; gap: 10px; margin-top: 22px; }
.wizard-nav .btn { flex: 1; }

/* ---------- home overview ---------- */
.home-head { margin: 4px 0 16px; }
.home-head .sub { color: var(--muted); }
.continue { display: block; width: 100%; text-align: left; padding: 18px; border-radius: var(--radius); background: var(--hero); color: var(--on-deep); border: 0; cursor: pointer; text-decoration: none; }
.continue:hover { background: var(--hero-hover); }
.continue small { color: var(--on-deep-muted); display: block; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; }
.continue strong { display: flex; align-items: center; justify-content: space-between; font-size: 22px; letter-spacing: -.02em; margin-top: 4px; gap: 12px; }
.tally { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.tally .pill { font-size: 13.5px; }
.rooms { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.rooms li + li { border-top: 1px solid var(--line); }
.rooms a { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 60px; text-decoration: none; color: var(--ink); }
.rooms a:hover { background: var(--sunk); }
.rooms .dot { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; color: var(--on-ok); }
.rooms .dot.done { background: var(--ok); border-color: var(--ok); }
.rooms .dot.partial { border-color: var(--brass); background: conic-gradient(var(--brass) var(--p, 0%), transparent 0); }
.rooms .name { flex: 1; min-width: 0; }
.rooms .name b { display: block; font-weight: 600; }
.rooms .name small { color: var(--muted); font-size: 13.5px; }
.rooms .chev { color: var(--muted); }
.section-title { margin: 28px 0 10px; }
.tools { display: grid; gap: 10px; }
.tool { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); text-decoration: none; color: var(--ink); min-height: 64px; }
.tool:hover { background: var(--sunk); }
.tool .ico { flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--sunk); display: grid; place-items: center; color: var(--icon); }
.tool b { display: block; }
.tool small { color: var(--muted); }

/* ---------- walk ---------- */
.walk-head { margin: 4px 0 14px; }
.walk-head .eyebrow { display: block; margin-bottom: 4px; }
.intro { color: var(--muted); }
.check { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; box-shadow: var(--shadow); }
.check h3 { margin-bottom: 6px; }
.check .ask { margin: 0 0 10px; font-size: 16.5px; }
.check.done { padding: 0; box-shadow: none; }
.check.done .summary { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 56px; }
.check.done .summary .tick { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--ok); color: var(--on-ok); display: grid; place-items: center; }
.check.done .summary .tick.na { background: var(--line-strong); }
.check.done .summary .tick.later { background: var(--brass); color: #172e36; }
.check.done .summary .txt { flex: 1; min-width: 0; }
.check.done .summary .txt b { font-weight: 600; }
.check.done .summary .txt span { color: var(--muted); font-size: 14px; display: block; }
.check.has-issue { border-color: var(--defect); border-left-width: 5px; }
details.look { margin: 0 0 12px; border-left: 3px solid var(--brass); background: var(--sunk); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
details.look summary { cursor: pointer; padding: 12px 14px; font-weight: 600; min-height: 48px; list-style: none; display: flex; align-items: center; gap: 8px; }
details.look summary::-webkit-details-marker { display: none; }
details.look summary::after { content: "+"; margin-left: auto; font-size: 20px; color: var(--brass-ink); }
details.look[open] summary::after { content: "\2212"; }
details.look .body { padding: 0 14px 14px; color: var(--ink); font-size: 15.5px; }
details.look .caution { margin-top: 10px; padding: 10px 12px; background: var(--defect-bg); border-radius: 8px; color: var(--ink); font-size: 15px; }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.answers .btn { flex-direction: column; gap: 4px; min-height: 72px; padding: 10px 12px; font-size: 16px; text-align: center; line-height: 1.2; }
.answers .btn.fine { border-color: var(--ok); color: var(--ok); }
.answers .btn.wrong { border-color: var(--defect); color: var(--defect); }
.answers .btn.na-btn { grid-column: 1 / -1; min-height: 48px; flex-direction: row; border-color: var(--line-strong); color: var(--muted); font-weight: 500; }
.answers .btn:hover { background: var(--sunk); }
.finding-list { margin-top: 12px; display: grid; gap: 8px; }
.finding { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); width: 100%; text-align: left; cursor: pointer; min-height: 60px; }
.finding:hover { background: var(--sunk); }
.finding .t { flex: 1; min-width: 0; }
.finding .t b { display: block; font-weight: 600; }
.finding .t span { color: var(--muted); font-size: 14px; }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.thumb { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; background: var(--sunk); border: 1px solid var(--line); display: block; }
.thumb.big { width: 100%; height: auto; max-height: 60vh; object-fit: contain; }
.thumb-wrap { position: relative; }
.thumb-wrap .x { position: absolute; top: -6px; right: -6px; width: 30px; height: 30px; border-radius: 50%; background: var(--hero); color: var(--on-deep); border: 2px solid var(--card); cursor: pointer; display: grid; place-items: center; padding: 0; }
.walknav { position: fixed; left: 0; right: 0; bottom: 0; background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); z-index: 15; }
.walknav-inner { max-width: 680px; margin: 0 auto; display: flex; gap: 10px; }
.walknav .btn { flex: 1; }
.walknav .btn.icon { flex: none; width: 56px; padding: 0; }
.note-area textarea { min-height: 84px; }

/* ---------- sheet (dialog) ---------- */
dialog.sheet { border: 0; padding: 0; background: var(--paper); color: var(--ink); width: 100%; max-width: 100%; max-height: 94vh; max-height: 94dvh; margin: auto 0 0; border-radius: 18px 18px 0 0; box-shadow: 0 -12px 40px rgba(0, 0, 0, .25); overflow: hidden; }
dialog.sheet::backdrop { background: rgba(8, 19, 24, .55); }
@media (min-width: 720px) { dialog.sheet { max-width: 620px; margin: auto; border-radius: 16px; max-height: 90vh; } }
.sheet-form { display: flex; flex-direction: column; max-height: inherit; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { flex: 1; font-size: 19px; }
.sheet-body { padding: 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; }
.sheet-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--paper); display: flex; gap: 10px; }
.sheet-foot .btn { flex: 1; }
.x-btn { width: 44px; height: 44px; border: 0; background: none; border-radius: 50%; cursor: pointer; display: grid; place-items: center; color: var(--muted); }
.x-btn:hover { background: var(--sunk); }
.preview { background: var(--sunk); border-radius: var(--radius-sm); padding: 12px 14px; }
.preview .lbl { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--brass-ink); display: block; margin-bottom: 2px; }
.preview p { margin: 0 0 8px; font-size: 15px; }
.alert-box { border: 2px solid var(--emergency); background: var(--emergency-bg); border-radius: 10px; padding: 12px 14px; margin: 12px 0; }
.alert-box b { color: var(--emergency); display: block; margin-bottom: 2px; }
.alert-box.mild { border-color: var(--defect); background: var(--defect-bg); }
.alert-box.mild b { color: var(--defect); }

/* ---------- report preview ---------- */
.rep-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0; }
.rep-summary div { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; border-top: 4px solid var(--line-strong); }
.rep-summary b { display: block; font-size: 26px; line-height: 1.1; }
.rep-summary span { font-size: 12.5px; color: var(--muted); }
.rep-summary .e { border-top-color: var(--emergency); } .rep-summary .e b { color: var(--emergency); }
.rep-summary .d { border-top-color: var(--defect); } .rep-summary .d b { color: var(--defect); }
.rep-summary .s { border-top-color: var(--snag); } .rep-summary .s b { color: var(--snag); }
.rep-group { margin-top: 22px; }
.rep-group > h3 { padding-bottom: 6px; border-bottom: 2px solid var(--brass); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: baseline; }
.rep-item { border-left: 4px solid var(--snag); padding: 4px 0 4px 14px; margin: 0 0 18px; }
.rep-item.emergency { border-color: var(--emergency); } .rep-item.defect { border-color: var(--defect); }
.rep-item h4 { margin: 2px 0 2px; font-size: 17px; }
.rep-item .lbl { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--brass-ink); display: block; margin-top: 8px; }
.rep-item p { margin: 0; }
.rep-item .meta { color: var(--muted); font-size: 13.5px; margin-top: 8px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1.5px solid var(--line-strong); }
.tbl td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }

/* ---------- toast ---------- */
#toasts { position: fixed; left: 0; right: 0; bottom: 84px; display: grid; justify-items: center; gap: 8px; pointer-events: none; z-index: 60; padding: 0 16px; }
.toast { pointer-events: auto; background: var(--hero); color: var(--on-deep); padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 14px; max-width: 520px; }
.toast button { background: none; border: 0; color: var(--brass); font-weight: 700; cursor: pointer; min-height: 40px; padding: 0 6px; }

/* ---------- desktop ---------- */
@media (min-width: 1000px) {
  main.walk-layout { max-width: 1040px; display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 32px; align-items: start; }
  main.walk-layout .side { position: sticky; top: 76px; }
  .walknav { display: none; }
  main { padding-bottom: 60px; }
}
@media (max-width: 999px) { .side { display: none; } }
.walk-inline-nav { display: none; gap: 10px; margin-top: 20px; }
@media (min-width: 1000px) { .walk-inline-nav { display: flex; } }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ---------- print (the in-app report preview) ---------- */
@media print {
  @page { size: A4; margin: 16mm 14mm; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .ey-bar, .walknav, #toasts, .no-print, .back { display: none !important; }
  main { max-width: none; padding: 0; }
  .rep-item, .rep-group > h3 { break-inside: avoid; }
  .thumb { break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- ecosystem pass (2026-09-23) ---------- */
.card.before { margin: 14px 0 0; background: var(--sunk); box-shadow: none; }
.card.before h2 { font-size: 17px; margin: 0 0 8px; }
.card.before ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 15.5px; }
.done-banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); background: var(--ok-bg); border: 1.5px solid var(--ok); }
.done-banner .tick { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--ok); color: var(--on-ok); display: grid; place-items: center; }
.done-banner b { display: block; color: var(--ok); }
.done-banner small { display: block; color: var(--ink); font-size: 14.5px; margin-top: 2px; }
.thumb-btn { display: block; padding: 0; border: 0; background: none; border-radius: 8px; cursor: pointer; }
.thumb-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
