/* 补充剂服用记录 — 样式
 * 视觉语言：温暖的青绿健康应用。圆角卡片、轻阴影、暖米色地面。
 * 取自参考实现的令牌，但两处灰被压深以满足 WCAG AA（原 #7a7a7a 仅 4.0:1、#b0b0b0 仅 2.1:1）。
 */

:root {
  color-scheme: light;

  --bg: #f7f5f0;
  --card: #ffffff;
  --text: #2c2c2c;
  /* 次级灰按最苛刻的底色校准：#fff 卡与 #f5e8e8 注意块上都需 ≥4.5:1 */
  --text-secondary: #636363;
  --text-muted: #8a8a8a;
  /* 绿承担两种角色：#4f7d66 作白字底（≥4.5:1），#3f6b58 作正文绿（≥4.5:1） */
  --accent: #4f7d66;
  --accent-light: #e8f0eb;
  --accent-dark: #3f6b58;
  /* 顶栏在自己的渐变里是「白字底」，暗面必须另给深色，不能沿用文字绿 */
  --header-from: #4f7d66;
  --header-to: #3f6b58;
  --warm: #7d6146;
  --warm-light: #f5ebe0;
  --danger: #8f4f4b;
  --danger-light: #f5e8e8;
  --border: #e8e4dd;
  --btn-primary-bg: #4f7d66;
  --btn-primary-bg-hover: #3f6b58;

  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.08);
  --radius: 14px;
  --radius-sm: 10px;

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --font-num: ui-monospace, Consolas, "Cascadia Mono", "SF Mono", Menlo, monospace;

  --app-max: 560px;
  --pad: 16px;
  --nav-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --bg: #16181a;
    --card: #1f2225;
    --text: #eceae6;
    --text-secondary: #a8a8a4;
    --text-muted: #8e8e8a;
    /* 绿在暗面必须提亮才能作文字色：--accent 用在浅绿底上，--accent-dark 用在卡片上 */
    --accent: #8fc9ab;
    --accent-light: #23332b;
    --accent-dark: #8ab99c;
    --header-from: #37604f;
    --header-to: #23443a;
    --warm: #d4a97e;
    --warm-light: #33291f;
    --danger: #d08b86;
    --danger-light: #35292a;
    --border: #2e3236;
    /* 主按钮：暗面用深绿底 + 白字，才够对比 */
    --btn-primary-bg: #2e5145;
    --btn-primary-bg-hover: #38604f;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.32);
    --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.4);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent-light);
  color: var(--text);
}

:focus-visible {
  outline: 2px solid var(--accent-dark);
  outline-offset: 2px;
  border-radius: 4px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  /* 用主按钮同款底：--accent-dark 在暗面会提亮成正文绿，白字压上去只有 2.2:1 */
  background: var(--btn-primary-bg);
  color: #fff;
  text-decoration: none;
}

.skip-link:focus {
  left: 0;
}

/* ============ 外壳：手机优先，桌面居中一栏 ============ */

.app {
  max-width: var(--app-max);
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
  padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom));
}

@media (min-width: 600px) {
  body {
    background: #f1ede6;
  }

  .app {
    box-shadow: var(--shadow-lg);
  }
}

/* ============ 顶栏 ============ */

.app-header {
  /* 显式声明底色：渐变之上仍有一个可被对比度工具读到的实色 */
  background-color: var(--header-to);
  background-image: linear-gradient(135deg, var(--header-from) 0%, var(--header-to) 100%);
  color: #fff;
  padding: 28px 20px 32px;
  position: relative;
  overflow: hidden;
}

.app-header::after {
  content: "";
  position: absolute;
  right: -46px;
  top: -46px;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
}

.header-inner {
  position: relative;
  z-index: 1;
}

.app-title {
  margin: 0 0 6px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.app-date {
  margin: 0;
  font-size: 13.5px;
  opacity: 0.9;
  font-variant-numeric: tabular-nums;
}

/* ============ 主体 ============ */

.app-main {
  padding: 16px var(--pad) 24px;
  margin-top: -14px;
  position: relative;
  z-index: 2;
}

.view:focus {
  outline: none;
}

.section-label {
  margin: 22px 4px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

/* ============ 卡片 ============ */

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* 今日打卡 */
.checkin-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
}

.ring {
  width: 56px;
  height: 56px;
  flex: none;
  position: relative;
}

.ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track {
  fill: none;
  stroke: var(--accent-light);
  stroke-width: 4;
}

.ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 320ms ease-out;
}

