:root {
  --forest: #10231C;
  --forest-2: #1C3A2F;
  --amber: #F2A900;
  --cream: #F3F1EC;
  --white: #FFFFFF;
  --ink: #101F1E;
  --slate: #535E5D;
  --muted: #6B7574;
  --sage: #AFC4BF;
  --sage-2: #E2E8E5;
  --sage-3: #EEF2F0;
  --critical: #9B2C1F;
  --critical-bg: #FBEDEA;
  --warning-ink: #6B4A00;
  --warning-bg: #FFF4D6;
  --good-bg: #E2EDE7;
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--cream); color: var(--ink); }
body { font-family: "DM Sans", "Segoe UI", system-ui, sans-serif; font-size: 16px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--forest); }
h1, h2, h3 { margin: 0; font-weight: 500; }
p { margin: 0; }

.app { max-width: 480px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; background: var(--cream); }

/* Header */
.top { position: sticky; top: 0; z-index: 5; background: var(--forest); color: #ECF3EF; padding: calc(12px + var(--safe-t)) 16px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 2px; font-family: "Sora", "DM Sans", sans-serif; font-weight: 800; font-size: 21px; letter-spacing: -0.02em; line-height: 1; }
.brand svg { width: 23px; height: 23px; margin-top: 1px; }
.install { background: var(--amber); color: var(--forest); border: 0; border-radius: 8px; padding: 8px 14px; font-weight: 500; min-height: 40px; cursor: pointer; }

.sample-banner { background: var(--warning-bg); color: var(--warning-ink); font-size: 13px; padding: 8px 16px; text-align: center; }

main { flex: 1; padding: 16px 16px calc(96px + var(--safe-b)); display: flex; flex-direction: column; gap: 12px; outline: none; }

/* Bottom tabs */
.tabs { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; z-index: 6; background: var(--white); border-top: 1px solid var(--sage); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding-bottom: var(--safe-b); }
.tabs button { position: relative; background: none; border: 0; padding: 8px 2px 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px; color: var(--slate); min-height: 56px; cursor: pointer; }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.tabs button[aria-current="page"] { color: var(--forest); font-weight: 700; }
.tabs button[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--amber); }
.tabs .dot { position: absolute; top: 8px; right: calc(50% - 16px); width: 9px; height: 9px; border-radius: 50%; background: var(--critical); border: 2px solid var(--white); }

/* Cards */
.card { background: var(--white); border: 1px solid var(--sage); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card.dark { background: var(--forest); border-color: var(--forest); color: #ECF3EF; }
.eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--slate); }
.dark .eyebrow { color: #B9C8C0; }
.title { font-size: 22px; font-weight: 300; letter-spacing: -0.01em; line-height: 1.2; }
.sub { font-size: 14px; color: var(--slate); }
.dark .sub { color: #B9C8C0; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { background: var(--white); border: 1px solid var(--sage); border-radius: 14px; padding: 12px; }
.tile .k { font-size: 12.5px; color: var(--slate); }
.tile .v { font-size: 21px; font-weight: 500; margin-top: 2px; letter-spacing: -0.01em; }
.tile .s { font-size: 12.5px; color: var(--slate); margin-top: 2px; }

/* Gauge */
.gauge { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.gauge svg { display: block; width: 210px; height: 175px; }
.gauge .what { font-size: 13.5px; color: var(--slate); }

/* Rate chip & block bar */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 500; background: var(--sage-3); color: var(--forest); }
.chip.amber { background: var(--warning-bg); color: var(--warning-ink); }
.chip.red { background: var(--critical-bg); color: var(--critical); }
.chip.good { background: var(--good-bg); color: var(--forest); }
.bar { position: relative; height: 12px; border-radius: 999px; background: var(--sage-2); overflow: hidden; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--forest); }
.bar > i.warn { background: var(--amber); }
.bar-legend { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--slate); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--forest); background: var(--forest); color: #FFFFFF; font-weight: 500; cursor: pointer; text-decoration: none; }
.btn.amber { background: var(--amber); border-color: var(--amber); color: var(--forest); }
.btn.ghost { background: transparent; color: var(--forest); }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: default; }
.link-btn { background: none; border: 0; padding: 6px 0; color: var(--forest); text-decoration: underline; cursor: pointer; font-size: 14px; }

