/* ============ 本地自托管字体（英文/数字 D-DIN） ============ */
@font-face { font-family: 'D-DIN'; src: url('fonts/D-DIN-PRO-Condensed-400-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'D-DIN'; src: url('fonts/D-DIN-PRO-Condensed-500-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'D-DIN'; src: url('fonts/D-DIN-PRO-Condensed-700-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'D-DIN'; src: url('fonts/D-DIN-PRO-Condensed-900-Heavy.woff2') format('woff2'); font-weight: 900; font-display: swap; }

/* ============ 基础 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
body {
  font-family: 'D-DIN', 'PingFang SC', 'HarmonyOS Sans SC', 'Microsoft YaHei', system-ui, -apple-system, sans-serif;
  font-size: 16px; line-height: 1.55;
  background: var(--bg); color: var(--text);
  transition: background .25s, color .25s;
  min-height: 100vh;
}
.hidden { display: none !important; }
a { color: inherit; text-decoration: none; }

/* ============ 六套主题 ============ */
/* 深色系：深蓝科技 / 墨绿森林 / 玫瑰品红；浅色系：经典蓝白 / 暖阳琥珀 / 清澈青碧 */
:root, [data-theme="dark"] {
  --bg: #0B1220; --card: #131F36; --card2: #1A2A45; --line: #243450;
  --primary: #38BDF8; --primary2: #6366F1; --deep: #7DD3FC;
  --text: #E8F1FB; --text2: #8FA6C0; --text3: #5A6E8A;
  --low: #A78BFA; --ok: #34D399; --high: #FBBF24; --danger: #FB7185;
  --shadow: rgba(0,0,0,.4);
}
[data-theme="blue"] {
  --bg: #F2F7FE; --card: #FFFFFF; --card2: #EAF2FC; --line: #DEE9F8;
  --primary: #1D6FE0; --primary2: #4D94F0; --deep: #0E4C9E;
  --text: #13203C; --text2: #56688C; --text3: #93A3C2;
  --low: #8B5CF6; --ok: #16A34A; --high: #F59E0B; --danger: #DC2626;
  --shadow: rgba(19,32,60,.08);
}
[data-theme="amber"] {
  --bg: #FFF5E6; --card: #FFFFFF; --card2: #FDEFD8; --line: #F2E0C6;
  --primary: #C96F1F; --primary2: #EE9D2D; --deep: #9A4E12;
  --text: #3A1C0A; --text2: #7A5A3A; --text3: #B39678;
  --low: #7C5CFC; --ok: #2F8F5B; --high: #E8890C; --danger: #D64545;
  --shadow: rgba(58,28,10,.08);
}
[data-theme="teal"] {
  --bg: #EFFAF9; --card: #FFFFFF; --card2: #E2F4F1; --line: #CBE8E2;
  --primary: #0E9384; --primary2: #2BB6A6; --deep: #0A5E57;
  --text: #0F2B2B; --text2: #4F7472; --text3: #82A5A2;
  --low: #7C5CFC; --ok: #0FA573; --high: #E8A020; --danger: #E2545E;
  --shadow: rgba(15,43,43,.08);
}
[data-theme="rose"] {
  --bg: #230D17; --card: #311322; --card2: #3E192A; --line: #522138;
  --primary: #F472B6; --primary2: #FB7185; --deep: #F9A8D4;
  --text: #FBEAF2; --text2: #C08BA6; --text3: #8A5B72;
  --low: #C084FC; --ok: #34D399; --high: #FBBF24; --danger: #F87171;
  --shadow: rgba(0,0,0,.4);
}
[data-theme="forest"] {
  --bg: #0A1B12; --card: #11261A; --card2: #17301F; --line: #1F3A28;
  --primary: #4ADE80; --primary2: #2DD4A7; --deep: #86EFAC;
  --text: #E6F4EA; --text2: #8FB49B; --text3: #55745F;
  --low: #A3E635; --ok: #34D399; --high: #FBBF24; --danger: #F87171;
  --shadow: rgba(0,0,0,.4);
}

/* ============ 图标 ============ */
.icon { width: 18px; height: 18px; flex-shrink: 0; display: inline-block; vertical-align: -0.15em; }
.icon-sm { width: 15px; height: 15px; }

/* ============ 登录页（无卡片） ============ */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: linear-gradient(160deg, var(--bg), var(--card));
}
.login-inner { width: 100%; max-width: 340px; }
.login-logo { text-align: center; margin-bottom: 10px; }
.login-title { text-align: center; font-size: 29px; font-weight: 700; color: var(--deep); letter-spacing: 1px; }
.login-sub { text-align: center; color: var(--text2); font-size: 14px; margin: 6px 0 28px; letter-spacing: 2px; padding: 0 2px; overflow-wrap: break-word; }
.login-tabs { display: flex; margin-bottom: 24px; background: var(--card2); border-radius: 8px; padding: 4px; }
.login-tab { flex: 1; border: none; background: transparent; color: var(--text2); padding: 10px 0; border-radius: 8px; font-size: 16px; cursor: pointer; transition: all .2s; }
.login-tab.active { background: linear-gradient(135deg, var(--primary), var(--primary2)); color: #fff; font-weight: 600; box-shadow: 0 4px 14px var(--shadow); }
.login-error { color: var(--danger); font-size: 14px; min-height: 18px; margin-top: 12px; text-align: center; }

/* 下划线式输入框（登录/注册） */
.input-line {
  width: 100%; background: transparent; border: none; border-bottom: 1.5px solid var(--line);
  color: var(--text); padding: 11px 2px; font-size: 16px; outline: none;
  transition: border-color .2s; border-radius: 0; margin-bottom: 14px;
}
.input-line:focus { border-bottom-color: var(--primary); }
.input-line::placeholder { color: var(--text3); }

/* ============ 主布局 ============ */
.topbar {
  position: sticky; top: 0; z-index: 50; background: var(--card);
  border-bottom: 1px solid var(--line); backdrop-filter: blur(8px);
}
.topbar-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 20px; padding: 10px 20px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; color: var(--deep); }
.nav-desktop { display: flex; gap: 2px; flex: 1; }
.nav-desktop a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 8px; font-size: 15px; color: var(--text2); }
.nav-desktop a:hover { color: var(--text); background: var(--card2); }
.nav-desktop a.active { color: var(--primary); font-weight: 600; background: var(--card2); }
.nav-desktop a .icon { width: 16px; height: 16px; }
.user-box { display: flex; align-items: center; gap: 10px; }
.username { color: var(--text2); font-size: 14px; }

/* 手机端 Hero 顶栏（原 mobile-header 已并入 hero） */
.mobile-hero { display: none; }
.hero-inner { display: none; }

.content { max-width: 1100px; margin: 0 auto; padding: 20px; }
.page { display: block; }

/* ============ 卡片 / 表单 ============ */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 18px; margin-bottom: 16px; box-shadow: 0 2px 10px var(--shadow);
}
.card-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 12px; }
.card-title .icon { width: 17px; height: 17px; color: var(--primary); }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.card-head .card-title { margin-bottom: 0; }
.tip { color: var(--text2); font-size: 14px; line-height: 1.6; display: flex; align-items: center; gap: 8px; }
.tip .icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--text3); }
.card.tip { padding: 14px 16px; }