.ring-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-num);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-dark);
  font-variant-numeric: tabular-nums;
}

.checkin-meta h2 {
  margin: 0 0 2px;
  font-size: 15.5px;
  font-weight: 600;
}

.checkin-meta p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.checkin-meta .streak-num {
  font-family: var(--font-num);
  font-weight: 700;
  color: var(--accent-dark);
  font-variant-numeric: tabular-nums;
}

/* 补充剂卡片 */
.rx-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rx {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  transition: box-shadow 160ms ease-out, opacity 160ms ease-out;
}

.rx:hover {
  box-shadow: var(--shadow-lg);
}

/* 打卡圆按钮 */
.rx-mark {
  appearance: none;
  width: 30px;
  height: 30px;
  flex: none;
  margin-top: 2px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--card);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  transition: background-color 160ms ease-out, border-color 160ms ease-out;
}

.rx-mark:hover {
  border-color: var(--accent);
}

.rx-mark .tick {
  width: 16px;
  height: 16px;
  stroke: #fff;
  opacity: 0;
  transition: opacity 140ms ease-out;
}

.rx-mark[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
}

.rx-mark[aria-pressed="true"] .tick {
  opacity: 1;
}

.rx-mark[disabled] {
  cursor: not-allowed;
  border-style: dashed;
  opacity: 0.5;
}

.rx-body {
  min-width: 0;
  flex: 1;
}

.rx-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rx-name {
  margin: 0;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.35;
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
  padding: 1px 8px;
  border-radius: 20px;
  background: var(--warm-light);
  color: var(--warm);
  white-space: nowrap;
}

.badge-off {
  background: var(--border);
  color: var(--text-secondary);
}

.rx-sub {
  margin: 5px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: baseline;
}

.rx-sub .sep {
  color: var(--border);
}

.rx-state {
  margin: 5px 0 0;
  font-size: 12.5px;
  font-weight: 600;
}

.rx-state.is-taken {
  color: var(--accent-dark);
}

.rx-state.is-pending {
  color: var(--warm);
}

.rx-state.is-overdue {
  color: var(--danger);
}

.rx-state.is-off {
  /* --text-muted 只有 3.45:1，不足以承载信息文字（这条文案就是信息）。
     该档灰仅限纯装饰用途。 */
  color: var(--text-secondary);
  font-weight: 400;
}

/* 未来日期（明日计划 / 日历里点开的未来某天）：绿色表示计划，红色才表示问题 */
.rx-state.is-future {
  color: var(--accent-dark);
}

/* 只读卡片：可看不可记。去掉阴影、压淡，与「今天要执行」的卡片明确区分。 */
.rx.is-readonly {
  box-shadow: none;
  border: 1px dashed var(--border);
  background: var(--card);
}

.rx-mark-ghost {
  width: 30px;
  height: 30px;
  flex: none;
  margin-top: 2px;
  border-radius: 50%;
  border: 2px dashed var(--border);
  opacity: 0.55;
}

/* ---------- 明日计划卡 ---------- */

.tomorrow-card {
  margin-top: 22px;
  padding: 16px;
  background: var(--accent-light);
  box-shadow: none;
}

.tomorrow-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.tomorrow-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.tomorrow-date {
  font-family: var(--font-num);
  font-size: 12.5px;
  color: var(--accent-dark);
  font-variant-numeric: tabular-nums;
}

.tomorrow-count {
  margin: 0 0 10px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.tomorrow-empty {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.tomorrow-next {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--accent-dark);
}

.rx.is-off .rx-name {
  color: var(--text-secondary);
}

.rx-caution {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--text-secondary);
  background: var(--danger-light);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  line-height: 1.5;
}

.rx-caution b {
  color: var(--danger);
}

/* 服用时间建议 */
.tips-card {
  background: var(--warm-light);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 22px;
}

.tips-card h2 {
  margin: 0 0 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--warm);
}

