/* =====================================================================
   학생생활지도 기록 시스템 — 공문서형 스타일
   글꼴: Pretendard 하나로 통일 (입력창·버튼·숫자 모두 동일)
   ===================================================================== */
:root {
  --font: Pretendard, "Pretendard Variable", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", system-ui, sans-serif;
  --bg: #f2f4f7;
  --card: #ffffff;
  --text: #1a1f27;
  --muted: #5b6573;
  --line: #d4d9e0;
  --line-strong: #aeb7c3;
  --soft: #f5f7fa;
  --head: #eef2f7;
  --navy: #0f2a52;
  --primary: #1c4f9c;
  --primary-hover: #163f7d;
  --primary-ink: #ffffff;
  --primary-soft: #e8eff9;
  --major: #c0362c;
  --major-soft: #fcecea;
  --warn: #855600;
  --warn-soft: #fdf4e1;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --ok: #1f7a4a;
  --radius: 4px;
  --m-advice: #2a5db0; --m-caution: #855600; --m-discipline: #b54a12;
  --m-admonition: #a3233a; --m-counsel: #5b45a0; --m-reward: #2b7a46;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10151d; --card: #171e28; --text: #e6eaf0; --muted: #9aa5b4; --line: #2b3542; --line-strong: #435064;
    --soft: #1c2430; --head: #1f2a38; --navy: #0b1d3a;
    --primary: #5b8ee0; --primary-hover: #77a2e8; --primary-ink: #0b1220; --primary-soft: #1c2c46;
    --major: #ff8277; --major-soft: #3a1d1b; --warn: #e6b45a; --warn-soft: #33290f; --danger: #ff7b6e; --danger-soft: #3a1e1b; --ok: #5fc48c;
    --m-advice: #86aef0; --m-caution: #e6b45a; --m-discipline: #f09a63; --m-admonition: #f08a9c; --m-counsel: #b6a3f0; --m-reward: #6fcf93;
    color-scheme: dark;
  }
}

/* ---------- 기본 ---------- */
*, *::before, *::after { 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; letter-spacing: -0.01em;
  word-break: keep-all; overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}
/* 모든 요소가 같은 글꼴을 쓰도록 (입력창·버튼·코드 포함) */
button, input, select, textarea, code, pre, kbd, samp, option { font-family: inherit; font-size: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.35; font-weight: 700; }
h2 { font-size: 1.05rem; }
h3 { font-size: 1rem; }
p { margin: .35rem 0; }
.ico { display: block; flex: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 50%, transparent); outline-offset: 2px; }

