/* KODSI BOOKING 디자인 시스템 — 다크네이비 · 화이트 기반 */
:root {
  --navy-950: #061224;
  --navy-900: #0a1b33;
  --navy-800: #102846;
  --navy-700: #183a63;
  --navy-600: #24507f;
  --navy-100: #e6edf6;
  --navy-50: #f3f6fb;
  --white: #ffffff;
  --ink: #0c1a2e;
  --ink-2: #33425a;
  --ink-3: #56657b;
  --line: #dde4ee;
  --line-2: #eef2f7;
  --accent: #2f7cf6;
  --accent-ink: #1559c9;
  --gold: #c9a24a;

  --ok: #10855f;      --ok-bg: #e5f5ee;
  --warn: #a86300;    --warn-bg: #fff4e0;
  --crit: #c62a2a;    --crit-bg: #fde9e9;
  --info: #1f5fbf;    --info-bg: #e8f0fd;
  --sim: #6b3fb5;     --sim-bg: #f1eafc;
  --idle: #5b6778;    --idle-bg: #eef1f5;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(10, 27, 51, .06), 0 6px 20px rgba(10, 27, 51, .06);
  --shadow-lg: 0 18px 50px rgba(6, 18, 36, .22);
  --sidebar: 264px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
svg { width: 18px; height: 18px; flex: none; }
.kpi .k svg { width: 15px; height: 15px; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--navy-50); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; word-break: keep-all; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid rgba(47, 124, 246, .45); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--white); padding: 8px 12px; z-index: 100; border-radius: 8px; }
.skip:focus { left: 8px; }

