/* 个人用药打卡与周期体征记录系统 - 移动端优先样式表 */
:root {
  --bg: #f2f6f8;
  --surface: #ffffff;
  --soft: #f8fafc;
  --primary: #0f5a6d;
  --primary-deep: #0a3f4d;
  --primary-light: #e6f4f7;
  --primary-border: #b8dce4;
  --accent: #168068;
  --green: #15803d;
  --green-bg: #dcfce7;
  --green-border: #86efac;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --amber-border: #fde68a;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --red-border: #fecaca;
  --text: #1e293b;
  --muted: #5b697a;
  --border: #e2e8f0;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(15, 44, 62, 0.06);
  --nav-h: 66px;
}

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

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* 登录门禁页 */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(155deg, #0b4958 0%, #147180 55%, #1d8a78 100%);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 20px;
  padding: 28px 24px 24px;
  box-shadow: 0 20px 50px rgba(7, 37, 46, 0.28);
  text-align: center;
}

.auth-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.auth-card h1 {
  font-size: 21px;
  color: var(--primary-deep);
  margin-bottom: 6px;
}

.auth-sub {
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 20px;
}

.auth-form {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-foot {
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.form-error {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-border);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
}

/* 主应用外壳 */
.app-shell {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom));
}

/* 顶部栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: linear-gradient(135deg, #0c4d5d 0%, #146f7e 65%, #1a8373 100%);
  color: #fff;
  padding: 14px 16px 12px;
  box-shadow: 0 6px 20px rgba(11, 73, 88, 0.18);
}

.topbar-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 11px;
}

.brand-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
}

.brand-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.day-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 12px;
  font-weight: 700;
}

.allergy-mini {
  font-size: 11.5px;
  background: rgba(220, 38, 38, 0.85);
  color: #fff;
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.btn-top {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-top:active { background: rgba(255, 255, 255, 0.28); }

/* 日期切换条 */
.date-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  padding: 5px 8px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.date-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.date-input {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.date-input::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
}

.date-weekday {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.88);
  font-weight: 600;
}

.today-btn {
  border: none;
  border-radius: 8px;
  background: #fff;
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 10px;
  cursor: pointer;
}

/* 主内容区 */
.main-content {
  padding: 14px 12px 10px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* 进度卡片 */
.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.summary-title {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
}

.summary-nums {
  display: flex;
  align-items: baseline;
  gap: 3px;
  margin-top: 2px;
}

.big-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
}

.slash { color: #94a3b8; font-size: 16px; font-weight: 700; }
.total-num { font-size: 18px; font-weight: 700; color: var(--muted); }
.unit { font-size: 12px; color: var(--muted); margin-left: 4px; }

.summary-right {
  flex: 1;
  max-width: 210px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #16a34a 0%, #0ea5a4 100%);
  transition: width 0.25s ease;
}

.progress-pct {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent);
}

/* 提示横幅 */
.banner-card {
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  border-left: 4px solid #d97706;
  color: #78350f;
  border-radius: 12px;
  padding: 10px 13px;
  font-size: 13px;
  margin-bottom: 12px;
  line-height: 1.5;
}

/* 空状态预置卡 */
.empty-card {
  background: var(--surface);
  border: 1.5px dashed var(--primary-border);
  border-radius: var(--radius);
  padding: 26px 18px;
  text-align: center;
  margin-bottom: 14px;
}

.empty-icon { font-size: 36px; margin-bottom: 8px; }
.empty-card h3 { font-size: 17px; color: var(--primary); margin-bottom: 8px; }
.empty-card p { font-size: 13.5px; color: var(--muted); margin-bottom: 16px; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* 时间槽分组 */
.slot-group {
  margin-bottom: 14px;
}

.slot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 6px;
}

.slot-time-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14.5px;
  font-weight: 800;
  color: var(--primary);
}

.slot-time-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--primary);
}

.slot-status-text {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 13px 14px;
  margin-bottom: 8px;
  box-shadow: 0 2px 10px rgba(15, 44, 62, 0.04);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.task-card.taken {
  background: #f0fdf4;
  border-color: var(--green-border);
}

.check-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2.2px solid #94a3b8;
  background: #fff;
  color: transparent;
  font-size: 16px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all 0.15s ease;
}

.task-card.taken .check-circle {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}

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

.task-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.task-name {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text);
}

.task-card.taken .task-name {
  color: var(--green);
}

.route-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary);
}