.form-card { margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 0; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 14px; color: var(--text2); }
.field-submit { justify-content: flex-end; padding-bottom: 16px; }
.input {
  width: 100%; background: var(--card2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 11px 12px; font-size: 16px; outline: none;
  transition: border-color .2s; min-height: 42px;
}
.input:focus { border-color: var(--primary); }
.input-sm { width: auto; padding: 7px 10px; font-size: 16px; min-height: 34px; }
select.input {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-color: var(--card2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238B93A6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 32px; cursor: pointer;
}
input[type="date"].input, input[type="time"].input, input[type="datetime-local"].input, input[type="month"].input { color-scheme: inherit; }
.input[readonly] { opacity: .7; }

.btn {
  border: none; border-radius: 8px; padding: 10px 18px; font-size: 15px; cursor: pointer;
  background: var(--card2); color: var(--text); transition: opacity .15s, transform .1s;
  display: inline-flex; align-items: center; gap: 8px; justify-content: center; min-height: 42px;
}
.btn:hover { opacity: .85; }
.btn:active { transform: scale(.97); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary2)); color: #fff; font-weight: 600; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--text2); }
.btn-danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ============ 页内 Tab ============ */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 5px; }
.tab { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none; background: transparent; color: var(--text2); padding: 10px 0; border-radius: 8px; font-size: 15px; cursor: pointer; }
.tab .icon { width: 16px; height: 16px; }
.tab.active { background: linear-gradient(135deg, var(--primary), var(--primary2)); color: #fff; font-weight: 600; }
.tab-panel { display: block; }

/* ============ 列表 ============ */
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  display: flex; align-items: center; gap: 12px; background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px;
}
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 600; font-size: 16px; }
.list-sub { color: var(--text2); font-size: 13px; margin-top: 2px; }
.badge-low { background: var(--low); color: #fff; }
.badge-ok { background: var(--ok); color: #fff; }
.badge-high { background: var(--high); color: #fff; }
.badge-danger { background: var(--danger); color: #fff; }
.lv-low { color: var(--low); }
.lv-high { color: var(--high); }
.lv-danger { color: var(--danger); }
.list-actions { display: flex; gap: 8px; }
.icon-btn { border: none; background: var(--card2); color: var(--text2); border-radius: 8px; width: 32px; height: 32px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { color: var(--danger); }
.icon-btn .icon { width: 15px; height: 15px; }
.value-dot { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0; }

/* ============ 统计卡 ============ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat-card { background: var(--card2); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.stat-label { font-size: 13px; color: var(--text2); }
.stat-value { font-size: 31px; font-weight: 700; color: var(--deep); margin: 4px 0 2px; }
.stat-unit { font-size: 13px; color: var(--text3); }
.stat-meta { font-size: 13px; color: var(--text2); margin-top: 2px; }
.stat-unit-inline { font-size: 14px; font-weight: 400; color: var(--text2); margin-left: 8px; letter-spacing: .2px; }

/* ============ 图表 ============ */
.chart { width: 100%; height: 320px; }
.chart-sm { height: 260px; }
.chart-xs { height: 220px; }

/* ============ 日历 ============ */
.calendar { width: 100%; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head { text-align: center; font-size: 12px; color: var(--text3); padding: 6px 0; }
.cal-day { border-radius: 8px; aspect-ratio: 1 / 1; padding: 4px; border: 1px solid var(--line); background: var(--card); display: flex; flex-direction: column; gap: 0; overflow: hidden; min-height: 0; }
.cal-day.empty { border-color: transparent; background: transparent; }
.cal-date { font-size: 11px; color: var(--text3); line-height: 1.2; }
.cal-value { font-size: 17px; font-weight: 700; flex: 1; display: flex; align-items: center; justify-content: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.1; min-height: 0; }
.lv-low { color: var(--low); }
.lv-high { color: var(--high); }
.lv-danger { color: var(--danger); }
.lv-ok { color: var(--ok); }
.cal-summary { margin-top: 10px; font-size: 14px; color: var(--text2); text-align: center; }
.cal-summary b { color: var(--primary); font-weight: 700; font-family: 'D-DIN', sans-serif; letter-spacing: .3px; }
.cal-day .med-mark { display: flex; align-items: center; justify-content: center; min-height: 0; flex: 1; }
.cal-day .med-mark.done { width: 18px; height: 18px; border-radius: 50%; background: var(--ok); color: #fff; flex: none; margin: 1px auto 0; }
.cal-day .med-mark.done .icon { width: 11px; height: 11px; }
.cal-day .med-mark.miss { width: 8px; height: 8px; min-height: 0; border-radius: 50%; border: 1.5px solid var(--text3); background: transparent; flex: none; margin: 1px auto 0; }
.cal-day.today { border-color: var(--primary); }

/* ============ 主题选择 ============ */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.theme-item { border: 2px solid var(--line); border-radius: 8px; padding: 10px; cursor: pointer; background: var(--card); transition: border-color .2s; }
.theme-item.active { border-color: var(--primary); }
.theme-swatches { display: flex; gap: 4px; margin-bottom: 8px; }
.theme-swatch { flex: 1; height: 22px; border-radius: 8px; }
.theme-name { font-size: 14px; color: var(--text2); }

/* ============ 提醒 / 弹层 ============ */
.remind-toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 200;
  width: min(360px, calc(100vw - 32px)); background: var(--card); border: 1px solid var(--primary);
  border-radius: 8px; box-shadow: 0 12px 40px var(--shadow); padding: 14px 16px;
}
.remind-title { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.remind-text { font-size: 15px; color: var(--text); margin-bottom: 10px; }
.remind-actions { display: flex; gap: 8px; justify-content: flex-end; }
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%); z-index: 300;
  background: var(--deep); color: #fff; padding: 10px 20px; border-radius: 8px; font-size: 14px;
  box-shadow: 0 6px 20px var(--shadow); white-space: nowrap;
}

/* ============ 监护 ============ */
.code-box { display: flex; align-items: center; gap: 12px; }
.code-text { font-size: 25px; font-weight: 700; color: var(--primary); letter-spacing: 3px; }
.watch-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.watch-item { display: flex; align-items: center; justify-content: space-between; background: var(--card2); border-radius: 8px; padding: 10px 14px; }

/* ============ 报告 / 数据 ============ */
.report-actions, .data-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* 今日打卡（选择药品版） */
.med-today { display: flex; flex-direction: column; gap: 8px; margin-top: 0; }
.med-chip { display: flex; align-items: center; justify-content: space-between; background: var(--card2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; font-size: 14px; }
.med-chip .taken { color: var(--ok); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.med-chip .untaken { color: var(--text3); }
.med-chip button { border: 1px solid var(--line); background: var(--card); color: var(--text2); border-radius: 8px; padding: 4px 12px; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.med-chip button.done { border-color: var(--ok); color: var(--ok); }

/* 用药统计表 */
.med-stats-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.med-stats-table th, .med-stats-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); }
.med-stats-table th { color: var(--text2); font-weight: 500; }
.rate-ok { color: var(--ok); font-weight: 600; }
.rate-warn { color: var(--high); font-weight: 600; }

/* ============ 移动端 ============ */
.tabbar { display: none; }

@media (max-width: 768px) {
  .topbar { display: none; }
  .mobile-hero {
    display: block; position: sticky; top: 0; z-index: auto;
    height: 122px;
    background-image: linear-gradient(165deg, var(--primary) 0%, var(--deep) 140%);
    background-size: 100% 122px; background-position: 0 0; background-repeat: no-repeat;
    color: #fff;
    border-radius: 0 0 32px 32px;
    box-shadow: 0 6px 18px var(--shadow);
  }
  .mobile-hero::before { content: ''; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(rgba(10,16,28,.20), rgba(10,16,28,.06)); pointer-events: none; }
  .hero-inner {
    position: fixed; top: 0; left: 0; right: 0; z-index: 70;
    min-height: 74px; padding: 14px 16px 12px;
    display: flex; flex-direction: column; gap: 1px;
    color: #fff;
    background-image: linear-gradient(165deg, var(--primary) 0%, var(--deep) 140%);
    background-size: 100% 122px; background-position: 0 0; background-repeat: no-repeat;
  }
  .hero-inner::before { content: ''; position: absolute; inset: 0; background: linear-gradient(rgba(10,16,28,.20), rgba(10,16,28,.06)); pointer-events: none; }
  .hero-top, .hero-greet { position: relative; z-index: 1; }
  .hero-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .hero-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .hero-logo { width: 36px; height: 24px; color: rgba(255,255,255,.98); flex-shrink: 0; }
  .hero-title { font-size: 20px; font-weight: 700; letter-spacing: .8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 3px rgba(0,0,0,.2); }
  .hero-date { font-size: 16px; font-weight: 500; letter-spacing: .3px; opacity: .92; text-shadow: 0 1px 3px rgba(0,0,0,.18); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hero-greet { padding-left: 46px; }
  .hero-user { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
  .hero-username { font-size: 14px; opacity: .95; max-width: 84px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hero-logout { width: 34px; height: 34px; border: none; background: rgba(255,255,255,.2); color: #fff; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: background .15s; }
  .hero-logout:active { background: rgba(255,255,255,.34); }
  .hero-logout .icon { width: 15px; height: 15px; }

  .content { padding: 12px 12px 92px; margin-top: -42px; position: relative; z-index: 50; }
  [data-theme="dark"] .mobile-hero, [data-theme="rose"] .mobile-hero {
    background-image: linear-gradient(165deg, var(--bg) 0%, var(--card2) 140%);
  }
  [data-theme="dark"] .hero-inner, [data-theme="rose"] .hero-inner {
    background-image: linear-gradient(165deg, var(--bg) 0%, var(--card2) 140%);
  }
  [data-theme="dark"] .hero-inner, [data-theme="rose"] .hero-inner { color: var(--text); }
  [data-theme="dark"] .hero-logo, [data-theme="rose"] .hero-logo { color: var(--primary); }
  [data-theme="dark"] .hero-title, [data-theme="rose"] .hero-title { color: var(--primary); text-shadow: none; }
  [data-theme="dark"] .hero-logout, [data-theme="rose"] .hero-logout { background: rgba(255,255,255,.14); color: var(--text); }
  [data-theme="dark"] .hero-username, [data-theme="rose"] .hero-username { color: var(--text); opacity: .9; }
  [data-theme="dark"] .hero-date, [data-theme="rose"] .hero-date { color: var(--text); text-shadow: none; }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    background: var(--card); border-top: 1px solid var(--line);
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
    justify-content: center; gap: 2px;
  }
  .tabbar-item {
    flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 4px; color: var(--text3); font-size: 12px; min-height: 44px; min-width: 66px;
    justify-content: center;
  }
  .tabbar-item .icon { width: 22px; height: 22px; }
  .tabbar-item.active { color: var(--primary); }
  .card { padding: 14px; border-radius: 8px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .chart { height: 280px; }
  .form-grid { grid-template-columns: 1fr 1fr; gap: 16px; }
  .list-item { padding: 10px 12px; }
  .value-dot { width: 38px; height: 38px; font-size: 13px; }
  .code-text { font-size: 21px; }
  .btn { min-height: 44px; }
}

@media (max-width: 480px) {
  .form-grid { grid-template-columns: 1fr; }
  .stat-card { padding: 10px 12px; }
  .stat-value { font-size: 27px; }
  .login-title { font-size: 26px; }
}

@media print {
  .topbar, .tabbar, .mobile-header, .btn, .card-head select { display: none !important; }
  .content { max-width: none; padding: 0; }
  .card { box-shadow: none; border-color: #ddd; page-break-inside: avoid; }
  body { background: #fff; }
}


/* ===== 8项改进补充：logo / 字体 / 字距 / 表格 ===== */
.login-logo svg { width: 64px; height: 43px; color: var(--primary); display: block; margin: 0 auto; }
.brand svg { width: 38px; height: 26px; color: var(--primary); }

input, select, textarea, button { font-family: inherit; }

.input, select.input, .btn, .tab, .login-tab, .nav-desktop a, .remind-title { letter-spacing: .3px; }
.stat-value { letter-spacing: .5px; }
.stat-meta, .stat-unit-inline, .list-sub { letter-spacing: .2px; }

.table-wrap { overflow-x: auto; }
.med-stats-table { white-space: nowrap; }


/* ===== 4项调整：用药统计卡片 / 按钮间距与居中 ===== */
/* 用药统计：卡片网格，不换行不滚动 */
.med-cards { display: grid; grid-template-columns: 1fr; gap: 10px; }
.med-card { background: var(--card2); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.med-card-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.med-card-name { font-weight: 600; font-size: 15px; color: var(--text); }
.med-card-dose { color: var(--text2); font-size: 13px; white-space: nowrap; }
.med-card-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.med-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 4px; background: var(--card); border-radius: 8px; min-width: 0; }
.med-cell span { font-size: 12px; color: var(--text2); white-space: nowrap; }
.med-cell b { font-size: 17px; font-weight: 700; color: var(--deep); white-space: nowrap; letter-spacing: .3px; }
.med-cell b.rate-ok { color: var(--ok); }
.med-cell b.rate-warn { color: var(--high); }
@media (min-width: 768px) { .med-cards { grid-template-columns: repeat(2, 1fr); } }

/* 记录页保存按钮：加大间距 + 居中 */
.form-card { display: flex; flex-direction: column; padding-bottom: 16px; }
.form-card > .btn { margin: 16px auto 0; }

/* 登录/注册按钮：与上方加大间距 */
.login-inner .btn-block { margin-top: 22px; }

/* 登录/注册页版权 */
.copyright { text-align: center; font-size: 12px; color: var(--text2); margin-top: 18px; letter-spacing: .3px; user-select: none; }

/* 表单栅格后按钮上间距统一 16px（设置页保存等） */
.form-grid + .btn { margin-top: 16px; }
/* form-grid 后独立字段（备注/吃了什么）上间距 16 */
.form-grid + .field { margin-top: 16px; }

/* 下拉选项样式：跟随主题 */
.input option, select.input option {
  background: var(--card); color: var(--text); font-family: inherit;
  font-size: 15px; letter-spacing: .3px; padding: 10px 12px;
}

/* 表单为卡片末元素时（提醒新增等），按钮下间距由 field-submit 16px 承担 */
.card:has(> form.form-grid:last-child) { padding-bottom: 0; }

/* ===== 大整改新增样式 ===== */
.btn-lg { min-height: 48px; font-size: 17px; }
.login-reset { text-align: center; margin-top: 14px; font-size: 14px; }
.login-reset a { color: var(--primary); text-decoration: none; }
.login-reset-title { text-align: center; font-size: 16px; font-weight: 600; color: var(--text); margin: 4px 0 14px; }
.reset-question { font-size: 15px; color: var(--text2); margin: 4px 0 12px; text-align: center; }
.card-hint { font-size: 13px; color: var(--text3); }
.hba1c-row { display: flex; flex-direction: column; gap: 12px; }
.icon-xs { width: 13px; height: 13px; }
.list-link { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.link-item { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text2); background: var(--card2); padding: 2px 8px; border-radius: 8px; }
.link-item .icon { color: var(--text3); }
.guide-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 24px; }
.guide-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 24px 20px; max-width: 360px; width: 100%; box-shadow: 0 12px 40px rgba(0,0,0,.2); }
.guide-title { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 16px; }
.guide-title .icon { width: 20px; height: 20px; color: var(--primary); }
.guide-body { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.guide-step { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--text2); line-height: 1.5; }
.guide-num { width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary2)); color: #fff; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
/* ===== 找回密码弹窗 + 自定义下拉 ===== */
.modal-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 22px 20px; max-width: 360px; width: 100%; box-shadow: 0 12px 40px rgba(0,0,0,.2); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-title { font-size: 18px; font-weight: 700; color: var(--text); }
.modal-card form + form { margin-top: 12px; }
.reset-question { font-size: 15px; color: var(--text2); margin: 4px 0 12px; }

/* 自定义下拉（移动端选项统一样式） */
.csel-hidden { display: none; }
.cselect { position: relative; width: 100%; }
.cselect-line { margin-bottom: 14px; }
.cselect-cur {
  background: var(--card2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 11px 12px; font-size: 15px; min-height: 42px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  cursor: pointer; transition: border-color .2s;
}
.cselect-cur:active { border-color: var(--primary); }
.cselect-cur-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cselect-arrow { width: 14px; height: 14px; color: var(--text3); flex-shrink: 0; }
.cselect-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 120;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  max-height: 230px; overflow-y: auto; box-shadow: 0 8px 24px var(--shadow);
}
.cselect-item { padding: 11px 14px; font-size: 15px; color: var(--text); cursor: pointer; transition: background .12s; }
.cselect-item + .cselect-item { border-top: 1px solid var(--line); }
.cselect-item.active, .cselect-item:active { background: var(--primary); color: #fff; }
/* 找回密码弹窗间距 */
.modal-card .input { margin-bottom: 14px; }
.modal-card .btn-block { margin-top: 22px; }

/* PWA 安装引导条 */
.install-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 96px; z-index: 150;
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px; box-shadow: 0 8px 24px var(--shadow);
  font-size: 14px; color: var(--text); max-width: 92vw; white-space: nowrap;
}
.install-bar .icon-btn { margin-left: 2px; }
@media (min-width: 768px) {
  .install-bar { bottom: 24px; }
}

/* ===== 找回密码弹窗美化 ===== */
.modal-overlay { padding: 20px; }
.modal-card { padding: 26px 22px; border-radius: 14px; box-shadow: 0 16px 48px rgba(0,0,0,.22); }
.modal-head { margin-bottom: 18px; }
.modal-title { display: inline-flex; align-items: center; gap: 8px; }
.modal-title-icon { width: 18px; height: 18px; color: var(--primary); }
.modal-card .icon-btn { width: 30px; height: 30px; border-radius: 8px; }
.modal-card .icon-btn:hover { background: var(--card2); }
.modal-card .input { background: var(--card2); border-radius: 10px; min-height: 44px; transition: border-color .2s, box-shadow .2s; }
.modal-card .input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.modal-card .btn-block { margin-top: 22px; min-height: 46px; border-radius: 10px; letter-spacing: 2px; font-weight: 600; }
.reset-question {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border-left: 3px solid var(--primary); border-radius: 10px;
  padding: 12px 14px; margin: 2px 0 14px; font-size: 15px; line-height: 1.6;
}
.modal-card form + form { margin-top: 0; }
.modal-card .login-error { min-height: 20px; margin: 0 0 10px; }
/* 密保问题提示条与上方按钮拉开间距 */
.reset-question { margin-top: 16px; }

/* ===== 找回密码弹窗 v2 美化 ===== */
.modal-overlay { backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal-card {
  padding: 28px 22px 24px; border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0,0,0,.24);
  animation: modalIn .28s cubic-bezier(.2,.8,.3,1);
  overflow: hidden;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(.96); } to { opacity: 1; transform: none; } }
.modal-head { text-align: center; position: relative; margin-bottom: 16px; }
.modal-close { position: absolute; top: -10px; right: -8px; width: 32px; height: 32px; border-radius: 10px; background: var(--card2); }
.modal-close:hover { background: var(--line); }
.modal-badge {
  width: 54px; height: 54px; border-radius: 50%; margin: 0 auto 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--primary) 35%, transparent);
}
.modal-badge .icon { width: 26px; height: 26px; color: #fff; }
.modal-title { font-size: 19px; font-weight: 700; color: var(--text); letter-spacing: 1px; }
.modal-sub { font-size: 13px; color: var(--text3); margin-top: 6px; letter-spacing: .3px; }
.modal-input { position: relative; margin-bottom: 14px; }
.modal-input .icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text3); pointer-events: none;
}
.modal-input .input { padding-left: 40px; background: var(--card2); border-radius: 10px; min-height: 46px; }
.modal-input .input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent); }
.reset-question {
  display: flex; align-items: center; gap: 8px; margin: 18px 0 14px;
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border-left: 3px solid var(--primary); border-radius: 10px;
  padding: 12px 14px; font-size: 15px; line-height: 1.6; text-align: left;
}
.reset-question .icon { width: 16px; height: 16px; color: var(--primary); flex-shrink: 0; }
.modal-card .btn-block { margin-top: 6px; min-height: 48px; border-radius: 12px; letter-spacing: 3px; font-weight: 700; box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 30%, transparent); }
/* 弹窗标题区左对齐 */
.modal-head { text-align: left; }
.modal-badge { margin: 0 0 12px; }
.modal-sub { margin-top: 4px; }
.modal-title { display: block; }
.modal-sub { display: block; }
.modal-head { display: block; }

/* 登录/注册页：头部整体上移 + 版权下移 */
.login-inner { margin-top: -28px; }
.copyright { margin-top: 36px; }
/* 弹窗输入框图标与文字底部对齐 */
.modal-input .icon { top: auto; bottom: 15px; transform: none; }
.modal-input .icon { bottom: 14px; }
/* 图标改为相对 input 锚定，底部对齐文字字形底 */
.modal-input .input { position: relative; }
.modal-input .icon { top: auto; bottom: 17px; transform: none; }
/* 图标用 top 精确定位：底边对齐文字字形底（input 高44 文字15 字形底距input底约16px，图标高16） */
.modal-input .icon { top: 12px; bottom: auto; }
/* 弹窗输入框：flex 消除行高基线空隙，图标底边精确对齐文字字形底（16px） */
.modal-input { display: flex; align-items: center; position: relative; margin-bottom: 14px; }
.modal-input .input { flex: 1; padding-left: 40px; }
.modal-input .icon { position: absolute; left: 13px; top: 12px; bottom: auto; transform: none; }
/* 清除弹窗 input 自带下 margin（间距由 .modal-input 容器统一控制，避免容器高度被撑高） */
.modal-card .modal-input .input { margin-bottom: 0; }
.modal-input .icon { top: 14px; }
/* 图标被 input 盖住：提升层级 */
.modal-input .icon { z-index: 1; }
/* input 恢复非定位，确保图标绘制在其上层 */
.modal-input .input { position: static; }
/* ===== 管理员：会员管理 ===== */
.admin-toolbar { margin-bottom: 12px; }
.admin-user {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border, rgba(128,128,128,.18));
}
.admin-user:last-child { border-bottom: none; }
.admin-user-info { min-width: 0; flex: 1; }
.admin-user-name { font-size: 14px; font-weight: 600; color: var(--text1); word-break: break-all; }
.admin-badge {
  display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 8px;
  background: var(--primary); color: #fff; margin-left: 6px; vertical-align: 1px;
}
.admin-user-meta { font-size: 12px; color: var(--text3); margin-top: 2px; }
.admin-user-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
/* ===== 管理员：系统设置 ===== */
#sys-panel .field { margin-bottom: 10px; }
#sys-panel .field input[type=file] { font-size: 13px; margin-top: 6px; }
.sys-preview {
  display: block; max-width: 120px; max-height: 120px; margin-top: 8px;
  border-radius: 8px; border: 1px solid var(--border, rgba(128,128,128,.25));
  object-fit: contain; background: #fff; padding: 6px;
}
.sys-preview-sm { max-width: 48px; max-height: 48px; }
/* ===== 管理员：系统设置 上传按钮/文件选择样式 ===== */
.btn-outline {
  background: transparent; color: var(--primary, #1D6FE0);
  border: 1px solid var(--primary, #1D6FE0);
}
.btn-outline:hover { background: var(--primary, #1D6FE0); color: #fff; }
.btn-outline svg.icon { width: 15px; height: 15px; margin-right: 6px; vertical-align: -2px; }

.file-btn {
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px; padding: 0 14px; height: 42px; cursor: pointer;
  background: var(--card-bg, #fff); border: 1.5px dashed var(--border, rgba(128,128,128,.35));
  border-radius: 8px; color: var(--text-2, #666); font-size: 14px;
  transition: border-color .2s, color .2s;
}
.file-btn:hover { border-color: var(--primary, #1D6FE0); color: var(--primary, #1D6FE0); }
.file-btn input { display: none; }
.file-btn .icon { width: 16px; height: 16px; color: var(--primary, #1D6FE0); }
/* ===== 管理员：系统设置 左右排列（预览图 + 上传控件） ===== */
.sys-row { display: flex; align-items: flex-start; gap: 14px; margin-top: 14px; }
.sys-row-main { flex: 1; min-width: 0; }
.sys-row-main > label[for] { display: block; font-size: 13px; color: var(--text-2, #666); margin-bottom: 8px; }
.sys-row-main .file-btn { margin-top: 0; }
.sys-thumb {
  width: 72px; height: 72px; flex: none; border-radius: 8px;
  border: 1.5px dashed var(--border, rgba(128,128,128,.35));
  background: var(--card-bg, #fff); overflow: hidden; position: relative;
  display: flex; align-items: center; justify-content: center;
}
.sys-thumb-sm { width: 56px; height: 56px; }
.sys-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sys-thumb .thumb-ph {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 11px; color: var(--text-2, #999);
}
.sys-thumb .thumb-ph .icon { width: 20px; height: 20px; color: var(--text-2, #aaa); }
.sys-thumb img:not([hidden]) ~ .thumb-ph { display: none; }
.sys-thumb img[hidden] { display: none !important; }
/* ===== 修复：.field 默认 column，sys-row 需显式 row ===== */
.sys-row { flex-direction: row; }
/* ===== 管理员：上传控件改为按钮样式 + 预览框统一 72px ===== */
#sys-panel .file-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 8px; padding: 9px 16px; cursor: pointer;
  background: var(--primary, #2f6bff); color: #fff; font-size: 13px;
  font-family: inherit; transition: opacity .15s;
}
#sys-panel .file-btn:hover { opacity: .85; }
#sys-panel .file-btn .icon { width: 15px; height: 15px; color: inherit; }
#sys-panel .file-btn input[type="file"] { display: none; }
.sys-thumb { width: 72px; height: 72px; }
/* ===== 登录页 输入框内图标 ===== */
.input-wrap { position: relative; }
.input-wrap .input-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-2, #999); pointer-events: none;
}
.input-wrap .input.has-icon { padding-left: 38px; }
/* ===== 登录页输入框图标：修正 margin 导致的中心偏移 ===== */
.input-wrap { margin-bottom: 14px; }
.input-wrap .input-line { margin-bottom: 0; }
/* ===== 自定义 Logo：CSS mask 渲染（大小/主题色可控） ===== */
.logo-mask-render {
  display: inline-block; vertical-align: middle; flex-shrink: 0;
  mask-repeat: no-repeat; -webkit-mask-repeat: no-repeat;
  mask-size: contain; -webkit-mask-size: contain;
  mask-position: center; -webkit-mask-position: center;
  background-color: var(--primary);
}
.logo-mask-render[hidden] { display: none !important; }
.login-logo .logo-mask-render { width: 64px; height: 43px; }
.brand .logo-mask-render { width: 38px; height: 26px; }
.hero-brand .logo-mask-render { width: 36px; height: 24px; background-color: rgba(255,255,255,.98); }
[data-theme="dark"] .hero-brand .logo-mask-render, [data-theme="rose"] .hero-brand .logo-mask-render { background-color: var(--primary); }
/* ===== 上传 Logo 尺寸跟随图片比例（高度固定、宽度自适应） ===== */
.login-logo .logo-mask-render { height: 43px; width: auto; }
.brand .logo-mask-render { height: 26px; width: auto; }
.hero-brand .logo-mask-render { height: 24px; width: auto; }
/* ===== 登录页 Logo 高 60px ===== */
.login-logo .logo-mask-render { height: 60px; }