/* ---------- 레이아웃 ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, var(--navy-900), var(--navy-950)); color: #cfd9e8; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 22px 20px 18px; color: var(--white); }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, #2f7cf6, #183a63); display: grid; place-items: center; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }
.brand-mark svg { width: 20px; height: 20px; }
.brand b { display: block; font-size: 15px; letter-spacing: .06em; }
.brand small { display: block; font-size: 12.5px; color: #a9bad2; }
.nav { padding: 6px 12px 24px; }
.nav-group { font-size: 12.5px; letter-spacing: .06em; color: #9cb0cc; padding: 18px 12px 6px; font-weight: 700; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #e1e9f4; font-size: 15px; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: var(--white); }
.nav a.active { background: rgba(47,124,246,.2); color: var(--white); box-shadow: inset 3px 0 0 var(--accent); }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav .soon { margin-left: auto; font-size: 11.5px; color: #a9bad2; border: 1px solid rgba(255,255,255,.12); padding: 0 6px; border-radius: 20px; }
.sidebar-foot { margin-top: auto; padding: 14px 18px 20px; font-size: 13.5px; color: #b3c3d9; border-top: 1px solid rgba(255,255,255,.07); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 10px 28px; min-height: 60px; }
.topbar h1 { font-size: 19px; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.topbar .spacer { flex: 1; }
.content { padding: 24px clamp(16px, 2.2vw, 40px) 60px; width: 100%; max-width: 2400px; }
.envbar { background: var(--sim-bg); color: #5a2f9c; font-size: 13.5px; padding: 6px 28px; border-bottom: 1px solid #e2d6f7; }
.offline { background: var(--warn-bg); color: var(--warn); font-size: 13px; padding: 7px 28px; border-bottom: 1px solid #f3dcae; }

.bottomnav { display: none; }

/* ---------- 공통 요소 ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.card-h h2, .card-h h3 { margin: 0; font-size: 16.5px; font-weight: 700; }
.card-b { padding: 16px 20px; }
.muted { color: var(--ink-3); }
.small { font-size: 14px; }
.xs { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 16px; align-content: start; }
.stack-sm { display: grid; gap: 8px; align-content: start; }
.grid { align-items: start; }
.grid.g4, .grid.g3 { align-items: stretch; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr); }
hr.sep { border: 0; border-top: 1px solid var(--line-2); margin: 14px 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); font-size: 15px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: var(--white); color: var(--ink); padding: 9px 16px; border-radius: 10px; font-weight: 600; font-size: 15px; cursor: pointer; min-height: 40px; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--navy-50); text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--navy-800); border-color: var(--navy-800); color: var(--white); }
.btn.primary:hover { background: var(--navy-700); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--white); }
.btn.accent:hover { background: var(--accent-ink); }
.btn.danger { color: var(--crit); border-color: #f1c4c4; }
.btn.danger:hover { background: var(--crit-bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 5px 10px; min-height: 32px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.iconbtn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--white); display: inline-grid; place-items: center; cursor: pointer; position: relative; }
.iconbtn svg { width: 19px; height: 19px; }
.iconbtn .dot { position: absolute; top: -4px; right: -4px; background: var(--crit); color: var(--white); font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; font-weight: 700; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--idle-bg); color: var(--idle); white-space: nowrap; line-height: 1.6; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-crit { background: var(--crit-bg); color: var(--crit); }
.b-info { background: var(--info-bg); color: var(--info); }
.b-sim { background: var(--sim-bg); color: var(--sim); }
.b-idle { background: var(--idle-bg); color: var(--idle); }
.b-navy { background: var(--navy-100); color: var(--navy-700); }

.alert { border-radius: var(--radius-sm); padding: 11px 14px; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid transparent; }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.alert.info { background: var(--info-bg); color: #163f7c; border-color: #cddcf8; }
.alert.warn { background: var(--warn-bg); color: #7a4800; border-color: #f3dcae; }
.alert.crit { background: var(--crit-bg); color: #8f1d1d; border-color: #f6c9c9; }
.alert.ok { background: var(--ok-bg); color: #0b5c42; border-color: #c4e8d8; }
.alert.sim { background: var(--sim-bg); color: #4e2a8a; border-color: #ddcdf6; }

/* 폼 */
.field { display: grid; gap: 6px; }
.field > label, .label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 13px; color: var(--ink-3); }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line); background: var(--white); border-radius: 10px; padding: 9px 12px; min-height: 42px; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,124,246,.15); outline: none; }
textarea.input { min-height: 84px; resize: vertical; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.c12 { grid-column: span 12; } .c10 { grid-column: span 10; } .c9 { grid-column: span 9; } .c8 { grid-column: span 8; } .c7 { grid-column: span 7; } .c6 { grid-column: span 6; } .c5 { grid-column: span 5; } .c4 { grid-column: span 4; } .c3 { grid-column: span 3; } .c2 { grid-column: span 2; }
.form-grid > .field { align-content: start; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--navy-700); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { border: 1px solid var(--line); background: var(--white); border-radius: 999px; padding: 6px 13px; font-size: 13.5px; cursor: pointer; min-height: 34px; }
.chip[aria-pressed="true"] { background: var(--navy-800); color: var(--white); border-color: var(--navy-800); }
.seg { display: inline-flex; background: var(--navy-50); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 13.5px; cursor: pointer; color: var(--ink-2); min-height: 36px; }
.seg button[aria-pressed="true"] { background: var(--white); color: var(--navy-800); box-shadow: 0 1px 3px rgba(10,27,51,.12); }
.mode-cards { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mode-card { border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; background: var(--white); text-align: left; display: grid; gap: 4px; }
.mode-card b { font-size: 14px; }
.mode-card span { font-size: 12.5px; color: var(--ink-3); }
.mode-card[aria-pressed="true"] { border-color: var(--navy-700); background: var(--navy-50); box-shadow: inset 0 0 0 1px var(--navy-700); }
.mode-card[disabled] { opacity: .55; cursor: not-allowed; }

/* 역 선택 */
.station { position: relative; }
.station-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--white); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 30; max-height: 280px; overflow: auto; padding: 4px; }
.station-list button { display: flex; width: 100%; justify-content: space-between; align-items: center; border: 0; background: none; padding: 9px 11px; border-radius: 8px; cursor: pointer; text-align: left; }
.station-list button:hover, .station-list button.hl { background: var(--navy-50); }
.od { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: end; }
.swap { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--white); cursor: pointer; display: grid; place-items: center; }