.route-badge.route-skin { background: #ede9fe; color: #5b21b6; }
.route-badge.route-vag { background: #fce7f3; color: #9d174d; }
.route-badge.route-inj { background: #fee2e2; color: #991b1b; }

.task-spec {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
}

.task-note {
  margin-top: 6px;
  font-size: 12px;
  color: #64748b;
  background: #f8fafc;
  border-left: 3px solid var(--primary-border);
  padding: 5px 8px;
  border-radius: 0 6px 6px 0;
}

.task-card.taken .task-note {
  background: rgba(255, 255, 255, 0.72);
  border-left-color: var(--green-border);
}

.task-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.taken-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.pending-hint {
  font-size: 12px;
  color: #94a3b8;
}

.period-hint {
  font-size: 11.5px;
  color: #64748b;
}

/* 暂停区 */
.paused-section {
  margin-top: 16px;
  background: #fef2f2;
  border: 1px solid var(--red-border);
  border-radius: 13px;
  padding: 12px 14px;
}

.section-mini-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--red);
  margin-bottom: 8px;
}

.paused-item {
  background: #fff;
  border: 1px solid var(--red-border);
  border-radius: 10px;
  padding: 9px 11px;
  margin-bottom: 6px;
  font-size: 13px;
}

.paused-item:last-child { margin-bottom: 0; }

/* 打卡页底部今日快捷备注卡 */
.quick-note-card {
  margin-top: 16px;
}

.quick-note-head {
  margin-bottom: 10px;
  padding-bottom: 8px;
}

.quick-note-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.quick-note-hint {
  font-size: 12px;
  color: var(--muted);
  flex: 1;
  min-width: 180px;
}

.tag-soft.is-saved {
  background: var(--green-bg);
  color: var(--green);
  border-color: var(--green-border);
}

.tag-soft.is-dirty {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

/* 通用卡片与表单 */
.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 16px 18px;
  margin-bottom: 14px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf2f7;
}

.panel-head h2 {
  font-size: 16.5px;
  color: var(--primary);
}

.tag-soft {
  font-size: 12px;
  color: var(--muted);
  background: var(--soft);
  border: 1px solid var(--border);
  padding: 2px 9px;
  border-radius: 999px;
}

.helper-text {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 12px;
}

.vitals-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.divider-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--primary);
  padding-top: 6px;
  border-top: 1px dashed #cbd5e1;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

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

.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: #f8fafc;
  border: 1.5px solid #dbe4ec;
  border-radius: 10px;
  padding: 9px 11px;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  background: #fff;
}

.input-unit {
  display: flex;
  gap: 5px;
}

.input-unit input { flex: 1; min-width: 0; }
.input-unit select { width: 82px; padding: 9px 4px; font-size: 12.5px; }

/* 按钮体系 */
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger-outline {
  appearance: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  border-radius: 11px;
  padding: 10px 16px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: opacity 0.15s ease, transform 0.08s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #0f5a6d, #168068);
  color: #fff;
}

.btn-secondary {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
}

.btn-ghost {
  background: #f8fafc;
  color: var(--muted);
  border-color: var(--border);
}

.btn-danger-outline {
  background: #fff;
  color: var(--red);
  border-color: var(--red-border);
}

.btn-sm { font-size: 12.5px; padding: 6px 11px; border-radius: 8px; }
.btn-block { width: 100%; }
button:active { transform: scale(0.985); }

/* 近期体征列表 */
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rec-card {
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 11px 13px;
  cursor: pointer;
}

.rec-card:hover { border-color: var(--primary-border); }

.rec-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.rec-date { font-size: 14px; font-weight: 800; color: var(--primary); }
.rec-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.metric-chip {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 7px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
}

.rec-note {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 6px;
}

/* 药单管理列表 */
.med-manage-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.med-row {
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 13px;
}

.med-row.is-paused { background: #fffbeb; border-color: var(--amber-border); }
.med-row.is-stopped { opacity: 0.68; }

.med-row-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.med-row-name { font-size: 15px; font-weight: 700; color: var(--text); }
.med-row-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.med-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.manage-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed #cbd5e1;
  text-align: center;
}

/* 导出磁贴 */
.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.action-tile {
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 12px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: inherit;
}

.action-tile:hover {
  border-color: var(--primary-border);
  background: var(--primary-light);
}

.tile-ico { font-size: 22px; }
.action-tile strong { font-size: 13.5px; color: var(--primary); }
.action-tile small { font-size: 11.5px; color: var(--muted); line-height: 1.4; }

/* 底部导航 */
.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 720px;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  z-index: 40;
}

.nav-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.nav-ico { font-size: 19px; line-height: 1; }
.nav-btn.active { color: var(--primary); font-weight: 800; }

/* 弹窗 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 60;
}

.modal-card {
  width: 100%;
  max-width: 460px;
  background: #fff;
  border-radius: 16px;
  padding: 18px 18px 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  max-height: 88vh;
  overflow-y: auto;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf2f7;
}

.modal-head h3 { font-size: 16.5px; color: var(--primary); }
.modal-close {
  border: none;
  background: #f1f5f9;
  color: var(--muted);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 15px;
  cursor: pointer;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

/* 轻提示 */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 20px);
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  z-index: 80;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

@media (max-width: 480px) {
  .action-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
