/**
 * style.css —— 药贴心 App 样式（iOS 设计语言）
 * ------------------------------------------------------------
 * 设计规范：
 * - 配色：iOS 系统色板基底（背景 #f4f7f6 / 卡片白），品牌主色为
 *   医疗感 teal 渐变（#16C0AC -> #0A8F82），与参考项目蓝形成区分；
 * - 时段语义色：早上=橙 / 中午=青 / 晚上=靛 / 睡前=紫（iOS 系统色）；
 * - 状态语义色：已服=绿 / 超时=红 / 即将=琥珀 / 跳过=灰；
 * - 卡片：大圆角 + 轻投影；按钮层级与参考项目一致；
 * - 安全区：顶部刘海 + 底部 Home 横条（env(safe-area-inset-*)）。
 */

/* ==================== 基础与变量 ==================== */
:root {
  --bg: #f4f7f6;              /* 页面背景（teal 微调，比纯灰更"健康"） */
  --card: #ffffff;            /* 卡片背景 */
  --text: #1c1c1e;            /* 主文字 */
  --text-2: #8e8e93;          /* 次要文字 */
  --brand: #0d9d8d;           /* 品牌 teal（主按钮/选中态） */
  --brand-deep: #0a8f82;      /* 品牌深色（渐变末端/图标） */
  --brand-light: #e6f6f3;     /* 品牌浅底（次级按钮/选中行底色） */
  --orange: #ff9500;          /* 早上/警示橙 */
  --cyan: #30b0c7;            /* 中午青 */
  --indigo: #5856d6;          /* 晚上靛 */
  --purple: #af52de;          /* 睡前紫 */
  --red: #ff3b30;             /* 危险红（超时未服） */
  --green: #34c759;           /* 已服绿 */
  --separator: rgba(60, 60, 67, 0.12);
  --radius: 16px;
  --radius-btn: 12px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ==================== 顶部标题 ==================== */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  padding: calc(var(--safe-top) + 10px) 16px 8px;
  background: rgba(244, 247, 246, 0.92);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
}
.app-header h1 { font-size: 28px; font-weight: 700; letter-spacing: 0.3px; }
.app-header__sub { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.app-header__row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.app-header__date { font-size: 14px; font-weight: 600; color: var(--text-2); white-space: nowrap; }

/* 顶栏提醒铃铛 chip：未开启系统通知时显示，点击跳转"我的" */
.bell-chip {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 149, 0, 0.14);
  font-size: 15px;
  line-height: 1;
  animation: bellPulse 2.4s ease-in-out infinite;
}
.bell-chip:active { opacity: 0.7; }
@keyframes bellPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 149, 0, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(255, 149, 0, 0); }
}

/* ==================== 主内容区 ==================== */
.app-main {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--safe-top) + 62px) 12px calc(76px + var(--safe-bottom));
}
.page { animation: pageIn 0.18s ease-out; }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ==================== 卡片 ==================== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 2px 10px rgba(20, 60, 55, 0.06);
}
.card__title { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.card__count { font-size: 12px; font-weight: 400; color: var(--text-2); margin-left: 4px; }
.card__title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card__title-row .card__title { margin-bottom: 0; }
/* 信息卡：浅品牌底，用于页首说明 */
.card--info { background: linear-gradient(150deg, #eefaf7 0%, #ffffff 78%); border: 0.5px solid rgba(13, 157, 141, 0.10); }
/* 可点击卡片 */
.card--link { cursor: pointer; }
.card--link:active { transform: scale(0.99); }

/* ==================== 超时提醒横幅 ==================== */
.alert-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--red);
  background: rgba(255, 59, 48, 0.10);
  border: 0.5px solid rgba(255, 59, 48, 0.22);
  animation: alertIn 0.25s ease-out;
}
@keyframes alertIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.alert-banner .alert-banner__icon { font-size: 18px; animation: bellShake 1.2s ease-in-out infinite; }
@keyframes bellShake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-14deg); }
  40% { transform: rotate(12deg); }
  60% { transform: rotate(-8deg); }
  80% { transform: rotate(6deg); }
}