/* 표 */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 15px; }
.t th { text-align: left; font-size: 13px; color: var(--ink-3); font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--line); background: #fafbfd; white-space: nowrap; position: sticky; top: 0; }
.t td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.t tr:hover td { background: #fafcff; }
.t tr.click { cursor: pointer; }

/* 대시보드 */
.kpi { padding: 16px 18px; display: grid; gap: 4px; }
.kpi .k { font-size: 13.5px; color: var(--ink-3); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi .v { font-size: 26px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 13.5px; color: var(--ink-3); }
.kpi.alertish .v { color: var(--crit); }
.hero { background: radial-gradient(1200px 300px at 0% 0%, #1d4a80 0%, transparent 60%), linear-gradient(135deg, var(--navy-800), var(--navy-950)); color: var(--white); border-radius: 18px; padding: 22px 24px; position: relative; overflow: hidden; box-shadow: var(--shadow-lg); }
.hero .eyebrow { font-size: 12px; letter-spacing: .1em; color: #9fb4d3; font-weight: 700; }
.hero h3 { margin: 6px 0 2px; font-size: 22px; letter-spacing: -.02em; }
.hero .route { display: flex; align-items: center; gap: 18px; margin-top: 14px; flex-wrap: wrap; }
.hero .t { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.hero .st { color: #b8c7de; font-size: 14px; }
.hero .line { flex: 1; min-width: 60px; height: 2px; background: linear-gradient(90deg, rgba(255,255,255,.6), rgba(255,255,255,.15)); position: relative; }
.hero .line::after { content: ""; position: absolute; right: -2px; top: -4px; border-left: 8px solid rgba(255,255,255,.6); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.hero .meta { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.hero .pill { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.14); border-radius: 999px; padding: 4px 11px; font-size: 13px; }
.hero .empty { color: #b8c7de; margin-top: 10px; }

.services { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.svc { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 14px 12px; display: grid; gap: 8px; justify-items: start; color: var(--ink); min-height: 112px; transition: transform .15s, box-shadow .15s, border-color .15s; }
.svc:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); border-color: #c9d6e8; }
.svc .ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--navy-50); color: var(--navy-700); }
.svc .ic svg { width: 20px; height: 20px; }
.svc b { font-size: 15px; }
.svc.feature { background: linear-gradient(160deg, #ffffff, #eef4ff); border-color: #cfdcf5; }
.svc.feature .ic { background: var(--navy-800); color: var(--white); }

.list { display: grid; }
.li { display: flex; gap: 12px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line-2); color: var(--ink); }
.li:last-child { border-bottom: 0; }
a.li:hover { background: #fafcff; text-decoration: none; }
.li .main-t { font-weight: 600; font-size: 15px; }
.li .sub { font-size: 13.5px; color: var(--ink-3); }
.li .grow { flex: 1; min-width: 0; }
.li .ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-state { padding: 28px 20px; text-align: center; color: var(--ink-3); font-size: 14px; }
.empty-state svg { width: 34px; height: 34px; opacity: .45; display: block; margin: 0 auto 8px; }

/* 열차 결과 */
.train { display: grid; grid-template-columns: auto 1fr auto auto; gap: 16px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.train:last-child { border-bottom: 0; }
.train.sel { background: #f2f7ff; box-shadow: inset 3px 0 0 var(--accent); }
.train .times { display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; }
.train .times b { font-size: 19px; letter-spacing: -.01em; }
.train .dur { font-size: 12px; color: var(--ink-3); border-top: 1px dashed var(--line); padding: 0 8px; }
.train .tt { font-weight: 700; font-size: 13.5px; }
.seatst { display: flex; gap: 6px; flex-wrap: wrap; }

/* 타임라인 */
.timeline { list-style: none; margin: 0; padding: 4px 20px 16px; }
.timeline li { position: relative; padding: 10px 0 10px 22px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 15px; width: 12px; height: 12px; border-radius: 50%; background: var(--white); border: 2px solid var(--navy-600); }
.timeline li.sys::before { border-color: var(--ink-3); }
.timeline .when { font-size: 12px; color: var(--ink-3); }

/* 모달·토스트 */
.modal-bg { position: fixed; inset: 0; background: rgba(6,18,36,.5); z-index: 60; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { background: var(--white); border-radius: 18px; width: min(640px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow-lg); }
.modal.wide { width: min(920px, 100%); }
.modal-h { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line-2); position: sticky; top: 0; background: var(--white); z-index: 1; }
.modal-h h3 { margin: 0; font-size: 17px; }
.modal-b { padding: 18px 22px; }
.modal-f { padding: 14px 22px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 8px; position: sticky; bottom: 0; background: var(--white); }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: grid; gap: 8px; }
.toast { background: var(--navy-900); color: var(--white); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 14px; max-width: 380px; animation: up .2s; }
.toast.err { background: #8f1d1d; }
.toast.ok { background: #0b5c42; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--white); z-index: 70; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .2s; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer .list { overflow: auto; }
.ntf-crit { box-shadow: inset 3px 0 0 var(--crit); }
.ntf-warn { box-shadow: inset 3px 0 0 #e09a2a; }
.ntf-ok { box-shadow: inset 3px 0 0 var(--ok); }
.unread .main-t::after { content: ""; display: inline-block; width: 7px; height: 7px; background: var(--accent); border-radius: 50%; margin-left: 6px; vertical-align: middle; }

/* 로그인 */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: radial-gradient(900px 500px at 10% 10%, #1e4f8a 0%, transparent 55%), linear-gradient(150deg, var(--navy-900), var(--navy-950)); color: var(--white); padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art h1 { font-size: 40px; line-height: 1.2; margin: 18px 0 12px; letter-spacing: -.03em; }
.auth-art p { color: #aebfd8; max-width: 460px; }
.auth-art ul { color: #cdd8e8; padding-left: 18px; line-height: 2; }
.auth-form { display: grid; place-items: center; padding: 32px; background: var(--white); }
.auth-form .box { width: min(400px, 100%); display: grid; gap: 16px; }
.auth-form h2 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.otp { letter-spacing: .5em; font-size: 22px; text-align: center; font-family: var(--mono); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a, .tabs button { padding: 10px 14px; border: 0; background: none; border-bottom: 2px solid transparent; color: var(--ink-3); font-weight: 600; cursor: pointer; white-space: nowrap; font-size: 14px; }
.tabs .on { color: var(--navy-800); border-bottom-color: var(--navy-800); }
.tabs a:hover { text-decoration: none; color: var(--ink); }

.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }
.cap-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.cap { font-size: 12px; border-radius: 8px; padding: 6px 8px; background: var(--line-2); }
.cap b { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.ticket-card { display: grid; grid-template-columns: 1fr auto; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--white); box-shadow: var(--shadow); }
.ticket-card .tc-main { padding: 18px 20px; }
.ticket-card .tc-side { background: var(--navy-50); border-left: 2px dashed var(--line); padding: 18px 20px; display: grid; align-content: center; gap: 4px; min-width: 150px; text-align: center; }
.ticket-card .seat { font-size: 24px; font-weight: 800; color: var(--navy-800); }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--navy-700); border-radius: 50%; animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 30px; text-align: center; color: var(--ink-3); }

/* ---------- 반응형 ---------- */
@media (max-width: 1280px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1080px) { .g-main { grid-template-columns: 1fr; } .cap-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 10px 16px; }
  .content { padding: 16px 14px 96px; }
  .envbar, .offline { padding: 6px 16px; }
  .services { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .svc { min-height: 92px; padding: 10px 8px; justify-items: center; text-align: center; }
  .svc b { font-size: 12.5px; }
  .svc .badge { display: none; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .mode-cards { grid-template-columns: 1fr; }
  .form-grid > * { grid-column: span 12 !important; }
  .od { grid-template-columns: 1fr; }
  .swap { justify-self: center; transform: rotate(90deg); }
  .train { grid-template-columns: 1fr auto; }
  .train > :nth-child(1) { grid-column: 1 / -1; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { padding: 28px 22px; }
  .auth-art h1 { font-size: 28px; }
  .auth-art ul, .auth-art .foot { display: none; }
  .bottomnav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; background: var(--white); border-top: 1px solid var(--line); z-index: 40; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .bottomnav a { display: grid; justify-items: center; gap: 2px; font-size: 11px; color: var(--ink-3); padding: 6px 2px; border-radius: 10px; }
  .bottomnav a svg { width: 22px; height: 22px; }
  .bottomnav a.active { color: var(--navy-800); font-weight: 700; }
  .bottomnav a:hover { text-decoration: none; }
  .hide-m { display: none !important; }
  .toasts { left: 12px; right: 12px; bottom: 84px; }
  .ticket-card { grid-template-columns: 1fr; }
  .ticket-card .tc-side { border-left: 0; border-top: 2px dashed var(--line); }
  .kv { grid-template-columns: 96px 1fr; }
}
@media (min-width: 861px) { .show-m { display: none !important; } }
@media print {
  .sidebar, .topbar, .bottomnav, .envbar, .no-print { display: none !important; }
  .app { display: block; }
  body { background: white; }
  .card { box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- 2026-11-27 개선: 대시보드 레이아웃·빠른 검색·실시간·처리 중 표시 ---------- */
.btn-spin { width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; opacity: .8; }
.btn[aria-busy="true"] { cursor: progress; opacity: .85; }
.live-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ok); font-weight: 600; padding: 0 4px; }
.live-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 2s infinite; }
.live-dot.off { color: var(--ink-3); }
.live-dot.off::before { animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(16,133,95,.45); } 70% { box-shadow: 0 0 0 7px rgba(16,133,95,0); } 100% { box-shadow: 0 0 0 0 rgba(16,133,95,0); } }
.section-t { margin: 26px 0 12px; font-size: 17px; }
.h-sm { margin: 0; font-size: 16.5px; display: inline-flex; align-items: center; gap: 8px; }

.route-bar { background: linear-gradient(120deg, #0f2a4d 0%, #183f6e 55%, #1f5aa0 100%); color: #fff; border-radius: 18px; padding: 20px 24px 16px; margin-bottom: 18px; box-shadow: var(--shadow-lg); }
.rb-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.rb-eyebrow { display: inline-flex; gap: 7px; align-items: center; font-size: 13.5px; font-weight: 700; color: #bcd2f2; letter-spacing: .02em; }
.route-bar h2 { margin: 4px 0 0; font-size: 22px; letter-spacing: -.02em; }
.rb-form { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.6fr) minmax(140px, .7fr) minmax(110px, .55fr) auto; gap: 10px; align-items: end; margin-top: 14px; }
.rb-form label { color: #d6e3f5 !important; }
.rb-form .input { border-color: rgba(255,255,255,.25); }
.rb-go { min-height: 44px; }
.rb-note { margin: 10px 0 0; font-size: 13.5px; color: #c3d4ec; }
.route-bar .badge.b-idle { background: rgba(255,255,255,.14); color: #e4edf9; }

.dash-grid { display: grid; gap: 18px; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .9fr) minmax(320px, 1fr); align-items: start; }
.dash-kpis { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.dash-kpis .kpi { color: var(--ink); }
.dash-kpis .kpi:hover { text-decoration: none; border-color: #c9d6e8; }
.dash-kpis .v { font-size: 24px; }
.dash-lists { display: grid; gap: 18px; margin-top: 22px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); align-items: start; }
.qr-form { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) minmax(130px, .8fr) minmax(110px, .6fr) auto; gap: 10px; align-items: end; }
.qr-form .swap { margin-bottom: 1px; }
.qr-go { min-height: 42px; }
@media (max-width: 1500px) {
  .dash-grid { grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); }
  .dash-side { grid-column: 1 / -1; }
}
@media (max-width: 1180px) {
  .dash-grid { grid-template-columns: 1fr; }
  .rb-form { grid-template-columns: 1fr 1fr; }
  .rb-form .rb-go { grid-column: 1 / -1; }
  .qr-form { grid-template-columns: 1fr auto 1fr; }
  .qr-form .qr-go { grid-column: 1 / -1; }
}
@media (min-width: 2000px) { body { font-size: 17px; } .dash-kpis .v { font-size: 28px; } }

.otp-enroll { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.otp-qr { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px; line-height: 0; }
.otp-qr svg { width: 196px !important; height: 196px !important; }
.otp-key { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--navy-50); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.otp-key .mono { font-size: 17px; letter-spacing: .08em; user-select: all; word-break: break-all; }
.auth-form .box { width: min(460px, 100%); }

.int-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); align-items: start; }
.int-fields { display: grid; gap: 6px; background: var(--line-2); border-radius: 10px; padding: 10px 12px; }

@media (max-width: 860px) {
  .rb-form, .qr-form { grid-template-columns: 1fr; }
  .qr-form .swap { justify-self: center; transform: rotate(90deg); }
  .dash-kpis { grid-template-columns: 1fr 1fr; }
  .otp-enroll { grid-template-columns: 1fr; justify-items: center; }
  .route-bar h2 { font-size: 19px; }
  .live-dot { display: none; }
}
.route-bar .input { color: var(--ink); }
.auth-form .otp-enroll { grid-template-columns: 1fr; justify-items: center; }
/* 모바일: 현재 출장·다음 이동 우선 → AI 경로 → 빠른 열차 검색 → 현황 */
@media (max-width: 860px) {
  .dash-top { display: flex; flex-direction: column; gap: 16px; }
  .dash-top .dash-grid, .dash-top .dash-main { display: contents; }
  .dash-top .hero { order: 1; }
  .dash-top .route-bar { order: 2; margin: 0; padding: 16px; }
  .dash-top .quick-rail { order: 3; }
  .dash-top .dash-kpis { order: 4; }
  .dash-top .dash-side { order: 5; }
  .rb-form { grid-template-columns: 1fr 1fr; }
  .rb-form .field:nth-child(1), .rb-form .field:nth-child(2), .rb-form .rb-go { grid-column: 1 / -1; }
  .rb-note { display: none; }
}

/* ---------- 열차예약 (Phase 1.3) ---------- */
.rail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.rail-side { position: sticky; top: 76px; }
.mode-cards.one { grid-template-columns: 1fr; }
.train-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 10px; padding: 4px 16px 16px; }
.tcard { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 6px; background: var(--white); transition: border-color .15s, box-shadow .15s; }
.tcard:hover { border-color: #c9d6e8; }
.tcard.sel { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: #f6f9ff; }
.tc-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tc-top .tt { font-weight: 700; }
.tcard .times { display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; }
.tcard .times b { font-size: 21px; letter-spacing: -.01em; }
.tcard .dur { font-size: 12.5px; color: var(--ink-3); border-top: 1px dashed var(--line); padding: 0 8px; }
.tc-bottom { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; }
.pick-list { list-style: none; margin: 0; padding: 8px 12px; display: grid; gap: 6px; }
.pick-list li { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.prio { width: 26px; height: 26px; border-radius: 50%; background: var(--navy-800); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.iconbtn.sm { width: 30px; height: 30px; border-radius: 8px; font-size: 11px; }
.iconbtn.sm svg { width: 14px; height: 14px; }
.iconbtn[disabled] { opacity: .35; cursor: not-allowed; }
.preset-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-x { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--white); }
.chip-x .chip { border: 0; background: transparent; }
.chip-x .x { border: 0; background: transparent; cursor: pointer; padding: 0 8px 0 0; color: var(--ink-3); display: grid; place-items: center; }
.chip-x .x svg { width: 13px; height: 13px; }
.ghost-chip { background: var(--navy-50); }
.chip.on, .chip[aria-pressed="true"] { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }
.chip.on .muted, .chip[aria-pressed="true"] .muted { color: #c8d5e8; }
.chip.strong { font-weight: 700; }
.chip[disabled] { opacity: .45; cursor: not-allowed; }
.seat-conds { display: flex; gap: 14px; flex-wrap: wrap; }
.seat-cond { display: flex; gap: 8px; align-items: center; }
.seg.sm button { padding: 4px 10px; min-height: 30px; font-size: 13px; }
@media (max-width: 1280px) { .rail-layout { grid-template-columns: 1fr; } .rail-side { position: static; } }
@media (max-width: 860px) { .train-grid { grid-template-columns: 1fr; padding: 4px 10px 12px; } .tc-bottom { grid-template-columns: 1fr auto; } .tc-bottom .btn { grid-column: 1 / -1; } }

/* ---------- AI 스마트 출장경로 ---------- */
.route-result { display: grid; gap: 12px; }
.route-card { border: 1px solid var(--line); border-radius: 14px; background: var(--white); padding: 14px 16px; display: grid; gap: 10px; }
.route-card.best { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.route-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.route-head .big { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.seg-line { display: grid; grid-template-columns: 78px 1fr auto; gap: 10px; align-items: start; padding: 8px 0; border-top: 1px dashed var(--line-2); }
.seg-line .mode { font-size: 12.5px; font-weight: 700; border-radius: 8px; padding: 3px 8px; background: var(--navy-50); color: var(--navy-700); text-align: center; }
.seg-line .mode.TRAIN { background: #e8f0fd; color: #1f5fbf; }
.seg-line .mode.TAXI, .seg-line .mode.CAR { background: #fff4e0; color: #a86300; }
.seg-line .mode.WALK { background: #e5f5ee; color: #10855f; }
.route-map { width: 100%; height: auto; background: #f7f9fc; border: 1px solid var(--line); border-radius: 12px; }
.c1 { grid-column: span 1; }
@media (max-width: 1400px) { #rf .c1 { grid-column: span 2; } #rf .c4 { grid-column: span 5; } }
