/* 8병동 신규간호사 로드맵 — 모바일 우선, 차분한 병원용 톤, 외부 폰트 없음 */
:root {
  --bg: #f4f6f6;
  --surface: #ffffff;
  --surface-2: #eef2f2;
  --border: #d8e0e0;
  --text: #1d2a2c;
  --muted: #5b6b6e;
  --primary: #1f6f78;
  --primary-ink: #ffffff;
  --primary-soft: #dcecee;
  --solo: #2f6b4f;
  --solo-soft: #dcefe4;
  --confirm: #5a4f8f;
  --confirm-soft: #e7e4f4;
  --warn: #8a5a12;
  --warn-soft: #f8ecd6;
  --danger: #a33a3a;
  --danger-soft: #f6e0e0;
  --bar-bg: #e3e9e9;
  --shadow: 0 1px 2px rgba(20, 40, 44, 0.06);
  --radius: 12px;
  --tap: 44px;
  --font: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1a1c;
    --surface: #172427;
    --surface-2: #1e2e31;
    --border: #2c3f43;
    --text: #e3ecec;
    --muted: #9fb1b3;
    --primary: #6cb7bf;
    --primary-ink: #0d1d20;
    --primary-soft: #1d3a3e;
    --solo: #86c9a6;
    --solo-soft: #1c372b;
    --confirm: #b6acec;
    --confirm-soft: #2c2843;
    --warn: #e2b768;
    --warn-soft: #3a2f1a;
    --danger: #ec9393;
    --danger-soft: #402424;
    --bar-bg: #24363a;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
h1, h2, h3, h4 { line-height: 1.35; margin: 0; }
.boot { padding: 48px 16px; text-align: center; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- 레이아웃 ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar .brand { flex: 1; min-width: 0; }
.topbar .org { font-size: 12px; color: var(--muted); }
.topbar .title { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .who { font-size: 13px; color: var(--muted); text-align: right; white-space: nowrap; }
main {
  flex: 1; width: 100%; max-width: 640px; margin: 0 auto;
  padding: 16px 16px calc(96px + env(safe-area-inset-bottom));
}
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; text-decoration: none; color: var(--muted); font-size: 13px;
}
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a[aria-current="page"] { color: var(--primary); font-weight: 700; }

/* ---------- 공통 요소 ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.stack > * + * { margin-top: 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.section-title { font-size: 18px; font-weight: 700; margin: 20px 0 10px; }
.page-title { font-size: 20px; font-weight: 700; margin: 4px 0 4px; }
.btn {
  min-height: var(--tap); min-width: var(--tap); padding: 8px 14px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; color: var(--text); font-size: 15px;
}
.btn:focus-visible, .chip:focus-visible, .toggle:focus-visible, .tabbar a:focus-visible, summary:focus-visible, .link-card:focus-visible {
  outline: 3px solid var(--primary); outline-offset: 2px;
}
.btn-primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); font-weight: 700; }
.btn-danger { color: var(--danger); border-color: var(--danger); background: var(--surface); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--primary); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: default; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.input, select.input, textarea.input {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
textarea.input { min-height: 88px; resize: vertical; }
.input:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
.badge {
  display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap;
}
.badge-level { background: var(--primary-soft); color: var(--text); border-color: transparent; white-space: normal; }
.badge-admin { background: var(--confirm-soft); color: var(--confirm); border-color: transparent; }
.notice { background: var(--warn-soft); color: var(--text); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.error-text { color: var(--danger); font-size: 14px; min-height: 1.4em; }

/* ---------- 로그인 ---------- */
.login { max-width: 400px; margin: 0 auto; padding: calc(48px + env(safe-area-inset-top)) 16px 32px; }
.login .org { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.login h1 { font-size: 24px; margin-bottom: 24px; }
.login .input { font-size: 22px; letter-spacing: 0.3em; text-align: center; }
.login .hint { font-size: 13px; color: var(--muted); margin-top: 16px; }

/* ---------- 진행 막대 ---------- */
.meter { margin: 6px 0; }
.meter .meter-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.meter .bar { height: 8px; background: var(--bar-bg); border-radius: 999px; overflow: hidden; margin-top: 3px; }
.meter .fill { height: 100%; background: var(--primary); border-radius: 999px; width: 0; }
.meter.solo .fill { background: var(--solo); }
.meter.confirm .fill { background: var(--confirm); }

/* ---------- 구역 칩 ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: var(--tap); padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.2;
}
.chip .chip-sub { font-size: 11px; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.chip[aria-pressed="true"] .chip-sub { color: var(--primary-ink); opacity: 0.85; }
.chip.is-now { border-width: 2px; border-color: var(--primary); }

/* ---------- 체크 항목 ---------- */
.item { padding: 12px 14px; }
.item-text { font-weight: 600; }
.item-meta { font-size: 13px; color: var(--muted); margin-top: 4px; }
.item-meta span + span::before { content: " · "; }
.toggles { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 10px; }
.toggles.two { grid-template-columns: 1fr 1fr; }
.toggle {
  min-height: var(--tap); border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  font-size: 14px; cursor: pointer; padding: 4px 6px; display: flex; align-items: center; justify-content: center; gap: 4px;
  text-align: center; line-height: 1.2;
}
.toggle .mark { width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--muted); flex: none; display: inline-flex; align-items: center; justify-content: center; }
.toggle[aria-pressed="true"] .mark::after { content: ""; width: 8px; height: 4px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg) translate(1px, -1px); }
.toggle.taught[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); }
.toggle.taught[aria-pressed="true"] .mark { border-color: var(--primary); color: var(--primary); }
.toggle.solo[aria-pressed="true"] { background: var(--solo-soft); border-color: var(--solo); }
.toggle.solo[aria-pressed="true"] .mark { border-color: var(--solo); color: var(--solo); }
.toggle.confirm[aria-pressed="true"] { background: var(--confirm-soft); border-color: var(--confirm); }
.toggle.confirm[aria-pressed="true"] .mark { border-color: var(--confirm); color: var(--confirm); }
.toggle[disabled] { cursor: default; opacity: 0.75; }
.toggle.readonly { border-style: dashed; }
.done-row { border-style: dashed; }

