:root {
  --korail-blue: #14448c;
  --korail-blue-dark: #0f3568;
  --accent: #1f6fe0;
  --bg: #eef1f5;
  --card: #ffffff;
  --line: #e2e6ec;
  --text: #1a1f27;
  --muted: #8a93a2;
  --green: #1aa251;
  --red: #e0483b;
  --amber: #e0951f;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  background: var(--korail-blue);
  color: #fff;
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.brand { font-size: 19px; letter-spacing: .3px; font-weight: 800; }
.brand b { font-weight: 800; opacity: 1; font-size: inherit; }
.icon-btn { background: transparent; border: 0; font-size: 22px; color: #fff; line-height: 1; }
.icon-btn:active { transform: scale(.9); }

main { padding: 14px; max-width: 520px; margin: 0 auto; }

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 18px 16px 16px;
  box-shadow: 0 2px 10px rgba(20,68,140,.08);
  margin-bottom: 16px;
}
.card-title { font-weight: 700; font-size: 15px; color: var(--korail-blue); margin-bottom: 14px; }

.od-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.station { flex: 1; text-align: center; }
.station .label { font-size: 12px; color: var(--muted); }
.station .name { font-size: 30px; font-weight: 800; color: var(--korail-blue-dark); cursor: pointer; }
.swap-btn {
  width: 46px; height: 34px; border-radius: 18px;
  border: 1px solid var(--accent); color: var(--accent);
  background: #fff; font-size: 16px;
}

.field-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 2px; border-top: 1px solid var(--line);
}
.field-label { font-size: 13px; color: var(--accent); }
.field-value { display: flex; gap: 8px; align-items: center; }
.field-value input[type="date"], .field-value input[type="time"] {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 15px; background:#fff;
}
.stepper { gap: 12px; }
.stepper button {
  width: 32px; height: 32px; border-radius: 16px; border: 1px solid var(--line);
  background: #fff; font-size: 18px; color: var(--korail-blue);
}

.options { display: flex; flex-wrap: wrap; gap: 12px; padding: 12px 2px; border-top: 1px solid var(--line); font-size: 13px; color: #444; }
.options label { display: flex; align-items: center; gap: 5px; }
.options select { border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; }

.cta-row { display: flex; gap: 10px; margin-top: 8px; }
.btn {
  flex: 1; padding: 14px; border: 0; border-radius: 10px;
  background: var(--korail-blue); color: #fff; font-size: 16px; font-weight: 700;
}
.btn.ghost { background: #fff; color: var(--korail-blue); border: 1.5px solid var(--korail-blue); }
.btn:active { opacity: .85; }

.list-section { margin-bottom: 18px; }
.list-section h3 { font-size: 15px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.meta { font-size: 12px; color: var(--muted); font-weight: 400; }
.mini-btn { margin-left: auto; font-size: 12px; border: 1px solid var(--line); background:#fff; border-radius: 6px; padding: 3px 8px; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }

.train {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 8px; display: flex; align-items: center; gap: 10px;
}
.train .info { flex: 1; }
.train .no { font-weight: 700; }
.train .time { color: #333; font-size: 14px; }
.train .status { font-size: 12px; padding: 3px 8px; border-radius: 10px; }
.status.ok { background: #e6f6ec; color: var(--green); }
.status.sold { background: #fdeceb; color: var(--red); }
.status.wait { background: #fdf4e3; color: var(--amber); }
.train .watch-btn { border: 1px solid var(--korail-blue); color: var(--korail-blue); background:#fff; border-radius: 8px; padding: 8px 10px; font-size: 13px; font-weight: 700; }

.watch-item, .rsv-item {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 8px; display: flex; align-items: center; gap: 10px;
}
.watch-item .grow, .rsv-item .grow { flex: 1; font-size: 14px; }
.watch-item .sub, .rsv-item .sub { font-size: 12px; color: var(--muted); }
.stop-btn { border: 1px solid var(--red); color: var(--red); background:#fff; border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.start-btn { border: 1px solid var(--green); color: var(--green); background:#fff; border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.badge { font-size: 11px; padding: 2px 7px; border-radius: 9px; background:#eef; color:#446; }

#trainList { max-height: 44vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
#trainList.collapsed { display: none; }

.hidden { display: none !important; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-box { background: #fff; border-radius: 16px; padding: 20px; width: 88%; max-width: 380px; position: relative; }
.modal-box h3 { margin: 0 0 12px; }
.modal-box input { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; font-size: 15px; }
.modal-actions { display: flex; gap: 8px; }
.account-status { font-size: 13px; margin-bottom: 10px; color: var(--korail-blue); }
.close-btn { position: absolute; top: 14px; right: 16px; border: 0; background: transparent; font-size: 14px; color: var(--muted); }
.hint { font-size: 11px; color: var(--muted); margin: 12px 0 0; }
.rsv-hint { font-size: 12px; color: var(--muted); margin: 0 0 8px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #222; color: #fff; padding: 10px 16px; border-radius: 20px; font-size: 14px; z-index: 100;
  max-width: 90%;
}

/* 접근 잠금 화면 */
.gate {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center; z-index: 60; padding: 24px;
}
.gate-box { background: #fff; border-radius: 16px; padding: 32px 24px; text-align: center; max-width: 340px; width: 100%; box-shadow: 0 6px 24px rgba(0,0,0,.08); }
.gate-emoji { font-size: 44px; }
.gate-box h2 { margin: 12px 0 8px; font-size: 20px; }
.gate-box p { color: var(--muted); font-size: 14px; margin: 0 0 20px; line-height: 1.5; }
.gate-box .btn { width: 100%; }

/* 관리자 사용자 목록 */
.admin-list { max-height: 60vh; overflow-y: auto; }
.admin-item { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.admin-item .grow { flex: 1; min-width: 0; }
.admin-item .grow .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.admin-item .st { font-size: 11px; padding: 2px 6px; border-radius: 6px; }
.admin-item .st.pending { background: #fff4e0; color: var(--amber); }
.admin-item .st.approved { background: #e5f6ec; color: var(--green); }
.admin-item .st.rejected { background: #fdeceb; color: var(--red); }
.admin-item button { border-radius: 8px; padding: 6px 10px; font-size: 13px; border: 1px solid var(--line); background: #fff; }
.admin-item .ok { border-color: var(--green); color: var(--green); }
.admin-item .no { border-color: var(--red); color: var(--red); }
