/* 长辈健康 · 网页版
 * 一套 CSS 适配 360–430 dp 的安卓机，也照顾 iPhone 的刘海和底部横条；
 * 平板和大屏上居中成一条，不拉宽到难读。
 */

:root {
  --paper: #f4f6f5;
  --surface: #ffffff;
  --ink: #161b1a;
  --muted: #868f8d;
  --hairline: rgba(22, 27, 26, 0.09);
  --field: rgba(22, 27, 26, 0.045);
  --accent: #2f7a6b;
  --accent-ink: #ffffff;
  --s-ok: #2f9e6a;
  --s-high: #dd5330;
  --s-low: #3b82f6;
  --tone: var(--accent);
  --rounded: ui-rounded, "SF Pro Rounded", -apple-system, system-ui, "Noto Sans SC", sans-serif;
  --sans: -apple-system, system-ui, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0b0f0e;
    --surface: #171c1b;
    --ink: #f1f4f3;
    --muted: #8b9491;
    --hairline: rgba(241, 244, 243, 0.1);
    --field: rgba(241, 244, 243, 0.06);
    --accent: #3f9c8a;
    --s-ok: #3fb37c;
    --s-high: #ef6a45;
    --s-low: #5b9bfb;
  }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  background: var(--paper);
}

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
input, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }

/* 平板、折叠屏：还是居中的一条，字号略微放大 */
@media (min-width: 700px) {
  body { font-size: 18px; }
}

.view {
  min-height: 100dvh;
  padding: calc(10px + env(safe-area-inset-top)) 14px calc(118px + env(safe-area-inset-bottom));
  max-width: 600px;
  margin: 0 auto;
}

.stack > * + * { margin-top: 14px; }
main.view > * + * { margin-top: 14px; }

/* ---------- 顶部 ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 600px;
  margin: 0 auto;
  padding: calc(6px + env(safe-area-inset-top)) 14px 10px;
}

.seg {
  display: flex;
  flex: 1;
  padding: 3px;
  border-radius: 999px;
  background: var(--field);
}

.seg-btn {
  flex: 1;
  min-height: 40px;
  padding: 8px 0;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
}

.seg-btn.on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.gear {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 20px;
  color: var(--muted);
  background: var(--field);
}

/* ---------- 最近一次 ---------- */

.s-ok { --tone: var(--s-ok); }
.s-high { --tone: var(--s-high); }
.s-low { --tone: var(--s-low); }