/* ---------- 접는 안내 ---------- */
details.guide { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; }
details.guide > summary { min-height: var(--tap); padding: 10px 16px; cursor: pointer; font-weight: 600; display: flex; align-items: center; }
details.guide > div { padding: 0 16px 12px; font-size: 14px; }
details.guide p { margin: 0 0 8px; }

/* ---------- 로드맵 ---------- */
.link-card { display: block; text-decoration: none; color: inherit; }
.link-card .lc-title { font-weight: 700; color: var(--primary); }
.week-card .wk { font-size: 13px; color: var(--muted); }
.week-card .topic { font-weight: 700; font-size: 17px; }
.week-card.is-now { border-color: var(--primary); border-width: 2px; }
.doc h3 { font-size: 17px; margin: 22px 0 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.doc h3:first-child { border-top: 0; margin-top: 4px; }
.doc h4 { font-size: 16px; margin: 18px 0 8px; color: var(--primary); }
.doc p { margin: 6px 0; }
.doc ul, .doc ol { margin: 6px 0; padding-left: 22px; }
.doc li { margin: 4px 0; }
.doc .lbl { font-weight: 700; }
.tcards { display: grid; gap: 8px; margin: 8px 0; }
.tcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.tcard .tc-title { font-weight: 700; margin-bottom: 4px; }
.tcard dl { margin: 0; }
.tcard dt { font-size: 12px; color: var(--muted); margin-top: 6px; }
.tcard dd { margin: 0; }
.form-table { border: 1px dashed var(--border); border-radius: 10px; padding: 10px 12px; font-size: 14px; color: var(--muted); }
.must { background: var(--warn-soft); border-color: transparent; }
.must h2 { font-size: 16px; margin-bottom: 6px; }
.must ul { margin: 0; padding-left: 20px; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
details.sub { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; }
details.sub > summary { min-height: var(--tap); padding: 10px 14px; cursor: pointer; font-weight: 700; }
details.sub > .doc { padding: 0 14px 12px; }
.back { margin-bottom: 8px; }

/* ---------- 관리자 ---------- */
.trainee .name { font-weight: 700; font-size: 17px; }
.weekdots { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin-top: 8px; }
.weekdots span { height: 6px; border-radius: 3px; background: var(--bar-bg); }
.weekdots span.on { background: var(--confirm); }
.note { border-left: 3px solid var(--primary); }
.note .nt-head { font-size: 13px; color: var(--muted); }
.note .nt-label { font-size: 12px; color: var(--muted); margin-top: 6px; }
.note .nt-body { white-space: pre-wrap; }
.emp .emp-no { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; }

/* ---------- 대화상자·알림 ---------- */
dialog {
  border: 0; border-radius: 16px; padding: 0; width: min(440px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: 0 10px 40px rgba(0,0,0,0.25);
}
dialog::backdrop { background: rgba(10, 20, 22, 0.45); }
dialog form, dialog .dlg { padding: 18px 16px 16px; }
dialog h2 { font-size: 18px; margin-bottom: 12px; }
dialog .actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 50;
  max-width: 480px; margin: 0 auto; padding: 12px 14px; border-radius: 10px;
  background: var(--text); color: var(--bg); font-size: 14px; text-align: center;
}
@media (min-width: 700px) {
  .toggles { max-width: 520px; }
}
@media (prefers-reduced-motion: no-preference) {
  .meter .fill { transition: width 0.25s ease; }
}