/* Chart */
.chart { display: flex; align-items: flex-end; gap: 8px; height: 170px; padding-top: 8px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart .barv { width: 100%; max-width: 34px; border-radius: 4px 4px 0 0; background: var(--sage); border: 0; padding: 0; cursor: pointer; }
.chart .barv.today { background: var(--forest); }
.chart .barv[aria-pressed="true"] { outline: 2px solid var(--amber); outline-offset: 2px; }
.chart .lbl { font-size: 11.5px; color: var(--slate); }
.chart-read { min-height: 22px; font-size: 14px; }

/* Lists */
.list { display: flex; flex-direction: column; }
.item { padding: 12px 0; border-top: 1px solid var(--sage-2); display: flex; flex-direction: column; gap: 4px; }
.item:first-child { border-top: 0; padding-top: 2px; }
.item h3 { font-size: 16px; font-weight: 500; }
.item .meta { font-size: 13px; color: var(--slate); }
.sev { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; }
.sev svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sev.info { color: var(--forest); }
.sev.warning { color: var(--warning-ink); }
.sev.critical { color: var(--critical); }
.empty { font-size: 14px; color: var(--slate); padding: 4px 0; }

/* Questionnaire */
.q { display: flex; flex-direction: column; gap: 10px; }
.q legend { font-size: 19px; font-weight: 500; padding: 0; margin-bottom: 4px; }
.q fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--sage); border-radius: 12px; background: var(--white); cursor: pointer; min-height: 48px; }
.opt input { margin: 3px 0 0; width: 18px; height: 18px; accent-color: var(--forest); flex: none; }
.opt .t { font-weight: 500; }
.opt .h { font-size: 13px; color: var(--slate); }
.opt:has(input:checked) { border-color: var(--forest); box-shadow: inset 0 0 0 1px var(--forest); }
.steps { display: flex; gap: 6px; }
.steps i { flex: 1; height: 4px; border-radius: 4px; background: var(--sage-2); }
.steps i.on { background: var(--forest); }
.help { font-size: 13.5px; color: var(--slate); background: var(--sage-3); border-radius: 10px; padding: 10px 12px; }

/* Rate table */
table.rates { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.rates th, table.rates td { text-align: left; padding: 8px 0; border-top: 1px solid var(--sage-2); }
table.rates th { font-weight: 400; color: var(--slate); }
table.rates td { text-align: right; font-weight: 500; }
table.rates tr.mine th, table.rates tr.mine td { color: var(--forest); font-weight: 700; }

/* Accordion */
details.pol { border-top: 1px solid var(--sage-2); }
details.pol:first-of-type { border-top: 0; }
details.pol summary { list-style: none; cursor: pointer; padding: 14px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; font-weight: 500; min-height: 48px; }
details.pol summary::-webkit-details-marker { display: none; }
details.pol summary::after { content: "+"; font-size: 22px; font-weight: 300; color: var(--slate); }
details.pol[open] summary::after { content: "\2212"; }
details.pol .body { padding: 0 0 14px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; color: #333; }
details.pol .src { font-size: 12.5px; color: var(--muted); }

/* Forms */
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; }
.input { height: 48px; padding: 0 12px; border: 1px solid #C2CEC8; border-radius: 8px; background: var(--white); font-size: 16px; width: 100%; }

/* Sheet */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(16, 35, 28, 0.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet-card { width: 100%; max-width: 480px; background: var(--white); border-radius: 20px 20px 0 0; padding: 20px 16px calc(20px + var(--safe-b)); display: flex; flex-direction: column; gap: 12px; max-height: 85vh; overflow: auto; }

.updated { font-size: 12.5px; color: var(--muted); }
.spacer { height: 4px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (min-width: 520px) {
  .app { border-left: 1px solid var(--sage-2); border-right: 1px solid var(--sage-2); }
}