.last {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  padding: 18px 20px 16px;
  border-radius: 26px;
  color: #fff;
  text-align: left;
  background: var(--tone);
  background-image: linear-gradient(
    150deg,
    color-mix(in srgb, var(--tone) 72%, #fff) 0%,
    var(--tone) 52%,
    color-mix(in srgb, var(--tone) 74%, #06110f) 100%
  );
  box-shadow: 0 18px 32px -24px color-mix(in srgb, var(--tone) 90%, transparent);
  animation: rise 0.4s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.last::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -80px;
  width: 200px;
  height: 200px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.last-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.chip.plain { background: var(--field); color: var(--muted); }
.last-when { font-size: 13px; color: rgba(255, 255, 255, 0.85); }

.last-value { display: flex; align-items: baseline; gap: 8px; margin: 8px 0 10px; }

.last-value b {
  font-family: var(--rounded);
  font-size: clamp(52px, 17vw, 68px);
  line-height: 1;
  font-weight: 700;
  letter-spacing: -1.5px;
}

.last-value span { font-size: 14px; color: rgba(255, 255, 255, 0.82); }

.last-foot { display: flex; align-items: center; gap: 10px; font-size: 13px; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: var(--field);
}

.last .badge { color: #fff; background: rgba(255, 255, 255, 0.22); }
.badge.s-ok { color: var(--s-ok); background: color-mix(in srgb, var(--s-ok) 15%, transparent); }
.badge.s-high { color: var(--s-high); background: color-mix(in srgb, var(--s-high) 15%, transparent); }
.badge.s-low { color: var(--s-low); background: color-mix(in srgb, var(--s-low) 15%, transparent); }
.last-target { color: rgba(255, 255, 255, 0.85); }

.last-note {
  display: block;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
}

/* ---------- 统计 ---------- */

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 12px 11px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--hairline);
}

.stat-label { font-size: 11.5px; color: var(--muted); }
.stat-value { font-family: var(--rounded); font-size: 23px; font-weight: 700; letter-spacing: -0.6px; }
.stat-value i { font-style: normal; font-size: 10.5px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.stat-sub { font-size: 11.5px; color: var(--muted); }

/* ---------- 折线 ---------- */

.card {
  padding: 14px 14px 8px;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--hairline);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.card-head h3 { font-size: 15px; font-weight: 700; }
.card-hint { font-size: 11px; color: var(--muted); text-align: right; }

.mini-seg {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--field);
}

.mini-seg button {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.mini-seg button.on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.chart-wrap { display: block; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart-band { fill: color-mix(in srgb, var(--accent) 13%, transparent); }
.chart-edge { stroke: color-mix(in srgb, var(--accent) 40%, transparent); stroke-width: 1; stroke-dasharray: 3 4; }
.chart-label { fill: var(--muted); font-size: 9px; }
.chart-axis { fill: var(--muted); font-size: 9.5px; }
.chart-line { stroke: color-mix(in srgb, var(--ink) 45%, transparent); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 1.6; }
.chart-value { fill: var(--ink); font-size: 9px; font-weight: 650; }
.chart-hit { cursor: pointer; }

.chart-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 2px 8px;
  font-size: 11.5px;
  color: var(--muted);
}

.chart-hint { padding: 14px 4px 18px; font-size: 13px; color: var(--muted); text-align: center; }

/* ---------- 记录列表 ---------- */

.day + .day { margin-top: 16px; }
.day-head { font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 0 2px 6px; }
.day-rows { border-radius: 18px; background: var(--surface); overflow: hidden; box-shadow: 0 1px 0 var(--hairline); }
.day-rows li + li { border-top: 1px solid var(--hairline); }

.row-btn {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 10px 14px;
  text-align: left;
}

.row-btn:active { background: var(--field); }
.row-time { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.row-time.s-high, .row-time.s-low { color: var(--tone); font-weight: 600; }

.row-mid { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-mid b { font-size: 15px; font-weight: 600; }
.row-mid i {
  font-style: normal;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-value { display: flex; align-items: center; gap: 8px; }
.row-value b { font-family: var(--rounded); font-size: 20px; font-weight: 700; letter-spacing: -0.4px; }

.foot-note { margin-top: 14px; padding: 0 4px; font-size: 11.5px; line-height: 1.6; color: var(--muted); }

/* ---------- 报告 ---------- */

.summary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--hairline);
}

.summary-label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 2px; }
.summary-value { font-family: var(--rounded); font-size: 16px; font-weight: 500; }
.summary-value b { font-size: 28px; font-weight: 700; letter-spacing: -0.8px; }
.summary-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-size: 12px; color: var(--muted); }

.reports { display: flex; flex-direction: column; gap: 10px; }

.report-card {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px;
  border-radius: 20px;
  background: var(--surface);
  text-align: left;
  box-shadow: 0 1px 0 var(--hairline);
}

.report-card:active { background: var(--field); }

.report-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 50px;
  border-radius: 13px;
  background: var(--field);
}

.report-date b { font-family: var(--rounded); font-size: 19px; font-weight: 700; line-height: 1; }
.report-date i { font-style: normal; font-size: 10px; color: var(--muted); }
.report-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.report-title {
  font-size: 15.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.report-sub { font-size: 12px; color: var(--muted); }
.report-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }

.tag {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--field);
}

