/* medbox 样式 — 移动端优先，用药蓝 #1565C0 */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", sans-serif;
  background: #F5F5F0;
  color: #333;
  font-size: 16px;
  line-height: 1.5;
}
.hidden { display: none !important; }
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; background: #F5F5F0; }

/* 顶栏 */
.header {
  background: #1565C0;
  color: #fff;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}
.header .title { font-size: 18px; font-weight: 600; }
.user-bar { font-size: 13px; }
.user-bar .logout { color: #BBDEFB; margin-left: 8px; cursor: pointer; }

/* 登录/注册 */
.auth-box { padding: 60px 24px 40px; }
.auth-box h1 { font-size: 28px; text-align: center; margin-bottom: 8px; }
.subtitle { text-align: center; color: #888; font-size: 14px; margin-bottom: 32px; }
.tabs { display: flex; border-bottom: 1px solid #e0e0e0; margin-bottom: 24px; }
.tab {
  flex: 1; padding: 12px; background: none; border: none; font-size: 16px;
  color: #888; cursor: pointer; border-bottom: 2px solid transparent;
}
.tab.active { color: #1565C0; border-bottom-color: #1565C0; font-weight: 600; }
form input[type="text"], form input[type="tel"], form input[type="password"],
form input[type="datetime-local"], form select, form textarea {
  width: 100%; padding: 14px 16px; margin-bottom: 12px;
  border: 1px solid #ddd; border-radius: 8px; font-size: 16px;
  font-family: inherit; background: #fff;
}
form textarea { min-height: 72px; resize: vertical; }
form input:focus, form select:focus, form textarea:focus { outline: none; border-color: #1565C0; }
.btn-primary {
  width: 100%; padding: 14px; background: #1565C0; color: #fff;
  border: none; border-radius: 24px; font-size: 16px; font-weight: 600; cursor: pointer;
}
.btn-primary:active { background: #0D47A1; }
.btn-ghost {
  padding: 14px 24px; background: #f5f5f5; color: #666;
  border: none; border-radius: 24px; font-size: 16px; cursor: pointer;
}
.msg { color: #F44336; font-size: 14px; text-align: center; min-height: 20px; }
.disclaimer { font-size: 12px; color: #999; text-align: center; margin-top: 24px; line-height: 1.6; }

/* 主视图 & 底部 Tab 栏 */
.tab-pane { padding-bottom: 76px; }
.toolbar { padding: 16px; }
.med-list { padding: 0 16px; }
.med-card {
  background: #fff; border-radius: 12px; padding: 16px; margin-bottom: 12px;
}
.med-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid #f0f0f0; }
.med-name { font-size: 18px; font-weight: 600; }
.med-purpose { font-size: 12px; color: #1565C0; background: #E3F2FD; padding: 2px 10px; border-radius: 10px; white-space: nowrap; }
.med-row { font-size: 14px; color: #666; margin: 4px 0; }
.med-times { margin-top: 8px; }
.time-tag { display: inline-block; font-size: 13px; color: #1565C0; background: #F0F7FF; border: 1px solid #BBDEFB; padding: 3px 10px; border-radius: 12px; margin-right: 6px; }
.med-notes { font-size: 13px; color: #E65100; background: #FFF3E0; padding: 8px 10px; border-radius: 6px; margin-top: 8px; }
.med-tcm { display: inline-block; font-size: 12px; color: #2E7D32; background: #E8F5E9; padding: 2px 8px; border-radius: 8px; margin-left: 6px; }
.med-actions { display: flex; justify-content: flex-end; align-items: center; margin-top: 12px; }
.act-stop { font-size: 13px; color: #F44336; background: #FFEBEE; padding: 6px 16px; border-radius: 16px; cursor: pointer; }
.act-del { font-size: 13px; color: #F44336; padding: 6px 12px; cursor: pointer; }
.act-toggle { font-size: 13px; color: #1565C0; padding: 6px 12px; cursor: pointer; margin-right: 8px; }

.empty { padding: 80px 24px; text-align: center; }
.empty-icon { font-size: 64px; margin-bottom: 12px; }
.empty p { font-size: 18px; margin-bottom: 8px; }
.muted { color: #999 !important; font-size: 14px !important; }

/* 底部 Tab 栏 */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; max-width: 480px; margin: 0 auto;
  background: #fff; border-top: 1px solid #eee;
  display: flex; padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); z-index: 20;
}
.tab-item { flex: 1; display: flex; flex-direction: column; align-items: center; font-size: 11px; color: #999; cursor: pointer; gap: 2px; }
.tab-item.active { color: #1565C0; }
.tab-icon { font-size: 20px; }

/* 今日打卡：统计条 */
.stats-bar { display: flex; background: #1565C0; color: #fff; padding: 16px 8px; }
.stat-cell { flex: 1; text-align: center; }
.stat-num { font-size: 24px; font-weight: 700; }
.stat-label { font-size: 12px; opacity: 0.85; margin-top: 2px; }
.today-progress { color: #1565C0; font-size: 14px; }
.log-actions { display: flex; gap: 8px; margin-top: 12px; }
.log-btn { flex: 1; text-align: center; padding: 9px 0; border-radius: 8px; font-size: 13px; cursor: pointer; }
.log-taken { background: #E8F5E9; color: #2E7D32; }
.log-missed { background: #FFEBEE; color: #C62828; }
.log-skip { background: #F5F5F5; color: #666; }

/* 严重度/类型 chip 选择器（弹层内） */
.field-label { display: block; font-size: 13px; color: #666; margin: 10px 0 6px; }
.req { color: #F44336; }
.sev-pick { display: flex; gap: 8px; margin-bottom: 12px; }
.sev-chip { flex: 1; text-align: center; padding: 10px 0; border-radius: 8px; font-size: 14px; cursor: pointer; border: 1px solid #ddd; background: #fff; color: #666; }
.sev-chip.mild.active { background: #E8F5E9; border-color: #2E7D32; color: #2E7D32; font-weight: 600; }
.sev-chip.moderate.active { background: #FFF3E0; border-color: #E65100; color: #E65100; font-weight: 600; }
.sev-chip.severe.active { background: #FFEBEE; border-color: #C62828; color: #C62828; font-weight: 600; }

/* 严重度标签（列表内） */
.sev-tag { font-size: 12px; padding: 2px 10px; border-radius: 10px; white-space: nowrap; }
.sev-mild { color: #2E7D32; background: #E8F5E9; }
.sev-moderate { color: #E65100; background: #FFF3E0; }
.sev-severe { color: #C62828; background: #FFEBEE; }

/* 不良反应卡片 */
.adv-note { color: #555; background: #FAFAFA; padding: 8px 10px; border-radius: 6px; margin-top: 4px; }
.adv-time { font-size: 12px; color: #aaa; margin-top: 6px; }

/* 提醒卡片 */
.rem-card.off { opacity: 0.5; }

/* 弹层 */
.modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-box {
  background: #fff; width: 100%; max-width: 480px;
  border-radius: 16px 16px 0 0; padding: 24px 20px 32px;
  max-height: 90vh; overflow-y: auto;
}
.modal-box h3 { font-size: 18px; margin-bottom: 16px; }
.check { display: flex; align-items: center; font-size: 14px; color: #666; margin: 12px 0; }
.check input { width: auto; margin-right: 8px; }
.modal-tip { font-size: 12px; color: #999; margin: 8px 0; }
.modal-actions { display: flex; gap: 12px; margin-top: 16px; }
.modal-actions .btn-primary { flex: 1; }

/* 到点提醒 toast */
.remind-toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  background: #333; color: #fff; padding: 14px 20px; border-radius: 12px;
  z-index: 200; max-width: 90%; box-shadow: 0 6px 20px rgba(0,0,0,0.3); font-size: 14px;
}
.remind-toast .toast-title { font-weight: 700; margin-bottom: 6px; }
.remind-toast .toast-line { padding: 3px 0; }
.remind-toast .toast-tip { font-size: 12px; opacity: 0.7; margin-top: 6px; }

/* toolbar 双按钮 */
.toolbar { display: flex; gap: 12px; }
.toolbar .btn-primary, .toolbar .btn-ghost { width: auto; flex: 1; }
.profile-entry { cursor: pointer; }

/* 健康档案两列 */
.two-col { display: flex; gap: 12px; }
.two-col > div { flex: 1; }

/* 就诊卡全屏视图 */
.fullview {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: #F5F5F0; z-index: 150;
  max-width: 480px; margin: 0 auto;
  display: flex; flex-direction: column;
}
.fullview-head {
  background: #1565C0; color: #fff; padding: 16px 20px;
  display: flex; justify-content: space-between; align-items: center;
}
.fv-back { cursor: pointer; }
.fv-title { font-size: 17px; font-weight: 600; }
.card-scroll { flex: 1; overflow-y: auto; padding: 20px 16px; display: flex; flex-direction: column; align-items: center; }
#cardCanvas { background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,0.1); border-radius: 8px; max-width: 100%; height: auto; }
.card-actions { display: flex; gap: 12px; padding: 0 16px; }
.card-actions button { flex: 1; width: auto; }
.card-tip { font-size: 12px; color: #999; text-align: center; padding: 12px 24px 24px; }

/* AI 用药问答聊天 */
.chat-box { padding: 16px 16px 140px; }
.chat-msg {
  margin-bottom: 12px; max-width: 85%; padding: 10px 14px; border-radius: 14px;
  font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.chat-msg.user { margin-left: auto; background: #1565C0; color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.assistant { margin-right: auto; background: #fff; color: #333; border-bottom-left-radius: 4px; }
.chat-empty { padding: 70px 24px 24px; text-align: center; }
.chat-disclaimer { font-size: 12px; color: #E65100; margin-top: 16px; line-height: 1.5; }
.chat-input-bar {
  position: fixed; bottom: 60px; left: 0; right: 0; max-width: 480px; margin: 0 auto;
  display: flex; gap: 8px; padding: 10px 12px; background: #fff;
  border-top: 1px solid #eee; z-index: 15;
}
.chat-input-bar input { flex: 1; padding: 12px 14px; border: 1px solid #ddd; border-radius: 22px; font-size: 15px; }
.chat-input-bar input:focus { outline: none; border-color: #1565C0; }
.chat-input-bar button { width: auto; padding: 12px 22px; border-radius: 22px; }

/* 儿童用药专区 */
.card-section { background: #fff; margin: 12px 16px; padding: 16px; border-radius: 12px; }
.cs-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.calc-result { margin-top: 12px; padding: 12px; background: #F0F7FF; border-radius: 8px; }
.calc-result .calc-drug { font-size: 15px; font-weight: 600; color: #1565C0; }
.calc-result .calc-main { font-size: 16px; margin: 8px 0; }
.calc-result .calc-main b { color: #1565C0; font-size: 18px; }
.calc-result .calc-sub { font-size: 13px; color: #666; }
.calc-result .calc-note { font-size: 12px; color: #888; margin-top: 8px; line-height: 1.5; }
.calc-warn { color: #E65100; font-size: 12px; display: block; margin-top: 8px; }
.tips-section .tips-body p { font-size: 13px; color: #555; line-height: 1.8; padding: 2px 0; }

/* 用药风险审查 */
.risk-summary { font-size: 13px; color: #666; margin-bottom: 12px; }
.risk-card { padding: 12px; border-radius: 8px; margin-bottom: 10px; border-left: 4px solid; }
.risk-card .risk-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.risk-card .risk-desc { font-size: 13px; line-height: 1.6; }
.risk-high { background: #FFEBEE; border-left-color: #C62828; }
.risk-high .risk-title { color: #C62828; }
.risk-moderate { background: #FFF3E0; border-left-color: #E65100; }
.risk-moderate .risk-title { color: #E65100; }
.risk-low { background: #E3F2FD; border-left-color: #1565C0; }
.risk-low .risk-title { color: #1565C0; }
.risk-empty { text-align: center; padding: 30px 16px; color: #2E7D32; font-size: 16px; }
