/* 판교 대리운전 관리 — 유니크 네이비 × 인슈원 화면 규칙 */
:root {
  --navy-900: #14294A; --navy-800: #1B3A6B; --navy-700: #24488A; --navy-600: #2E5AA8; --navy-500: #3E6FC0;
  --navy-200: #B9C9E4; --navy-100: #DCE4F2; --navy-50: #EEF2F9;
  --bg: #F4F7FB; --card: #FFFFFF; --sunken: #F5F6F8; --border: #E5EAF0; --border-soft: #EEF1F5; --border-strong: #C9CED6;
  --text: #2B3440; --muted: #6B7280; --head: #14294A; --on-brand: #FFFFFF;
  --red: #A93232; --red-600: #C43B3B; --red-50: #FBECEC; --red-100: #F8DCDC;
  --green: #2F7048; --green-50: #EEF7F0; --orange: #8A4B12; --orange-50: #FCF4E8;
  --primary: #1B3A6B; --primary-hover: #24488A; --accent: #2E5AA8; --active-bg: #EEF2F9;
  --shadow-card: 0 1px 2px rgba(20,41,74,.06), 0 1px 3px rgba(20,41,74,.08);
  --shadow-pop: 0 2px 6px rgba(20,41,74,.10), 0 8px 24px rgba(20,41,74,.12);
  --r-control: 10px; --r-card: 12px;
  --font: '현대하모니 M', 'Hyundai Harmony M', 'HyundaiHarmonyM', 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --tab-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --navy-50: #1D2B45; --navy-100: #263757; --navy-200: #3A5684;
    --bg: #0E1626; --card: #162238; --sunken: #1B2840; --border: #263550; --border-soft: #213049; --border-strong: #3A4A66;
    --text: #D9E1EC; --muted: #9AA7BA; --head: #F2F6FC;
    --red: #F08A8A; --red-50: #3A1F26; --red-100: #4A2630; --green: #7BCB97; --green-50: #18322A;
    --orange: #F0B37A; --orange-50: #3A2A18;
    --primary: #3E6FC0; --primary-hover: #4B7DD0; --accent: #7EA6E6; --active-bg: #1E3052;
    --shadow-card: none; --shadow-pop: 0 8px 24px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --navy-50: #1D2B45; --navy-100: #263757; --navy-200: #3A5684;
  --bg: #0E1626; --card: #162238; --sunken: #1B2840; --border: #263550; --border-soft: #213049; --border-strong: #3A4A66;
  --text: #D9E1EC; --muted: #9AA7BA; --head: #F2F6FC;
  --red: #F08A8A; --red-50: #3A1F26; --red-100: #4A2630; --green: #7BCB97; --green-50: #18322A;
  --orange: #F0B37A; --orange-50: #3A2A18;
  --primary: #3E6FC0; --primary-hover: #4B7DD0; --accent: #7EA6E6; --active-bg: #1E3052;
  --shadow-card: none; --shadow-pop: 0 8px 24px rgba(0,0,0,.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--text); background: var(--bg); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { color: var(--head); margin: 0; letter-spacing: -0.015em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 700; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-s { display: flex; flex-direction: column; gap: 6px; }
.grow { flex: 1; min-width: 0; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; }
.boot { display: grid; place-items: center; height: 100vh; font-size: 28px; font-weight: 800; letter-spacing: .06em; color: var(--primary); }
.brand { font-weight: 800; letter-spacing: .06em; color: var(--primary); }
:root[data-theme="dark"] .brand, :root:not([data-theme="light"]) .brand { }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand { color: #8FB2EC; } }
:root[data-theme="dark"] .brand { color: #8FB2EC; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
.shell { min-height: 100vh; display: flex; }
.side { width: 240px; flex-shrink: 0; background: var(--card); border-right: 1px solid var(--border); padding: 20px 12px;
  display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .logo { padding: 4px 12px 18px; display: flex; flex-direction: column; gap: 2px; }
.side .logo .brand { font-size: 22px; }
.side .logo span:last-child { font-size: 13px; color: var(--muted); }
.nav-a { height: 40px; border-radius: var(--r-control); color: var(--text); font-size: 14px; display: flex; align-items: center;
  gap: 10px; padding: 0 12px; text-decoration: none !important; }
.nav-a:hover { background: var(--sunken); }
.nav-a.on { background: var(--active-bg); color: var(--accent); font-weight: 700; box-shadow: inset 3px 0 0 var(--accent); }
.nav-a svg { flex-shrink: 0; }
.side .me { margin-top: auto; border-top: 1px solid var(--border); padding: 14px 8px 0; display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 999px; background: var(--navy-900); color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.avatar.light { background: var(--active-bg); color: var(--accent); }
.main { flex: 1; min-width: 0; padding: 24px 32px 40px; display: flex; flex-direction: column; gap: 18px; max-width: 1480px; }
.topbar { display: none; }
.tabbar { display: none; }

body.is-mobile .side { display: none; }
body.is-mobile .shell { flex-direction: column; }
body.is-mobile .topbar { display: flex; position: sticky; top: 0; z-index: 30; height: 56px; background: var(--card);
  border-bottom: 1px solid var(--border); align-items: center; justify-content: space-between; padding: 0 16px; }
body.is-mobile .topbar .brand { font-size: 18px; }
body.is-mobile .main { padding: 14px 16px calc(var(--tab-h) + 24px + env(safe-area-inset-bottom)); gap: 12px; }
body.is-mobile .tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 40; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--border); }
.tab-a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px;
  color: var(--muted); text-decoration: none !important; }
.tab-a.on { color: var(--accent); font-weight: 700; }
body.is-mobile .only-d { display: none !important; }
body.is-desktop .only-m { display: none !important; }

/* ---------- page head ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.page-head .title { display: flex; flex-direction: column; gap: 2px; margin-right: auto; }
.page-head .sub { font-size: 13px; color: var(--muted); }
body.is-mobile .page-head h1 { font-size: 20px; }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-card);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
body.is-mobile .card { padding: 14px; }
.card-h { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.cols { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.cols > .c2 { flex: 2 1 520px; min-width: 0; }
.cols > .c1 { flex: 1 1 320px; min-width: 0; }
.cols > .ch { flex: 1 1 440px; min-width: 0; }
body.is-mobile .cols { gap: 12px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; }
body.is-mobile .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-card);
  padding: 14px 18px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi .k { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi .v { font-size: 24px; font-weight: 700; color: var(--head); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .d { font-size: 12px; color: var(--muted); }
body.is-mobile .kpi { padding: 12px 14px; }
body.is-mobile .kpi .v { font-size: 20px; }
.up { color: var(--red); font-weight: 600; }
.down { color: var(--green); font-weight: 600; }

.hero { background: #1B3A6B; color: #fff; border-radius: var(--r-card); padding: 18px; display: flex; flex-direction: column; gap: 6px;
  text-decoration: none !important; }
.hero .t { font-size: 13px; color: #DCE4F2; }
.hero .big { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.hero .big small { font-size: 18px; font-weight: 500; margin-left: 4px; }
.hero .s { font-size: 13px; color: #B9C9E4; font-variant-numeric: tabular-nums; }
.hero .pill { height: 24px; padding: 0 8px; border-radius: 6px; background: rgba(255,255,255,.14); font-size: 12px; font-weight: 600;
  display: inline-flex; align-items: center; color: #fff; }
.strip { background: #1B3A6B; border-radius: var(--r-card); padding: 14px 20px; display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px 16px; color: #fff; text-decoration: none !important; }
.strip b { font-size: 15px; }
.strip span { font-size: 13px; color: #DCE4F2; }
.strip .go { margin-left: auto; font-weight: 700; color: #fff; font-size: 13px; }

/* ---------- banners ---------- */
.banners { display: flex; flex-direction: column; gap: 8px; }
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r-control); font-size: 13px;
  border: 1px solid transparent; text-decoration: none !important; color: inherit; }
.banner.info { background: var(--active-bg); color: var(--accent); border-color: var(--navy-100); }
.banner.warn { background: var(--orange-50); color: var(--orange); border-color: #F3DDBF; }
.banner.danger { background: var(--red-50); color: var(--red); border-color: var(--red-100); }
.banner .arrow { margin-left: auto; font-weight: 700; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 14px;
  border-radius: var(--r-control); border: 1px solid var(--border); background: var(--card); color: var(--accent);
  font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none !important;
  transition: background .15s ease-out, border-color .15s ease-out; }
.btn:hover { background: var(--sunken); }
.btn:focus-visible, .chip:focus-visible, .nav-a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--navy-100); }
.btn-p { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(27,58,107,.3); }
.btn-p:hover { background: var(--primary-hover); }
.btn-danger { color: var(--red); border-color: var(--red-100); background: var(--red-50); }
.btn-danger:hover { background: var(--red-100); }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 52px; font-size: 16px; font-weight: 700; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.icon-btn { width: 40px; height: 40px; border: 0; background: transparent; border-radius: 10px; display: inline-flex;
  align-items: center; justify-content: center; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--sunken); }