.tag.high { color: var(--s-high); background: color-mix(in srgb, var(--s-high) 14%, transparent); }
.tag.low { color: var(--s-low); background: color-mix(in srgb, var(--s-low) 14%, transparent); }
.tag.photo { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.chev { font-size: 22px; color: var(--muted); opacity: 0.6; }

.trend-chips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; }
.trend-chips::-webkit-scrollbar { display: none; }
.trend-chips .chip { flex: none; padding: 7px 12px; font-size: 12.5px; color: var(--muted); background: var(--field); }
.trend-chips .chip.on { color: #fff; background: var(--accent); }

/* ---------- 空白 ---------- */

.blank {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: min(12dvh, 96px) 16px 20px;
}

.blank-mark { font-size: 52px; line-height: 1; }
.blank h2 { font-size: 19px; font-weight: 700; }
.blank p { font-size: 14px; line-height: 1.65; color: var(--muted); max-width: 320px; }
.blank-note { font-size: 12px; }

.primary {
  margin-top: 10px;
  min-height: 50px;
  padding: 13px 26px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 650;
  color: var(--accent-ink);
  background: var(--accent);
  box-shadow: 0 12px 24px -14px color-mix(in srgb, var(--accent) 90%, transparent);
}

.primary:active { transform: scale(0.98); }

/* ---------- 底部 ---------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 600px;
  margin: 0 auto;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--paper) 62%, transparent);
}

.tabswitch {
  display: flex;
  flex: 1;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 8px 20px -10px rgba(0, 0, 0, 0.3);
}

.tabswitch button {
  position: relative;
  flex: 1;
  min-height: 44px;
  padding: 9px 0;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
}

.tabswitch button.on { color: var(--accent-ink); background: var(--accent); }

.dot {
  position: absolute;
  top: 8px;
  right: 18%;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--s-high);
}

.tabswitch button.on .dot { background: #fff; }

.fab {
  width: 56px;
  height: 56px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 30px;
  line-height: 1;
  padding-bottom: 3px;
  color: var(--accent-ink);
  background: var(--accent);
  box-shadow: 0 10px 24px -10px color-mix(in srgb, var(--accent) 85%, transparent);
}

.fab:active { transform: scale(0.94); }

/* ---------- 弹层 ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(8, 12, 11, 0.42);
  animation: fade 0.2s ease both;
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sheet {
  width: 100%;
  max-width: 600px;
  max-height: 92dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 8px 16px calc(22px + env(safe-area-inset-bottom));
  border-radius: 26px 26px 0 0;
  background: var(--surface);
  animation: slide 0.3s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}

@keyframes slide {
  from { transform: translateY(16%); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}

.sheet-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0 14px;
  background: var(--surface);
}

.sheet-bar strong { font-size: 16px; font-weight: 650; }

.link {
  min-width: 48px;
  min-height: 36px;
  padding: 6px 2px;
  font-size: 15px;
  color: var(--muted);
  text-align: left;
}

.link.strong { color: var(--accent); font-weight: 650; text-align: right; }
.link:disabled { opacity: 0.35; }
.link.ghost { visibility: hidden; }

.num-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: 20px;
  background: var(--field);
}

.num-input {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--rounded);
  font-size: clamp(40px, 12vw, 48px);
  font-weight: 700;
  letter-spacing: -1.5px;
  color: var(--tone);
  -moz-appearance: textfield;
}

.num-input::-webkit-outer-spin-button,
.num-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num-input::placeholder { color: color-mix(in srgb, var(--muted) 60%, transparent); }

.num-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.num-unit { font-size: 12px; color: var(--muted); }
.num-hint { font-size: 12px; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chips .chip { padding: 9px 14px; font-size: 14px; color: var(--muted); background: var(--field); }
.chips .chip.on { color: #fff; background: var(--accent); }

.group { border-radius: 18px; background: var(--field); overflow: hidden; }

.field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 10px 14px;
}

.field + .field { border-top: 1px solid var(--hairline); }
.field > span { flex: none; max-width: 56%; font-size: 14px; color: var(--muted); }

.field input,
.field textarea {
  flex: 1;
  min-width: 0;
  padding: 4px 0;
  border: 0;
  background: none;
  font-size: 16px;
  text-align: right;
}

.field textarea { margin-top: 6px; width: 100%; text-align: left; resize: none; line-height: 1.5; }
.field:has(textarea) { flex-direction: column; align-items: stretch; }

.remove {
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--s-high);
  background: color-mix(in srgb, var(--s-high) 10%, transparent);
}

.remove.sure { color: #fff; background: var(--s-high); }

.sheet-note { margin-top: 12px; font-size: 11.5px; line-height: 1.6; color: var(--muted); }

/* ---------- 报告表单 ---------- */

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 2px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.mini {
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.mini.wide { flex: 1; min-height: 42px; padding: 9px 12px; font-size: 14px; text-align: center; }

.export-row { display: flex; gap: 8px; }
.export-actions { display: flex; gap: 8px; margin-top: 8px; }

.items { display: flex; flex-direction: column; gap: 8px; }
.item-row { padding: 9px 11px; border-radius: 16px; background: var(--field); }

.item-name {
  width: 100%;
  padding: 4px 0 8px;
  border: 0;
  background: none;
  font-size: 15px;
  font-weight: 600;
}

.item-line { display: grid; grid-template-columns: 1fr 0.72fr 1fr 32px; gap: 6px; align-items: center; }

.item-line input {
  min-width: 0;
  padding: 8px 9px;
  border: 0;
  border-radius: 10px;
  background: var(--surface);
  font-size: 14px;
}

.item-drop {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  background: var(--surface);
}

.photo-block { margin-top: 14px; }
.photo-label { display: block; margin-bottom: 8px; font-size: 13px; color: var(--muted); }

.photo-add {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  border-radius: 16px;
  border: 1px dashed color-mix(in srgb, var(--muted) 45%, transparent);
  color: var(--muted);
  font-size: 14px;
}

.photo-add input { display: none; }
.photo-add:active { background: var(--field); }

.photo-preview { position: relative; overflow: hidden; border-radius: 16px; background: var(--field); }
.photo-preview img { display: block; width: 100%; max-height: 340px; object-fit: contain; }

.photo-drop {
  position: absolute;
  right: 10px;
  top: 10px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
}

/* ---------- 报告详情 ---------- */

.detail-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.detail-meta .chip { color: var(--muted); background: var(--field); }

.detail-photo {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  border-radius: 18px;
  background: var(--field);
}

.detail-photo img { display: block; width: 100%; max-height: 46dvh; object-fit: contain; }

.detail-photo-hint {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
}

.detail-items { margin-top: 14px; border-radius: 18px; background: var(--field); overflow: hidden; }
.detail-item { display: grid; grid-template-columns: 1fr auto auto; gap: 6px 10px; padding: 11px 14px; }
.detail-item + .detail-item { border-top: 1px solid var(--hairline); }
.detail-name { font-size: 14.5px; font-weight: 600; }
.detail-result { display: flex; align-items: center; gap: 6px; justify-self: end; }
.detail-result b { font-family: var(--rounded); font-size: 17px; font-weight: 700; }
.detail-result i { font-style: normal; font-size: 11px; color: var(--muted); }
.detail-range { grid-column: 1 / -1; font-size: 11.5px; color: var(--muted); }

.detail-summary {
  margin-top: 12px;
  padding: 13px 15px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.detail-summary span { font-size: 12px; color: var(--muted); }
.detail-summary p { margin-top: 6px; font-size: 14.5px; line-height: 1.6; }

.zoom {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 18px;
  background: rgba(0, 0, 0, 0.92);
  animation: fade 0.2s ease both;
}

.zoom img { max-width: 100%; max-height: 82dvh; object-fit: contain; }
.zoom span { font-size: 12px; color: rgba(255, 255, 255, 0.6); }

/* ---------- 设置 ---------- */

.targets { display: flex; flex-direction: column; gap: 8px; }

.target {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 13px 15px;
  border-radius: 16px;
  border: 1.5px solid transparent;
  background: var(--field);
  text-align: left;
}

.target.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.target b { font-size: 15px; }
.target span { font-size: 12px; color: var(--muted); }

.export-box {
  width: 100%;
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background: var(--field);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  resize: none;
}

.about { border-radius: 16px; background: var(--field); overflow: hidden; }
.about > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 15px; font-size: 13.5px; }
.about > div + div { border-top: 1px solid var(--hairline); }
.about span { color: var(--muted); }
.about b { font-size: 13px; font-weight: 600; }

/* ---------- 提示 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 60;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  color: #fff;
  background: rgba(16, 22, 20, 0.92);
  white-space: nowrap;
  pointer-events: none;
  animation: fade 0.2s ease both;
}

.toast[hidden] { display: none; }
/* ---------- 识别报告单 ---------- */

.ocr-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 16px;
  background: var(--field);
}

.ocr-actions { display: flex; gap: 8px; }
.ocr-actions .mini { flex: 1; }

.ocr-status {
  min-height: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.ocr-status:empty { display: none; }

.ocr-text {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--surface);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
}

.ocr-endpoint {
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--surface);
  font-size: 13px;
}

