:root {
  --primary: #0d9488;
  --primary-deep: #0f766e;
  --primary-soft: #ccfbf1;
  --accent: #06b6d4;
  --bg: #f2f6f9;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --good: #15803d;
  --good-bg: #dcfce7;
  --low: #b45309;
  --low-bg: #fef3c7;
  --high: #be123c;
  --high-bg: #ffe4e6;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --unknown: #94a3b8;
  --unknown-bg: #f1f5f9;
  --info-bg: #e0f2fe;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgba(2, 32, 40, 0.05), 0 10px 28px rgba(2, 32, 40, 0.07);
  --nav-h: 66px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  background: linear-gradient(180deg, #eaf4f6 0%, var(--bg) 240px);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

#root-shell { min-height: 100dvh; }

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 14px calc(var(--nav-h) + 26px + env(safe-area-inset-bottom, 0px));
  min-height: 100dvh;
}

.screen { padding-top: calc(env(safe-area-inset-top, 0px) + 14px); }

.hidden { display: none !important; }

.muted { color: var(--muted); }
.center { text-align: center; }
.link { color: var(--primary-deep); text-decoration: none; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.pad { padding: 16px 0; }

.i { flex-shrink: 0; display: inline-block; vertical-align: -4px; }

h1, h2, h3 { margin: 0; color: var(--ink); line-height: 1.2; }
h1 { font-size: 24px; letter-spacing: -0.02em; }
h2 { font-size: 17px; }
h3 { font-size: 16px; }
p { margin: 0 0 8px; line-height: 1.5; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding-top: 4px;
}
.topbar h1 { font-size: 22px; }
.topbar p { margin: 2px 0 0; font-size: 13px; }

/* ---------- Card ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 16px;
  margin: 0 0 14px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 8px; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card.sub { box-shadow: none; background: #f8fbfc; padding: 14px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:active { transform: scale(0.985); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  border-color: transparent;
  color: #fff;
}
.btn-primary.btn-lg { width: 100%; min-height: 54px; font-size: 16px; border-radius: 18px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--primary-deep); }
.btn-icon { min-height: 44px; min-width: 44px; padding: 8px; border-radius: 14px; }
.btn-danger { color: var(--high); border-color: #fecdd3; background: #fff1f2; }
.btn-disabled { opacity: 0.55; pointer-events: none; }
.btn:disabled { opacity: 0.55; pointer-events: none; }

.actions { margin-top: 6px; display: grid; gap: 10px; padding-bottom: 6px; }
.actions-inline { margin-top: 4px; padding-bottom: 6px; }
.stack { display: grid; gap: 10px; margin-top: 10px; }

/* ---------- Chips ---------- */
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-row.wrap { flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  min-height: 42px;
}
.chip.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-deep);
}

