:root {
  --bg: #f3f5f9;
  --card: #ffffff;
  --text: #141a26;
  --muted: #667085;
  --line: #e4e8ef;
  --primary: #2457f5;
  --primary-weak: #e8eeff;
  --ok: #12a150;
  --ok-weak: #e3f6ea;
  --warn: #c77700;
  --warn-weak: #fff3dc;
  --danger: #d92d20;
  --danger-weak: #fde8e6;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e121a; --card: #171c26; --text: #eef1f6; --muted: #9aa4b5; --line: #262d3a;
    --primary: #5b82ff; --primary-weak: #1c2747; --ok: #3ccf7f; --ok-weak: #15301f;
    --warn: #f0a83a; --warn-weak: #33270f; --danger: #ff6b5e; --danger-weak: #3a1916;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", "Noto Sans KR", sans-serif;
  font-size: 16px; line-height: 1.5; word-break: keep-all;
}
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; }

.wrap { max-width: 520px; margin: 0 auto; padding: 0 16px 96px; }
.wrap.no-nav { padding-bottom: 32px; }
.top { display: flex; align-items: center; justify-content: space-between; padding: 18px 0 10px; }
.brand { font-weight: 800; font-size: 17px; letter-spacing: -.2px; color: var(--text); }
.brand span { color: var(--primary); }
.top .who { font-size: 13px; color: var(--muted); }

.page-title { font-size: 22px; font-weight: 800; margin: 8px 0 14px; letter-spacing: -.4px; }
.sub { color: var(--muted); font-size: 14px; margin: -8px 0 16px; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px; border: 1px solid var(--line); }
.card h3 { font-size: 16px; margin-bottom: 10px; }
.card.center { text-align: center; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 5px 10px; border-radius: 999px; }
.badge.watch { background: var(--primary-weak); color: var(--primary); }
.badge.ok { background: var(--ok-weak); color: var(--ok); }
.badge.warn { background: var(--warn-weak); color: var(--warn); }
.badge.muted { background: var(--bg); color: var(--muted); }
.badge.danger { background: var(--danger-weak); color: var(--danger); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.dot.pulse { animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { opacity: 1 } 50% { opacity: .3 } 100% { opacity: 1 } }

.trip { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: 16px 0 6px; }
.trip .leg .lbl { font-size: 12px; color: var(--muted); }
.trip .leg .d { font-size: 18px; font-weight: 800; letter-spacing: -.3px; }
.trip .leg .t { font-size: 14px; color: var(--muted); }
.trip .leg.right { text-align: right; }
.trip .arrow { color: var(--muted); font-size: 20px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 14px; margin: 12px 0 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.stat { background: var(--bg); border-radius: 12px; padding: 10px; text-align: center; }
.stat .n { font-size: 18px; font-weight: 800; }
.stat .l { font-size: 12px; color: var(--muted); }

.note { font-size: 13px; color: var(--muted); margin-top: 10px; }
.alert { border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-bottom: 14px; }
.alert.ok { background: var(--ok-weak); color: var(--ok); }
.alert.err { background: var(--danger-weak); color: var(--danger); }
.alert.info { background: var(--primary-weak); color: var(--primary); }
.alert.warn { background: var(--warn-weak); color: var(--warn); }

/* 폼 */
label.f { display: block; margin-bottom: 14px; }
label.f > span { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
input[type=text], input[type=password], input[type=tel], input[type=date], select {
  width: 100%; height: 50px; padding: 0 14px; font-size: 16px; color: var(--text);
  background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; outline: none;
  -webkit-appearance: none; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 22px, calc(100% - 14px) 22px; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
input:focus, select:focus { border-color: var(--primary); }
.err-text { color: var(--danger); font-size: 13px; margin-top: 6px; }
.has-err input, .has-err select { border-color: var(--danger); }
.row2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { display: block; text-align: center; padding: 13px 8px; border: 1.5px solid var(--line); border-radius: 12px; font-weight: 700; background: var(--card); }
.seg input:checked + label { border-color: var(--primary); color: var(--primary); background: var(--primary-weak); }
.seg small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }

.check { display: flex; gap: 10px; align-items: flex-start; padding: 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); }
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--primary); }
.check b { display: block; font-size: 15px; }
.check small { color: var(--muted); font-size: 13px; }