/* ---------- 상단 ---------- */
.gov-strip { height: 4px; background: var(--navy); }
.topbar { position: sticky; top: 0; z-index: 10; background: var(--card); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.topbar-in { max-width: 760px; margin: 0 auto; padding: .6rem 1rem; display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.brand { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.brand-mark { width: 36px; height: 36px; border-radius: var(--radius); background: var(--navy); color: #fff; display: grid; place-items: center; flex: none; }
.brand-sub { font-size: .72rem; color: var(--muted); font-weight: 600; }
.school-name { font-weight: 800; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-box { text-align: right; }
.who { font-size: .8rem; color: var(--text); font-weight: 600; white-space: nowrap; }
.live { font-size: .72rem; color: var(--muted); display: inline-flex; align-items: center; gap: .3rem; }
.live .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }

.main { max-width: 760px; margin: 0 auto; padding: 1rem 1rem calc(150px + env(safe-area-inset-bottom)); }

/* ---------- 하단 메뉴 ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--line-strong); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); }
.tab { flex: 1; max-width: 152px; background: none; border: 0; border-top: 3px solid transparent; padding: .45rem 0 .5rem; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .74rem; font-weight: 600; color: var(--muted); position: relative; }
.tab-icon { display: grid; place-items: center; height: 24px; }
.tab.on { color: var(--primary); border-top-color: var(--primary); font-weight: 800; }
.badge { position: absolute; top: 3px; left: calc(50% + 8px); background: var(--major); color: #fff; border-radius: 9px; font-size: .66rem; padding: 0 5px; min-width: 18px; text-align: center; font-weight: 700; line-height: 1.5; }
.badge[hidden] { display: none; }

/* ---------- 공통 상자 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: .75rem; }
.card > h3, .card h3:first-child { padding-bottom: .55rem; margin-bottom: .75rem; border-bottom: 1px solid var(--line); }
.center-screen { min-height: 70vh; display: flex; flex-direction: column; gap: 1rem; align-items: center; justify-content: center; padding: 2rem; text-align: center; }
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.gap { gap: .5rem; }
.row.wrap { flex-wrap: wrap; }
.center-v { align-items: center; }
.mt { margin-top: .75rem; }
.mb { margin-bottom: .6rem; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.hint { font-size: .82rem; color: var(--muted); margin: .35rem 0 .2rem; }
.error { color: var(--danger); }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; background: var(--card); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.foot { text-align: center; color: var(--muted); font-size: .75rem; margin-top: 1.5rem; }
.scope-note { font-size: .8rem; color: var(--muted); margin: .4rem 0 .75rem; padding-left: .55rem; border-left: 3px solid var(--line-strong); }
.section-label { font-size: .85rem; font-weight: 800; color: var(--navy); margin: 1.5rem 0 .5rem; padding-bottom: .35rem; border-bottom: 2px solid var(--navy); }
@media (prefers-color-scheme: dark) { .section-label { color: var(--text); border-color: var(--line-strong); } }

/* ---------- 버튼·입력 ---------- */
.btn { border: 1px solid var(--line-strong); background: var(--card); border-radius: var(--radius); padding: .55rem 1rem; font-weight: 700; min-height: 44px; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: .35rem; }
.btn:hover { background: var(--soft); }
.btn.sm { padding: .3rem .7rem; min-height: 36px; font-size: .86rem; }
.btn.lg { min-height: 54px; font-size: 1.05rem; }
.btn.block { width: 100%; }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.danger-text { color: var(--danger); }
.link { background: none; border: 0; color: var(--primary); padding: .2rem 0; font-weight: 700; font-size: .9rem; text-decoration: underline; text-underline-offset: 3px; }
.link.center { display: block; margin-left: auto; margin-right: auto; }
.link.back { margin-bottom: .5rem; text-decoration: none; }
.icon-btn { background: none; border: 1px solid transparent; width: 36px; height: 36px; border-radius: var(--radius); color: var(--muted); display: grid; place-items: center; }
.icon-btn:hover { background: var(--soft); border-color: var(--line); }
.input { width: 100%; border: 1px solid var(--line-strong); background: var(--card); border-radius: var(--radius); padding: .55rem .75rem; min-height: 44px; }
.input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.input.inline { width: auto; }
.input.num { width: 5rem; }
.input.code { letter-spacing: .2em; font-weight: 700; max-width: 11rem; text-transform: uppercase; }
.input.mono { font-size: .88rem; }
textarea.input { resize: vertical; min-height: 64px; }
select.input { padding-right: 2rem; }
.label { display: block; font-weight: 700; font-size: .9rem; margin: 1rem 0 .4rem; }
.label.sm { font-size: .84rem; margin-top: .65rem; }
.check { display: flex; gap: .5rem; align-items: flex-start; font-size: .9rem; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--primary); flex: none; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.seg button { border: 0; border-right: 1px solid var(--line); background: none; padding: .4rem .95rem; font-weight: 700; color: var(--muted); min-height: 38px; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--primary); color: var(--primary-ink); }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip-label { font-size: .78rem; color: var(--muted); font-weight: 700; align-self: center; margin-right: .15rem; }
.chip { border: 1px solid var(--line-strong); background: var(--card); border-radius: var(--radius); padding: .38rem .8rem; font-size: .9rem; font-weight: 600; min-height: 38px; white-space: nowrap; display: inline-flex; align-items: center; gap: .35rem; }
.chip:hover { border-color: var(--primary); }
.chip.sm { min-height: 30px; padding: .15rem .6rem; font-size: .8rem; }
.chip.lg { min-height: 46px; padding: .5rem .9rem; font-size: .95rem; white-space: normal; text-align: left; }
.chip.on { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.chip.on.major { background: var(--major); border-color: var(--major); }
.chip.on.warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.chip.major { border-left: 4px solid var(--major); }
.chip.static { cursor: default; background: var(--soft); border-color: var(--line); }
.chip-x { border: 0; background: none; color: var(--muted); padding: 0 0 0 .2rem; display: grid; place-items: center; }
.sev-dot { width: 7px; height: 7px; background: var(--major); flex: none; }
.tag { font-size: .72rem; font-weight: 700; padding: .05rem .4rem; border-radius: 3px; border: 1px solid var(--line-strong); color: var(--muted); margin-left: .35rem; white-space: nowrap; }
.tag.soft { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); color: var(--primary); background: var(--primary-soft); }
.tag.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); color: var(--warn); background: var(--warn-soft); }
.tag.danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); color: var(--danger); background: var(--danger-soft); }
.sev { font-size: .72rem; font-weight: 800; padding: .05rem .4rem; border-radius: 3px; margin-right: .45rem; }
.sev.major { background: var(--major); color: #fff; }

/* ---------- 기록 화면 ---------- */
.step { background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--navy); border-radius: var(--radius); padding: 1rem; margin-bottom: .75rem; }
.step-head { display: flex; align-items: center; gap: .6rem; margin: -.1rem 0 .9rem; padding-bottom: .6rem; border-bottom: 1px solid var(--line); }
.step-num { width: 26px; height: 26px; border-radius: 3px; background: var(--navy); color: #fff; font-weight: 800; font-size: .85rem; display: grid; place-items: center; flex: none; }
.step.done { display: flex; align-items: center; gap: .7rem; padding: .65rem 1rem; border-top-width: 1px; border-left: 4px solid var(--primary); }
.step.done .step-num { background: var(--primary-soft); color: var(--primary); }
.step-sel { flex: 1; display: flex; align-items: center; flex-wrap: wrap; gap: .3rem; }
.step-sel .link { margin-left: auto; }
.sel-main { font-weight: 800; }
.student-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .4rem; margin-top: .75rem; }
.stu { border: 1px solid var(--line-strong); background: var(--card); border-radius: var(--radius); padding: .5rem .4rem; min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; }
.stu:hover, .stu:active { border-color: var(--primary); background: var(--primary-soft); }
.stu-no { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.stu-name { font-weight: 700; }
.stu-flag { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; background: var(--primary); }
.domain { margin-bottom: 1rem; }
.domain-title { font-size: .84rem; font-weight: 800; color: var(--text); margin-bottom: .45rem; display: flex; align-items: center; gap: .35rem; }
.domain-title::before { content: ''; width: 3px; height: .95em; background: var(--navy); }
.law { font-weight: 600; margin-left: .2rem; font-size: .74rem; color: var(--muted); }
.rec-box { background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--line)); border-left: 4px solid var(--primary); border-radius: var(--radius); padding: .75rem .9rem; font-size: .9rem; }
.rec-box.loading { color: var(--muted); }
.rec-title { font-weight: 800; color: var(--primary); font-size: .8rem; margin-bottom: .2rem; }
.rec-hint { font-size: .84rem; color: var(--muted); }
.rec-alert { font-weight: 700; color: var(--major); font-size: .86rem; }
.notice { margin-top: .6rem; background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 30%, var(--line)); border-left: 4px solid var(--warn); border-radius: var(--radius); padding: .75rem .9rem; font-size: .86rem; }
.notice.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); border-left-color: var(--danger); }
.notice.danger strong { color: var(--danger); }
.notice .check { margin-top: .5rem; font-weight: 700; }
.method-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
@media (max-width: 420px) { .method-grid { grid-template-columns: repeat(2, 1fr); } }
.method { border: 1px solid var(--line-strong); background: var(--card); border-radius: var(--radius); padding: .5rem .6rem; text-align: left; display: flex; flex-direction: column; gap: .1rem; min-height: 60px; }
.method:hover { border-color: var(--primary); }
.method-name { font-weight: 800; display: flex; align-items: center; gap: .3rem; }
.method-desc { font-size: .72rem; color: var(--muted); line-height: 1.35; }
.method.on { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.rec-tag { font-size: .64rem; border: 1px solid var(--primary); color: var(--primary); background: var(--card); border-radius: 3px; padding: 0 .3rem; font-weight: 800; }
.sub-box { margin-top: .75rem; background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius); padding: .2rem .85rem .75rem; }
.sub-box > .label:first-child { margin-top: .6rem; }
.tpl-chip { white-space: normal; text-align: left; font-size: .86rem; font-weight: 500; min-height: 36px; }
.tpl-chip.mine { border-color: color-mix(in srgb, var(--primary) 50%, var(--line)); }
.star { color: #b8860b; display: inline-flex; }
.save-bar { position: sticky; bottom: calc(66px + env(safe-area-inset-bottom)); padding: .5rem 0; background: linear-gradient(to top, var(--bg) 70%, transparent); }

/* ---------- 기록함·목록 ---------- */
.list { display: flex; flex-direction: column; gap: .5rem; }
.list.tight { gap: 0; }
.list-row { padding: .55rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; gap: .5rem; }
.inc { text-align: left; width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.inc:hover { border-color: var(--line-strong); }
.inc.major { border-left: 4px solid var(--major); }
.inc.voided { opacity: .55; }
.inc.voided .inc-beh { text-decoration: line-through; }
.inc-top { display: flex; justify-content: space-between; gap: .5rem; font-size: .84rem; background: var(--head); padding: .45rem .85rem; border-bottom: 1px solid var(--line); }
.inc-stu { font-weight: 800; }
.inc-time { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.inc-beh { font-weight: 800; display: flex; flex-wrap: wrap; align-items: center; padding: .55rem .85rem 0; }
.inc-methods { display: flex; flex-wrap: wrap; gap: .3rem; padding: .35rem .85rem 0; }
.mtag { font-size: .72rem; font-weight: 700; padding: 0 .4rem; border-radius: 3px; border: 1px solid currentColor; line-height: 1.6; }
.m-advice { color: var(--m-advice); } .m-caution { color: var(--m-caution); } .m-discipline { color: var(--m-discipline); }
.m-admonition { color: var(--m-admonition); } .m-counsel { color: var(--m-counsel); } .m-reward { color: var(--m-reward); }
.inc-text { font-size: .9rem; padding: .35rem .85rem 0; }
.inc-meta { font-size: .78rem; color: var(--muted); padding: .35rem .85rem .6rem; }
.stu-row { display: flex; align-items: center; gap: .75rem; width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .9rem; text-align: left; }
.stu-row:hover { border-color: var(--line-strong); }
.list.tight .stu-row { border-radius: 0; border-width: 0 0 1px; padding-left: 0; padding-right: 0; background: transparent; }
.stu-row .stu-no { width: 2.6rem; font-size: .85rem; }
.stu-row .stu-name { flex: 1; }
.count { font-weight: 800; font-size: .85rem; color: var(--muted); min-width: 2.6rem; text-align: right; font-variant-numeric: tabular-nums; }
.count.some { color: var(--text); }
.count.hot { color: #fff; background: var(--major); border-radius: 3px; padding: .05rem .45rem; text-align: center; }
.student-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; border-top: 3px solid var(--navy); }
.detail-head { margin-bottom: .75rem; padding-bottom: .6rem; border-bottom: 2px solid var(--navy); }
.detail-stu { font-weight: 800; font-size: 1.1rem; }
/* 표 형식 항목 (구분 | 내용) */
.kv { display: grid; grid-template-columns: 6.8rem 1fr; border: 1px solid var(--line); border-top: 0; font-size: .92rem; }
.kv:first-of-type, .detail-head + .kv, .notice + .kv { border-top: 1px solid var(--line); }
.kv .k { background: var(--head); padding: .5rem .65rem; border-right: 1px solid var(--line); font-weight: 700; color: var(--muted); font-size: .84rem; }
.kv .v { padding: .5rem .7rem; }
.k { color: var(--muted); font-size: .85rem; }
.private { margin-top: .75rem; background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius); padding: .65rem .85rem; font-size: .9rem; }
.private .k { font-weight: 700; margin-bottom: .25rem; }
.summary { display: flex; flex-direction: column; gap: .4rem; }

/* ---------- 통계 ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: .75rem; }
.kpi { background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--navy); border-radius: var(--radius); padding: .75rem; text-align: center; }
.kpi-v { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi-l { font-size: .78rem; color: var(--muted); font-weight: 600; }
.kpi.warn { border-top-color: var(--major); }
.kpi.warn .kpi-v { color: var(--major); }
.bars { display: flex; flex-direction: column; gap: .45rem; }
.bar-row { display: grid; grid-template-columns: minmax(6rem, 40%) 1fr 2.4rem; gap: .5rem; align-items: center; font-size: .86rem; }
.bar-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--soft); border: 1px solid var(--line); height: 14px; }
.bar-fill { background: var(--primary); height: 100%; }
.bar-n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 800; }
.cols { display: flex; gap: .3rem; align-items: stretch; height: 140px; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .2rem; min-width: 0; }
.col-n { font-size: .72rem; font-weight: 800; height: 1rem; font-variant-numeric: tabular-nums; }
.col-track { flex: 1; width: 100%; max-width: 32px; background: var(--soft); border: 1px solid var(--line); display: flex; align-items: flex-end; }
.col-fill { width: 100%; background: var(--primary); }
.col-l { font-size: .7rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- 설정 ---------- */
.sec { padding: 0; }
.sec summary { padding: .85rem 1rem; font-weight: 800; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.sec summary::-webkit-details-marker { display: none; }
.sec summary::after { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin-right: 4px; transition: transform .15s; }
.sec[open] summary { border-bottom: 1px solid var(--line); background: var(--head); }
.sec[open] summary::after { transform: rotate(-135deg); margin-top: 4px; }
.sec-body { padding: .5rem 1rem 1rem; }
.sec-body > .kv:first-child { margin-top: .5rem; border-top: 1px solid var(--line); }
.code-box { font-size: 1.5rem; font-weight: 800; letter-spacing: .25em; background: var(--soft); border: 1px solid var(--line-strong); padding: .15rem .7rem; border-radius: var(--radius); font-variant-numeric: tabular-nums; }
.member { padding: .7rem 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: .4rem; }
.member-name { font-weight: 800; }
.beh-row { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .45rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.beh-row.off .beh-name { color: var(--muted); text-decoration: line-through; }
.beh-name { font-size: .92rem; }

/* ---------- 로그인·안내 화면 ---------- */
.auth-page { min-height: 100vh; }
.auth-wrap { max-width: 460px; margin: 0 auto; padding: 2.25rem 1rem; }
.auth-brand { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom: 2px solid var(--navy); }
.auth-brand h1 { font-size: 1.35rem; font-weight: 800; }
.auth-brand .brand-sub { font-size: .78rem; }
.auth-wrap > .card > h2, .auth-wrap .card h2 { margin-bottom: .4rem; }
.logo { width: 52px; height: 52px; border-radius: var(--radius); background: var(--navy); color: #fff; display: grid; place-items: center; flex: none; }
.auth-card { border-top: 3px solid var(--navy); }
.auth-card .seg { display: flex; }
.auth-card .seg button { flex: 1; }
details.card > summary { cursor: pointer; font-weight: 800; }
.confirm-msg { margin-bottom: 1rem; }
.steps { padding-left: 1.2rem; font-size: .9rem; margin: .6rem 0; }
.steps li { margin: .2rem 0; }
.qr { display: flex; justify-content: center; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; margin: .5rem 0; }
.secret { display: block; word-break: break-all; background: var(--soft); border: 1px solid var(--line); padding: .4rem .6rem; border-radius: var(--radius); font-size: .9rem; font-weight: 700; letter-spacing: .08em; margin-top: .3rem; user-select: all; }

/* ---------- 대화상자·알림 ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10, 18, 32, .5); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); width: 100%; max-width: 580px; max-height: 88vh; overflow: auto; border-radius: 8px 8px 0 0; border-top: 4px solid var(--navy); padding-bottom: env(safe-area-inset-bottom); animation: up .16s ease-out; }
@media (min-width: 720px) { .overlay { align-items: center; } .sheet { border-radius: var(--radius); } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1rem; position: sticky; top: 0; background: var(--card); border-bottom: 1px solid var(--line); z-index: 1; }
.sheet-body { padding: 1rem 1rem 1.25rem; }
@keyframes up { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px); opacity: 0; pointer-events: none; z-index: 60;
  background: #1a2433; color: #fff; padding: .7rem 1.1rem; border-radius: var(--radius); border-left: 4px solid var(--ok); font-size: .9rem; font-weight: 600; max-width: calc(100% - 2rem); transition: all .2s; box-shadow: 0 6px 20px rgba(0,0,0,.22); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-left-color: #ff6b5e; }
.toast.warn { border-left-color: #f0b44c; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin: 1rem auto; }
.spinner.sm { width: 22px; height: 22px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- 인쇄 (기록 상세를 공문서처럼) ---------- */
@media print {
  .topbar, .tabbar, .toolbar, .save-bar, .btn, .icon-btn, .toast { display: none !important; }
  body { background: #fff; }
  .overlay { position: static; background: none; }
  .sheet { max-height: none; border: 0; }
}
