:root {
  color-scheme: light;
  --bg: #eef5f2;
  --surface: #fff;
  --text: #19312c;
  --muted: #6d807b;
  --primary: #16735f;
  --primary-soft: #dff1eb;
  --border: #dbe7e3;
  --danger: #b13f47;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { width: min(100%, 520px); min-height: 100vh; margin: auto; background: #f8fbfa; padding-bottom: 86px; }
.app-header { display: flex; align-items: center; justify-content: space-between; padding: 26px 20px 14px; }
.eyebrow { color: var(--muted); margin: 0 0 4px; font-size: 13px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 25px; }
.app-header h1, .section-title h2, .dialog-head h2 { font-weight: 600; }
.icon-button { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-size: 21px; }
.page { display: none; padding: 0 16px 20px; }
.page.active { display: block; }
.hero-card { background: var(--primary); color: #fff; border-radius: 22px; padding: 20px; display: flex; gap: 14px; justify-content: space-between; align-items: center; }
.hero-card p { margin-bottom: 8px; opacity: .8; }
.hero-card h2 { font-size: 20px; margin-bottom: 6px; }
.hero-card span { font-size: 13px; opacity: .82; }
.section-title { margin: 22px 2px 11px; display: flex; align-items: center; justify-content: space-between; }
.section-title h2 { font-size: 18px; margin: 0; }
.section-title > span { color: var(--muted); font-size: 13px; }
.primary-button { border: 0; border-radius: 13px; background: #fff; color: var(--primary); min-height: 44px; padding: 10px 15px; font-weight: 600; }
.primary-button:disabled { opacity: .45; cursor: default; }
.primary-button.compact, dialog .primary-button { background: var(--primary); color: #fff; }
.full { width: 100%; }
.text-button { border: 0; background: transparent; color: var(--primary); min-height: 40px; }
.overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.overview-card { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 18px; padding: 15px; text-align: left; }
.overview-card span, .overview-card small { display: block; color: var(--muted); }
.overview-card strong { display: block; font-size: 24px; margin: 9px 0 6px; }
.list { display: grid; gap: 10px; }
.list-item { background: var(--surface); border: 1px solid var(--border); border-radius: 17px; padding: 15px; display: flex; align-items: center; gap: 12px; }
.list-main { flex: 1; min-width: 0; }
.list-main strong { display: block; margin-bottom: 5px; }
.list-main small { display: block; color: var(--muted); line-height: 1.45; }
.status-button { border: 0; border-radius: 12px; padding: 9px 11px; min-height: 40px; background: var(--primary-soft); color: var(--primary); }
.status-button.done { background: #edf1f0; color: var(--muted); }
.medicine-todo.done { opacity: .68; }
.medicine-todo.done .list-main strong { text-decoration: line-through; }
.todo-check { width: 42px; height: 42px; flex: 0 0 42px; border: 2px solid var(--border); background: var(--surface); color: transparent; border-radius: 50%; font-size: 20px; }
.medicine-todo.done .todo-check { border-color: var(--primary); background: var(--primary); color: #fff; }
.todo-time { min-width: 48px; color: var(--primary); font-weight: 600; font-variant-numeric: tabular-nums; }
.daily-record-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.daily-record-card { min-height: 112px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 18px; padding: 14px; text-align: left; display: flex; flex-direction: column; justify-content: space-between; }
.daily-record-card .record-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.daily-record-card .record-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--primary-soft); color: var(--primary); }
.daily-record-card strong { font-size: 19px; font-weight: 600; }
.daily-record-card small { color: var(--muted); }
.daily-record-card.recorded { border-color: #a8d4c7; }
.daily-record-card.recorded small { color: var(--primary); }
.empty { padding: 24px 12px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--border); border-radius: 17px; }
.safety-note { margin-top: 18px; color: var(--muted); background: #fff8e8; padding: 14px; border-radius: 15px; font-size: 13px; line-height: 1.6; }
.search-input { width: 100%; min-height: 46px; border: 1px solid var(--border); background: var(--surface); border-radius: 14px; padding: 0 14px; margin-bottom: 12px; font-size: 16px; }
.metric-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; }
.metric-tab { flex: 0 0 auto; border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 18px; padding: 8px 12px; }
.metric-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: 19px; padding: 16px; margin-bottom: 12px; }
.chart-summary { display: flex; gap: 30px; }
.chart-summary span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.chart-summary strong { font-size: 20px; }
#trendChart { width: 100%; height: auto; margin-top: 14px; }
.bottom-nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 520px); display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border-top: 1px solid var(--border); padding: 8px 8px max(8px, env(safe-area-inset-bottom)); }
.nav-item { border: 0; background: transparent; color: var(--muted); min-height: 55px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.nav-item span { font-size: 20px; }
.nav-item.active { color: var(--primary); }
dialog { width: min(calc(100% - 28px), 460px); border: 0; border-radius: 22px; padding: 0; color: var(--text); }
dialog::backdrop { background: rgba(13, 29, 25, .48); }
dialog form { padding: 20px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.dialog-head h2 { margin: 0; font-size: 20px; }
.field { margin-bottom: 13px; }
.field label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; min-height: 46px; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: #fff; color: var(--text); font-size: 16px; }
.field textarea { min-height: 80px; resize: vertical; }
.form-error { min-height: 20px; color: var(--danger); font-size: 13px; }
.upload-zone { display: block; border: 1px dashed var(--primary); background: var(--primary-soft); border-radius: 15px; padding: 18px; text-align: center; color: var(--primary); margin-bottom: 14px; }
.upload-zone input { width: 100%; margin-top: 10px; color: var(--text); }
.report-status { display: inline-block; margin-top: 7px; padding: 4px 8px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); font-size: 12px; }
.report-status.pending { background: #fff3d9; color: #8a5b12; }
.report-status.failed { background: #fde8ea; color: var(--danger); }
.weekday-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.weekday-option { position: relative; }
.weekday-option input { position: absolute; opacity: 0; pointer-events: none; }
.weekday-option span { min-height: 42px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 11px; background: #fff; color: var(--muted); }
.weekday-option input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.medicine-time-group { margin-bottom: 15px; }
.medicine-time-heading { display: flex; align-items: center; gap: 10px; margin: 4px 3px 8px; }
.medicine-time-heading strong { font-size: 18px; color: var(--primary); }
.medicine-time-heading span { color: var(--muted); font-size: 13px; }
.medicine-entry { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 14px; }
.medicine-entry:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.medicine-entry-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.medicine-entry-head strong { font-size: 15px; }
.remove-medicine-row { border: 0; background: transparent; color: var(--danger); min-height: 36px; padding: 4px 8px; }
.add-medicine-row { width: 100%; min-height: 46px; margin: 4px 0 10px; border: 1px dashed var(--primary); border-radius: 13px; background: var(--primary-soft); color: var(--primary); }
@media (max-width: 360px) { .overview-grid { grid-template-columns: 1fr; } .daily-record-grid { grid-template-columns: 1fr; } .hero-card { align-items: flex-start; flex-direction: column; } .weekday-grid { grid-template-columns: repeat(4, 1fr); } }