/* ==================== 首页：当前时段 hero 卡 ==================== */
.hero-card {
  padding: 20px 18px 18px;
  background: linear-gradient(150deg, #14bfa8 0%, #0a8f82 100%);
  color: #fff;
  border: none;
}
.hero-card__period { display: flex; align-items: center; gap: 12px; }
.hero-card__picon {
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  flex-shrink: 0;
}
.hero-card__ptext { flex: 1; min-width: 0; }
.hero-card__plabel { font-size: 26px; font-weight: 800; letter-spacing: 0.5px; line-height: 1.15; }
.hero-card__psub { font-size: 12px; color: rgba(255, 255, 255, 0.78); margin-top: 2px; }
.hero-card__clock {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.14);
  padding: 6px 10px;
  border-radius: 10px;
  flex-shrink: 0;
}
.hero-card__progress { margin-top: 16px; }
.hero-card__ptext2 {
  display: flex; justify-content: space-between;
  font-size: 12px; color: rgba(255, 255, 255, 0.85); margin-bottom: 6px;
}
.hero-card__ptext2 b { font-size: 15px; font-weight: 800; color: #fff; }
.hero-bar { height: 10px; border-radius: 5px; background: rgba(255, 255, 255, 0.22); overflow: hidden; }
.hero-bar__fill {
  height: 100%; width: 0;
  border-radius: 5px;
  background: linear-gradient(90deg, #d8fff6, #9be8db);
  transition: width 0.4s ease;
}

/* ==================== 今日服药：时段分组 ==================== */
.tgroup { margin-bottom: 4px; }
.tgroup:last-child { margin-bottom: 0; }
/* 组头：时段 icon + label + 摘要 chip（点击折叠/展开） */
.tgroup__head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 2px;
  border: none;
  background: transparent;
  text-align: left;
}
.tgroup__icon {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
  border-radius: 12px;
  flex-shrink: 0;
}
.tgroup__name { font-size: 15px; font-weight: 600; }
.tgroup__time { font-size: 11px; color: var(--text-2); margin-top: 1px; }
.tgroup__info { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.tgroup__arrow { font-size: 12px; color: var(--text-2); transition: transform 0.2s; }
.tgroup.is-open .tgroup__arrow { transform: rotate(180deg); }
/* 时段摘要 chip：x/y 完成 */
.tsum {
  font-size: 11px; font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  background: rgba(142, 142, 147, 0.12);
  color: var(--text-2);
}
.tsum.is-done   { background: rgba(52, 199, 89, 0.14); color: var(--green); }
.tsum.is-part   { background: rgba(255, 149, 0, 0.14); color: var(--orange); }
.tsum.is-wait   { background: rgba(13, 157, 141, 0.12); color: var(--brand); }
.tsum.is-miss   { background: rgba(255, 59, 48, 0.12); color: var(--red); }

/* 组体：剂量行列表（默认展开当前时段，其余折叠） */
.tgroup__body { display: none; padding-bottom: 6px; }
.tgroup.is-open .tgroup__body { display: block; }

/* 剂量行：药品名 + 剂量/时间 + 状态操作 */
.dose-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 12px;
  margin-bottom: 4px;
  background: #f7faf9;
}
.dose-row.is-overdue { background: rgba(255, 59, 48, 0.07); }
.dose-row__main { flex: 1; min-width: 0; }
.dose-row__name {
  font-size: 15px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dose-row__name.is-deleted { color: var(--text-2); text-decoration: line-through; font-weight: 500; }
.dose-row__meta { font-size: 12px; color: var(--text-2); margin-top: 2px; display: flex; gap: 6px; flex-wrap: wrap; }
.dose-row__meta .is-overdue-text { color: var(--red); font-weight: 600; }
.dose-row__meta .is-late-text { color: var(--orange); font-weight: 600; }
.dose-row__note {
  font-size: 10px; color: var(--cyan);
  background: rgba(48, 176, 199, 0.12);
  padding: 2px 6px; border-radius: 6px; white-space: nowrap;
}

/* 状态/操作区 */
.dose-row__ops { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
/* 已服：绿色圆勾徽标（点击撤销） */
.done-pill {
  display: flex; align-items: center; gap: 4px;
  border: none;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 12px; font-weight: 700;
  background: rgba(52, 199, 89, 0.14);
  color: var(--green);
}
.done-pill:active { opacity: 0.7; }
/* 跳过：灰色小 chip */
.skip-pill {
  border: none;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: rgba(142, 142, 147, 0.14);
  color: var(--text-2);
}
.skip-pill:active { opacity: 0.7; }
/* 待服：主打卡按钮（圆形，"服"字） */
.take-btn {
  width: 44px; height: 44px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #16C0AC, var(--brand-deep));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(13, 157, 141, 0.32);
  transition: transform 0.1s;
}
.take-btn:active { transform: scale(0.92); }
/* 超时行的打卡按钮换红色渐变，强调"赶紧补" */
.dose-row.is-overdue .take-btn {
  background: linear-gradient(135deg, #ff6a5e, #e5352a);
  box-shadow: 0 3px 10px rgba(255, 59, 48, 0.32);
}
/* 未来时段/跨天的行不显示操作（仅展示） */

/* ==================== 首页：连续全勤摘要卡 ==================== */
.today-streak { display: flex; align-items: center; }
.today-streak__main { flex: 1; }
.today-streak__num { font-size: 34px; font-weight: 800; color: var(--brand); line-height: 1; }
.today-streak__num small { font-size: 14px; font-weight: 600; color: var(--text-2); margin-left: 2px; }
.today-streak__label { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.today-streak__right { text-align: right; }
.today-streak__rate { font-size: 22px; font-weight: 800; }
.today-streak__sub { font-size: 11px; color: var(--text-2); margin-top: 2px; }

/* ==================== 表单行 ==================== */
.field-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 6px 0;
  border-bottom: 1px solid var(--separator);
}
.field-row:last-of-type { border-bottom: none; }
.field-row--notop { border-top: 1px solid var(--separator); margin-top: 8px; }
.field-row__label { flex: 0 0 92px; font-size: 14px; color: var(--text); }
.field-row__input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  text-align: right;
  color: var(--text);
}
.field-row__input::placeholder { color: #c7c7cc; }
/* 小宽度输入（剂量/库存），右侧跟单位 */
.field-row__input--dose { flex: 0 1 90px; text-align: right; }
.field-unit { font-size: 14px; color: var(--text-2); flex-shrink: 0; }
.field-icon { font-size: 15px; margin-right: 2px; }

/* 上下堆叠布局（chip 行等） */
.field-row--stack { flex-wrap: wrap; row-gap: 8px; }
.field-row--stack > .field-row__label { flex: 0 0 100%; }

/* 药品弹窗：剂量输入 + 单位 chips 同行（label 独占一行，避免挤成竖条） */
.dose-unit-row { display: flex; align-items: center; gap: 8px; width: 100%; }
.dose-unit-row .field-row__input--dose { flex: 0 0 72px; text-align: right; }
.dose-unit-chips { flex: 1; justify-content: flex-end; }

/* 日期/时间控件：去系统图标、右对齐 */
.field-row__input[type="date"],
.field-row__input[type="time"] {
  min-height: 44px;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
  text-align: right;
}
.field-row__input[type="date"]::-webkit-date-and-time-value,
.field-row__input[type="time"]::-webkit-date-and-time-value { text-align: right; }
.field-row__input[type="date"]::-webkit-calendar-picker-indicator,
.field-row__input[type="time"]::-webkit-calendar-picker-indicator {
  display: none;
  -webkit-appearance: none;
}

/* 下拉选择（计划弹窗选药品） */
.select {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: #f4f6f8;
  border: none;
  border-radius: 10px;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238e8e93' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
}
.select:focus { outline: none; box-shadow: 0 0 0 2px rgba(13, 157, 141, 0.25); }

/* ==================== 开关（iOS 风格 toggle） ==================== */
.switch { position: relative; display: inline-block; width: 50px; height: 30px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch__slider {
  position: absolute; inset: 0;
  border-radius: 999px;
  background: rgba(120, 120, 128, 0.24);
  transition: background 0.2s;
}
.switch__slider::before {
  content: "";
  position: absolute;
  width: 26px; height: 26px;
  left: 2px; top: 2px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s;
}
.switch input:checked + .switch__slider { background: var(--green); }
.switch input:checked + .switch__slider::before { transform: translateX(20px); }

/* ==================== chip 选择组 ==================== */
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
/* 等分铺满一行 */
.chip-row--even { display: flex; gap: 6px; width: 100%; }
.chip-row--even .chip { flex: 1 1 0; text-align: center; }
.chip {
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: rgba(118, 118, 128, 0.12);
  border: none;
  border-radius: 9px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.chip.is-active { background: var(--brand); color: #fff; font-weight: 600; }
.chip:active { opacity: 0.8; }

/* ==================== 按钮体系 ==================== */
button { font-family: inherit; border: none; cursor: pointer; }

.btn-primary {
  width: 100%;
  margin-top: 12px;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #16C0AC, var(--brand-deep));
  border-radius: var(--radius-btn);
  box-shadow: 0 4px 12px rgba(13, 157, 141, 0.28);
  transition: opacity 0.15s, transform 0.1s;
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { background: #d1d1d6; color: #f2f2f7; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary {
  padding: 11px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--brand);
  background: var(--brand-light);
  border-radius: var(--radius-btn);
  transition: opacity 0.15s;
}
.btn-secondary:active { opacity: 0.7; }

.btn-danger {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  font-size: 15px;
  font-weight: 500;
  color: var(--red);
  background: rgba(255, 59, 48, 0.08);
  border-radius: var(--radius-btn);
}
.btn-danger:active { opacity: 0.7; }

.btn-plain {
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  font-size: 14px;
  color: var(--text-2);
  background: transparent;
}

.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-grid .btn-secondary { width: 100%; }

/* 行内小按钮 */
.btn-mini {
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 500;
  color: var(--brand);
  background: var(--brand-light);
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-mini:active { opacity: 0.7; }
.btn-mini--danger { color: var(--red); background: rgba(255, 59, 48, 0.10); }

/* ==================== 只读提示 ==================== */
.hint-text { font-size: 12px; color: var(--text-2); line-height: 1.55; margin-top: 6px; }
/* 语义色文本 */
.c-green { color: var(--green); }
.c-brand { color: var(--brand); }
.c-red { color: var(--red); }
.c-orange { color: var(--orange); }

/* ==================== 计划页：时段分组 ==================== */
.pgroup { margin-bottom: 14px; }
/* 时段头：彩色渐变浅底，突出时段 */
.pgroup__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px 14px 0 0;
}
.pgroup__head .tgroup__icon { background: rgba(255, 255, 255, 0.55); }
.pgroup__name { font-size: 16px; font-weight: 700; color: #fff; }
.pgroup__time { font-size: 11px; color: rgba(255, 255, 255, 0.82); margin-top: 1px; }
.pgroup__add {
  margin-left: auto;
  border: none;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  flex-shrink: 0;
}
.pgroup__add:active { opacity: 0.7; }
/* 时段彩条（与今日页徽标一致的语义色） */
.pgroup__head.p-morning { background: linear-gradient(120deg, #ffb03a, #ff9500); }
.pgroup__head.p-noon    { background: linear-gradient(120deg, #45c4d8, #30b0c7); }
.pgroup__head.p-evening { background: linear-gradient(120deg, #7270e6, #5856d6); }
.pgroup__head.p-bedtime { background: linear-gradient(120deg, #c06ae8, #af52de); }

/* 计划行容器：与彩色头衔接 */
.pgroup__body {
  background: var(--card);
  border-radius: 0 0 14px 14px;
  padding: 2px 12px 8px;
  box-shadow: 0 2px 10px rgba(20, 60, 55, 0.06);
}
/* 计划行 */
.plan-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--separator);
}
.plan-row:last-child { border-bottom: none; }
.plan-row.is-off { opacity: 0.5; }
.plan-row__main { flex: 1; min-width: 0; }
.plan-row__name { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-row__meta { font-size: 12px; color: var(--text-2); margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }
.plan-row__time {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  flex-shrink: 0;
}
.plan-row__ops { display: flex; gap: 6px; flex-shrink: 0; }
/* 启用/停用小开关（复用 .switch 缩小版） */
.switch--sm { width: 42px; height: 25px; }
.switch--sm .switch__slider::before { width: 21px; height: 21px; }
.switch--sm input:checked + .switch__slider::before { transform: translateX(17px); }

/* 空时段占位提示 */
.pgroup__empty {
  padding: 14px 12px;
  font-size: 13px;
  color: var(--text-2);
  text-align: center;
}

/* ==================== 药箱：药品卡片 ==================== */
.med-card {
  background: #f7faf9;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.med-card__head { display: flex; align-items: center; gap: 10px; }
/* 药品首字头像（teal 浅底圆角） */
.med-card__avatar {
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-light);
  border-radius: 12px;
  flex-shrink: 0;
}
.med-card__title { font-size: 16px; font-weight: 700; }
.med-card__spec { font-size: 12px; color: var(--text-2); margin-top: 1px; }
.med-card__tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.mtag {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(142, 142, 147, 0.12);
  color: var(--text-2);
  white-space: nowrap;
}
.mtag.is-dose { background: var(--brand-light); color: var(--brand); font-weight: 600; }
.mtag.is-stock { background: rgba(48, 176, 199, 0.12); color: var(--cyan); font-weight: 600; }
.mtag.is-low { background: rgba(255, 149, 0, 0.14); color: var(--orange); font-weight: 700; }
.mtag.is-out { background: rgba(255, 59, 48, 0.12); color: var(--red); font-weight: 700; }
.med-card__note { font-size: 12px; color: var(--text-2); margin-top: 8px; }
.med-card__ops {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--separator);
}
/* 药品备注行内小标签 */
.med-card__note-chip { color: var(--orange); }

/* ==================== 记录页：依从率 ==================== */
.adhere-row { display: flex; align-items: center; gap: 14px; }
.adhere-row__num {
  font-size: 44px;
  font-weight: 800;
  color: var(--brand);
  line-height: 1;
  min-width: 96px;
  font-variant-numeric: tabular-nums;
}
.adhere-row__meta { flex: 1; }
.adhere-row__line { font-size: 13px; color: var(--text-2); line-height: 1.7; }
.adhere-row__line b { font-size: 15px; font-weight: 700; color: var(--text); }

/* 近 7 天迷你柱状图（纯 CSS 柱） */
.mini-bars {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  align-items: flex-end;
}
.mini-bars__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.mini-bars__track {
  width: 100%;
  height: 64px;
  display: flex;
  align-items: flex-end;
  background: rgba(118, 118, 128, 0.08);
  border-radius: 8px;
  overflow: hidden;
}
.mini-bars__fill {
  width: 100%;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #16C0AC, #0a8f82);
  min-height: 3px;
  transition: height 0.3s ease;
}
.mini-bars__fill.is-part { background: linear-gradient(180deg, #ffc042, #ff9500); }
.mini-bars__fill.is-zero { background: rgba(142, 142, 147, 0.30); }
.mini-bars__label { font-size: 10px; color: var(--text-2); white-space: nowrap; }
.mini-bars__label.is-today { color: var(--brand); font-weight: 700; }

/* ==================== 打卡日历 ==================== */
.streak-head { display: flex; align-items: center; justify-content: space-between; width: 100%; flex-wrap: wrap; gap: 6px; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nav__btn {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: rgba(142, 142, 147, 0.16);
  color: var(--text);
  font-size: 17px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.cal-nav__btn:disabled { opacity: 0.3; }
/* 图例 */
.cal-legend { display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--text-2); }
.cal-dot { width: 9px; height: 9px; border-radius: 999px; display: inline-block; margin-left: 6px; }
.cal-dot--full { background: var(--green); }
.cal-dot--part { background: var(--orange); }
.cal-dot--miss { background: rgba(255, 59, 48, 0.35); }

.cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
  font-size: 11px;
  color: var(--text-2);
  margin-bottom: 4px;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: 10px;
  transition: background 0.15s;
}
.cal-cell.is-dim { visibility: hidden; }
.cal-cell__day { font-size: 13px; line-height: 1; color: var(--text); font-weight: 500; }
.cal-cell__pct { font-size: 9px; line-height: 1; font-weight: 700; color: var(--text-2); }
/* 全勤：绿底 */
.cal-cell.is-full { background: rgba(52, 199, 89, 0.16); }
.cal-cell.is-full .cal-cell__pct { color: var(--green); }
/* 部分：琥珀底 */
.cal-cell.is-part { background: rgba(255, 149, 0, 0.16); }
.cal-cell.is-part .cal-cell__pct { color: var(--orange); }
/* 漏服：红点提示 */
.cal-cell.is-miss { background: rgba(255, 59, 48, 0.10); }
.cal-cell.is-miss .cal-cell__pct { color: var(--red); }
.cal-cell.is-today { box-shadow: inset 0 0 0 2px var(--brand); }

/* ==================== 记录列表 ==================== */
.day-card {
  background: #f6f8f7;
  border-radius: 14px;
  padding: 2px 12px 4px;
  margin-bottom: 12px;
}
.day-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 2px 4px;
}
.day-card__title { font-size: 13px; font-weight: 600; }
.day-card__count {
  font-size: 11px;
  color: var(--text-2);
  background: rgba(142, 142, 147, 0.14);
  padding: 2px 9px;
  border-radius: 999px;
}
.record-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--separator);
}
.record-item:last-child { border-bottom: none; }
.record-item__main { flex: 1; min-width: 0; }
.record-item__name { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-item__meta { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.record-item__time { font-size: 12px; color: var(--text-2); flex-shrink: 0; font-variant-numeric: tabular-nums; }
/* 记录行时段小标签（与今日页一致的时段色） */
.period-tag {
  flex: 0 0 44px;
  width: 44px;
  box-sizing: border-box;
  font-size: 10px;
  line-height: 1;
  text-align: center;
  padding: 5px 2px;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}
.period-tag.p-morning { color: #c66a00; background: rgba(255, 149, 0, 0.14); }
.period-tag.p-noon    { color: #177f93; background: rgba(48, 176, 199, 0.14); }
.period-tag.p-evening { color: #4442b8; background: rgba(88, 86, 214, 0.12); }
.period-tag.p-bedtime { color: #8e34b8; background: rgba(175, 82, 222, 0.12); }
/* 记录行状态徽标 */
.record-item__delta { flex-shrink: 0; }
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(52, 199, 89, 0.14);
  color: var(--green);
}
.badge.is-skip { background: rgba(142, 142, 147, 0.14); color: var(--text-2); font-weight: 500; }
.badge.is-late { background: rgba(255, 59, 48, 0.12); color: var(--red); }

/* ==================== 设置页 ==================== */
.perm-state { flex: 1; text-align: right; font-size: 13px; color: var(--text-2); }
.perm-state.is-granted { color: var(--green); font-weight: 600; }
.perm-state.is-denied { color: var(--red); }

/* Apple 徽标（伪元素绘制  字形） */
.apple-badge { font-size: 15px; color: var(--text); }
.apple-badge::before { content: ""; }

/* 导出步骤条 */
.hint-steps { margin: 4px 0 2px; }
.hint-steps__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  font-size: 13px;
  color: var(--text);
}
.hint-steps__item b {
  flex: 0 0 22px;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  color: #fff;
  background: var(--brand);
  border-radius: 999px;
}
.hint-steps__item span { flex: 1; }

.app-footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-2);
  padding: 6px 0 18px;
}

/* ==================== 底部页签栏 ==================== */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  padding-bottom: var(--safe-bottom);
  background: rgba(250, 252, 251, 0.94);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 0.5px solid var(--separator);
}
.tabbar__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 7px 0 5px;
  background: transparent;
  color: var(--text-2);
  font-size: 10px;
}
.tabbar__icon { font-size: 20px; line-height: 1; }
.tabbar__item.is-active { color: var(--brand); }

/* ==================== 弹窗 ==================== */
[hidden] { display: none !important; }

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.4);
  animation: fadeIn 0.15s ease-out;
}
.modal {
  width: 100%;
  max-width: 340px;
  max-height: 82vh;
  overflow-y: auto;
  background: var(--card);
  border-radius: 16px;
  padding: 18px 16px 16px;
  animation: popIn 0.18s ease-out;
}
.modal--narrow { max-width: 280px; text-align: center; }
.modal__title { font-size: 17px; font-weight: 600; margin-bottom: 10px; }
.modal__desc { font-size: 14px; color: var(--text-2); line-height: 1.5; }
.modal__actions { display: flex; gap: 10px; margin-top: 6px; }
.modal__actions .btn-primary { margin-top: 0; width: auto; flex: 1; }
.modal__actions .btn-secondary { flex: 1; }
.modal__actions .btn-danger { margin-top: 0; flex: 1; background: transparent; }
.modal__actions .btn-primary,
.modal__actions .btn-secondary,
.modal__actions .btn-danger { white-space: nowrap; }
/* 弹窗里的删除按钮（底部独立行） */
.modal > .btn-danger { margin-top: 10px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: scale(1); } }

/* 确认弹窗置顶（与其它弹窗同层时保证在上） */
#confirmModal { z-index: 60; }

/* ==================== Toast 轻提示 ==================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 99;
  max-width: 80vw;
  padding: 10px 18px;
  background: rgba(28, 28, 30, 0.9);
  color: #fff;
  font-size: 13px;
  border-radius: 999px;
  text-align: center;
  animation: fadeIn 0.2s ease-out;
}

/* ==================== 小屏适配（<360px） ==================== */
@media (max-width: 359px) {
  .hero-card__plabel { font-size: 22px; }
  .adhere-row__num { font-size: 36px; min-width: 80px; }
  .field-row__label { flex: 0 0 84px; }
}
