:root {
  --bg: #f3f7f6;
  --card: #ffffff;
  --ink: #183b3a;
  --muted: #536d6a;
  --line: #dfe9e7;
  --primary: #238979;
  --primary-dark: #176c61;
  --mint: #dff4ee;
  --coral: #fff0ea;
  --coral-ink: #c46b50;
  --shadow: 0 10px 28px rgba(42, 85, 79, 0.08);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: #dbe9e6;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: linear-gradient(135deg, #d7ebe6, #edf4f2); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  padding: max(18px, env(safe-area-inset-top)) 18px calc(102px + env(safe-area-inset-bottom));
  box-shadow: 0 0 60px rgba(31, 78, 71, .12);
}

.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.eyebrow { margin: 0 0 4px; color: var(--primary); font-size: 14px; font-weight: 700; letter-spacing: .05em; }
h1 { font-size: 27px; margin: 0; letter-spacing: -.03em; }
h2 { font-size: 19px; margin: 0; }
p { color: var(--muted); }
.icon-button { border: 0; background: var(--card); width: 42px; height: 42px; border-radius: 15px; color: var(--ink); box-shadow: var(--shadow); }

.page { display: none; animation: page-in .22s ease-out; }
.page.active { display: block; }
@keyframes page-in { from { opacity: 0; transform: translateY(5px); } }
.guide-entry {
  width: 100%; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  margin-bottom: 14px; padding: 16px; border: 0; border-radius: 20px; text-align: left;
  background: linear-gradient(135deg, #247f71, #34a08a); color: white; box-shadow: 0 10px 25px rgba(31,128,112,.24);
}
.guide-entry-icon { padding: 8px 9px; border-radius: 12px; background: rgba(255,255,255,.16); font-size: 12px; font-weight: 750; }
.guide-entry strong, .guide-entry small { display: block; }
.guide-entry strong { font-size: 18px; }
.guide-entry small { margin-top: 4px; color: rgba(255,255,255,.8); font-size: 13px; }
.guide-entry b { font-size: 28px; }

.date-card, .progress-card, .form-card, .range-card, .chart-card, .summary-hero {
  background: var(--card); border: 1px solid rgba(217,230,227,.8); border-radius: 22px; box-shadow: var(--shadow);
}
.date-card { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; padding: 8px; }
.date-step { border: 0; background: var(--bg); border-radius: 14px; height: 42px; font-size: 28px; color: var(--primary); }
.date-main { text-align: center; cursor: pointer; }
.date-main span { display: block; font-weight: 750; font-size: 17px; }
.date-main input { border: 0; color: var(--muted); background: transparent; text-align: center; font-size: 15px; padding: 3px; }

.progress-card { margin: 14px 0; padding: 16px; }
.progress-copy { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.progress-copy strong { font-size: 17px; }
.progress-copy p { font-size: 14px; margin: 4px 0 0; }
.progress-copy > span { color: var(--primary); font-weight: 800; }
.progress-track { height: 7px; background: #e9f0ee; border-radius: 9px; overflow: hidden; margin-top: 13px; }
.progress-track span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, #42aa97, #1f806f); border-radius: inherit; transition: width .25s; }
.bp-quick-fill { margin-top: 15px; padding-top: 14px; border-top: 1px solid var(--line); }
.bp-quick-heading { display: flex; align-items: end; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.bp-quick-heading strong { font-size: 16px; }
.bp-quick-heading small { color: var(--muted); font-size: 12px; }
.bp-quick-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bp-quick-button { border: 2px solid #bcd8d2; border-radius: 14px; padding: 10px 4px; background: #f5fbf9; color: var(--primary-dark); }
.bp-quick-button span, .bp-quick-button small { display: block; }
.bp-quick-button span { font-size: 17px; font-weight: 850; }
.bp-quick-button small { margin-top: 3px; font-size: 12px; }
.bp-quick-button.done { border-color: #d9e4e1; background: #eef3f2; color: var(--muted); }
.bp-quick-button.next { border-color: var(--primary); background: var(--mint); box-shadow: 0 4px 12px rgba(35,137,121,.14); }
.photo-ocr-entry { width: 100%; display: block; margin-top: 10px; border: 2px solid var(--primary); border-radius: 15px; padding: 11px 8px; background: var(--mint); color: var(--primary-dark); text-align: center; }
.photo-ocr-entry strong, .photo-ocr-entry small { display: block; }
.photo-ocr-entry strong { font-size: 17px; }
.photo-ocr-entry small { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.ocr-dialog { width: min(calc(100% - 24px), 500px); }
.ocr-card { max-height: 92vh; overflow-y: auto; border-radius: 24px; padding: 20px; background: #f5f9f8; }
.ocr-camera-guide { display: grid; place-items: center; min-height: 210px; padding: 24px; border: 3px dashed #8ebfb5; border-radius: 20px; background: white; text-align: center; }
.ocr-camera-guide strong { font-size: 22px; }
.ocr-camera-guide p { margin-bottom: 0; font-size: 15px; }
.ocr-main-button { width: 100%; margin-top: 14px; border: 0; border-radius: 15px; padding: 15px; background: var(--primary); color: white; font-size: 18px; font-weight: 850; }
.ocr-processing { min-height: 260px; place-items: center; align-content: center; text-align: center; }
.ocr-processing:not([hidden]) { display: grid; }
.ocr-spinner { width: 52px; height: 52px; border: 6px solid #d5e6e2; border-top-color: var(--primary); border-radius: 50%; animation: ocr-spin .8s linear infinite; }
@keyframes ocr-spin { to { transform: rotate(360deg); } }
.ocr-preview { display: block; width: 100%; max-height: 210px; border-radius: 16px; background: #dde7e5; object-fit: contain; }
.ocr-warning { padding: 10px; border-radius: 11px; background: #fff5d9; color: #7a5a00; text-align: center; font-weight: 750; }
.ocr-review-fields { display: grid; gap: 10px; }
.ocr-review-fields label { color: var(--muted); font-size: 15px; font-weight: 800; }
.ocr-review-fields input { width: 100%; margin-top: 6px; border: 2px solid #bcd5d0; border-radius: 14px; padding: 14px 10px; background: white; color: var(--ink); text-align: center; font-size: 28px; font-weight: 850; }
.ocr-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 9px; margin-top: 14px; }
.ocr-actions button { border: 0; border-radius: 15px; padding: 14px 8px; background: #e4eeec; color: var(--ink); font-size: 16px; font-weight: 850; }
.ocr-actions .ocr-main-button { margin: 0; background: var(--primary); color: white; }

.form-card { padding: 18px; margin-bottom: 14px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 17px; }
.section-heading > div { display: flex; align-items: center; gap: 11px; }
.section-heading p { font-size: 14px; margin: 3px 0 0; }
.section-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 13px; font-weight: 800; }
.section-icon.mint { color: var(--primary); background: var(--mint); }
.section-icon.coral { color: var(--coral-ink); background: var(--coral); }

.field-grid { display: grid; gap: 12px; }
.field-grid.two { grid-template-columns: 1fr 1fr; }
.field.full { grid-column: 1 / -1; }
.drain-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px;
  border: 1.5px solid #d4e3e0;
  border-radius: 14px;
  background: #f7fbfa;
}
.drain-result div span { display: block; color: var(--muted); font-size: 13px; font-weight: 650; }
.drain-result strong { display: block; margin-top: 3px; font-size: 20px; }
.drain-result em { padding: 7px 10px; border-radius: 10px; background: #e8f1ef; color: var(--muted); font-size: 13px; font-style: normal; font-weight: 700; text-align: center; }
.drain-result.good { border-color: #8bc9b7; background: #eef9f5; }
.drain-result.good strong, .drain-result.good em { color: #14705e; }
.drain-result.good em { background: #d9f2e9; }
.drain-result.bad { border-color: #e6a69b; background: #fff5f2; }
.drain-result.bad strong, .drain-result.bad em { color: #af4938; }
.drain-result.bad em { background: #ffe2dc; }
.signed-input { display: grid; gap: 8px; }
.sign-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.sign-picker button { border: 1.5px solid #cbdad7; border-radius: 11px; padding: 9px; background: white; color: var(--muted); font-weight: 700; }
.sign-picker button.active { border-color: var(--primary); background: var(--mint); color: var(--primary-dark); }
.sign-picker button[data-sign="-1"].active { border-color: #d77b68; background: #fff0ea; color: #a74434; }
.field span, .range-fields label { display: block; font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.field small { color: var(--muted); font-weight: 500; }
.field input, .field textarea, .range-fields input, .search-box input {
  width: 100%; border: 1.5px solid #cbdad7; border-radius: 13px; background: #fbfdfc; padding: 13px; color: var(--ink); outline: none; font-size: 17px;
}
.field input:focus, .field textarea:focus, .range-fields input:focus { border-color: #65ad9f; box-shadow: 0 0 0 3px rgba(48,144,126,.1); }
.field textarea { resize: vertical; min-height: 86px; }
.notes-field { display: block; background: var(--card); padding: 18px; border-radius: 22px; box-shadow: var(--shadow); }

.time-row { padding: 15px 0; border-top: 1px solid #edf2f1; }
.time-row:first-child { border-top: 0; padding-top: 0; }
.time-row:last-child { padding-bottom: 0; }
.time-label { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 750; margin-bottom: 13px; }
.time-label span { color: var(--primary-dark); background: var(--mint); border-radius: 10px; font-size: 14px; padding: 6px 9px; }
.vitals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; }
.vitals label { min-width: 0; font-size: 14px; font-weight: 650; color: var(--muted); }
.vitals input { min-width: 0; max-width: 100%; padding: 13px 7px; text-align: center; margin-top: 7px; font-size: 18px; font-weight: 650; }

.save-area { margin: 18px 0 8px; text-align: center; }
.primary-button, .secondary-button { width: 100%; border: 0; border-radius: 16px; padding: 16px; font-size: 16px; font-weight: 750; }
.primary-button { color: white; background: linear-gradient(135deg, #299583, #1d776a); box-shadow: 0 9px 20px rgba(31,128,112,.25); }
.secondary-button { color: var(--primary); background: var(--mint); }
.stats-actions { display: grid; gap: 10px; margin-top: 14px; }
#save-hint { font-size: 11px; margin: 10px 0; }

.bottom-nav {
  position: fixed; z-index: 10; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 520px);
  display: grid; grid-template-columns: repeat(3,1fr); padding: 10px 20px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.94); backdrop-filter: blur(16px); border-top: 1px solid var(--line);
}
.nav-item { border: 0; background: transparent; color: #8a9b99; display: grid; place-items: center; gap: 3px; font-size: 11px; }
.nav-icon { width: 32px; height: 28px; display: grid; place-items: center; border-radius: 11px; font-size: 20px; }
.nav-item.active { color: var(--primary); font-weight: 750; }
.nav-item.active .nav-icon { background: var(--mint); }

.summary-hero { padding: 22px; background: linear-gradient(145deg, #247f71, #319985); color: white; margin-bottom: 14px; }
.summary-hero p, .summary-hero > span { color: rgba(255,255,255,.78); margin: 0; font-size: 12px; }
.summary-hero strong { display: block; font-size: 31px; margin: 6px 0; }
.search-box { display: flex; align-items: center; gap: 8px; background: white; padding: 5px 12px; border-radius: 16px; box-shadow: var(--shadow); }
.search-box input { border: 0; background: white; }
.history-list { display: grid; gap: 10px; margin-top: 14px; }
.history-item { border: 1px solid var(--line); background: white; border-radius: 18px; padding: 15px; display: flex; justify-content: space-between; align-items: center; text-align: left; }
.history-date strong { display: block; font-size: 15px; }
.history-date span { color: var(--muted); font-size: 12px; }
.history-metrics { display: flex; gap: 12px; color: var(--ink); font-size: 12px; }
.history-metrics span { text-align: right; }
.history-metrics small { display: block; color: var(--muted); margin-bottom: 2px; }

.range-card { padding: 18px; }
.range-title { display: flex; align-items: center; justify-content: space-between; }
.range-title p { margin: 3px 0 0; font-size: 12px; }
.text-button { border: 0; background: var(--mint); color: var(--primary); padding: 8px 10px; border-radius: 10px; font-size: 12px; font-weight: 700; }
.range-fields { display: grid; grid-template-columns: 1fr 22px 1fr; align-items: end; gap: 7px; margin-top: 15px; }
.range-fields > span { text-align: center; padding-bottom: 13px; color: var(--muted); font-size: 12px; }
.range-fields input { padding: 10px 7px; font-size: 12px; }
.empty-state { text-align: center; padding: 72px 28px; }
.empty-illustration { width: 75px; height: 75px; border-radius: 28px; background: var(--mint); color: var(--primary); display: grid; place-items: center; margin: auto; font-size: 38px; transform: rotate(-8deg); }
.empty-state h2 { margin-top: 20px; }
.empty-state p { font-size: 13px; line-height: 1.7; }
.metric-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.metric-card { background: white; border-radius: 18px; padding: 15px; box-shadow: var(--shadow); }
.metric-card p { margin: 0; font-size: 11px; }
.metric-card strong { display: block; font-size: 22px; margin: 5px 0 2px; }
.metric-card span { font-size: 11px; color: var(--primary); }
.chart-card { padding: 18px; margin-top: 14px; }
.chart-heading { display: flex; justify-content: space-between; align-items: start; }
.chart-heading p { margin: 4px 0; font-size: 11px; }
.charts-heading { margin: 20px 3px 0; }
.charts-heading p { margin: 5px 0 0; font-size: 13px; line-height: 1.5; }
.trend-charts { display: grid; gap: 14px; min-width: 0; }
.trend-charts .chart-card { min-width: 0; max-width: 100%; }
.legend-group { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.legend-dot { font-size: 12px; color: var(--muted); white-space: nowrap; }
.legend-dot::before { content: ""; display: inline-block; width: 8px; height: 8px; background: var(--legend-color, var(--primary)); border-radius: 50%; margin-right: 5px; }
.chart-scroll { width: 100%; min-width: 0; overflow-x: auto; overflow-y: hidden; padding: 2px 0 4px; scrollbar-width: thin; }
.chart { height: 230px; min-width: 100%; margin-top: 8px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart-date-range { display: flex; justify-content: space-between; gap: 12px; margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 650; }
.chart-empty { display: grid; place-items: center; height: 150px; color: var(--muted); font-size: 14px; }

dialog { border: 0; padding: 0; background: transparent; width: min(calc(100% - 32px), 470px); }
dialog::backdrop { background: rgba(17,49,46,.48); backdrop-filter: blur(3px); }
.guide-dialog { width: min(100vw, 520px); max-width: none; height: 100vh; max-height: none; margin: 0 auto; }
.guide-dialog::backdrop { background: rgba(17,49,46,.7); }
.guide-window { min-height: 100%; display: flex; flex-direction: column; background: #f4f8f7; color: var(--ink); }
.guide-topbar { display: flex; justify-content: space-between; align-items: center; padding: max(18px, env(safe-area-inset-top)) 20px 14px; background: white; border-bottom: 1px solid var(--line); }
.guide-topbar > div { flex: 1; }
.guide-topbar span { font-size: 15px; font-weight: 750; }
.guide-progress { height: 8px; margin-top: 9px; border-radius: 8px; overflow: hidden; background: #e6eeec; }
.guide-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--primary); transition: width .25s; }
.guide-topbar button { margin-left: 18px; width: 44px; height: 44px; border: 0; border-radius: 15px; background: var(--bg); font-size: 27px; color: var(--ink); }
.guide-main { flex: 1; display: flex; flex-direction: column; justify-content: center; overflow-y: auto; padding: 28px 22px; }
#guide-question-wrap { width: 100%; text-align: center; }
.guide-time-control { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 9px; max-width: 390px; margin: 0 auto 18px; text-align: left; }
.guide-time-control[hidden] { display: none; }
.guide-time-control label { color: var(--muted); font-size: 14px; font-weight: 750; }
.guide-time-control input { display: block; width: 100%; margin-top: 6px; border: 2px solid #bcd5d0; border-radius: 13px; padding: 10px 12px; background: white; color: var(--ink); font-size: 22px; font-weight: 800; }
.guide-time-control button { border: 0; border-radius: 13px; padding: 12px 10px; background: var(--mint); color: var(--primary-dark); font-size: 14px; font-weight: 800; }
.time-label input { border: 0; border-radius: 10px; padding: 5px 7px; background: var(--mint); color: var(--primary-dark); font-size: 14px; font-weight: 800; }
#guide-question { font-size: clamp(28px, 7vw, 38px); line-height: 1.28; }
#guide-help { margin: 12px auto 24px; font-size: 17px; line-height: 1.6; }
.guide-input-wrap { width: 100%; max-width: 390px; margin: 0 auto; }
.guide-big-input { width: 100%; border: 3px solid #abcfc7; border-radius: 22px; padding: 20px 16px; background: white; color: var(--ink); text-align: center; font-size: 42px; font-weight: 800; outline: none; }
.guide-big-input:focus { border-color: var(--primary); box-shadow: 0 0 0 5px rgba(35,137,121,.12); }
.guide-unit { display: block; margin-top: 10px; color: var(--muted); font-size: 18px; font-weight: 700; }
.guide-sign-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.guide-sign-picker button { border: 2px solid #c6d8d4; border-radius: 16px; padding: 14px; background: white; color: var(--muted); font-size: 17px; font-weight: 800; }
.guide-sign-picker button.active { border-color: var(--primary); background: var(--mint); color: var(--primary-dark); }
.guide-sign-picker button[data-sign="-1"].active { border-color: #d77b68; background: #fff0ea; color: #a74434; }
.guide-photo-button { margin-top: 22px; border: 2px solid #bdd8d2; border-radius: 16px; padding: 13px 20px; background: white; color: var(--primary-dark); font-size: 17px; font-weight: 800; }
.guide-photo-note { margin: 10px auto 0; font-size: 13px; }
.guide-photo-preview { display: block; max-width: 100%; max-height: 190px; margin: 14px auto 0; border-radius: 14px; object-fit: contain; }
.guide-actions { display: grid; grid-template-columns: 1fr 1fr 1.5fr; gap: 9px; padding: 14px 18px calc(14px + env(safe-area-inset-bottom)); background: white; border-top: 1px solid var(--line); }
.guide-actions button { border: 0; border-radius: 16px; padding: 15px 8px; font-size: 16px; font-weight: 800; }
.guide-secondary { background: #eaf1ef; color: var(--muted); }
.guide-primary { background: var(--primary); color: white; }
.guide-review { width: 100%; }
.guide-review h2 { text-align: center; font-size: 28px; }
.guide-review > p { text-align: center; font-size: 15px; }
.review-list { display: grid; gap: 8px; margin-top: 18px; }
.review-item { display: flex; justify-content: space-between; gap: 15px; padding: 13px 14px; border-radius: 13px; background: white; border: 1px solid var(--line); font-size: 15px; }
.review-item span { color: var(--muted); }
.review-item strong { text-align: right; }
.dialog-card { background: white; border-radius: 24px; padding: 20px; }
.dialog-heading { display: flex; justify-content: space-between; margin-bottom: 12px; }
.dialog-heading p { margin: 3px 0; font-size: 12px; }
.dialog-heading button { border: 0; background: var(--bg); width: 34px; height: 34px; border-radius: 12px; font-size: 22px; }
.dialog-action { position: relative; width: 100%; text-align: left; border: 0; border-top: 1px solid var(--line); background: white; padding: 14px 3px; color: var(--ink); }
.dialog-action span, .dialog-action small { display: block; }
.dialog-action small { color: var(--muted); margin-top: 4px; }
.dialog-action.danger span { color: #bc4c4c; }
.cloud-account-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding: 14px 3px; }
.cloud-account-row span, .cloud-account-row small { display: block; }
.cloud-account-row small { margin-top: 4px; color: var(--muted); }
.cloud-account-row button { flex: none; border: 0; border-radius: 11px; padding: 10px 13px; background: var(--primary); color: white; font-weight: 800; }
.cloud-account-row button.connected { background: var(--mint); color: var(--primary-dark); }
.cloud-code-field { display: block; color: var(--muted); font-weight: 750; }
.cloud-code-field input { width: 100%; margin-top: 8px; border: 2px solid #bcd5d0; border-radius: 14px; padding: 14px; color: var(--ink); font-size: 24px; text-align: center; letter-spacing: 4px; }
.cloud-login-note { padding: 11px; border-radius: 12px; background: var(--bg); font-size: 13px; line-height: 1.6; }
.cloud-login-submit { width: 100%; border: 0; border-radius: 14px; padding: 14px; background: var(--primary); color: white; font-size: 17px; font-weight: 800; }
.cloud-login-dialog.required-login #close-cloud-login { display: none; }
.cloud-login-dialog.required-login::backdrop { background: rgba(17,49,46,.86); backdrop-filter: blur(8px); }
.font-setting { display: block; cursor: pointer; padding-right: 58px; }
.font-setting input { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); width: 42px; height: 24px; accent-color: var(--primary); }
.reminder-setting { border-top: 1px solid var(--line); padding-bottom: 13px; }
.reminder-setting .dialog-action { border-top: 0; }
.wechat-bind-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 3px 10px; }
.wechat-bind-row span, .wechat-bind-row small { display: block; }
.wechat-bind-row small { margin-top: 4px; color: var(--muted); }
.wechat-bind-row button { flex: none; border: 0; border-radius: 11px; padding: 10px 13px; background: var(--primary); color: white; font-weight: 800; }
.wechat-bind-row button.connected { background: var(--mint); color: var(--primary-dark); }
.reminder-times { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.reminder-times label { color: var(--muted); font-size: 12px; font-weight: 700; }
.reminder-times input { width: 100%; margin-top: 5px; border: 1px solid var(--line); border-radius: 10px; padding: 9px 5px; background: var(--bg); color: var(--ink); font-size: 15px; font-weight: 750; }
.reminder-test { width: 100%; margin-top: 9px; border: 0; border-radius: 11px; padding: 10px; background: var(--mint); color: var(--primary-dark); font-weight: 800; }
.bp-reminder-dialog { width: min(calc(100% - 24px), 480px); }
.bp-reminder-card { position: relative; padding: 30px 20px 22px; border-radius: 26px; background: #f5f9f8; text-align: center; }
.bp-reminder-close { position: absolute; top: 13px; right: 13px; width: 42px; height: 42px; border: 0; border-radius: 14px; background: #e7efed; color: var(--ink); font-size: 27px; }
.bp-reminder-kicker { margin: 0; color: var(--primary); font-size: 17px; font-weight: 850; }
.bp-reminder-card h2 { margin: 8px 0 22px; font-size: 34px; }
.bp-reminder-time { display: block; margin: 0 auto 14px; color: var(--muted); font-size: 14px; font-weight: 750; }
.bp-reminder-time input { display: block; width: 180px; margin: 7px auto 0; border: 2px solid #bcd5d0; border-radius: 13px; padding: 10px; background: white; color: var(--ink); font-size: 23px; font-weight: 850; text-align: center; }
.bp-reminder-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bp-reminder-fields label { color: var(--muted); font-size: 15px; font-weight: 800; }
.bp-reminder-fields input { width: 100%; margin-top: 7px; border: 2px solid #bcd5d0; border-radius: 15px; padding: 15px 5px; background: white; color: var(--ink); font-size: 27px; font-weight: 850; text-align: center; }
.bp-reminder-save, .bp-reminder-later { width: 100%; border: 0; border-radius: 16px; padding: 15px; font-size: 18px; font-weight: 850; }
.bp-reminder-save { margin-top: 18px; background: var(--primary); color: white; }
.bp-reminder-later { margin-top: 8px; background: #e7efed; color: var(--muted); }
.privacy-note { background: var(--bg); border-radius: 13px; padding: 12px; font-size: 11px; line-height: 1.6; margin-bottom: 0; }
.ios-install-tip {
  position: fixed; z-index: 18; left: 50%; bottom: calc(82px + env(safe-area-inset-bottom));
  width: min(calc(100% - 24px), 494px); transform: translateX(-50%);
  display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 10px;
  padding: 12px 40px 12px 12px; border: 1px solid rgba(35,137,121,.18); border-radius: 18px;
  background: rgba(255,255,255,.96); box-shadow: 0 16px 42px rgba(24,59,58,.18);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.ios-install-tip[hidden] { display: none; }
.ios-install-tip img { width: 46px; height: 46px; border-radius: 12px; box-shadow: 0 4px 12px rgba(24,59,58,.15); }
.ios-install-tip strong, .ios-install-tip small { display: block; }
.ios-install-tip strong { font-size: 15px; }
.ios-install-tip small { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.ios-install-tip > button:not(.ios-install-dismiss) { border: 0; border-radius: 11px; padding: 9px 11px; background: var(--primary); color: white; font-size: 12px; font-weight: 800; }
.ios-install-dismiss { position: absolute; top: 3px; right: 5px; border: 0; background: transparent; color: #829793; font-size: 22px; }
.install-app-dialog { width: min(calc(100% - 24px), 460px); }
.install-app-dialog::backdrop { background: rgba(17,49,46,.7); backdrop-filter: blur(5px); }
.install-app-card { position: relative; padding: 27px 20px 20px; border-radius: 28px; background: #f7fbfa; text-align: center; }
.install-app-close { position: absolute; top: 13px; right: 13px; width: 40px; height: 40px; border: 0; border-radius: 13px; background: #e7f0ee; color: var(--ink); font-size: 25px; }
.install-app-icon { width: 78px; height: 78px; border-radius: 20px; box-shadow: 0 9px 24px rgba(24,87,78,.2); }
.install-app-kicker { margin: 13px 0 4px; color: var(--primary); font-size: 13px; font-weight: 850; letter-spacing: .08em; }
.install-app-card h2 { font-size: 24px; }
.install-app-lead { margin: 9px auto 18px; max-width: 340px; font-size: 14px; line-height: 1.65; }
.install-steps { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; text-align: left; }
.install-steps li { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.install-steps b { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--mint); color: var(--primary-dark); font-size: 17px; }
.install-steps span { color: var(--muted); font-size: 14px; line-height: 1.55; }
.install-steps strong { color: var(--ink); }
.install-steps i { color: var(--primary); font-size: 18px; font-style: normal; font-weight: 850; }
.install-app-note { margin: 13px 0; padding: 10px; border-radius: 12px; background: #edf5f3; font-size: 12px; line-height: 1.5; }
.install-app-confirm { width: 100%; border: 0; border-radius: 15px; padding: 14px; background: var(--primary); color: white; font-size: 17px; font-weight: 850; }
.standalone-app .topbar { padding-top: 3px; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 95px; transform: translate(-50%, 20px); background: #173e39; color: white; padding: 10px 16px; border-radius: 99px; font-size: 13px; opacity: 0; pointer-events: none; transition: .2s; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
#print-sheet { display: none; }
.print-preview-dialog { width: min(96vw, 1100px); max-width: none; height: min(94vh, 820px); }
.print-preview-dialog::backdrop { background: rgba(17,49,46,.65); backdrop-filter: blur(4px); }
.preview-window { height: 100%; display: flex; flex-direction: column; overflow: hidden; background: #e3e7e6; border-radius: 20px; }
.preview-toolbar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; background: white; border-bottom: 1px solid #d5dddb; }
.preview-toolbar strong { display: block; font-size: 18px; }
.preview-toolbar span { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.preview-toolbar-actions { display: flex; align-items: center; gap: 9px; }
.preview-print-button { border: 0; border-radius: 11px; padding: 10px 20px; background: var(--primary); color: white; font-weight: 750; }
.preview-close-button { width: 39px; height: 39px; border: 0; border-radius: 11px; background: var(--bg); color: var(--ink); font-size: 24px; }
.paper-stage { flex: 1; overflow: auto; padding: 24px; }
.preview-pages { display: grid; gap: 24px; justify-content: center; }
.paper-sheet {
  width: 1120px;
  min-height: 792px;
  margin: 0 auto;
  padding: 38px;
  background: white;
  color: #111;
  box-shadow: 0 8px 30px rgba(26,48,45,.18);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 12px;
  transform-origin: top left;
}
.paper-page-number { margin-top: 12px; color: #52615f; font-size: 12px; text-align: center; }
.paper-sheet .print-title { text-align: center; margin: 0 0 14px; font-size: 25px; }
.paper-sheet .print-meta { display: flex; justify-content: space-between; margin-bottom: 12px; font-size: 13px; }
.paper-sheet .print-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.paper-sheet .print-table th, .paper-sheet .print-table td { border: 1px solid #222; padding: 8px 5px; text-align: center; word-break: break-all; }
.paper-sheet .print-table th { background: #e8f2ef; font-weight: 700; }
.paper-sheet .print-table td.notes { text-align: left; }
.paper-sheet .print-footer { margin-top: 12px; color: #444; font-size: 11px; }

body.large-font { font-size: 18px; }
body.large-font h1 { font-size: 31px; }
body.large-font h2 { font-size: 21px; }
body.large-font .field span,
body.large-font .range-fields label { font-size: 18px; }
body.large-font .field input,
body.large-font .field textarea,
body.large-font .range-fields input { font-size: 19px; }
body.large-font .vitals label { font-size: 16px; }
body.large-font .vitals input { font-size: 20px; }
body.large-font .drain-result div span,
body.large-font .drain-result em { font-size: 15px; }
body.large-font .chart-heading p,
body.large-font .legend-dot,
body.large-font .chart-date-range { font-size: 14px; }

@media (max-width: 370px) {
  .app-shell { padding-left: 12px; padding-right: 12px; }
  .field-grid.two { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
}

@media (max-width: 700px) {
  .print-preview-dialog { width: 100vw; height: 100vh; max-height: none; margin: 0; }
  .preview-window { border-radius: 0; }
  .paper-stage { padding: 14px; }
  .preview-pages { display: block; width: 560px; }
  .paper-sheet { margin-bottom: -372px; transform: scale(.5); }
  .paper-sheet:last-child { margin-bottom: 0; }
}

@media (min-width: 700px) {
  body { padding: 24px 0; }
  .app-shell { min-height: calc(100vh - 48px); border-radius: 32px; overflow: hidden; }
  .bottom-nav { bottom: 24px; border-radius: 0 0 32px 32px; }
}

@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body { background: white !important; }
  .app-shell { display: none !important; }
  #print-preview-dialog { display: none !important; }
  #print-sheet {
    display: block !important;
    color: #111;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 9pt;
  }
  #print-sheet .print-page {
    width: auto;
    min-height: 185mm;
    margin: 0;
    padding: 0;
    box-shadow: none;
    break-after: page;
    page-break-after: always;
  }
  #print-sheet .print-page:last-child {
    break-after: auto;
    page-break-after: auto;
  }
  .print-title { text-align: center; margin: 0 0 3mm; font-size: 18pt; }
  .print-meta { display: flex; justify-content: space-between; margin-bottom: 3mm; font-size: 10pt; }
  .print-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
  .print-table th, .print-table td { border: 1px solid #222; padding: 2.2mm 1.3mm; text-align: center; word-break: break-all; }
  .print-table th { background: #e8f2ef !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; font-weight: 700; }
  .print-table td.notes { text-align: left; }
  .print-footer { margin-top: 3mm; color: #444; font-size: 8pt; }
  .paper-page-number { margin-top: 2mm; font-size: 8pt; }
}