.ocr-details summary {
  padding: 4px 2px;
  font-size: 12.5px;
  color: var(--accent);
  cursor: pointer;
}

.ocr-details .sheet-note { margin-top: 6px; }

/* ---------- 成员（爸爸 / 岳父 / 奶奶…，自己加） ---------- */

.members-wrap {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(to right, transparent 0, #000 6px, #000 calc(100% - 10px), transparent 100%);
}

.members-wrap::-webkit-scrollbar { display: none; }

.members {
  display: flex;
  gap: 7px;
  padding: 4px 2px;
  width: max-content;
}

.member {
  flex: none;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  background: var(--field);
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

.member.on {
  color: var(--accent-ink);
  background: var(--accent);
  box-shadow: 0 6px 14px -8px color-mix(in srgb, var(--accent) 80%, transparent);
}

.member.add {
  width: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 20px;
  color: var(--accent);
  background: var(--field);
}

.members-admin {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.member-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px 9px 14px;
  border-radius: 16px;
  background: var(--field);
}

.member-name {
  min-width: 0;
  padding: 6px 0;
  border: 0;
  background: none;
  font-size: 15px;
  font-weight: 600;
}

.member-count {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}

.member-del {
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--s-high);
  background: color-mix(in srgb, var(--s-high) 10%, transparent);
}

/* ---------- 血糖来源与误差比对 ---------- */

.last-tags { display: flex; align-items: center; gap: 6px; }
.last .chip.source { background: rgba(255, 255, 255, 0.32); }

.row-source {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--field);
  vertical-align: 1.5px;
}