.linkbtn { border: 0; background: none; color: var(--accent); font-weight: 600; cursor: pointer; padding: 0; font-size: 13px; }

/* ---------- chips / seg / badges ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--card);
  color: var(--text); font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.chip.on { border-color: var(--accent); background: var(--active-bg); color: var(--accent); font-weight: 700; }
.chip.dashed { border-style: dashed; color: var(--accent); background: transparent; }
.chip-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 13px; cursor: pointer; }
.seg button.on { background: var(--navy-900); color: #fff; font-weight: 700; }
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px;
  font-weight: 700; white-space: nowrap; }
.b-info { background: var(--active-bg); color: var(--accent); }
.b-ok { background: var(--green-50); color: var(--green); }
.b-warn { background: var(--orange-50); color: var(--orange); }
.b-danger { background: var(--red-50); color: var(--red); }
.b-muted { background: var(--sunken); color: var(--muted); }
.b-dark { background: var(--navy-900); color: #fff; }
.team-chip { height: 28px; padding: 0 10px; border-radius: 999px; background: var(--active-bg); color: var(--accent); font-size: 12px;
  font-weight: 700; display: inline-flex; align-items: center; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .lbl { font-size: 13px; font-weight: 600; color: var(--muted); }
.req { color: var(--red-600); }
.input, select.input, textarea.input { height: 44px; border: 1px solid var(--border); border-radius: var(--r-control); padding: 0 12px;
  background: var(--card); font-size: 15px; width: 100%; min-width: 0; color: var(--head); }
textarea.input { height: auto; min-height: 72px; padding: 10px 12px; resize: vertical; }
.input[readonly] { background: var(--sunken); }
.input.big { font-size: 20px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.input-wrap { display: flex; align-items: center; gap: 6px; height: 48px; border: 1px solid var(--border); border-radius: var(--r-control);
  background: var(--card); padding: 0 12px; }
.input-wrap input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; height: 100%; font-size: 15px; color: var(--head); }
.input-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--navy-100); }
.input-wrap input:focus-visible { box-shadow: none; border: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
body.is-mobile .grid2, body.is-mobile .grid3 { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.help { font-size: 12px; color: var(--muted); }
.err { font-size: 12px; color: var(--red); }
details.more { border: 1px dashed var(--border-strong); border-radius: var(--r-control); padding: 0 12px; }
details.more > summary { cursor: pointer; height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; color: var(--muted); list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] { padding-bottom: 12px; }
details.more[open] > summary { color: var(--accent); font-weight: 600; }

.picker { position: relative; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-control); box-shadow: var(--shadow-pop); z-index: 50; max-height: 280px; overflow-y: auto; }
.suggest button { width: 100%; text-align: left; border: 0; background: none; padding: 10px 14px; cursor: pointer; display: flex;
  justify-content: space-between; gap: 8px; font-size: 14px; }
.suggest button:hover, .suggest button.hl { background: var(--active-bg); }
.selected { display: flex; align-items: center; gap: 10px; min-height: 52px; border: 1px solid var(--border); border-radius: var(--r-control);
  background: var(--card); padding: 8px 12px; }

/* 구간 카드 */
.route { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); overflow: hidden; }
.route .pt { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border-soft);
  cursor: pointer; width: 100%; border-left: 0; border-right: 0; border-top: 0; background: none; text-align: left; font-size: 15px; color: var(--head); }
