:root {
  --bg: #f4f1ec;
  --surface: #ffffff;
  --text: #1f2a28;
  --muted: #66716e;
  --accent: #2f6f62;
  --accent-ink: #ffffff;
  --accent-soft: #e2efe9;
  --border: #e3ddd4;
  --danger: #a33a2c;
  --bubble: #ffffff;
  --bubble-new: #fff8e6;
  --shadow: 0 1px 2px rgba(31, 42, 40, .06), 0 4px 16px rgba(31, 42, 40, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141917; --surface: #1d2422; --text: #e8ece9; --muted: #9aa6a2;
    --accent: #6fb7a4; --accent-ink: #0f1513; --accent-soft: #23332e; --border: #2c3532;
    --danger: #e0806f; --bubble: #1d2422; --bubble-new: #2b2a1f; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141917; --surface: #1d2422; --text: #e8ece9; --muted: #9aa6a2;
  --accent: #6fb7a4; --accent-ink: #0f1513; --accent-soft: #23332e; --border: #2c3532;
  --danger: #e0806f; --bubble: #1d2422; --bubble-new: #2b2a1f; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
.app { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
.screen[hidden] { display: none; }
h1 { font-size: 28px; line-height: 1.2; margin: 12px 0 8px; }
h2 { font-size: 18px; margin: 0; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.lead { font-size: 17px; margin: 0; }
.fineprint { font-size: 13px; color: var(--muted); margin: 12px 4px; }

.hero { padding: 24px 4px 16px; }
.hero-icon { border-radius: 18px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px; margin: 12px 0; box-shadow: var(--shadow);
}
.card p { margin: 0 0 12px; }
.card p:last-child { margin-bottom: 0; }
.notice { background: var(--accent-soft); border-color: transparent; }

.form label { display: block; font-weight: 600; font-size: 14px; margin: 4px 0 6px; }
.form input {
  width: 100%; font: inherit; font-size: 18px; padding: 12px 14px; margin-bottom: 14px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg); color: var(--text);
}
.form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.error { color: var(--danger); font-size: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 48px; padding: 12px 16px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--danger); background: transparent; margin-top: 8px; }
.btn.small { width: auto; min-height: 40px; padding: 8px 14px; font-size: 15px; }
.btn:disabled { opacity: .6; cursor: default; }

.topbar { display: flex; align-items: center; gap: 12px; padding: 4px 0 8px; }
.topbar > div { flex: 1; }
.topbar p { margin: 0; }
.day-count { font-size: 30px; font-weight: 700; line-height: 1.1; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer;
}

.section-title { margin: 20px 4px 8px; font-size: 15px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.bubble {
  background: var(--bubble); border: 1px solid var(--border); border-radius: 16px 16px 16px 4px;
  padding: 12px 14px; box-shadow: var(--shadow);
}
.bubble.new { background: var(--bubble-new); }
.bubble .meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 8px; }
.bubble .meta .tag { color: var(--accent); font-weight: 600; }
.bubble .text p { margin: 0 0 8px; }
.bubble .text p:last-child { margin-bottom: 0; }
.bubble .text ul { margin: 4px 0 8px; padding-left: 20px; }

.survey { border: 2px solid var(--accent); }
.survey h3 { margin: 0 0 6px; font-size: 17px; }
.survey .row { display: flex; gap: 8px; flex-wrap: wrap; }
.survey .row .btn { flex: 1 1 160px; }
.survey.done { border-color: var(--border); opacity: .75; }

.contact-bar {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; font-size: 14px;
}
.contact-links { display: flex; gap: 8px; }

.lab-field { margin-bottom: 14px; }
.lab-field label { margin-bottom: 4px; }
.lab-input { display: flex; align-items: center; gap: 8px; }
.lab-input input { margin-bottom: 0; flex: 1; }
.lab-input .unit { min-width: 64px; font-size: 14px; color: var(--muted); }
.lab-field .hint { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.form input.invalid { outline: 2px solid var(--danger); }
.lab-group { font-size: 15px; margin: 18px 0 10px; padding-top: 12px; border-top: 1px solid var(--border); color: var(--accent); }
.lab-group:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.lab-field .aka { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