.btn { display: flex; align-items: center; justify-content: center; width: 100%; height: 52px; border: 0; border-radius: 14px;
  font-size: 16px; font-weight: 800; cursor: pointer; background: var(--primary); color: #fff; text-decoration: none; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.ghost { background: var(--bg); color: var(--text); border: 1px solid var(--line); }
.btn.danger-ghost { background: transparent; color: var(--danger); border: 1.5px solid var(--danger-weak); }
.btn.sm { height: 44px; font-size: 15px; border-radius: 12px; }
.btns { display: grid; gap: 8px; margin-top: 14px; }
.btns.two { grid-template-columns: 1fr 1fr; }
form.inline { margin: 0; }

/* 하단 탭 */
.nav { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.nav ul { list-style: none; margin: 0 auto; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); max-width: 520px; }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 0 8px; font-size: 12px; color: var(--muted); font-weight: 600; }
.nav a.on { color: var(--primary); }
.nav svg { width: 24px; height: 24px; }

/* 내역 */
.hist { display: grid; gap: 10px; }
.hist .card { margin: 0; }
.hist .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.hist .when { font-size: 13px; color: var(--muted); }
.hist .route { font-weight: 800; font-size: 16px; margin: 6px 0 2px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* 모달 */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 14, 22, .55); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--card); width: 100%; max-width: 520px; max-height: 92vh; border-radius: 22px 22px 0 0; display: flex; flex-direction: column;
  padding: 20px 18px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 600px) { .modal-bg { align-items: center; } .modal { border-radius: 22px; } }
.modal h2 { font-size: 20px; margin-bottom: 6px; }
.modal .lead { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.modal.success { text-align: center; }
.modal .big { font-size: 48px; line-height: 1; margin: 6px 0 10px; }
.hidden { display: none !important; }

/* 약관 */
.terms-body { overflow-y: auto; flex: 1; margin: 0 -2px; padding: 0 2px; }
.term { margin-bottom: 14px; }
.term-title { font-weight: 800; font-size: 15px; margin-bottom: 8px; }
.term-box { height: 34vh; min-height: 200px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; color: var(--text); background: var(--bg); }
.term-box h4 { font-size: 14px; margin: 14px 0 6px; }
.term-box h4:first-child { margin-top: 0; }
.term-box ul { padding-left: 18px; margin: 4px 0; }
.term-box p { margin: 4px 0; }
.term .check { margin-top: 8px; }
.term .check.locked { opacity: .45; }
.scroll-hint { font-size: 12px; color: var(--warn); margin-top: 6px; }
.terms-page h4 { margin: 18px 0 6px; font-size: 15px; }
.terms-page ul { padding-left: 18px; }

.login-hero { padding: 48px 0 24px; text-align: center; }
.login-hero .logo { width: 64px; height: 64px; border-radius: 18px; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 900; margin-bottom: 14px; }
.login-hero h1 { font-size: 24px; letter-spacing: -.5px; }
.login-hero p { color: var(--muted); margin: 6px 0 0; font-size: 14px; }
.foot { text-align: center; font-size: 12px; color: var(--muted); margin-top: 24px; }
.foot a { color: var(--muted); text-decoration: underline; }
.mt { margin-top: 16px; }
h3.mt { margin-bottom: 10px; }
.f-label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
a.card { display: block; color: var(--text); }
a.card h3 { color: var(--primary); margin-bottom: 2px; }
a.card .note { margin-top: 0; }
textarea { width: 100%; padding: 12px 14px; font: inherit; font-size: 16px; color: var(--text); background: var(--card);
  border: 1.5px solid var(--line); border-radius: 12px; outline: none; resize: vertical; min-height: 140px; }
textarea:focus { border-color: var(--primary); }
.seg.three { grid-template-columns: repeat(3, 1fr); }
.seg.three label { padding: 12px 4px; font-size: 14px; }
.list-title { font-size: 16px; margin: 22px 0 10px; }
.msg { white-space: pre-wrap; word-break: break-word; margin: 8px 0 0; font-size: 15px; }
.reply { margin-top: 12px; padding: 12px; border-radius: 12px; background: var(--primary-weak); }
.reply-head { font-size: 13px; font-weight: 700; color: var(--primary); }
.reply .msg { margin-top: 4px; }
.alert a { color: inherit; font-weight: 800; text-decoration: underline; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 19px; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; }
.login-hero .logo-img { width: 72px; height: 72px; border-radius: 20px; margin-bottom: 14px; box-shadow: 0 8px 24px rgba(36, 87, 245, .25); }
.login-hero h1 { font-size: 30px; }
.login-hero h1 span { color: var(--primary); }
.login-hero p { line-height: 1.6; }

.fee { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--bg); font-size: 13.5px; }
.fee p { margin: 0 0 6px; }
.fee ul { margin: 0 0 6px; padding-left: 18px; }
.fee-est { font-weight: 800; color: var(--primary); }