.route .pt:hover { background: var(--sunken); }
.dot { width: 10px; height: 10px; border-radius: 999px; background: var(--primary); flex-shrink: 0; }
.dot.dest { border-radius: 2px; background: var(--red-600); }
.route .pt .ph { color: var(--muted); }
.route .actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.route .actions button { height: 42px; border: 0; background: var(--card); color: var(--accent); font-weight: 600; font-size: 13px; cursor: pointer; }
.route .actions button + button { border-left: 1px solid var(--border-soft); }
.map { position: relative; background-color: #EEF2F9;
  background-image: repeating-linear-gradient(0deg, transparent 0 25px, #DCE4F2 25px 26px), repeating-linear-gradient(90deg, transparent 0 25px, #DCE4F2 25px 26px); }
.map-mini { height: 140px; }
.map-big { height: 300px; border-radius: var(--r-card); overflow: hidden; border: 1px solid var(--border); }
.map-pick { height: 260px; border-radius: var(--r-control); overflow: hidden; border: 1px solid var(--border); }
body.is-desktop .map-pick { height: 320px; }
.dist-badge { position: absolute; right: 10px; top: 10px; z-index: 500; height: 30px; padding: 0 12px;
  border-radius: 999px; background: #1B3A6B; color: #fff; font-size: 14px; font-weight: 700; display: inline-flex; align-items: center;
  font-variant-numeric: tabular-nums; pointer-events: none; box-shadow: var(--shadow-pop); }
.leaflet-container { font-family: var(--font); background: transparent; }
.dist-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dist-stats > div { padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; }
.dist-stats > div + div { border-left: 1px solid var(--border-soft); }
.dist-stats b { font-size: 16px; color: var(--head); font-variant-numeric: tabular-nums; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font-weight: 500; color: var(--muted); padding: 9px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 9px 8px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--sunken); }
.tbl tr.flag td { background: var(--red-50); }
.tbl tfoot td { font-weight: 700; color: var(--head); border-bottom: 0; border-top: 1px solid var(--border); }
.tbl .r { text-align: right; }
.tbl .strong { font-weight: 700; color: var(--head); }
.minibar { display: flex; align-items: center; gap: 8px; }
.minibar .track { width: 100px; height: 6px; border-radius: 999px; background: var(--border-soft); flex-shrink: 0; }
.minibar .fill { height: 6px; border-radius: 999px; background: var(--primary); }
.hbar { display: flex; flex-direction: column; gap: 6px; }
.hbar .track { height: 8px; border-radius: 999px; background: var(--border-soft); }
.hbar .fill { height: 8px; border-radius: 999px; background: var(--primary); }
.stack-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; gap: 2px; background: var(--border-soft); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }

/* ---------- 내역 카드(휴대폰) ---------- */
.day { font-size: 12px; font-weight: 600; color: var(--muted); padding: 4px 2px 0; }
.ucard { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); padding: 12px 14px; display: flex;
  flex-direction: column; gap: 6px; cursor: pointer; text-align: left; width: 100%; font: inherit; color: inherit; }
.ucard:hover { border-color: var(--navy-200); }
.ucard.flag { border-color: var(--red-100); }
.ucard .l1 { display: flex; justify-content: space-between; gap: 8px; }
.ucard .l1 b { font-size: 15px; color: var(--head); }
.ucard .amt { font-size: 16px; font-weight: 700; color: var(--head); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ucard .l2 { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.sumbar { padding: 12px 14px; border-radius: var(--r-card); background: var(--active-bg); display: flex; justify-content: space-between;
  gap: 8px; font-size: 14px; color: var(--accent); font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.sumbar b { font-weight: 800; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: var(--r-card); }

/* 단계 */
.steps { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.steps li { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-control); padding: 10px 12px; display: flex;
  flex-direction: column; gap: 2px; min-width: 0; }
.steps li .s { font-size: 12px; font-weight: 700; }
.steps li .n { font-size: 13px; font-weight: 600; color: var(--head); }
.steps li.cur { background: var(--active-bg); border-color: var(--accent); }
body.is-mobile .steps { grid-template-columns: repeat(5, minmax(84px, 1fr)); overflow-x: auto; }

/* 메일 미리보기 */
.mail-frame { width: 100%; height: 420px; border: 1px solid var(--border); border-radius: var(--r-control); background: #F4F7FB; }

/* ---------- dialog ---------- */
dialog.dlg { border: 0; padding: 0; border-radius: 14px; box-shadow: var(--shadow-pop); width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 24px); background: var(--card); color: var(--text); }
dialog.dlg.wide { width: min(860px, calc(100vw - 24px)); }
dialog.dlg::backdrop { background: rgba(11, 21, 37, .45); backdrop-filter: blur(2px); }
.dlg-h { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border-soft); }
.dlg-b { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; max-height: calc(100vh - 160px); }
.dlg-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--border-soft); }
body.is-mobile dialog.dlg { width: 100vw; max-width: 100vw; max-height: 100vh; height: auto; margin: auto 0 0; border-radius: 16px 16px 0 0; }
.results { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-control); overflow: hidden; }
.results button { border: 0; border-bottom: 1px solid var(--border-soft); background: var(--card); text-align: left; padding: 10px 12px;
  cursor: pointer; display: flex; flex-direction: column; gap: 2px; font-size: 14px; color: var(--head); }