.stats-note {
  margin: -4px 4px 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
}

.pair-card { padding-bottom: 12px; }
.pairs { display: flex; flex-direction: column; }

.pair-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: baseline;
  padding: 8px 2px;
  font-size: 12.5px;
  border-top: 1px solid var(--hairline);
}

.pair-row:first-child { border-top: 0; }
.pair-when { color: var(--muted); font-variant-numeric: tabular-nums; }
.pair-values { color: var(--ink); white-space: nowrap; }

.pair-delta {
  font-weight: 700;
  color: var(--s-ok);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pair-delta.big { color: var(--s-high); }

.pair-note {
  margin-top: 8px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
}

.chart-legend {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 10.5px;
  color: var(--muted);
}

.chart-legend .lg { font-style: normal; }
.chart-legend .lg-finger { color: var(--accent); }
.chart-legend .lg-lab { color: var(--s-high); }
.chart-legend .lg-cgm { color: var(--s-low); }
.chart-legend .text { opacity: 0.85; }

.sources { margin-top: -2px; }
.sources .chip { padding: 7px 12px; font-size: 12.5px; }
.chip-label { align-self: center; margin-right: 2px; font-size: 11.5px; color: var(--muted); }

/* 从报告里点某项指标，看它的历史 */

.trend-link {
  align-self: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  white-space: nowrap;
}

.trend-row {
  width: 100%;
  border: 0;
  background: none;
  text-align: left;
}

.trend-row:active { background: var(--surface); }

/* ---------- 误差修正（正 1 / 负 1） ---------- */

.adjust-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--field);
}

.adjust-label { font-size: 14px; color: var(--muted); }
.stepper { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.step {
  width: 46px;
  height: 40px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  background: var(--surface);
}

.step:active { transform: scale(0.96); }

.adjust-input {
  width: 62px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  text-align: center;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}

.adjust-input::-webkit-outer-spin-button,
.adjust-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.adjust-echo {
  min-width: 64px;
  font-size: 11.5px;
  text-align: right;
  color: var(--muted);
}

.last-adjust {
  margin-left: 8px;
  font-style: normal;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.9);
}

.row-adjust {
  margin-left: 2px;
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
}

/* ---------- 自动修正 ---------- */

.auto-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}

.auto-badge {
  flex: none;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  font-variant-numeric: tabular-nums;
}

.auto-text { font-size: 11.5px; line-height: 1.5; color: var(--muted); }

.auto-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 15px;
  border-radius: 16px;
  background: var(--field);
}

.auto-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.auto-copy b { font-size: 15px; }
.auto-copy span { font-size: 11.5px; line-height: 1.5; color: var(--muted); }

.switch {
  flex: none;
  width: 52px;
  height: 32px;
  padding: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 40%, transparent);
  transition: background 0.2s;
}

.switch .knob {
  display: block;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s;
}

.switch.on { background: var(--accent); }
.switch.on .knob { transform: translateX(20px); }

/* ---------- 静脉 + 指尖同测 ---------- */

.meter-block {
  margin-bottom: 8px;
  padding: 10px 12px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--s-high) 8%, transparent);
}

.meter-block.hidden { display: none; }

.meter-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.meter-row .adjust-label { flex: 1; }

.meter-input {
  width: 84px;
  height: 40px;
  padding: 0 8px;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  text-align: center;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}

.meter-input::-webkit-outer-spin-button,
.meter-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* 原始 / 修正 的快捷切换 */
.auto-strip .auto-text { flex: 1; min-width: 0; }

