/* 药安心 · 全局样式 —— 适老化设计（工信部适老化规范：正文≥24px、高对比、大按钮） */
:root {
  --brand: #E8722A;          /* 主色·暖橙 */
  --brand-dark: #C75A18;
  --brand-light: #FDEBDD;
  --bg: #FFF9F2;             /* 米白背景 */
  --card: #FFFFFF;
  --ink: #2B2118;            /* 高对比正文 */
  --ink-2: #5C5044;          /* 次要文字 */
  --danger: #C62828;         /* 医嘱/警示红 */
  --ok: #2E7D32;             /* 完成绿 */
  --line: #EBDFD2;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(90, 60, 30, .08);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 18px; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg); color: var(--ink);
  min-height: 100vh; line-height: 1.6;
}
.container { max-width: 520px; margin: 0 auto; padding: 0 16px 90px; }

/* 顶部导航 */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--brand); color: #fff;
  padding: 14px 16px; display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow);
}
.nav .logo { font-size: 1.25rem; font-weight: 700; letter-spacing: 1px; }
.nav .sub { font-size: .8rem; opacity: .9; }
.nav .spacer { flex: 1; }
.nav button, .nav a {
  background: rgba(255,255,255,.18); color: #fff; border: none;
  padding: 8px 14px; border-radius: 10px; font-size: .9rem; cursor: pointer;
  text-decoration: none; display: inline-block;
}

/* 大按钮 */
.btn {
  display: block; width: 100%; border: none; cursor: pointer;
  background: var(--brand); color: #fff;
  font-size: 1.3rem; font-weight: 700;
  padding: 18px 20px; border-radius: var(--radius);
  margin: 14px 0; text-align: center; text-decoration: none;
  box-shadow: 0 3px 0 var(--brand-dark);
  transition: transform .05s;
}
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn.secondary { background: #fff; color: var(--brand); border: 2px solid var(--brand); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--ink-2); border: 2px solid var(--line); box-shadow: none; font-size: 1.05rem; padding: 12px; }
.btn.small { width: auto; display: inline-block; font-size: 1rem; padding: 10px 18px; margin: 6px 4px 6px 0; }
.btn.danger { background: var(--danger); box-shadow: 0 3px 0 #8E1B1B; }
.btn.ok { background: var(--ok); box-shadow: 0 3px 0 #1B5E20; }
.btn:disabled { opacity: .5; box-shadow: none; cursor: not-allowed; }

/* 卡片 */
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 20px; margin: 14px 0; box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.card h2 { font-size: 1.35rem; margin-bottom: 10px; }
.card h3 { font-size: 1.15rem; margin-bottom: 8px; }

/* 表单 */
.field { margin: 14px 0; }
.field label { display: block; font-size: 1.05rem; font-weight: 600; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; font-size: 1.15rem; padding: 14px;
  border: 2px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--ink); font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); }

/* 角色选择卡片 */
.role-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin: 10px 0; }
.role-grid .role {
  border: 2px solid var(--line); border-radius: 12px; background: #fff;
  padding: 14px 6px; text-align: center; cursor: pointer; font-size: 1rem; font-weight: 600;
}
.role-grid .role .emoji { font-size: 1.8rem; display: block; margin-bottom: 4px; }
.role-grid .role.active { border-color: var(--brand); background: var(--brand-light); color: var(--brand-dark); }

/* 提示条 */
.notice { background: var(--brand-light); border-left: 5px solid var(--brand); border-radius: 8px; padding: 12px 14px; margin: 12px 0; font-size: 1rem; }
.notice.red { background: #FDECEA; border-left-color: var(--danger); color: var(--danger); font-weight: 700; }
.notice.green { background: #E8F5E9; border-left-color: var(--ok); color: var(--ok); }

/* 用药卡（老人端大字） */
.medcard { background: #fff; border-radius: 20px; padding: 24px; margin: 16px 0; box-shadow: var(--shadow); border: 2px solid var(--line); }
.medcard .drug-name { font-size: 1.7rem; font-weight: 800; color: var(--ink); }
.medcard .drug-sub { color: var(--ink-2); font-size: 1rem; margin: 4px 0 12px; }
.medcard .row { display: flex; gap: 10px; padding: 10px 0; border-top: 1px dashed var(--line); font-size: 1.25rem; }
.medcard .row .k { flex: 0 0 5.5em; color: var(--ink-2); font-weight: 600; }
.medcard .row .v { flex: 1; font-weight: 700; }
.doctor-advice {
  background: #FDECEA; border: 2px solid var(--danger); border-radius: 12px;
  padding: 14px; margin-bottom: 14px;
}
.doctor-advice .tag { color: var(--danger); font-weight: 800; font-size: 1.1rem; }
.doctor-advice .text { font-size: 1.3rem; font-weight: 700; color: var(--danger); margin-top: 4px; }
.badge { display: inline-block; font-size: .8rem; padding: 3px 10px; border-radius: 20px; font-weight: 700; }
.badge.reviewed { background: #E8F5E9; color: var(--ok); }
.badge.confirmed { background: #FFF3E0; color: #B26A00; }

/* 时段分组（今日服药） */
.slot-group { margin: 18px 0; }
.slot-title { font-size: 1.4rem; font-weight: 800; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.dose-item {
  background: #fff; border: 2px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 10px 0; display: flex; align-items: center; gap: 14px;
}
.dose-item .info { flex: 1; }
.dose-item .name { font-size: 1.3rem; font-weight: 700; }
.dose-item .dose { font-size: 1.1rem; color: var(--ink-2); }
.dose-item.done { border-color: var(--ok); background: #F1F8F2; }
.dose-item .check-btn {
  flex: 0 0 auto; width: 96px; height: 64px; border: none; border-radius: 14px;
  background: var(--brand); color: #fff; font-size: 1.15rem; font-weight: 700; cursor: pointer;
}
.dose-item.done .check-btn { background: var(--ok); }

/* 底部标签栏 */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  background: #fff; border-top: 1px solid var(--line);
  display: flex; max-width: 520px; margin: 0 auto;
}
.tabbar a {
  flex: 1; text-align: center; padding: 10px 0 14px; text-decoration: none;
  color: var(--ink-2); font-size: .85rem; font-weight: 600;
}
.tabbar a .ico { font-size: 1.5rem; display: block; }
.tabbar a.active { color: var(--brand); }

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%);
  background: rgba(30,20,10,.92); color: #fff; padding: 14px 22px;
  border-radius: 14px; font-size: 1.1rem; z-index: 999; display: none;
  max-width: 86%; text-align: center;
}

/* 语音播报按钮 */
.speak-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--brand-light); color: var(--brand-dark);
  border: 2px solid var(--brand); border-radius: 12px;
  font-size: 1.1rem; font-weight: 700; padding: 10px 16px; cursor: pointer;
}

/* 列表 */
.list-item { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 10px 0; display: flex; align-items: center; gap: 12px; }
.list-item .grow { flex: 1; }
.muted { color: var(--ink-2); font-size: .95rem; }
.center { text-align: center; }
.mt { margin-top: 16px; }
.hidden { display: none !important; }
.spinner { display: inline-block; width: 22px; height: 22px; border: 3px solid var(--brand-light); border-top-color: var(--brand); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 桌面端放宽 */
@media (min-width: 768px) {
  .container { max-width: 640px; }
  .tabbar { max-width: 640px; }
}