.results button:last-child { border-bottom: 0; }
.results button:hover, .results button.on { background: var(--active-bg); }
.results small { color: var(--muted); font-size: 12px; }
.secret { font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; font-size: 18px; font-weight: 700; letter-spacing: .05em;
  background: var(--sunken); border-radius: 8px; padding: 10px 14px; color: var(--head); user-select: all; }

/* ---------- toast ---------- */
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column;
  gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 24px); }
body.is-mobile #toasts { bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom)); }
.toast { background: var(--navy-900); color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow-pop);
  animation: toastIn .2s ease-out; pointer-events: auto; }
.toast.err { background: #A93232; }
.toast.ok { background: #2F7048; }
@keyframes toastIn { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- login ---------- */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 20px; gap: 32px; }
.login .logo { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.login .logo .brand { font-size: 34px; }
.login .logo span:last-child { color: var(--muted); font-weight: 500; font-size: 15px; }
.login form { width: min(400px, 100%); }
.login .foot { text-align: center; font-size: 12px; color: var(--muted); }
.login .foot b { color: var(--accent); }

/* ---------- 탭(관리) ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs a { height: 42px; padding: 0 14px; display: inline-flex; align-items: center; color: var(--muted); font-size: 14px; white-space: nowrap;
  text-decoration: none !important; }
.tabs a.on { color: var(--accent); font-weight: 700; box-shadow: inset 0 -2px 0 var(--accent); }
.menu-list { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); overflow: hidden; }
.menu-list a, .menu-list button { display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 52px; border: 0; border-bottom: 1px solid var(--border-soft);
  background: none; color: var(--head); font-size: 15px; text-align: left; cursor: pointer; text-decoration: none !important; width: 100%; }
.menu-list > :last-child { border-bottom: 0; }
.menu-list .chev { margin-left: auto; color: var(--muted); }

.chart-box { position: relative; height: 220px; }
body.is-mobile .chart-box { height: 180px; }
.flag-item { border: 1px solid var(--border-soft); border-radius: var(--r-control); padding: 10px 12px; display: flex; flex-direction: column;
  gap: 4px; cursor: pointer; background: var(--card); text-align: left; font: inherit; color: inherit; width: 100%; }
.flag-item:hover { border-color: var(--red-100); }
.flag-item .x { color: var(--red); font-weight: 700; }
@media print { .side, .tabbar, .topbar, .page-head .btn { display: none !important; } .main { padding: 0; } }