.view-switch {
  flex: none;
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.view-switch button {
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.view-switch button.on {
  color: #fff;
  background: var(--accent);
}

.auto-badge.muted { background: color-mix(in srgb, var(--muted) 60%, transparent); font-weight: 600; }

/* ---------- 日历 ---------- */

.cal-card { padding: 14px 12px 12px; }
.cal-head { justify-content: space-between; }
.cal-head h3 { font-size: 16px; }

.cal-nav {
  width: 40px;
  height: 36px;
  border-radius: 999px;
  font-size: 22px;
  line-height: 1;
  color: var(--accent);
  background: var(--field);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 6px;
}

.cal-wd { padding: 4px 0; font-size: 11px; color: var(--muted); text-align: center; }
.cal-blank { height: 48px; }

.cal-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  min-height: 48px;
  padding: 5px 0 4px;
  border-radius: 12px;
  background: var(--field);
}

.cal-day.today { background: color-mix(in srgb, var(--accent) 14%, transparent); outline: 1.5px solid var(--accent); }

.cal-num { font-size: 13px; font-weight: 600; }

.cal-dots { display: flex; gap: 2px; }
.cal-dots i { width: 5px; height: 5px; border-radius: 999px; background: var(--tone); }
.cal-count { font-size: 9px; color: var(--muted); line-height: 1; }

.day-sheet-list { display: flex; flex-direction: column; }
.day-sheet-list + .mini { margin-top: 12px; }

.day-row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 2px;
  text-align: left;
  border-top: 1px solid var(--hairline);
}

.day-row:first-child { border-top: 0; }

/* 同步状态：一个小胶囊，写字，不靠猜 */
.sync-pill {
  flex: none;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  color: var(--muted);
  background: var(--field);
}

.sync-pill.ok { color: var(--s-ok); background: color-mix(in srgb, var(--s-ok) 12%, transparent); }
.sync-pill.busy { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.sync-pill.bad { color: var(--s-high); background: color-mix(in srgb, var(--s-high) 12%, transparent); }

.invite-box { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }

.invite-link {
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--field);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  line-height: 1.5;
  word-break: break-all;
}

/* 弹层里的大保存按钮 */
.primary.wide {
  display: block;
  width: 100%;
  min-height: 56px;
  margin: 18px 0 6px;
  padding: 16px 20px;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0.5px;
  text-align: center;
}

.primary:disabled { opacity: 0.4; box-shadow: none; }

/* ---------- 用药 ---------- */

.med-board { padding-bottom: 12px; }
.med-progress { height: 8px; margin: 6px 0 6px; border-radius: 999px; background: var(--field); overflow: hidden; }
.med-progress i { display: block; height: 100%; border-radius: 999px; background: var(--accent); transition: width 0.3s; }
.med-progress-text { font-size: 11.5px; color: var(--muted); }

.med-list { display: flex; flex-direction: column; gap: 10px; }
.med-list .day-head { padding-bottom: 4px; }

.med-card { padding: 14px; border-radius: 20px; background: var(--surface); box-shadow: 0 1px 0 var(--hairline); }
.med-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.med-name { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.med-name b { font-size: 16px; }
.med-sub { font-size: 11.5px; color: var(--muted); }
.med-edit { flex: none; padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }

.med-doses { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.dose {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  background: var(--field);
}

.dose.on { color: #fff; background: var(--accent); }
.dose-slot { line-height: 1; }
.dose-mark { min-width: 10px; }

.med-note { margin-top: 8px; font-size: 11.5px; color: var(--muted); }

.med-hist { padding: 10px 2px; }
.med-hist + .med-hist { border-top: 1px solid var(--hairline); }
.med-hist b { font-size: 14px; }
.med-hist ul { margin: 6px 0 0; padding-left: 16px; }
.med-hist li { font-size: 11.5px; line-height: 1.7; color: var(--muted); }

.dose-input { display: flex; gap: 8px; align-items: center; }
.dose-input input { width: 64px; text-align: right; }
.dose-input select { border: 0; background: none; color: var(--muted); font-size: 15px; }

/* 弹层底部：取消（红）+ 保存（绿）平分 */
.sheet-actions {
  display: flex;
  gap: 10px;
  margin: 18px 0 6px;
}

.sheet-actions .primary {
  flex: 1;
  width: auto;
  min-height: 56px;
  margin: 0;
  padding: 16px 12px;
  font-size: 17px;
  border-radius: 999px;
}

.primary.danger {
  color: var(--s-high);
  background: color-mix(in srgb, var(--s-high) 12%, transparent);
  box-shadow: none;
}

.primary.danger:active { transform: scale(0.98); }
