* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: #f6f7f9; color: #1a1d21; font-size: 16px; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; background: #fff; border-bottom: 1px solid #e5e7eb; position: sticky; top: 0; z-index: 5; }
.brand { font-size: 20px; font-weight: 700; }
.brand-en { font-size: 13px; color: #6b7280; font-weight: 400; margin-left: 6px; }
main { max-width: 560px; margin: 0 auto; padding: 18px 16px 48px; }
.view h1 { font-size: 24px; margin: 8px 0 12px; }
.view h2 { font-size: 17px; margin: 24px 0 10px; }
.hidden { display: none !important; }
.hint { color: #6b7280; font-size: 14px; line-height: 1.6; }
.hint.center, .center { text-align: center; }
.error { color: #c0392b; min-height: 20px; font-size: 14px; }
.status { color: #2563eb; min-height: 20px; font-size: 14px; text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.profile-label { font-size: 15px; color: #374151; }
.profile-label select { font-size: 17px; padding: 9px; border-radius: 8px; border: 1px solid #d1d5db; margin-left: 6px; background: #fff; max-width: 190px; }
.link-btn { background: none; border: none; color: #2563eb; font-size: 15px; padding: 8px 4px; cursor: pointer; }
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 16px; margin: 12px 0; }
.big-input { width: 100%; font-size: 18px; padding: 13px; border: 1px solid #d1d5db; border-radius: 10px; margin: 8px 0; }
.primary-btn { width: 100%; background: #d6191b; color: #fff; border: none; border-radius: 12px; padding: 15px; font-size: 18px; font-weight: 600; cursor: pointer; margin-top: 10px; }
.primary-btn:disabled { opacity: .55; }
.danger-btn { width: 100%; background: #fff; color: #c0392b; border: 1px solid #e5b4ae; border-radius: 12px; padding: 13px; font-size: 16px; cursor: pointer; margin-top: 12px; }
.danger-btn.armed { background: #c0392b; color: #fff; border-color: #c0392b; font-weight: 700; }
.ghost-btn { width: 100%; background: #fff; color: #1a1d21; border: 1px solid #d1d5db; border-radius: 12px; padding: 13px; font-size: 16px; cursor: pointer; margin-top: 10px; }
.photo-btn { display: block; width: 100%; text-align: center; background: #d6191b; color: #fff; border-radius: 14px; padding: 24px; font-size: 23px; font-weight: 700; cursor: pointer; margin-top: 16px; box-shadow: 0 4px 14px rgba(214,25,27,.25); }
.mini-btn { display: inline-block; background: #d6191b; color: #fff; border: none; border-radius: 10px; padding: 11px 18px; font-size: 15px; cursor: pointer; }
.mini-btn.ghost { background: #fff; color: #1a1d21; border: 1px solid #d1d5db; }
.error-panel { background: #fdf2f2; border: 1px solid #f3c2c2; border-radius: 12px; padding: 14px; margin-top: 8px; }
.error-panel p { margin: 4px 0 10px; font-size: 15px; line-height: 1.6; }
.home-nav { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 20px; }
.nav-btn { background: #fff; border: 1px solid #d1d5db; border-radius: 12px; padding: 16px 4px; font-size: 16px; cursor: pointer; font-weight: 600; }
.back-btn { background: none; border: none; font-size: 17px; color: #2563eb; padding: 6px 0; cursor: pointer; }

/* 首页状态卡 */
.stat-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 16px; margin-top: 12px; }
.stat-card .card-head { display: flex; justify-content: space-between; align-items: baseline; }
.stat-card .card-title { font-size: 16px; font-weight: 700; }
.stat-card .card-time { font-size: 13px; color: #6b7280; }
.stat-card .card-value { font-size: 40px; font-weight: 800; margin: 6px 0 2px; letter-spacing: .5px; }
.stat-card .card-value .unit { font-size: 15px; color: #6b7280; font-weight: 400; }
.stat-card .card-sub { font-size: 14px; color: #374151; }
.stat-card canvas { width: 100%; height: 44px; margin-top: 8px; }
.stat-card.empty .card-value { font-size: 20px; color: #9ca3af; font-weight: 600; }
.flag-high { display: inline-block; background: #fde8e8; color: #c81e1e; border-radius: 6px; padding: 1px 8px; font-size: 13px; font-weight: 700; margin-left: 8px; vertical-align: 6px; }
.flag-ok { display: inline-block; background: #e7f6ec; color: #137333; border-radius: 6px; padding: 1px 8px; font-size: 13px; font-weight: 700; margin-left: 8px; vertical-align: 6px; }

/* 记录列表 */
.list .item { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 13px 14px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; cursor: pointer; }
.list .item:active { background: #f3f4f6; }
.list .item .main-val { font-size: 21px; font-weight: 700; }
.list .item .main-val.high { color: #c81e1e; }
.list .item .sub { color: #6b7280; font-size: 13px; margin-top: 3px; }
.list .item .chev { color: #9ca3af; font-size: 20px; flex-shrink: 0; }
.badge { display: inline-block; background: #eef2ff; color: #3730a3; border-radius: 6px; padding: 1px 6px; font-size: 12px; margin-left: 6px; }
.badge.warn-badge { background: #fef3c7; color: #92400e; }
.empty-box { background: #fff; border: 1px dashed #d1d5db; border-radius: 12px; padding: 26px 16px; text-align: center; color: #6b7280; font-size: 15px; line-height: 1.7; }
.date-head { font-size: 14px; color: #6b7280; margin: 18px 0 8px; font-weight: 600; }

/* 确认页 */
.seg { display: flex; gap: 8px; margin: 12px 0; }
.seg-btn { flex: 1; padding: 11px; border-radius: 10px; border: 1px solid #d1d5db; background: #fff; font-size: 16px; cursor: pointer; }
.seg-btn.on { background: #1a1d21; color: #fff; border-color: #1a1d21; }
.seg.small .seg-btn { padding: 8px; font-size: 14px; }
.big-field { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; font-size: 15px; color: #374151; flex-wrap: wrap; }
.big-field input { flex: 1; min-width: 90px; font-size: 38px; font-weight: 700; border: none; outline: none; text-align: right; background: transparent; }
.big-field input.warn { border-bottom: 3px solid #f59e0b; background: #fffbeb; }
.big-field .unit { color: #6b7280; font-size: 15px; }
.unit-select { font-size: 16px; padding: 6px; border-radius: 8px; border: 1px solid #d1d5db; }
.check-field { display: block; font-size: 15px; padding: 6px 2px 12px; }
.check-field input { width: 20px; height: 20px; vertical-align: -4px; }
.chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 14px; }
.chips-label { font-size: 14px; color: #6b7280; }
.chip { border: 1px solid #d1d5db; background: #fff; border-radius: 999px; padding: 9px 17px; font-size: 15px; cursor: pointer; }
.chip.on { background: #d6191b; color: #fff; border-color: #d6191b; }
.more-fields { margin: 8px 0 4px; }
.more-fields summary { color: #6b7280; font-size: 14px; padding: 8px 0; cursor: pointer; }
.small-field { display: block; font-size: 14px; color: #374151; margin: 10px 0; }
.small-field input { width: 100%; font-size: 16px; padding: 10px; border: 1px solid #d1d5db; border-radius: 8px; margin-top: 5px; }
.photo-preview { width: 100%; border-radius: 12px; margin-bottom: 10px; }

/* 趋势图与小结 */
#chart-canvas { width: 100%; height: 220px; display: block; }
.chart-legend { display: flex; gap: 16px; font-size: 13px; color: #374151; margin-top: 8px; flex-wrap: wrap; }
.chart-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.stat-grid .cell { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 12px 14px; }
.stat-grid .cell .k { font-size: 13px; color: #6b7280; }
.stat-grid .cell .v { font-size: 22px; font-weight: 700; margin-top: 2px; }
.trend-text { font-size: 15px; line-height: 1.7; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 13px 14px; margin-top: 12px; }
.doctor-card { background: #fff; border: 1px solid #d1d5db; border-radius: 14px; padding: 18px 16px; margin-top: 12px; }
.doctor-card h3 { margin: 2px 0 4px; font-size: 19px; }
.doctor-card .meta { color: #6b7280; font-size: 13px; line-height: 1.6; }
.doctor-card h4 { margin: 18px 0 6px; font-size: 16px; border-bottom: 2px solid #1a1d21; padding-bottom: 5px; }
.doctor-card table { width: 100%; border-collapse: collapse; font-size: 15px; }
.doctor-card td { padding: 6px 4px; border-bottom: 1px solid #f0f1f3; }
.doctor-card td:last-child { text-align: right; font-weight: 600; }
.doctor-card .trend { margin-top: 10px; font-size: 14.5px; line-height: 1.65; color: #374151; }
.doctor-card .foot { margin-top: 16px; font-size: 12px; color: #9ca3af; line-height: 1.6; }

/* 加载遮罩 */
.loading-mask { position: fixed; inset: 0; background: rgba(255,255,255,.88); z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid #f3c2c2; border-top-color: #d6191b; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-mask p { font-size: 16px; color: #374151; }

@media print {
  .topbar, .back-btn, .primary-btn, .seg, .home-nav, .photo-btn, .ghost-btn { display: none !important; }
  body { background: #fff; }
}