.tips-card ul {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.tips-card li + li {
  margin-top: 3px;
}

/* ============ 月历热力图 ============ */

.cal-card {
  padding: 16px;
}

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.cal-title {
  font-size: 15px;
  font-weight: 600;
}

.cal-nav-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cal-nav,
.cal-today {
  appearance: none;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  padding: 0 10px;
}

.cal-nav {
  font-size: 17px;
  line-height: 1;
}

.cal-nav:hover,
.cal-today:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

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

.cal-week {
  margin-bottom: 4px;
}

.cal-week span {
  text-align: center;
  font-size: 11.5px;
  color: var(--text-muted);
}

.cal-cell {
  appearance: none;
  aspect-ratio: 1.5;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-num);
  font-size: 13.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  transition: background-color 140ms ease-out;
}

/* 热力五档：同一主色的明度阶梯，与参考实现的图例同构。
   档位 0 必须一眼看出「有记录但少」，否则与「未到」的空白无法区分。 */
.cal-cell.heat-0,
.cal-scale .heat-0 { background: #cfe2d7; color: #2f5c48; }
.cal-cell.heat-1,
.cal-scale .heat-1 { background: #aed2bd; color: #234b39; }
.cal-cell.heat-2,
.cal-scale .heat-2 { background: #86b89e; color: #ffffff; }
.cal-cell.heat-3,
.cal-scale .heat-3 { background: #6aa287; color: #ffffff; }
.cal-cell.heat-4,
.cal-scale .heat-4 { background: var(--accent); color: #ffffff; }

.cal-cell.is-blank,
.cal-cell.is-future {
  background: transparent;
  color: var(--text-muted);
  opacity: 0.4;
  cursor: default;
}

.cal-cell.is-nodue {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  cursor: default;
}

.cal-cell.is-today {
  box-shadow: inset 0 0 0 2px var(--accent-dark);
  font-weight: 700;
}

.cal-cell.is-picked {
  box-shadow: inset 0 0 0 2px var(--accent-dark), 0 0 0 2px var(--card),
    0 0 0 4px var(--accent-dark);
  font-weight: 700;
}

.cal-scale {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

.cal-scale i {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: block;
}

/* 单日明细面板 */
.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.day-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.day-close {
  appearance: none;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 12.5px;
  cursor: pointer;
}

.day-close:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

/* ============ 统计 ============ */

.stats-card {
  padding: 18px 16px;
  text-align: center;
}

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

.stat-num {
  display: block;
  font-family: var(--font-num);
  font-size: 23px;
  font-weight: 700;
  color: var(--accent-dark);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.stat-label {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* ============ 执行网格 ============ */

.grid-card {
  padding: 8px 4px 10px;
  overflow: hidden;
}

.grid-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 4px;
}

table.grid {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 12px;
}

table.grid th,
table.grid td {
  padding: 0;
  text-align: center;
}

table.grid thead th {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 11px;
  padding: 6px 0;
  white-space: nowrap;
}

table.grid thead th.is-today {
  color: var(--accent-dark);
  font-weight: 700;
}

/* 日期列表头与行标签同宽，否则表头会与数据行错位一格 */
table.grid thead th:first-child {
  width: 96px;
  min-width: 96px;
  position: sticky;
  left: 0;
  background: var(--card);
  z-index: 3;
}

table.grid tbody th {
  text-align: left;
  padding: 8px 10px 8px 4px;
  font-weight: 500;
  font-size: 12.5px;
  white-space: nowrap;
  position: sticky;
  left: 0;
  background: var(--card);
  z-index: 2;
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
}

table.grid tbody th .cell-freq {
  display: block;
  font-size: 10.5px;
  color: var(--text-secondary);
  font-family: var(--font-num);
}

table.grid td {
  width: 24px;
  min-width: 24px;
}

/* 窄屏：行标签允许换行而不是被截成「复合维生素B..」 */
@media (max-width: 640px) {
  table.grid thead th:first-child {
    width: 104px;
    min-width: 104px;
  }

  table.grid tbody th {
    max-width: 104px;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    font-size: 11.5px;
    line-height: 1.3;
    padding: 7px 8px 7px 2px;
  }

  table.grid tbody th .cell-freq {
    font-size: 10px;
  }

  table.grid td {
    width: 23px;
    min-width: 23px;
  }

  /* 日历格子：390px 宽下 7 列只有 ~47px，用最小高度保住触控尺寸 */
  .cal-cell {
    aspect-ratio: auto;
    min-height: 44px;
    font-size: 13px;
  }

  .cell {
    width: 21px;
    height: 21px;
    margin: 3px auto;
  }

  .stat-num {
    font-size: 21px;
  }

  .stat-label {
    font-size: 11px;
  }
}

.cell {
  appearance: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin: 3px auto;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-family: var(--font-num);
  font-size: 11px;
  cursor: pointer;
  padding: 0;
  transition: background-color 140ms ease-out;
}

.cell.is-picked {
  box-shadow: 0 0 0 2px var(--accent-dark);
}

.cell.is-taken {
  background: var(--accent);
  color: #fff;
}

.cell.is-taken .tick {
  width: 12px;
  height: 12px;
  stroke: #fff;
}

.cell.is-missed {
  background: var(--danger-light);
  color: var(--danger);
  font-weight: 700;
}

/* 未来日期的计划格：绿色空心圈，可点开看计划，但记录不进去 */
.cell.is-future {
  border: 1px solid var(--accent);
  color: var(--accent-dark);
  cursor: pointer;
}

.cell.is-future:hover {
  background: var(--accent-light);
}

.cell.is-off {
  color: var(--border);
  cursor: default;
}

.cell:disabled {
  cursor: default;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 12px 4px 0;
  padding: 0;
  list-style: none;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend .key {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-family: var(--font-num);
  font-size: 10px;
  flex: none;
}

.key-taken {
  background: var(--accent);
  color: #fff;
}

.key-missed {
  background: var(--danger-light);
  color: var(--danger);
  font-weight: 700;
}

.key-future {
  border: 1px solid var(--accent);
  color: var(--accent-dark);
}

.key-off {
  color: var(--border);
  border: 1px solid var(--border);
}

/* 日期范围切换 */
.seg {
  display: flex;
  gap: 8px;
  margin: 14px 0 0;
}

.seg button {
  appearance: none;
  flex: 1;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
}

.seg button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.seg-note {
  margin: 8px 2px 0;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ============ 设置 ============ */

.plan-item {
  padding: 16px;
}

.plan-item + .plan-item {
  margin-top: 10px;
}

.plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.plan-name {
  font-size: 15px;
  font-weight: 600;
}

.plan-freq {
  font-size: 12px;
  color: var(--accent-dark);
  background: var(--accent-light);
  padding: 2px 9px;
  border-radius: 20px;
  white-space: nowrap;
  font-weight: 600;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

.field > label,
.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.field-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.field-row > .field {
  flex: 1 1 130px;
  min-width: 0;
}

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-height: 44px;
  width: 100%;
}

textarea {
  min-height: 68px;
  resize: vertical;
  line-height: 1.5;
}

input:disabled,
select:disabled {
  color: var(--text-muted);
}

.weekdays {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.wd {
  appearance: none;
  flex: 1 1 auto;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
}

.wd[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  min-height: 44px;
}

.switch input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.btn {
  appearance: none;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 16px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:hover {
  border-color: var(--accent);
}

.btn-primary {
  background: var(--btn-primary-bg);
  border-color: var(--btn-primary-bg);
  color: #fff;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--btn-primary-bg-hover);
  border-color: var(--btn-primary-bg-hover);
}

.btn-danger {
  color: var(--danger);
  border-color: var(--danger-light);
  background: var(--danger-light);
  font-weight: 500;
}

.btn-block {
  width: 100%;
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.btn-row > .btn {
  flex: 1 1 130px;
}

/* 数据管理 / 安全提醒 */
.info-card {
  padding: 16px;
}

.info-card p {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.safety-card {
  background: var(--warm-light);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 22px;
}

.safety-card h2 {
  margin: 0 0 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--warm);
}

.safety-card ol {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.safety-card li + li {
  margin-top: 5px;
}

/* 空状态 */
.empty {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 18px;
  text-align: center;
}

.empty h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.empty p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ============ 底部导航 ============ */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: var(--app-max);
  margin: 0 auto;
  background: var(--card);
  border-top: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.06);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  z-index: 100;
}

.nav-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 18px;
  min-height: 44px;
  border-radius: var(--radius-sm);
}

.nav-btn svg {
  width: 21px;
  height: 21px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

.nav-btn[aria-selected="true"] {
  color: var(--accent-dark);
  font-weight: 600;
}

/* 提示条 */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 16px);
  transform: translateX(-50%) translateY(8px);
  background: rgba(44, 44, 44, 0.94);
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease-out, transform 180ms ease-out;
  z-index: 150;
  max-width: calc(100vw - 32px);
}

.toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
