/* edu.drwon.kr — 노선도: 프로그램 = 노선, 7단계 = 역. 남색 레일 + 밝은 작업면, 노선색은 사업 구분 */
:root {
  --navy: #16243c; --navy2: #22345a; --navy-ink: #b9c4d9;
  --bg: #f5f6f8; --card: #ffffff; --soft: #eef1f5; --line: #dde2e9; --line2: #eceff3;
  --ink: #141a24; --muted: #5f6878; --faint: #98a0ad;
  --now: #e5673f; --now-soft: #fde6dc; --now-ink: #b84a24;
  --ok: #1e7f5c; --ok-soft: #e1f2ea; --warn: #b7791f; --warn-soft: #fbf0dc; --bad: #c2362c; --bad-soft: #fbe5e3;
  --l-dyd: #2c5bb8; --l-rise: #14907d; --l-hyeoksin: #c98a14; --l-etc: #7a5bb5;
  --f: "Gothic A1", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --r: 12px; --r-s: 8px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f); font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
::selection { background: var(--now-soft); color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--l-dyd); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--now); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
* { scrollbar-color: #c3cad5 transparent; scrollbar-width: thin; }

/* 버튼·입력 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: var(--r-s);
  border: 1px solid var(--line); background: var(--card); font-weight: 700; font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #c3cad5; background: #fafbfc; }
.btn.pri { background: #c24d26; border-color: #c24d26; color: #fff; }   /* 흰 글씨 대비 4.5 이상 */
.btn.pri:hover { background: #a8411f; border-color: #a8411f; }
.btn.navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn svg { width: 16px; height: 16px; }
.in, select.in, textarea.in { width: 100%; min-height: 38px; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--card); }
textarea.in { min-height: 90px; resize: vertical; line-height: 1.6; }
.in:focus { outline: none; border-color: var(--l-dyd); box-shadow: 0 0 0 3px rgba(44, 91, 184, .14); }
.in::placeholder { color: var(--faint); }
label.f { display: grid; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.chk input { width: 18px; height: 18px; accent-color: var(--now); }

/* 레이아웃 */
.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100%; }
.rail { background: var(--navy); color: var(--navy-ink); padding: 20px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; color: #fff; font-weight: 800; font-size: 16px; letter-spacing: -.01em; }
.brand svg { width: 30px; height: 30px; flex: none; }
.brand small { display: block; font-weight: 500; font-size: 11px; color: var(--navy-ink); }
.rail a.nav { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r-s); color: var(--navy-ink); text-decoration: none; font-weight: 600; }
.rail a.nav svg { width: 18px; height: 18px; flex: none; }
.rail a.nav:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.rail a.nav[aria-current="page"] { background: var(--navy2); color: #fff; }
.legend { margin-top: auto; padding: 12px 10px; font-size: 12px; line-height: 2; }
.legend i { display: inline-block; width: 20px; height: 5px; border-radius: 3px; margin-right: 8px; vertical-align: middle; }
.who { padding: 10px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.who button { background: none; border: 0; color: var(--navy-ink); cursor: pointer; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.main { padding-block: 24px 64px; padding-left: max(16px, 28px, env(safe-area-inset-left, 0px)); padding-right: max(16px, 28px, env(safe-area-inset-right, 0px)); min-width: 0; }
.page { max-width: 1200px; display: grid; gap: 18px; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 0; text-wrap: balance; }
h2 { font-size: 15px; font-weight: 800; margin: 0; }
.sub { color: var(--muted); margin: 2px 0 0; font-size: 13px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; min-width: 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.span2 { grid-column: 1 / -1; }
.muted { color: var(--muted); }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* 필터 칩 */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 12.5px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip i { width: 14px; height: 4px; border-radius: 2px; display: inline-block; }

/* 노선도 */
.map { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 6px 22px; }
.ln { display: grid; grid-template-columns: 250px minmax(0, 1fr) 118px; gap: 16px; align-items: center; min-height: 92px; border-top: 1px solid var(--line2); cursor: pointer; }
.ln:first-child { border-top: 0; }
.ln:hover .nm b { text-decoration: underline; text-underline-offset: 3px; }
.nm b { display: block; font-size: 14.5px; font-weight: 800; line-height: 1.35; letter-spacing: -.01em; }
.nm span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.nm .xfer { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.nm .xfer::before { content: ""; width: 14px; border-top: 3px dotted var(--faint); }
.track { position: relative; height: 62px; --c: var(--l-dyd); }
.track .bed, .track .run { position: absolute; left: var(--edge, 7%); height: 7px; top: 20px; border-radius: 4px; background: var(--c); }
.track .bed { right: var(--edge, 7%); opacity: .2; }
.track .run { transition: width .7s cubic-bezier(.16, 1, .3, 1); }
.stops { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(7, 1fr); }
.stop { position: relative; text-align: center; background: none; border: 0; padding: 0; cursor: pointer; }
.stop i { position: absolute; left: 50%; top: 14px; width: 19px; height: 19px; margin-left: -9.5px; border-radius: 50%; background: var(--card); border: 4px solid var(--c); }
.stop.done i { background: var(--c); }
.stop.now i { width: 27px; height: 27px; margin-left: -13.5px; top: 10px; border: 5px solid var(--now); box-shadow: 0 0 0 5px var(--now-soft); }
.stop.now.pulse i { animation: pulse 1.1s cubic-bezier(.16, 1, .3, 1) 1; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(229, 103, 63, .55); } 100% { box-shadow: 0 0 0 5px var(--now-soft); } }
.stop span { position: absolute; top: 41px; left: -6px; right: -6px; font-size: 11px; color: var(--muted); font-weight: 500; line-height: 1.25; }
.stop.now span { color: var(--now-ink); font-weight: 800; }
.stop.late i { border-color: var(--bad); }
.dl { text-align: right; font-size: 12.5px; font-weight: 800; color: var(--now-ink); line-height: 1.35; }
.dl small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.dl.late { color: var(--bad); } .dl.done { color: var(--muted); }
.strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.strip .panel h2 { font-size: 13px; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.todo { display: grid; gap: 0; }
.todo a { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 8px; padding: 8px 0; border-top: 1px solid var(--line2); color: var(--ink); text-decoration: none; font-size: 13px; }
.todo a:first-child { border-top: 0; }
.todo a:hover span { text-decoration: underline; }
.todo b { font-size: 12px; color: var(--now-ink); }
.todo b.late { color: var(--bad); }

/* 프로그램 상세 */
.phead { display: grid; gap: 6px; }
.scheme { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--muted); }
.scheme i { width: 22px; height: 6px; border-radius: 3px; }
.bigline { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 26px 10px; }
.bigline .track { height: 74px; }
/* 상세 노선: 역 이름을 선 아래·위로 번갈아(폭 두 배), 두 줄까지 */
.bigline .track { height: 124px; }
.bigline .track .bed, .bigline .track .run { top: 58px; }
.bigline .stop i { top: 52px; }
.bigline .stop.now i { top: 48px; }
.bigline .stop span { font-size: 12px; line-height: 1.3; left: -50%; right: -50%; top: 82px; word-break: keep-all;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* 이름은 고른 역(아래)·지금 역(위, 고른 역과 다를 때)만 */
.bigline .stop span { display: none; left: -120%; right: -120%; -webkit-line-clamp: 1; white-space: nowrap; text-overflow: ellipsis; }
.bigline .stop[aria-selected="true"] span { display: block; font-size: 13px; }
.bigline .stop.now:not([aria-selected="true"]) span { display: block; top: auto; bottom: 76px; color: var(--now-ink); font-weight: 700; }
/* 목록 노선: 역 이름은 숨기고 오른쪽 칸에 지금 단계만, 높이도 낮게 */
.map .stop span { display: none; }
.map .track { height: 44px; }
.map .track .bed, .map .track .run { top: 18px; }
.map .stop i { top: 12px; }
.map .stop.now i { top: 8px; }
.map .ln { min-height: 76px; }
.bigline .stop[aria-selected="true"] span { color: var(--ink); font-weight: 800; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.station { display: grid; gap: 16px; }
.station > *, .page > * { min-width: 0; }   /* 넓은 표가 칸을 밀어내지 않게(표는 .tbl-wrap 안에서 스크롤) */
.st-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.st-head h2 { font-size: 18px; }
.st-state { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.st-state.now { background: var(--now-soft); color: var(--now-ink); }
.st-state.done { background: var(--ok-soft); color: var(--ok); }
.hwpx { display: inline-flex; align-items: center; gap: 8px; }
.hwpx::before { content: "HWPX"; font-size: 10px; font-weight: 800; letter-spacing: .02em; padding: 2px 5px; border-radius: 4px; background: var(--now); color: #fff; }
.btn.pri.hwpx::before { background: #fff; color: var(--now); }

/* 큰 단계 패널: 하위 단계(증빙) */
.f.inline { flex-direction: row; align-items: center; gap: 6px; display: inline-flex; white-space: nowrap; }
.f.inline .in { width: auto; min-height: 32px; }
.subs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.subs li { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(0, 2fr) auto auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line2); border-radius: var(--r-s); }
.subs li.on { background: var(--ok-soft); border-color: transparent; }
.subs li.on .chk span { color: var(--ok); font-weight: 700; }
.sub-files { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.sub-files .btn { max-width: 220px; overflow: hidden; text-overflow: ellipsis; color: var(--l-dyd); }
.sub-meta { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.ev { display: inline-block; margin-left: 8px; font-size: 10.5px; font-weight: 800; padding: 1px 7px; border-radius: 999px; vertical-align: 1px; }
.ev-auto { background: #e4ecfb; color: var(--l-dyd); } .ev-file { background: var(--now-soft); color: var(--now-ink); } .ev-check { background: var(--soft); color: var(--muted); }
.ev-text { font-size: 12.5px; color: var(--ink); font-weight: 600; align-self: center; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tab { border: 0; background: none; padding: 10px 14px; font-weight: 700; font-size: 13.5px; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--now); }
.tab:hover { color: var(--ink); }
@media (max-width: 640px) { .subs li { grid-template-columns: minmax(0, 1fr) auto; } .sub-files, .sub-meta { grid-column: 1 / -1; } }

/* 표 */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-s); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line2); text-align: left; white-space: nowrap; }
th { background: #f8f9fb; color: var(--muted); font-weight: 600; font-size: 12px; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
td.c, th.c { text-align: center; }
td input.in { min-height: 32px; padding: 4px 8px; }
.pill { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.warn { background: var(--warn-soft); color: var(--warn); } .pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.now { background: var(--now-soft); color: var(--now-ink); }
.att { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--card); cursor: pointer; font-weight: 800; font-size: 12px; color: var(--faint); }
.att.on { background: var(--ok); border-color: var(--ok); color: #fff; }

/* 결과 수치 */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { border: 1px solid var(--line); border-radius: var(--r-s); padding: 12px 14px; }
.kpi span { display: block; font-size: 12px; color: var(--muted); }
.kpi strong { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.kpi em { font-style: normal; font-size: 12px; font-weight: 700; margin-left: 6px; }
.kpi em.ok { color: var(--ok); } .kpi em.bad { color: var(--bad); }
.meter { position: relative; height: 6px; border-radius: 3px; background: var(--line2); margin-top: 8px; }
.meter i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--ok); }
.meter u { position: absolute; top: -3px; width: 2px; height: 12px; background: var(--ink); }

/* 파일 */
.files { display: grid; gap: 8px; }
.file { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line2); border-radius: var(--r-s); font-size: 13px; }
.file b { font-size: 12px; color: var(--muted); }
.file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop { border: 1.5px dashed #c3cad5; border-radius: var(--r-s); padding: 16px; text-align: center; color: var(--muted); font-size: 13px; }
.drop.over { border-color: var(--now); background: var(--now-soft); }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-s); border: 1px solid var(--line); }

/* 대화상자 */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 24px 60px rgba(16, 24, 40, .28); }
dialog::backdrop { background: rgba(20, 26, 36, .45); }
dialog form { padding: 22px; display: grid; gap: 14px; }
dialog h2 { font-size: 18px; }
.qrfull { position: fixed; inset: 0; background: #fff; z-index: 50; display: grid; place-items: center; text-align: center; padding: 24px; cursor: pointer; }
.qrfull h2 { font-size: clamp(22px, 3.4vw, 40px); margin-bottom: 8px; }
.qrfull p { color: var(--muted); font-size: clamp(14px, 1.6vw, 20px); margin: 0 0 18px; }
.qrfull img, .qrfull canvas { width: min(68vh, 82vw); height: auto; image-rendering: pixelated; }
/* 결과보고서 미리보기: 종이는 테마와 상관없이 흰 바탕 */
.pv { position: fixed; inset: 0; z-index: 50; background: var(--soft); display: flex; flex-direction: column; }
.pv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); background: var(--card); border-bottom: 1px solid var(--line); }
.pv-bar .muted { flex: 1 1 260px; font-size: 13px; }
.pv-scroll { flex: 1; overflow: auto; padding: 18px 12px 40px; -webkit-overflow-scrolling: touch; }
.pv-page { width: 794px; margin: 0 auto; background: #fff; color: #000; padding: 56px 60px; box-shadow: 0 1px 4px rgba(0,0,0,.15); font-family: "Malgun Gothic", "맑은 고딕", sans-serif; line-height: 1.45; transform-origin: top left; }
.pv-page p { margin: 0; min-height: 1em; }
.pv-page table { border-collapse: collapse; margin: 2px 0; table-layout: fixed; }
.pv-page td { padding: 2px 4px; word-break: keep-all; overflow-wrap: anywhere; }
.pv-break { border-top: 2px dashed #9aa4b2; margin: 28px -60px; position: relative; }
.pv-break::after { content: "쪽 나눔"; position: absolute; right: 8px; top: -18px; font-size: 11px; color: #6b7686; }
.qrfull .cnt { font-size: clamp(18px, 2.2vw, 28px); font-weight: 800; color: var(--ok); margin-top: 14px; }

/* 알림 */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 13px; z-index: 60; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }

/* 로그인 */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: var(--navy); }
.login form { width: min(380px, 100%); background: var(--card); border-radius: 18px; padding: 28px; display: grid; gap: 14px; }
.login .brand { color: var(--ink); padding: 0 0 6px; }
.login .brand small { color: var(--muted); }
.login .msg { color: var(--bad); font-size: 13px; min-height: 1em; margin: 0; }

/* 태블릿·폰: 노선은 짧은 줄로, 상세의 노선은 세로로 */
@media (max-width: 1000px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: sticky; top: 0; height: auto; z-index: 20; flex-direction: row; align-items: center; padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); overflow-x: auto; gap: 4px; }
  .brand { padding: 0 8px 0 0; font-size: 14px; } .brand small, .legend, .who span { display: none; }
  .rail a.nav { padding: 8px 10px; font-size: 13px; white-space: nowrap; flex: none; } .rail a.nav svg { display: none; }
  .rail .brand div { white-space: nowrap; } .who { flex: none; } .who button { white-space: nowrap; }
  .who { border: 0; margin-left: auto; padding: 0 0 0 8px; }
  .ln { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 0; }
  .nm b { font-size: 15px; } .nm span { font-size: 13px; color: #4a5263; }
  .dl { font-size: 13px; } .dl small { font-size: 12.5px; color: #4a5263; }
  .ln .track { grid-column: 1 / -1; grid-row: 2; height: 54px; }
  .ln .stop span { display: none; }
  .strip, .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .main { padding-block: 16px 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .map { padding: 4px 14px; }
  .rail .brand div { display: none; }
  .strip, .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); }
  /* 폰: 노선은 옆으로 밀어 보는 띠(역마다 72px) */
  .bigline { padding: 4px 0; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; }
  .bigline .track { width: max(calc(100% - 16px), calc(var(--n, 12) * 30px)); margin: 0 8px; }
  .bigline .stop { scroll-snap-align: center; }
  .bigline .stop span { font-size: 11.5px; }
  .phead h1 { font-size: 20px; }
  .st-head .row { width: 100%; }
  .f.inline { flex: 1 1 140px; } .f.inline .in { flex: 1; }
  .file { grid-template-columns: minmax(0, 1fr) auto; } .file b { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { .track .run { transition: none; } .stop.now.pulse i { animation: none; } }
