/* ===== 張家健管系統 LIFF 原型 — 共用樣式（自包含，無 CDN） ===== */
:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #1f2937;
  --sub: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --red: #dc2626;
  --yellow: #d97706;
  --green: #059669;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif;
  background: var(--bg); color: var(--ink);
  max-width: 560px; margin: 0 auto; padding: 14px 14px 90px;
  line-height: 1.55;
}
h1 { font-size: 1.25rem; margin: 6px 0 2px; }
.sub { color: var(--sub); font-size: .82rem; margin-bottom: 12px; }

/* 人員切換 */
.member-bar { display: flex; gap: 8px; margin: 10px 0 16px; }
.member-chip {
  flex: 1; border: 1.5px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 8px 0; font-size: .95rem; cursor: pointer;
  color: var(--sub); font-family: inherit;
}
.member-chip.active { border-color: var(--mc); color: var(--mc); font-weight: 700; background: color-mix(in srgb, var(--mc) 8%, white); }
.chip-emoji { margin-right: 4px; }

/* 卡片與區塊 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.card h2 { font-size: .95rem; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.hint { font-size: .78rem; color: var(--sub); margin-top: 6px; }

/* 表單元素 */
label.field { display: block; font-size: .82rem; color: var(--sub); margin: 10px 0 4px; }
input[type=text], input[type=date], select, textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line);
  border-radius: 10px; font-size: 1rem; font-family: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* 點選膠囊 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--line); background: #fff; border-radius: 999px;
  padding: 8px 14px; font-size: .95rem; cursor: pointer; color: var(--ink); font-family: inherit;
  transition: all .12s;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* 按鈕 */
.btn {
  display: block; width: 100%; padding: 14px; border: none; border-radius: 12px;
  font-size: 1.05rem; font-weight: 700; cursor: pointer; font-family: inherit;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { background: #fff; color: var(--accent); border: 1.5px solid var(--accent); margin-top: 8px; }
.btn:active { transform: scale(.98); }

/* 歷史紀錄 */
.rec { border-left: 4px solid var(--accent); padding: 8px 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; }
.rec .t { font-size: .8rem; color: var(--sub); }
.rec .del { float: right; color: var(--red); background: none; border: none; cursor: pointer; font-size: .8rem; font-family: inherit; }

/* 燈號 */
.flag { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; font-size: .92rem; }
.dot { flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: 7px; }
.dot.red { background: var(--red); }
.dot.yellow { background: var(--yellow); }
.dot.green { background: var(--green); }

/* 底部導覽 */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; max-width: 560px; margin: 0 auto;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.tabbar a { flex: 1; text-align: center; text-decoration: none; color: var(--sub); font-size: .72rem; }
.tabbar a .ico { display: block; font-size: 1.25rem; }
.tabbar a.on { color: var(--accent); font-weight: 700; }

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: #111827; color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: .9rem; opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 99;
}
#toast.show { opacity: .95; }

/* ===== 報告頁列印樣式 ===== */
.report-sheet { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.report-sheet h2 { font-size: 1.05rem; border-bottom: 2px solid var(--ink); padding-bottom: 6px; margin: 18px 0 8px; }
.report-sheet h2:first-child { margin-top: 0; }
.report-sheet table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.report-sheet td, .report-sheet th { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.report-sheet th { background: #f3f4f6; white-space: nowrap; }
.report-title { text-align: center; font-size: 1.2rem; font-weight: 800; margin-bottom: 2px; }
.report-meta { text-align: center; color: var(--sub); font-size: .8rem; margin-bottom: 14px; }
.disclaimer { font-size: .72rem; color: var(--sub); margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 8px; }

@media print {
  body { background: #fff; max-width: none; padding: 0; }
  .no-print, .tabbar, .member-bar { display: none !important; }
  .report-sheet { border: none; border-radius: 0; padding: 0; }
  .card { border: none; padding: 0; }
}