/* ---------- Segmented ---------- */
.seg { display: flex; background: #eef3f5; border-radius: 12px; padding: 3px; gap: 3px; }
.seg-btn {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
}
.seg-btn.active { background: #fff; color: var(--primary-deep); box-shadow: 0 1px 3px rgba(2, 32, 40, 0.12); }

/* ---------- Fields / inputs ---------- */
.field { margin: 0 0 14px; }
.label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.label small { color: var(--muted); font-weight: 500; }
.field-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.field-row .label { margin-bottom: 6px; }
.prev { font-size: 11.5px; color: var(--muted); }
.input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}
.input.num { font-variant-numeric: tabular-nums; }
.input-wrap { display: flex; align-items: center; gap: 8px; }
.input-wrap .input { flex: 1; }
.unit { color: var(--muted); font-size: 14px; font-weight: 600; min-width: 32px; }
.amount-row { display: flex; gap: 8px; align-items: center; }
.amount-row .input { flex: 1; }
.amount-row .seg { flex-shrink: 0; }

.mini-help { margin-top: 8px; font-size: 13px; color: var(--primary-deep); font-weight: 600; cursor: pointer; display: inline-block; }
.mini-help span::after { content: ''; display: inline-block; width: 0; height: 0; margin-left: 5px; border: 4px solid transparent; border-top-color: var(--primary-deep); vertical-align: 2px; transition: transform 0.2s; }
.mini-help.open span::after { transform: rotate(180deg); }
.mini-body { display: none; margin-top: 8px; background: #f8fbfc; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; color: var(--ink-2); line-height: 1.5; }
.mini-body.open { display: block; }

/* ---------- Pills ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.pill-low { background: var(--low-bg); color: var(--low); }
.pill-good { background: var(--good-bg); color: var(--good); }
.pill-high { background: var(--high-bg); color: var(--high); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-unknown { background: var(--unknown-bg); color: var(--unknown); }
.pill-na { background: var(--unknown-bg); color: var(--unknown); }
.pill-info { background: var(--info-bg); color: #0369a1; }

/* ---------- Home ---------- */
.home-hero { display: flex; align-items: center; justify-content: space-between; padding: 18px 4px 6px; }
.home-hero h1 { font-size: 26px; }
.home-hero p { margin: 4px 0 0; font-size: 13.5px; }
.brand-badge {
  width: 46px; height: 46px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
}

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.quick-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-decoration: none;
  color: var(--ink);
  min-height: 118px;
  transition: transform 0.08s ease;
  -webkit-tap-highlight-color: transparent;
}
.quick-card:active { transform: scale(0.98); }
.quick-icon {
  width: 40px; height: 40px;
  border-radius: 13px;
  background: var(--primary-soft);
  color: var(--primary-deep);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
}
.quick-label { font-weight: 700; font-size: 15px; }
.quick-sub { font-size: 12px; color: var(--muted); }

.check-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: linear-gradient(135deg, #0d9488, #0891b2);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.check-card:active { transform: scale(0.985); }
.check-icon {
  width: 46px; height: 46px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.18);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.check-card b { font-size: 16px; }
.check-card small { opacity: 0.85; font-size: 12.5px; }
.check-arrow { margin-left: auto; opacity: 0.85; display: flex; }

.status-list { display: grid; gap: 2px; }
.status-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px solid #f1f5f9;
}
.status-row:last-child { border-bottom: 0; }
.sname { font-size: 15px; color: var(--ink-2); }
.sval { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sval small { font-size: 11px; color: var(--muted); font-weight: 500; }

.overall {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
}
.overall p { margin: 0; }
.overall-good { background: var(--good-bg); color: #14532d; }
.overall-warn { background: var(--warn-bg); color: #78350f; }

.foot-note { text-align: center; font-size: 12.5px; color: var(--muted); margin: 4px 0 10px; padding: 0 12px; }

/* ---------- Setup ---------- */
.setup { padding-top: calc(env(safe-area-inset-top, 0px) + 22px); }
.setup-head { text-align: center; padding: 8px 0 16px; }
.setup-head .i { color: var(--primary-deep); }
.brand { font-size: 26px; letter-spacing: -0.02em; color: var(--primary-deep); margin-top: 4px; }
.setup-dots { display: flex; justify-content: center; gap: 7px; margin-top: 14px; }
.dot { width: 8px; height: 8px; border-radius: 99px; background: #cbd5e1; transition: all 0.2s; }
.dot.on { width: 24px; background: var(--primary); }
.dot.done { background: var(--primary); opacity: 0.45; }
.setup-card { padding: 24px 18px; }
.step-head h2 { font-size: 20px; margin-bottom: 4px; }
.step-head p { font-size: 14px; }
.setup-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; }

.big-list { display: grid; gap: 8px; margin-top: 14px; }
.big-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  padding: 13px 14px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.big-item .i { margin-left: auto; color: var(--primary); opacity: 0; }
.big-item.selected { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-deep); }
.big-item.selected .i { opacity: 1; }
.big-icon {
  width: 34px; height: 34px;
  border-radius: 11px;
  background: #eef3f5;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary-deep);
  flex-shrink: 0;
}

.review-list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 10px; }
.review-list li { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--ink-2); }
.review-list .i { color: var(--primary-deep); }

.hint { font-size: 13px; color: var(--muted); margin-top: 8px; line-height: 1.45; }

/* ---------- Problems ---------- */
.issue-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.issue-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: var(--ink-2);
  cursor: pointer;
  text-align: left;
  transition: all 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.issue-icon {
  width: 34px; height: 34px;
  border-radius: 11px;
  background: #eef3f5;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary-deep);
  flex-shrink: 0;
}
.issue-chip.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-deep); }
.issue-chip.active .issue-icon { background: #fff; }
.q3 { margin-bottom: 4px; }

/* ---------- Banners / notices ---------- */
.banner { display: flex; align-items: flex-start; gap: 10px; }
.banner p { margin: 0; font-size: 14px; }
.banner.warn { background: var(--warn-bg); border-color: #fde68a; color: #78350f; }
.notice {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  background: #eef3f5;
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 8px;
}

/* ---------- Response cards ---------- */
.resp-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 16px;
}
.resp-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.src-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  padding: 4px 10px;
}
.src-tag.ai { background: linear-gradient(135deg, #ede9fe, #e0f2fe); color: #5b21b6; }
.src-tag.app { background: var(--primary-soft); color: var(--primary-deep); }
.resp-summary { font-size: 17px; line-height: 1.4; margin-bottom: 6px; }
.resp-sec { margin-top: 14px; }
.sec-title { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-2); margin: 0 0 8px; }
.sec-title.avoid { color: var(--high); }
.do-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.do-list li { display: flex; align-items: flex-start; gap: 10px; font-size: 14.5px; color: var(--ink-2); }
.do-num {
  width: 22px; height: 22px;
  border-radius: 99px;
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-size: 12px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.plain-list li { display: flex; align-items: flex-start; gap: 8px; font-size: 14.5px; color: var(--ink-2); }
.plain-list .i { color: var(--muted); margin-top: 2px; }
.avoid-list { color: #78350f; }
.avoid-list .i { color: var(--high); }
.why { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.why summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--muted);
}
.why summary::-webkit-details-marker { display: none; }
.why summary .dots { margin-left: auto; color: var(--primary); }
.dots .dim { opacity: 0.3; }
.why p { margin-top: 10px; font-size: 14px; color: var(--ink-2); line-height: 1.55; }
.calc-box { margin-top: 14px; background: #f8fbfc; border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px; }
.calc-box .sec-title { text-transform: none; letter-spacing: 0; font-size: 13px; }
.calc-row { display: flex; flex-direction: column; gap: 2px; padding: 7px 0; border-top: 1px solid #eef3f5; font-size: 14px; color: var(--ink-2); }
.calc-row b { color: var(--ink); font-size: 13.5px; }
.calc-row span { color: var(--primary-deep); font-weight: 600; }
.calc-box .hint { margin: 6px 0 0; }

.query-card { background: #eef3f5; box-shadow: none; border-color: #e4edf0; }
.q-text { font-size: 15px; color: var(--ink-2); margin: 0; font-style: italic; }
.ai-wrap { margin-bottom: 12px; }

/* ---------- Chat ---------- */
.chat-screen {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--nav-h) - env(safe-area-inset-bottom, 0px) - 16px);
  margin: 0 -14px;
  padding: 0 14px;
}
.chat-log { flex: 1; overflow-y: auto; padding: 8px 0 12px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; }
.chat-intro { text-align: center; margin-top: 10px; }
.chat-intro p { font-size: 14px; color: var(--muted); }
.suggestions { display: grid; gap: 8px; margin-top: 10px; }
.sug {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink-2);
  text-align: left;
  cursor: pointer;
  transition: all 0.12s ease;
  box-shadow: var(--shadow);
}
.sug:active { transform: scale(0.985); }
.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.msg.bot { justify-content: flex-start; }
.bubble {
  max-width: 100%;
  padding: 12px 14px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.45;
  background: #fff;
  color: var(--ink-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.msg.user .bubble { background: linear-gradient(135deg, var(--primary), var(--primary-deep)); color: #fff; border-color: transparent; }
.chat-note { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin: 8px 4px 0; }
.typing { display: flex; gap: 4px; align-items: center; padding: 14px 16px; }
.typing span { width: 7px; height: 7px; border-radius: 99px; background: var(--muted); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.chat-input { display: flex; align-items: center; gap: 8px; padding: 10px 0 calc(env(safe-area-inset-bottom, 0px) + 8px); background: transparent; }
.chat-input .input { border-radius: 24px; }
.chat-input .send { border-radius: 50%; flex-shrink: 0; background: linear-gradient(135deg, var(--primary), var(--primary-deep)); color: #fff; border: 0; }

/* ---------- History ---------- */
.timeline { padding-bottom: 8px; }
.day {
  font-size: 12.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 16px 2px 8px;
}
.tl-item { display: flex; align-items: flex-start; gap: 12px; padding: 10px 2px; }
.tl-icon {
  width: 38px; height: 38px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.tl-icon-test { background: var(--info-bg); color: #0369a1; }
.tl-icon-chemical { background: var(--primary-soft); color: var(--primary-deep); }
.tl-icon-problem { background: var(--warn-bg); color: var(--warn); }
.tl-body { flex: 1; }
.tl-body p { margin: 0 0 2px; font-size: 14.5px; }
.tl-body .muted { font-size: 12.5px; }

.chart-section { margin-top: 10px; }
.chart-section summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-2);
  padding: 10px 2px;
}
.chart-section summary::-webkit-details-marker { display: none; }
.mini-chart { margin: 12px 0 4px; }
.chart-label { font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 4px; }
.chart { width: 100%; height: auto; display: block; }
.chart-line { fill: none; stroke: var(--primary-deep); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { fill: #fff; stroke: var(--primary-deep); stroke-width: 2; }
.target-band { fill: var(--primary); opacity: 0.08; }

/* ---------- Pool tab ---------- */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.toggle-row b { font-size: 15px; }
.toggle-row p { font-size: 12.5px; margin: 3px 0 0; }
.switch { position: relative; display: inline-block; width: 50px; height: 30px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0;
  background: #cbd5e1;
  border-radius: 999px;
  transition: background 0.2s;
  cursor: pointer;
}
.switch span::after {
  content: '';
  position: absolute;
  width: 24px; height: 24px;
  border-radius: 99px;
  background: #fff;
  top: 3px; left: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s;
}
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(20px); }
.range-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid #f1f5f9;
}
.range-row:first-of-type { border-top: 0; }
.range-name b { display: block; font-size: 14.5px; }
.range-name small { color: var(--muted); font-size: 12px; }
.range-inputs { display: flex; align-items: center; gap: 6px; }
.range-inputs .input { min-height: 40px; width: 74px; padding: 6px 10px; text-align: center; font-size: 14px; }
.range-inputs span { color: var(--muted); }
.sep { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.about { background: #f8fbfc; }
.about h2 { color: var(--primary-deep); display: flex; align-items: center; gap: 8px; }
.about .btn { margin-top: 10px; }

/* ---------- Toast ---------- */
#toast { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; z-index: 60; padding: 0 16px; }
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0f172a;
  color: #fff;
  border-radius: 14px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  transform: translateY(16px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  max-width: 100%;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast-error .i { color: #fda4af; }
.toast-neutral .i { color: #5eead4; }

/* ---------- Nav ---------- */
#nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--line);
}
.nav-inner {
  max-width: 560px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px;
  border-radius: 14px;
  text-decoration: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease;
}
.nav-item .i { transition: transform 0.15s ease; }
.nav-item.active { color: var(--primary-deep); }
.nav-item.active .i { transform: translateY(-1px); }
.nav-item:active { background: #f1f5f9; }

/* ---------- misc ---------- */
::selection { background: var(--primary-soft); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
a { color: inherit; }

@media (min-width: 620px) {
  .app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); min-height: 100dvh; background: rgba(255, 255, 255, 0.4); }
  .nav-inner { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001s !important; transition-duration: 0.1s !important; }
}