:root {
  --bg: #f4f6f4;
  --surface: #ffffff;
  --surface-2: #eaf1ef;
  --text: #15201f;
  --muted: #5b6b69;
  --primary: #0f4c4a;
  --primary-text: #ffffff;
  --accent: #c8873a;
  --warn-bg: #fff4e5;
  --warn-text: #7a4a00;
  --danger-bg: #fde8e8;
  --danger-text: #8a1c1c;
  --ok-bg: #e5f4ec;
  --ok-text: #1d5c3a;
  --border: #d9e2e0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1514; --surface: #162120; --surface-2: #1d2b2a; --text: #e8efee; --muted: #9db0ad;
    --primary: #5fb8ad; --primary-text: #062221; --accent: #e0a35c;
    --warn-bg: #3a2a10; --warn-text: #ffd59a; --danger-bg: #3d1717; --danger-text: #ffb4b4;
    --ok-bg: #12301f; --ok-text: #9fe0b8; --border: #2a3a38; --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1514; --surface: #162120; --surface-2: #1d2b2a; --text: #e8efee; --muted: #9db0ad;
  --primary: #5fb8ad; --primary-text: #062221; --accent: #e0a35c;
  --warn-bg: #3a2a10; --warn-text: #ffd59a; --danger-bg: #3d1717; --danger-text: #ffb4b4;
  --ok-bg: #12301f; --ok-text: #9fe0b8; --border: #2a3a38; --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
.topbar {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 14px 16px 6px; max-width: 640px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; color: var(--primary); }
.brand img { align-self: center; }
.byline { font-size: 12px; color: var(--muted); }

main { max-width: 640px; margin: 0 auto; padding: 8px 16px 16px; outline: none; }
h1 { font-size: 24px; line-height: 1.2; margin: 8px 0 12px; }
h2 { font-size: 18px; margin: 0 0 8px; }
h3 { font-size: 16px; margin: 12px 0 6px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.card.hero { background: var(--primary); color: var(--primary-text); border: none; }
.card.hero .muted { color: inherit; opacity: .85; }
.big { font-size: 34px; font-weight: 750; line-height: 1.1; }

.alert { border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; font-size: 15px; }
.alert.warn { background: var(--warn-bg); color: var(--warn-text); }
.alert.danger { background: var(--danger-bg); color: var(--danger-text); }
.alert.ok { background: var(--ok-bg); color: var(--ok-text); }
.alert strong { display: block; margin-bottom: 2px; }

label { display: block; font-size: 14px; font-weight: 600; margin: 10px 0 4px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px;
}
textarea { min-height: 90px; resize: vertical; }
input[type="checkbox"] { width: auto; margin: 3px 8px 0 0; flex: none; }
.check { display: flex; align-items: flex-start; font-weight: 400; font-size: 14px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 650; border: none; border-radius: 12px; padding: 12px 16px;
  background: var(--primary); color: var(--primary-text); cursor: pointer; text-decoration: none;
  width: 100%; margin-top: 12px;
}
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn.accent { background: var(--accent); color: #1b1203; }
.btn.inline { width: auto; margin-top: 0; padding: 8px 12px; font-size: 14px; }
.btn:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: 14px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  border-radius: 999px; padding: 8px 12px; cursor: pointer;
}
.chip.active { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }

ul.tips { padding-left: 20px; margin: 6px 0 10px; }
ul.tips li { margin-bottom: 4px; }
ol.steps { padding-left: 22px; margin: 8px 0 10px; }
ol.steps li { margin-bottom: 7px; }

.progress { height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 8px 0; }
.progress > div { height: 100%; background: var(--primary); border-radius: 999px; transition: width .3s; }
.hero .progress { background: rgba(255,255,255,.25); }
.hero .progress > div { background: var(--primary-text); }

.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; justify-content: space-between; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 15px; }
.list li:last-child { border-bottom: none; }
.del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 18px; padding: 0 4px; }

.chart { width: 100%; height: 160px; display: block; }
.chart .line { fill: none; stroke: var(--primary); stroke-width: 2.5; }
.chart .dot { fill: var(--primary); }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart text { fill: var(--muted); font-size: 11px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font-size: 20px; }

.disclaimer { max-width: 640px; margin: 0 auto; padding: 0 16px 16px; font-size: 12px; color: var(--muted); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 10;
}
.tabbar button {
  flex: 1; background: none; border: none; color: var(--muted); font: inherit; font-size: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; cursor: pointer; border-radius: 10px;
}
.tabbar button span { font-size: 20px; line-height: 1; }
.tabbar button.active { color: var(--primary); font-weight: 700; }

#toast {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .25s; max-width: calc(100% - 32px); text-align: center; z-index: 20;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

