:root {
  --bg: #0f1115;
  --card: #1a1d24;
  --border: #2a2e37;
  --text: #e6e8eb;
  --muted: #9aa0aa;
  --primary: #3b82f6;
  --danger: #ef4444;
  --ok: #22c55e;
  --srt: #e11d48;
  --ktx: #0ea5e9;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

header h1 { font-size: 20px; margin: 0; }

.header-right { display: flex; align-items: center; gap: 12px; }
.user-label { color: var(--muted); font-size: 13px; }
#logout-btn { white-space: nowrap; flex-shrink: 0; }
button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
button.ghost:hover { color: var(--text); border-color: var(--primary); }

.rail-toggle { display: flex; gap: 6px; }
.rail-btn {
  padding: 6px 16px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}
.rail-btn.active[data-rail="SRT"] { background: var(--srt); color: #fff; border-color: var(--srt); }
.rail-btn.active[data-rail="KTX"] { background: var(--ktx); color: #fff; border-color: var(--ktx); }

.tabs { display: flex; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--border); }
.tab {
  padding: 12px 18px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
}
.tab.active { color: var(--text); border-bottom-color: var(--primary); }

main { max-width: 760px; margin: 0 auto; padding: 20px; }
.panel { display: none; }
.panel.active { display: block; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 14px; font-size: 16px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

label { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); gap: 5px; }
label.checkbox, .checks label { flex-direction: row; align-items: center; gap: 6px; color: var(--text); }

select, input[type="text"], input[type="password"] {
  background: #0f1115;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 14px;
}

.checks { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 14px; }

button.primary, button.danger {
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
}
button.primary { background: var(--primary); color: #fff; }
button.danger { background: var(--danger); color: #fff; }
button:disabled { opacity: .5; cursor: not-allowed; }

.train-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.train-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: "SF Mono", Menlo, monospace;
  font-size: 13px;
  cursor: pointer;
}
/* ── 열차 목록: 칼럼 정렬 ───────────────────────────────────────── */
/* 페이지네이션으로 최대 60건이 오므로 한 줄 문자열이 아니라 칼럼으로 비교 가능하게. */
#trains-filter.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 12px; }
#trains-filter .chip {
  padding: 4px 11px; font: inherit; font-size: 12px; cursor: pointer;
  color: var(--muted); background: transparent;
  border: 1px solid var(--border); border-radius: 999px;
}
#trains-filter .chip:hover { border-color: var(--primary); color: var(--fg); }
#trains-filter .chip.on { color: #fff; background: var(--primary); border-color: var(--primary); }
#trains-filter .count { margin-left: auto; font-size: 12px; color: var(--muted); }

.train-head, .train-item {
  display: grid;
  /* 마지막 열은 좌석 버튼 — '좌석 선택'/'좌석 배치' 가 줄바꿈 없이 들어가는 폭 */
  grid-template-columns: 96px 1fr 46px 92px 66px 26px 74px;
  gap: 8px;
  align-items: center;
}
.train-head {
  padding: 0 12px 6px; font-size: 11px; color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.train-head .r, .train-item .r { text-align: right; }
.train-item { flex-wrap: nowrap; font-size: 13px; }
.train-item.dim { opacity: .5; }
.train-item .tn { display: flex; align-items: center; gap: 5px; min-width: 0; }
.train-item .badge-train {
  font-size: 10px; font-weight: 400; padding: 2px 5px; border-radius: 4px;
  color: var(--primary); background: rgba(59,130,246,.14); white-space: nowrap;
}
.train-item .tt { font-size: 14px; letter-spacing: -.2px; white-space: nowrap; }
.train-item .dur, .train-item .r em { font-size: 11px; color: var(--muted); font-style: normal; }
.train-item .r em { display: block; }
.train-item .r i { font-style: normal; font-size: 12px; }
/* 특실이 아닌 등급(청룡·이음의 우등실)만 이름을 덧붙인다 */
.train-item .r .cls {
  display: block; font-size: 9px; color: var(--muted); text-decoration: none;
}
.train-item .st-ok { color: var(--fg); }
.train-item .st-low { color: #f59e0b; }
.train-item .st-out { color: #ef4444; }
.train-item .st-none { color: var(--muted); }
.train-item .pick input { margin: 0; }
.train-item .seat-btn {
  padding: 3px 7px; font-size: 11px; font-family: inherit; cursor: pointer;
  color: var(--muted); background: transparent;
  border: 1px solid var(--border); border-radius: 6px; white-space: nowrap;
}
.train-item .seat-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--fg); }
.train-item .seat-btn:disabled { opacity: .5; cursor: default; }
.train-item .seat-detail {
  grid-column: 1 / -1;
  display: flex; flex-wrap: wrap; gap: 5px; align-items: center;
  margin-top: 2px; font-size: 11px; color: var(--muted);
}
.train-item .rs-total { margin-right: 3px; }
.train-item .rs-car {
  font-family: "SF Mono", Menlo, monospace;
  padding: 2px 6px; border-radius: 4px;
  color: var(--muted); background: rgba(148,163,184,.12);
}
.train-item .rs-car.many { color: #22c55e; background: rgba(34,197,94,.14); }
.train-item .rs-car.none { color: #ef4444; background: rgba(239,68,68,.12); }
.train-item .rs-more {
  padding: 2px 7px; font: inherit; font-size: 11px; cursor: pointer;
  color: var(--muted); background: transparent;
  border: 1px solid var(--border); border-radius: 4px;
}
.train-item .rs-more:hover { border-color: var(--primary); color: var(--fg); }
.train-item .rs-car { cursor: pointer; border: 1px solid transparent; }
.train-item .rs-car:hover { border-color: var(--primary); }
.train-item .rs-car.on { border-color: var(--primary); color: var(--fg); }
.train-item .rs-car.pending { opacity: .45; cursor: default; }
.train-item .rs-car.none:disabled { opacity: .4; cursor: default; }

/* ── 좌석 배치도 ────────────────────────────────────────────────── */
.train-item .seat-map {
  grid-column: 1 / -1;
  margin-top: 6px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px;
}
.seat-map .sm-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-bottom: 9px; font-size: 12px; color: var(--muted);
}
.seat-map .sm-head b { font-weight: 500; color: var(--fg); }
.seat-map .sm-head .dir { padding: 1px 7px; border-radius: 999px; background: rgba(148,163,184,.14); }
.seat-map .sm-head .vr { color: var(--primary); text-decoration: none; }
/* 차량을 가로로 눕혀 그린다 — 진행방향 오른쪽, 위·아래가 창측, 가운데 통로.
   좌석은 의자 모양(몸체 + 등받이 ::after). 등받이는 통로 쪽을 향한다. */
.seat-map .sm-scroll { overflow-x: auto; padding-bottom: 4px; outline: none; }
.seat-map .sm-scroll:focus-visible { box-shadow: 0 0 0 2px rgba(59,130,246,.45); border-radius: 6px; }
.seat-map .sm-scroll.dragging { cursor: grabbing; user-select: none; }
.seat-map .sm-grid {
  display: grid; gap: 3px; justify-content: start; align-items: center;
  font-family: "SF Mono", Menlo, monospace; width: max-content;
}
.seat-map .sm-side {
  font-size: 9px; color: var(--muted); text-align: right; padding-right: 4px;
  white-space: nowrap;
}
.seat-map .sm-dir-head {
  font-size: 10px; color: var(--primary); white-space: nowrap; padding-left: 5px;
}
.seat-map .sm-aisle { font-size: 9px; color: var(--muted); text-align: center; opacity: .5; }
.seat-map .sm-x, .seat-map .sm-gap { }

/* 세로 배치: 차량을 가운데 두고 좌우에 호차 이동 버튼 */
/* 차량을 가운데 두고 좌우에 호차 이동 버튼 (가로·세로 공통).
   세로는 15행이라 길어지므로 격자 자체에 높이 제한을 둬서, 버튼이 중앙에 있어도
   항상 화면에 보이게 한다(격자는 안에서 스크롤). */
.seat-map .sm-body {
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.seat-map .sm-body .sm-scroll {
  flex: 0 1 auto;
  max-height: 60vh; overflow-y: auto;
}
.seat-map .sm-sidebtn {
  flex: 0 0 auto; width: 40px; height: 96px; padding: 0;
  font: inherit; font-size: 24px; line-height: 1; cursor: pointer;
  color: var(--fg); background: transparent;
  border: 1px solid var(--border); border-radius: 10px;
}
.seat-map .sm-sidebtn:hover:not(:disabled) {
  border-color: var(--primary); background: rgba(59,130,246,.10);
}
.seat-map .sm-sidebtn:active:not(:disabled) { transform: scale(.96); }
.seat-map .sm-sidebtn:disabled { opacity: .25; cursor: default; }

.seat-map .sm-navpos { font-size: 11px; color: var(--muted); min-width: 30px; }

/* 좁은 화면: 좌석 44px 를 지키려면 격자에 폭을 다 줘야 한다.
   버튼을 나란히 두면 자리가 없으니 격자 좌우 끝에 겹쳐 띄운다. */
@media (max-width: 480px) {
  .seat-map .sm-body { position: relative; gap: 0; }
  .seat-map .sm-body .sm-scroll { flex: 1 1 auto; }
  .seat-map .sm-sidebtn {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
    width: 30px; height: 72px; font-size: 20px;
    background: color-mix(in srgb, var(--card) 88%, transparent);
    border-color: var(--border);
  }
  .seat-map .sm-sidebtn:first-child { left: 0; }
  .seat-map .sm-sidebtn:last-child { right: 0; }
  .seat-map .sm-sidebtn:active:not(:disabled) { transform: translateY(-50%) scale(.96); }
}

/* 방향 토글 */
.seat-map .sm-dirtoggle { margin-left: auto; display: inline-flex; gap: 3px; }
.seat-map .sm-dirtoggle button {
  padding: 2px 8px; font: inherit; font-size: 11px; cursor: pointer;
  color: var(--muted); background: transparent;
  border: 1px solid var(--border); border-radius: 999px;
}
.seat-map .sm-dirtoggle button:hover { border-color: var(--primary); color: var(--fg); }
.seat-map .sm-dirtoggle button.on { color: #fff; background: var(--primary); border-color: var(--primary); }

/* 세로 배치용 머리줄 */
.seat-map .sm-colhead {
  font-size: 9px; color: var(--muted); text-align: center; padding-bottom: 2px;
}
.seat-map .sm-grid.v .sm-dir-head { text-align: center; padding-left: 0; }

/* 창문 — 가로 배치는 위·아래 가로 띠, 세로 배치는 좌·우 세로 바 */
/* 창문은 좌석 2칸당 1개 — 좌석 크기가 바뀌면 간격(gap 3px)도 따라가야 한다 */
.seat-map .sm-win.h { height: 4px; display: block; border-radius: 2px; }
.seat-map .sm-win.h.on {
  background: rgba(59,130,246,.4);
  box-shadow: calc(var(--seat-w) + 3px) 0 0 rgba(59,130,246,.4);
}
.seat-map .sm-win.v { width: 4px; height: var(--seat-h); display: block; border-radius: 2px; }
.seat-map .sm-win.v.on {
  background: rgba(59,130,246,.4);
  box-shadow: 0 calc(var(--seat-h) + 3px) 0 rgba(59,130,246,.4);
}
.seat-map .sm-win-chip {
  display: inline-block; width: 12px; height: 4px; vertical-align: 2px;
  background: rgba(59,130,246,.4); border-radius: 2px;
}

/* 좌석 크기 — 마우스는 촘촘하게, 손가락은 크게.
   iOS/Android 가이드라인 최소 터치 영역이 44px 이라 coarse 포인터에서 맞춘다. */
.seat-map { --seat-w: 30px; --seat-h: 28px; --seat-fs: 9px; --aisle-w: 30px; }
@media (pointer: coarse) {
  /* 통로는 방향 화살표만 들어가면 되므로 좁혀서 좌석 폭을 확보한다.
     세로 배치 총폭 = 6 + 44×2 + 20 + 44×2 + 6 = 208px (모바일 가용 215px) */
  .seat-map { --seat-w: 44px; --seat-h: 42px; --seat-fs: 11px; --aisle-w: 20px; }
}

.seat-map .sm-seat {
  position: relative; display: block;
  width: var(--seat-w); height: var(--seat-h);
  border: 1px solid var(--border); border-radius: 6px;
  background: rgba(148,163,184,.06);
}
.seat-map .sm-seat b {
  position: absolute; inset: 0; line-height: calc(var(--seat-h) - 2px);
  font-size: var(--seat-fs); font-weight: 400; text-align: center; color: var(--fg);
}
/* 등받이 — 두툼한 선. 위치는 아래 '좌석 방향' 규칙이 진행방향 기준으로 정한다 */
.seat-map .sm-seat::after {
  content: ""; position: absolute; left: 4px; right: 4px; top: 2px; height: 3px;
  border-radius: 2px; background: var(--border);
}
.seat-map .sm-seat.win {
  background: rgba(59,130,246,.13); border-color: rgba(59,130,246,.45);
}
.seat-map .sm-seat.win::after { background: rgba(59,130,246,.55); }
/* 선택불가 — 봐야 하는 건 '가능한 좌석'이라 최대한 죽인다 */
.seat-map .sm-seat.off {
  background: transparent; border-color: var(--border); border-style: dashed;
  opacity: .28;
}
.seat-map .sm-seat.off::after { background: var(--border); }
/* 안내 문구가 붙은 좌석(4인동반석·유아동반석 등) */
.seat-map .sm-seat.noted { border-color: #f59e0b; }
.seat-map .sm-seat.noted::after { background: #f59e0b; }
/* 좌석 지정(SRT) — 누를 수 있는 좌석과 선택된 좌석 */
.seat-map .sm-seat.pk { cursor: pointer; }
.seat-map .sm-seat.pk:hover { border-color: var(--primary); }
.seat-map .sm-seat.sel {
  background: var(--primary); border-color: var(--primary);
}
.seat-map .sm-seat.sel b { color: #fff; font-weight: 600; }
.seat-map .sm-seat.sel::after { background: rgba(255,255,255,.7); }

/* 좌석 지정 하단 바 — 선택 현황 + 예매 버튼 */
.seat-map .sm-pick {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
}
.seat-map .sm-pick-info { font-size: 12px; color: var(--muted); }
.seat-map .sm-pick-go { padding: 8px 16px; }
.seat-map .sm-pick-go:disabled { opacity: .45; cursor: default; }

.seat-map .sm-legend {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  margin-top: 10px; font-size: 11px; color: var(--muted);
}
/* 범례 아이콘도 본체와 같은 의자 모양으로 */
.seat-map .sm-legend i {
  position: relative; display: inline-block; width: 18px; height: 16px;
  vertical-align: -4px; border: 1px solid var(--border); border-radius: 4px;
  background: rgba(148,163,184,.06);
}
.seat-map .sm-legend i::after {
  content: ""; position: absolute; left: 3px; right: 3px; top: 2px; height: 2px;
  border-radius: 1px; background: var(--border);
}
.seat-map .sm-legend i.win { background: rgba(59,130,246,.13); border-color: rgba(59,130,246,.45); }
.seat-map .sm-legend i.win::after { background: rgba(59,130,246,.55); }
.seat-map .sm-legend i.off { background: transparent; border-style: dashed; opacity: .35; }
.seat-map .sm-legend i.noted { border-color: #f59e0b; }
.seat-map .sm-legend i.noted::after { background: #f59e0b; }
.seat-map .sm-legend i b { display: none; }
.train-item:hover { border-color: var(--primary); }

/* 스크롤을 따라오는 선택/예매 바.
   열차가 60건이고 배치도를 펼치면 한 행이 화면보다 커져서, 목록 끝까지 내려가지
   않고 보고 있는 자리에서 예매를 시작할 수 있어야 한다. */
.pick-bar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 12px; padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--card);
  box-shadow: 0 -6px 16px rgba(0,0,0,.35);
}
.pick-bar.on { border-color: var(--primary); }
.pick-bar .n { font-size: 13px; font-weight: 500; white-space: nowrap; }
.pick-bar .names {
  font-size: 11px; font-family: "SF Mono", Menlo, monospace;
  flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pick-bar .pick-opts {
  flex: 0 0 auto; padding: 4px 10px; font: inherit; font-size: 11px; cursor: pointer;
  color: var(--muted); background: transparent;
  border: 1px solid var(--border); border-radius: 999px; white-space: nowrap;
}
.pick-bar .pick-opts:hover { border-color: var(--primary); color: var(--text); }
.pick-bar .pick-go { flex: 0 0 auto; padding: 7px 18px; font-size: 13px; }
.pick-bar .pick-main {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%;
}
/* 설정을 바 안에서 펼친다 — 목록이 길어도 스크롤을 오갈 필요가 없다 */
.pick-bar .pick-options {
  width: 100%; margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--border);
  max-height: 46vh; overflow-y: auto;
}
.pick-bar .pick-options[hidden] { display: none; }
.pick-bar .pick-opts[aria-expanded="true"] { border-color: var(--primary); color: var(--text); }

/* 마지막 행이 바에 가리지 않게 */
#trains-list { padding-bottom: 6px; }

@media (max-width: 480px) {
  .pick-bar { gap: 6px; padding: 8px 10px; }
  .pick-bar .names { flex-basis: 100%; order: 3; }
  .pick-bar .pick-go { margin-left: auto; }
}

/* 좁은 화면: 소요시간·특실 칼럼을 접고 열차/시각/일반실/선택만 남긴다.
   (특실은 요금·상태가 길어 375px 에서 넘친다) */
@media (max-width: 760px) {
  .train-head { display: none; }
  .train-item {
    grid-template-columns: 78px 1fr auto 22px;
    row-gap: 4px;
  }
  .train-item .c-dur, .train-item .c-spe { display: none; }
  .train-item .tt { font-size: 13px; }
  .train-item .seat-btn { grid-column: 1 / -1; justify-self: start; }
  #trains-filter .count { margin-left: 0; }
}
.train-item.selected { border-color: var(--primary); background: rgba(59,130,246,.12); }
.train-item .label { white-space: pre; overflow-x: auto; }

.countdown { font-size: 12px; color: var(--muted); margin: 4px 0; font-variant-numeric: tabular-nums; }
.countdown.urgent { color: var(--danger); font-weight: 700; }

/* 예약 확인 행 — 열차 목록(.train-item)의 그리드와 달리 세로 스택 */
.res-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-family: "SF Mono", Menlo, monospace; font-size: 13px;
}
.res-item .label { white-space: pre-wrap; word-break: break-word; }
.res-detail { font-family: "SF Mono", Menlo, monospace; font-size: 12px; color: var(--muted); margin: 2px 0 0; white-space: pre-wrap; word-break: break-word; }
.rail-tag { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 5px; margin-right: 6px; color: #fff; }
.rail-tag.SRT { background: var(--srt); }
.rail-tag.KTX { background: var(--ktx); }
.job-log { background: #0a0d11; border: 1px solid var(--border); border-radius: 8px; padding: 10px; font-family: "SF Mono", Menlo, monospace; font-size: 12px; color: var(--muted); white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow-y: auto; margin: 6px 0 0; }
.job-targets { margin: 4px 0 12px; padding-left: 18px; font-size: 13px; }
.job-targets li { margin: 3px 0; word-break: break-word; }
.res-actions { display: flex; gap: 8px; margin-top: 8px; }
.res-actions button { padding: 6px 12px; font-size: 13px; }

.badge { font-size: 12px; padding: 2px 10px; border-radius: 20px; font-weight: 600; }
.badge.on { background: var(--ok); color: #04210f; }
.badge.off { background: var(--border); color: var(--muted); }
.badge.running { background: var(--primary); color: #fff; }
.badge.success { background: var(--ok); color: #04210f; }
.badge.stopped, .badge.error { background: var(--danger); color: #fff; }

.muted { color: var(--muted); font-size: 13px; margin-bottom: 10px; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.notice {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(239, 68, 68, .12);
  border: 1px solid var(--danger);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
}
.notice button { margin-left: auto; flex-shrink: 0; }

.login-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-top: 12px;
}
.login-block-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.rail-tag { font-weight: 700; font-size: 13px; padding: 3px 12px; border-radius: 8px; color: #fff; }
.rail-tag.srt { background: var(--srt); }
.rail-tag.ktx { background: var(--ktx); }

.tab-badge {
  display: inline-block;
  margin-left: 6px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 7px;
}

.dash-summary { display: flex; flex-wrap: wrap; gap: 18px; }
.dash-summary .stat { display: flex; flex-direction: column; gap: 2px; }
.dash-summary .stat .num { font-size: 22px; font-weight: 700; }
.dash-summary .stat .lbl { font-size: 12px; color: var(--muted); }
.dash-summary .users { flex: 1 1 220px; }
.dash-summary .users .urow { font-size: 13px; color: var(--text); display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }

.job {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.job .job-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.job .job-route { font-weight: 600; font-size: 14px; }
.job .job-owner { color: var(--muted); font-size: 12px; }
.job .job-meta { color: var(--muted); font-size: 12px; margin: 6px 0; }
.job .job-actions { margin-left: auto; }
.job .job-actions button { padding: 5px 12px; font-size: 12px; }
.job .logs { margin: 8px 0 0; max-height: 160px; }
.job-empty { color: var(--muted); font-size: 14px; padding: 8px 2px; }

.workers-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.wchip { font-size: 13px; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--border); display: inline-flex; align-items: center; gap: 8px; }
.wchip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim, #6b7682); flex-shrink: 0; }
.wchip.online .dot { background: var(--ok); }
.wchip.paused .dot { background: var(--warn, #f5b341); }
.wchip.offline { color: var(--muted); }
.wchip .wip { font-family: "SF Mono", Menlo, monospace; font-size: 11px; color: var(--muted); }
.wchip .wver { font-family: "SF Mono", Menlo, monospace; font-size: 11px; color: var(--dim, #6b7682); }
.wchip .wver.stale { color: var(--warn, #f5b341); font-weight: 600; }
.wchip .wctl { display: inline-flex; gap: 4px; margin-left: 4px; }
.wctl-btn { font-size: 11px; padding: 3px 8px; border-radius: 6px; }
.job .runner-tag { font-family: "SF Mono", Menlo, monospace; font-size: 11px; color: var(--muted); background: #0a0d11; border: 1px solid var(--border); padding: 1px 7px; border-radius: 5px; }
.logs {
  background: #0a0c10;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  max-height: 260px;
  overflow-y: auto;
  font-size: 12px;
  white-space: pre-wrap;
  margin: 0 0 12px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  width: 100%;
  max-width: 460px;
}
.modal h3 { margin: 0 0 12px; font-size: 17px; }
.modal-body { font-size: 14px; color: var(--text); margin-bottom: 18px; line-height: 1.6; }
.modal-body .warn { color: var(--danger); font-weight: 600; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.modal .step { display: flex; gap: 8px; padding: 4px 0; align-items: flex-start; }
.modal .step .ic { flex-shrink: 0; }
.modal .step .ic.ok { color: var(--ok); }
.modal .step .ic.no { color: var(--danger); }
.modal .step .txt { font-size: 13px; }
.modal .step .txt .d { color: var(--muted); font-size: 12px; }

#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  border: 1px solid var(--border);
  padding: 12px 20px;
  border-radius: 10px;
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
  max-width: 80%;
}
#toast.show { opacity: 1; }
#toast.err { border-color: var(--danger); }
#toast.ok { border-color: var(--ok); }

/* ---------- 모바일 ---------- */
@media (max-width: 600px) {
  header { flex-wrap: wrap; gap: 8px; padding: 12px 14px; }
  header h1 { font-size: 18px; }
  .header-right { width: 100%; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
  .user-label { font-size: 12px; min-width: 0; }

  /* 탭: 좁은 화면에서 가로 스크롤 */
  .tabs { padding: 0 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab { padding: 12px 12px; font-size: 14px; white-space: nowrap; }

  main { padding: 14px; }
  .card { padding: 14px; }

  /* 입력은 한 줄에 하나씩 */
  .grid { grid-template-columns: 1fr; gap: 10px; }

  /* 열차/예약 목록: 가로 스크롤 대신 줄바꿈 */
  .train-item { font-size: 12px; gap: 8px; }
  .train-item .label { white-space: pre-wrap; word-break: break-word; overflow-x: visible; }

  /* 버튼: 풀폭 + 터치 영역 확대 */
  button.primary, button.danger { padding: 13px 16px; }
  .btn-row { flex-direction: column; align-items: stretch; }
  .btn-row button { width: 100%; }
  .res-actions { width: 100%; }
  .res-actions button { flex: 1; padding: 10px; }

  /* 카드/목록 행: 좁은 화면에선 라벨(위) + 버튼(아래) 세로 스택 — 글자 세로 깨짐 방지 */
  .train-item { flex-direction: column; align-items: stretch; }

  /* 워커 칩: 전체 폭 카드로 + 정보 줄바꿈, 제어 버튼은 아래 줄에 풀폭 균등 */
  .workers-row .wchip { width: 100%; flex-wrap: wrap; }
  .wchip .wctl { margin-left: 0; width: 100%; }
  .wchip .wctl-btn { flex: 1; padding: 8px 6px; font-size: 12px; }

  .modal { padding: 18px; }
  .modal-actions button { flex: 1; }
  .dash-summary { gap: 12px; }
}

/* ---------- 즐겨찾기 (자주 가는 구간) ---------- */
.fav-block { margin-bottom: 14px; }
.fav-title {
  display: block; margin-bottom: 7px;
  font-size: 12px; color: var(--muted);
}
/* 구간+인원을 칩으로 저장해 두고, 누르면 검색 폼을 채운다.
   역 목록이 35개(KTX)라 드롭다운 스크롤이 실제 부담이었다. */
.fav-bar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.fav {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 18px;
  border: 1px solid var(--border); background: rgba(148,163,184,.05);
  color: var(--text); font-size: 13px; cursor: pointer;
}
.fav:hover { border-color: var(--primary); }
.fav.on { border-color: var(--primary); background: rgba(59,130,246,.15); }
.fav .r { font-weight: 500; }
.fav .p { font-size: 11px; color: var(--muted); }
.fav .x { font-size: 11px; color: var(--muted); margin-left: 2px; }
.fav .x:hover { color: var(--danger); }
.fav.add { border-style: dashed; color: var(--muted); }
.fav-hint { font-size: 11px; color: var(--muted); }

@media (pointer: coarse) {
  /* 손가락 터치 영역 확보 */
  .fav { padding: 9px 14px; }
}

/* ---------- 환승 여정 ---------- */
/* 코레일이 연결 편성을 조합해 준다. 조회 전용 — 예매는 지원하지 않는다. */
.mode-tabs { display: flex; gap: 6px; margin: 0 0 12px; }
.mode-tab {
  padding: 6px 14px; border: 1px solid var(--border); border-radius: 8px;
  background: transparent; color: var(--muted); font-size: 13px; cursor: pointer;
}
.mode-tab:hover { border-color: var(--primary); }
.mode-tab.on { background: var(--primary); border-color: var(--primary); color: #fff; }

.transfer-list { margin: 12px 0; }
.transfer-note { margin: 0 0 10px; font-size: 12px; }
.transfer-foot { margin: 10px 0 0; font-size: 11px; }
.itin { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 9px; overflow: hidden; }
.itin.best { border-color: rgba(34,197,94,.45); }
.itin-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 12px; background: rgba(148,163,184,.05);
  border-bottom: 1px solid var(--border); font-size: 14px;
}
.itin-head .dur { color: var(--muted); font-size: 12px; }
.itin .leg {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 12px; font-size: 13px;
}
.itin .leg .tn { min-width: 116px; font-size: 12px; color: var(--muted); }
.itin .leg .tm { font-variant-numeric: tabular-nums; }
.itin .leg .st { color: var(--muted); font-size: 12px; }
.itin .leg .arrow { color: var(--muted); }
.itin .xfer {
  padding: 5px 12px; font-size: 11px; color: #93c5fd;
  background: rgba(59,130,246,.06);
  border-top: 1px dashed var(--border); border-bottom: 1px dashed var(--border);
}
.itin .xfer.tight { background: rgba(245,158,11,.08); color: #fcd34d; }
.itin .pill {
  font-size: 10px; padding: 1px 6px; border-radius: 10px;
  border: 1px solid var(--border); color: var(--muted); white-space: nowrap;
}
.itin .pill.on { background: rgba(34,197,94,.14); border-color: rgba(34,197,94,.4); color: #86efac; }
.itin .pill.no { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.35); color: #fca5a5; }
.itin .pill.best-tag { margin-left: auto; }

/* 대리예매 표시 — 하단 예매 바에서 눈에 띄어야 한다 */
.pick-bar .proxy {
  padding: 2px 9px; border-radius: 10px; font-size: 11px; font-weight: 600;
  color: #fcd34d; background: rgba(245,158,11,.14);
  border: 1px solid rgba(245,158,11,.4);
}

/* ---------- 혜택·마일리지 ---------- */
/* 헤더 잔액 칩 — KTX 전용. SRT 에선 감춘다(없는 것과 0 은 다르다). */
.mlg-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: 8px; cursor: pointer;
  border: 1px solid rgba(14,165,233,.4); background: rgba(14,165,233,.1);
  color: var(--text); font-size: 13px; white-space: nowrap;
}
.mlg-chip .v { font-weight: 700; color: #7dd3fc; font-variant-numeric: tabular-nums; }
.mlg-chip .u { font-size: 11px; color: var(--muted); }
.mlg-chip.load { border-color: var(--border); background: transparent; }
.mlg-chip.load .v { color: var(--muted); font-weight: 400; }
.mlg-chip.err { border-color: rgba(245,158,11,.4); background: rgba(245,158,11,.08); }
.mlg-chip.err .v { color: #fcd34d; font-weight: 400; font-size: 12px; }

.mlg-top { display: flex; align-items: baseline; gap: 10px; }
.mlg-balance { font-size: 30px; font-weight: 700; color: #7dd3fc; font-variant-numeric: tabular-nums; }
#mlg-filter { margin-bottom: 10px; }
#mlg-more { margin-top: 10px; }

table.mlg-table { width: 100%; border-collapse: collapse; font-size: 12px; }
table.mlg-table th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 11px;
  padding: 4px 8px 6px 0; border-bottom: 1px solid var(--border);
}
table.mlg-table td { padding: 7px 8px 7px 0; border-bottom: 1px solid rgba(42,46,55,.5); }
table.mlg-table .r { text-align: right; }
table.mlg-table td.plus { color: #86efac; font-variant-numeric: tabular-nums; }
table.mlg-table td.minus { color: #fca5a5; font-variant-numeric: tabular-nums; }
table.mlg-table .pill {
  font-size: 10px; padding: 1px 6px; border-radius: 10px;
  border: 1px solid var(--border); color: var(--muted);
}
table.mlg-table .pill.on { background: rgba(34,197,94,.14); border-color: rgba(34,197,94,.4); color: #86efac; }
table.mlg-table .pill.no { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.35); color: #fca5a5; }

/* 카탈로그 */
.bn-cat { margin-bottom: 16px; }
.bn-cat-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 7px 0; border-bottom: 1px solid var(--border); margin-bottom: 8px;
  font-size: 13px;
}
.bn-cat-head .muted { font-size: 11px; }
.bn-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.bn-item {
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px;
  background: rgba(148,163,184,.04);
}
.bn-item.off { opacity: .45; }
.bn-item.has-info { cursor: help; }
.bn-item .r1 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bn-item .nm { font-size: 13px; font-weight: 500; }
.bn-item .ds { font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.bn-item .seg { font-size: 11px; color: #7dd3fc; margin-top: 4px; }
.bn-item .pill {
  font-size: 10px; padding: 1px 6px; border-radius: 10px;
  border: 1px solid var(--border); color: var(--muted); white-space: nowrap;
}
.bn-item .pill.on { background: rgba(34,197,94,.14); border-color: rgba(34,197,94,.4); color: #86efac; }
.bn-item .pill.no { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.35); color: #fca5a5; }

/* 동행자 마일리지 패널 (예약 확인) — 조회 전용 */
.res-item .cm-panel {
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border);
  width: 100%;
}
table.cm-table { width: 100%; border-collapse: collapse; font-size: 12px; }
table.cm-table th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 11px;
  padding: 4px 8px 6px 0; border-bottom: 1px solid var(--border);
}
table.cm-table td { padding: 7px 8px 7px 0; border-bottom: 1px solid rgba(42,46,55,.5); }
table.cm-table tr:last-child td { border-bottom: 0; }
table.cm-table .seat { font-family: "SF Mono", Menlo, monospace; }
table.cm-table .reason { color: #fca5a5; }
.res-actions .ghost.on { border-color: var(--primary); color: #93c5fd; }

/* 승차권 전달 패널 (예약 확인) — 조회·수신자 선택까지만 */
.res-item .tf-panel {
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border);
  width: 100%;
}
.tf-head { font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.tf-recent { margin-bottom: 10px; }
.tf-recent .chip {
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: transparent; color: var(--text); font-size: 13px; cursor: pointer;
}
.tf-recent .chip:hover { border-color: var(--primary); }
.tf-recent .chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.tf-recent .chip.on .muted { color: rgba(255,255,255,.75); }
.tf-form { margin-bottom: 10px; }
.tf-note {
  margin: 8px 0 0; font-size: 11px;
  background: rgba(245,158,11,.07); border-left: 2px solid var(--warn);
  padding: 7px 10px; border-radius: 4px; color: #fcd34d;
}

/* 승차권 영수증 패널 (예약 확인) — 조회 전용 */
.res-item .rc-panel {
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border);
  width: 100%;
}
.rc-sec { margin-bottom: 12px; }
.rc-sec:last-child { margin-bottom: 0; }
.rc-head {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  font-size: 13px; margin-bottom: 6px;
}
.rc-head .muted { font-size: 11px; }
.rc-line {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 12px; padding: 3px 0;
}
.rc-line.rc-amt { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 6px; }
.rc-line.rc-amt b { color: #7dd3fc; font-variant-numeric: tabular-nums; }
table.rc-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; }
table.rc-table th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 11px;
  padding: 4px 8px 5px 0; border-bottom: 1px solid var(--border);
}
table.rc-table td { padding: 6px 8px 6px 0; border-bottom: 1px solid rgba(42,46,55,.5); }
table.rc-table .r { text-align: right; font-variant-numeric: tabular-nums; }
.rc-cash {
  margin-top: 8px; padding: 8px 10px; border-radius: 6px;
  background: rgba(34,197,94,.06); border: 1px solid rgba(34,197,94,.25);
}
.rc-note {
  margin: 8px 0 0; font-size: 11px;
  background: rgba(148,163,184,.06); border-left: 2px solid var(--border);
  padding: 7px 10px; border-radius: 4px;
}

/* 영수증 인쇄 버튼 줄 */
.rc-actions {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
}
.rc-actions .muted { font-size: 11px; }

/* ---------- 승차권 카드 (예약 확인) ---------- */
/* 검표용이 아니다 — QR·바코드는 조회 API 에 없어서 만들지 않는다.
   용도는 '앱 열지 않고 내 호차·좌석 확인'. */
.res-item .tc-panel {
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border);
  width: 100%;
}
/* 리스트 카드 — 색 스텁 + 흰 종이. 실제 승차권처럼 보여야 '눌러 볼 것'이 된다. */
.tc-card {
  display: flex; border-radius: 8px; overflow: hidden; width: 100%;
  background: #f7f7f5; color: #16181d;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif;
  transition: transform .1s, box-shadow .1s;
}
.res-item.res-card:hover .tc-card { transform: translateY(-1px); box-shadow: 0 3px 12px rgba(0,0,0,.35); }
.tc-stub {
  flex-shrink: 0; width: 80px; padding: 12px 8px; color: #fff; text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.tc-card.srt .tc-stub { background: var(--srt); }
.tc-card.ktx .tc-stub { background: var(--ktx); }
.tc-card.pending .tc-stub { background: #6b7280; }
.tc-stub-n { font-size: 9px; letter-spacing: .06em; opacity: .85; line-height: 1.3; }
.tc-stub-v { font-size: 19px; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
/* '좌석 없음' 처럼 4자 이상은 스텁 폭(80px)에 19px 로 안 들어가 두 줄이 됐다 */
.tc-stub-v { white-space: nowrap; }
.tc-stub-v.long { font-size: 14px; letter-spacing: -.3px; }

.tc-body {
  flex: 1; min-width: 0; padding: 11px 13px; border-left: 2px dashed #cfcfc8;
}
.tc-hd { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: #6b6f76; }
.tc-fallback { font-size: 13px; word-break: break-word; white-space: pre-wrap; }
.tc-route { display: flex; align-items: baseline; gap: 9px; margin: 5px 0 3px; flex-wrap: wrap; }
.tc-route b { font-size: 19px; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.tc-route span { font-size: 12px; color: #4b5563; }
.tc-route i { font-style: normal; color: #9ca3af; }
.tc-meta { font-size: 11.5px; color: #6b6f76; margin-top: 3px; word-break: break-word; }
.tc-warn {
  display: inline-block; font-size: 10px; font-weight: 700; margin-right: 6px;
  padding: 1px 6px; border-radius: 4px; background: #fde3c4; color: #92400e;
}

/* 눌린다는 표시 — 모든 행이 화살표 하나로 같다 */
.tc-chev {
  flex-shrink: 0; align-self: center; margin-right: 11px;
  color: #b8b8ae; font-size: 19px; line-height: 1;
}

/* ---------- 승차권 시트 ---------- */
/* 확인 모달(#modal, z-index:100)보다 아래에 둔다 — 같은 값이면 DOM 뒤인 시트가
   위로 올라와 환불 확인창이 시트 뒤에 가려진다. */
#tk-sheet { z-index: 90; }
.tk-sheet {
  width: 100%; max-width: 400px; max-height: 92vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 18px 48px rgba(0,0,0,.6);
}
.tk-grab { width: 36px; height: 4px; border-radius: 2px; background: #3a3f4a; margin: 9px auto 3px; }
.tk-shd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 14px 10px; border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 600;
}
.tk-shd button { padding: 2px 9px; line-height: 1.4; }
.tk-sbody { padding: 14px; }

/* 시트 안 큰 승차권 — 한 장의 종이. QR 이 맨 위. */
.tks {
  background: #f7f7f5; color: #16181d; border-radius: 10px; overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif;
}
.tks-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 9px 13px; color: #fff; font-size: 12px; font-weight: 600; letter-spacing: .03em;
}
.tks.srt .tks-bar { background: var(--srt); }
.tks.ktx .tks-bar { background: var(--ktx); }
.tks.pending .tks-bar { background: #6b7280; }
.tks-qz { background: #fff; padding: 16px 14px 13px; text-align: center; }
.tks-qrimg svg { width: 190px; height: 190px; display: block; margin: 0 auto; }
.tks-qcap { font-size: 10.5px; color: #8b8f96; margin-top: 8px; }
.tks-qwait { font-size: 12px; color: #8b8f96; padding: 22px 0; }
.tks-pend { font-size: 16px; font-weight: 700; color: #b45309; font-variant-numeric: tabular-nums; padding-top: 8px; }

/* 절취선 — 양옆 반원은 시트 배경색 원 두 개다 */
.tks-tear { border-top: 1.5px dashed #cdcdc5; position: relative; }
.tks-tear::before, .tks-tear::after {
  content: ""; position: absolute; top: -8px; width: 15px; height: 15px;
  border-radius: 50%; background: var(--card);
}
.tks-tear::before { left: -8px; }
.tks-tear::after { right: -8px; }

.tks-info { padding: 13px 14px; }
.tks-route { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; margin-bottom: 8px; }
.tks-route b { font-size: 23px; font-variant-numeric: tabular-nums; letter-spacing: -.6px; }
.tks-route span { font-size: 13px; color: #4b5563; }
.tks-route i { font-style: normal; color: #9ca3af; }
.tks-kv { display: grid; grid-template-columns: 56px 1fr; gap: 4px 10px; font-size: 12px; color: #374151; }
.tks-kv .k { color: #8b8f96; font-size: 11px; padding-top: 1px; }
.tks-kv .v { font-weight: 600; font-variant-numeric: tabular-nums; word-break: break-word; }
.tks-kv .v em { font-style: normal; font-weight: 400; color: #8b8f96; font-size: 11px; margin-left: 4px; }
/* 반환된 좌석 — 죽여서 보여 준다. 지우면 '내가 산 게 몇 석이었지'를 알 수 없다. */
.tks-kv .v.ret { text-decoration: line-through; color: #9ca3af; }
.tks-kv .v.ret em { color: #9ca3af; }
.tks-kv .v .rettag {
  text-decoration: none; font-weight: 700; color: #92400e;
  background: #fde3c4; border-radius: 3px; padding: 0 5px; font-size: 10px;
}

.tks-warn {
  margin-top: 11px; font-size: 11px; line-height: 1.5; color: #92400e;
  background: #fdf1e0; border-left: 2px solid #d97706; border-radius: 4px; padding: 7px 10px;
}

.tks-acts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 13px; }
.tks-acts button {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 4px; font-size: 11.5px; border-radius: 9px;
  border: 1px solid var(--border); background: #20242c; color: var(--text);
}
.tks-acts button .ic { font-size: 15px; line-height: 1; }
.tks-acts button.on { border-color: var(--primary); color: #93c5fd; }
.tks-danger { margin-top: 8px; }
.tks-danger button {
  width: 100%; padding: 11px; font-size: 12.5px; border-radius: 9px;
  border: 1px solid rgba(239,68,68,.35); background: rgba(239,68,68,.09); color: #fca5a5;
}
/* 영수증·전달·마일리지 결과는 시트 안에서 펼친다 (기존 패널 재사용) */
.tks-panels:empty { display: none; }
.tks-panels .rc-panel, .tks-panels .tf-panel, .tks-panels .cm-panel {
  margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); width: 100%;
}

/* 지난 승차권 — 반환·여행변경건은 합계에서 빠지므로 시각적으로도 죽인다 */
table.mlg-table tr.hist-void td { opacity: .5; }
table.mlg-table tr.hist-void td.r { text-decoration: line-through; }
table.mlg-table tr.hist-void td.r:last-child { text-decoration: none; }
.hist-stt { font-size: 10.5px; color: #fca5a5; margin-top: 2px; }
button.hist-rc { padding: 3px 9px; font-size: 11.5px; line-height: 1.5; }
button.hist-rc.on { border-color: var(--primary); color: #93c5fd; }
table.mlg-table tr.hist-rcrow td { padding: 0 0 10px; border-bottom: 0; }
tr.hist-rcrow .rc-panel { margin-top: 0; padding-top: 10px; border-top: 1px dashed var(--border); }

/* ---------- 예약 확인: 카드가 곧 행 ---------- */
/* 행에는 승차권만 둔다. 기능 버튼은 전부 시트(.tk-sheet) 안으로 옮겼다 —
   티켓 바깥에 떠 있는 버튼 줄은 티켓과 별개의 덩어리로 보였다. */
/* .res-item 은 align-items:flex-start 라 자식이 내용 폭으로 줄어든다 —
   카드형 행에서는 카드가 행 전체를 쓰도록 늘린다. */
.res-item.res-card {
  gap: 8px; align-items: stretch; padding: 0; border: 0; cursor: pointer;
  background: transparent;
}
.res-item.res-card .countdown { padding: 0 2px; }

/* ---------- 예매 신청 이력 ---------- */
/* 진행 로그는 상한 500줄이라 오류가 반복되면 몇 분치만 남는다. 이 표는 서버가
   영구 볼륨에 append 한 기록이므로 재시작·재빌드에도 남는다. */
.jh-wrap { overflow-x: auto; margin-top: 10px; }
table.jh-table { min-width: 820px; }
table.jh-table td { vertical-align: top; }
.jh-reuse { white-space: nowrap; padding: 5px 8px; font-size: 11px; }
.jh-sub { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.jh-stt {
  display: inline-block; font-size: 10.5px; font-weight: 700;
  padding: 1px 7px; border-radius: 4px;
}
.jh-stt.ok { background: rgba(34,197,94,.16); color: #86efac; }
.jh-stt.err { background: rgba(239,68,68,.16); color: #fca5a5; }
.jh-stt.warn { background: rgba(245,158,11,.16); color: #fcd34d; }
.jh-stt.off { background: var(--border); color: var(--muted); }
tr.jh-clickable { cursor: pointer; }
tr.jh-clickable:hover td { background: rgba(148,163,184,.06); }
table.jh-table tr.jh-logrow td { padding: 0 0 10px; border-bottom: 0; }
tr.jh-logrow .job-log { max-height: 180px; margin: 0; }

/* 진행 중인 작업의 결제수단·대리·정체 표시 */
.proxy-tag {
  font-size: 10px; font-weight: 700; margin-left: 5px;
  padding: 1px 6px; border-radius: 4px;
  background: rgba(59,130,246,.16); color: #93c5fd;
}
.stall-tag {
  font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 4px;
  background: rgba(245,158,11,.16); color: #fcd34d;
}
/* 시도 횟수가 멈춘 작업 — 보고만 오면 running 으로 보이므로 눈에 띄게 */
.job.job-stalled { border-color: rgba(245,158,11,.45); }

/* 갱신 상태 — 폴링이 멈추거나 실패했을 때만 눈에 띈다 */
.poll-status { font-size: 11px; color: var(--muted); margin-top: 8px; }
.poll-status.warn { color: #fcd34d; }
.poll-status.err { color: #fca5a5; }

/* 텔레그램 전송 결과 — 실패 사유를 그대로 보여 준다 */
.tg-result { font-size: 11.5px; color: var(--muted); margin-top: 10px; line-height: 1.6; }
.tg-result.ok { color: #86efac; }
.tg-result.err { color: #fca5a5; }

/* ── 예매 대상 열차 (현황 카드) ─────────────────────────────────────
   예전에는 서버가 만든 라벨 한 줄에 열차·시각·구간·좌석상태·소요가 다 몰려
   있었다. 구조체로 받아 2줄 + 배지로 나눈다. */
.job .jt-id { display: flex; align-items: center; gap: 6px; min-width: 0; }
.job .jt-id .rail-tag { margin-right: 0; }
.job .jt-no {
  font-family: "SF Mono", Menlo, monospace; font-size: 15px; letter-spacing: -.2px;
}
.job .jt-route {
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
  margin: 5px 0 0; font-family: "SF Mono", Menlo, monospace;
}
.job .jt-route b { font-size: 16px; font-weight: 500; }
.job .jt-route span { font-size: 13px; color: var(--muted); }
.job .jt-route i { font-style: normal; color: var(--muted); }
.job .jt-dur { font-size: 12px; color: var(--muted); }
.job .jt-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 0; }
.job .jt-chip {
  font-size: 11px; padding: 2px 7px; border-radius: 4px;
  color: var(--muted); background: rgba(148, 163, 184, .14);
}
.job .jt-chip.on { color: var(--primary); background: rgba(59, 130, 246, .14); }
.job .jt-more {
  margin: 8px 0 0; padding: 0; font: inherit; font-size: 12px; cursor: pointer;
  color: var(--primary); background: transparent; border: 0;
}
.job .jt-list { margin: 6px 0 0; display: flex; flex-direction: column; gap: 4px; }
.job .jt-row {
  display: flex; gap: 8px; align-items: baseline; font-size: 12px;
  font-family: "SF Mono", Menlo, monospace; color: var(--text);
}
.job .jt-row em { font-style: normal; font-size: 11px; color: var(--muted); }

/* 이력 표의 대상 열차 */
.jh-tgt {
  margin: 3px 0 0; font-family: "SF Mono", Menlo, monospace; font-size: 11px;
  color: var(--muted); line-height: 1.5;
}

/* 예약대기 설명 — 결제 대기와 구분해야 한다 */
.countdown.wait { color: var(--muted); }
.tks-note {
  margin: 10px 0 0; padding: 10px 12px; border-radius: 8px;
  background: rgba(148, 163, 184, .10); border: 1px solid var(--border);
  font-size: 12px; color: var(--text); line-height: 1.6;
}
.tks-note ul { margin: 6px 0 6px; padding-left: 18px; }
.tks-note li { margin: 2px 0; color: var(--muted); }
.tks-note li b { color: var(--text); }

/* ---------- AI 예매 도우미 ---------- */
body.assistant-open { overflow: hidden; overscroll-behavior: none; }
.assistant-drawer {
  position: fixed; z-index: 1002; top: 16px; right: 16px; bottom: 16px;
  width: min(420px, calc(100vw - 32px));
  transform: translateX(calc(100% + 28px));
  opacity: 0; pointer-events: none;
  transition: transform .28s cubic-bezier(.2,.8,.2,1), opacity .2s ease;
}
.assistant-drawer.open { transform: translateX(0); opacity: 1; pointer-events: auto; }
.assistant-backdrop {
  position: fixed; z-index: 1001; inset: 0; opacity: 0; pointer-events: none;
  background: rgba(4,6,10,.38); backdrop-filter: blur(2px);
  transition: opacity .2s ease;
}
.assistant-backdrop.open { opacity: 1; pointer-events: auto; }
.assistant-fab {
  position: fixed; z-index: 1000; right: 22px; bottom: 22px;
  display: flex; align-items: center; gap: 8px;
  padding: 11px 16px; border: 1px solid rgba(125,211,252,.58); border-radius: 999px;
  color: #fff; background: linear-gradient(135deg, #0284c7, #2563eb);
  box-shadow: 0 12px 32px rgba(2,132,199,.3); font: inherit; font-size: 13px;
  font-weight: 700; cursor: pointer; transition: transform .18s ease, opacity .18s ease;
}
.assistant-fab:hover { transform: translateY(-2px); }
.assistant-fab.open { opacity: 0; pointer-events: none; transform: translateY(8px); }
.assistant-fab-icon {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  color: #082f49; background: #bae6fd; font-size: 13px;
}
.assistant-shell {
  height: 100%; min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #303743;
  border-radius: 18px;
  background:
    radial-gradient(circle at 85% 0%, rgba(14,165,233,.16), transparent 34%),
    linear-gradient(155deg, #191d24 0%, #12151b 72%);
  box-shadow: 0 22px 60px rgba(0,0,0,.24);
}
.assistant-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 18px;
  padding: 24px 24px 18px; border-bottom: 1px solid rgba(148,163,184,.14);
}
.assistant-head h2 { margin: 3px 0 5px; font-size: 20px; letter-spacing: -.4px; }
.assistant-head p { margin: 0; max-width: 520px; color: var(--muted); font-size: 13px; }
.assistant-head-actions { display: flex; align-items: center; gap: 8px; }
.assistant-reset { padding: 5px 9px; font-size: 11px; white-space: nowrap; }
.assistant-close {
  width: 32px; height: 32px; padding: 0; border: 1px solid var(--border); border-radius: 50%;
  color: var(--muted); background: rgba(15,17,21,.55); font: inherit; font-size: 22px;
  line-height: 1; cursor: pointer;
}
.assistant-close:hover { color: var(--text); border-color: var(--primary); }
.assistant-kicker {
  color: #7dd3fc; font-size: 10px; font-weight: 800; letter-spacing: 1.5px;
  text-transform: uppercase;
}
.ai-status {
  flex-shrink: 0; padding: 4px 9px; border: 1px solid var(--border); border-radius: 999px;
  color: var(--muted); background: rgba(15,17,21,.55); font-size: 11px;
}
.ai-status.on { border-color: rgba(34,197,94,.35); color: #86efac; }
.ai-status.off { border-color: rgba(245,158,11,.35); color: #fcd34d; }
#ai-setup { margin: 16px 20px 0; }
.chat-log {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 17px; padding: 24px;
}
.chat-message { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.chat-message.user { align-items: flex-end; }
.chat-role { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .5px; }
.chat-bubble {
  max-width: 88%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 4px 14px 14px;
  background: rgba(26,29,36,.9); color: var(--text); font-size: 14px;
  line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere;
}
.chat-message.user .chat-bubble {
  border-color: rgba(14,165,233,.42); border-radius: 14px 4px 14px 14px;
  background: rgba(14,165,233,.14);
}
.chat-message.pending .chat-bubble { color: var(--muted); }
.chat-tools { display: flex; flex-wrap: wrap; gap: 6px; max-width: 88%; }
.chat-tool {
  padding: 4px 8px; border: 1px solid rgba(148,163,184,.18); border-radius: 6px;
  background: rgba(148,163,184,.08); color: var(--muted); font-size: 10px;
}
.chat-action {
  margin-top: 3px; padding: 7px 11px; border: 1px solid rgba(14,165,233,.42);
  border-radius: 8px; background: rgba(14,165,233,.12); color: #7dd3fc;
  font: inherit; font-size: 12px; cursor: pointer;
}
.chat-trains {
  display: grid; gap: 8px; width: min(100%, 360px); margin-top: 4px;
}
.chat-train-card {
  display: grid; gap: 8px; padding: 11px 12px;
  border: 1px solid rgba(148,163,184,.2); border-radius: 12px;
  background: rgba(10,12,16,.56);
}
.chat-train-head, .chat-train-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.chat-train-head b { color: var(--text); font-size: 13px; }
.chat-train-head span, .chat-train-foot > span { color: var(--muted); font-size: 10px; }
.chat-train-times {
  color: #e2e8f0; font: 700 17px/1.2 "SF Mono", Menlo, monospace;
  letter-spacing: -.4px;
}
.chat-train-seats { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-train-seats span {
  padding: 3px 7px; border-radius: 999px; background: rgba(148,163,184,.1);
  color: var(--muted); font-size: 10px;
}
.chat-train-seats .st-ok { color: #86efac; background: rgba(34,197,94,.12); }
.chat-train-seats .st-low { color: #fde68a; background: rgba(245,158,11,.12); }
.chat-train-seats .st-out { color: #fca5a5; background: rgba(239,68,68,.1); }
.chat-train-foot button {
  padding: 6px 10px; border: 1px solid rgba(14,165,233,.45); border-radius: 8px;
  background: rgba(14,165,233,.12); color: #7dd3fc; font: inherit;
  font-size: 11px; font-weight: 700; cursor: pointer;
}
.chat-all-trains { justify-self: start; }
.chat-review-card, .chat-job-card {
  display: grid; gap: 11px; width: min(100%, 360px); margin-top: 5px;
  padding: 14px; border: 1px solid rgba(14,165,233,.3); border-radius: 14px;
  background: linear-gradient(145deg, rgba(18,24,32,.98), rgba(10,13,18,.96));
  box-shadow: 0 12px 28px rgba(0,0,0,.18);
}
.chat-review-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chat-review-title b { font-size: 15px; }
.chat-review-title span {
  padding: 3px 7px; border-radius: 999px; background: rgba(14,165,233,.14);
  color: #7dd3fc; font-size: 10px; font-weight: 800;
}
.chat-review-route { color: #f8fafc; font: 700 15px/1.4 "SF Mono", Menlo, monospace; }
.chat-review-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-review-meta span {
  padding: 5px 8px; border-radius: 7px; background: rgba(148,163,184,.09);
  color: #cbd5e1; font-size: 11px;
}
.chat-review-options { display: grid; gap: 9px; padding-top: 2px; }
.chat-review-options label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.chat-review-options select {
  width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 9px;
  background: #101319; color: var(--text); font: inherit; font-size: 13px;
}
.chat-review-options .chat-review-check { display: flex; align-items: center; gap: 7px; color: var(--text); }
.chat-review-check input { margin: 0; }
.chat-review-notice { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.chat-review-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; }
.chat-review-actions button, .chat-job-card button { padding: 9px 11px; font: inherit; font-size: 12px; }
.chat-job-card { border-color: rgba(245,158,11,.32); }
.chat-job-card > b { font-size: 14px; }
.chat-job-card > strong { color: #fde68a; font-size: 13px; }
.chat-job-card > span { color: var(--muted); font-size: 11px; }
.chat-job-card.success { border-color: rgba(34,197,94,.38); }
.chat-job-card.success > strong { color: #86efac; }
.chat-job-card.error, .chat-job-card.stopped { border-color: rgba(239,68,68,.34); }
.chat-job-card.error > strong, .chat-job-card.stopped > strong { color: #fca5a5; }
.chat-question {
  display: flex; flex-wrap: wrap; gap: 7px; max-width: 92%; margin-top: 4px;
  padding: 10px; border: 1px solid rgba(14,165,233,.24); border-radius: 12px;
  background: rgba(14,165,233,.06);
}
.chat-question button {
  padding: 7px 11px; border: 1px solid var(--border); border-radius: 999px;
  background: rgba(15,17,21,.72); color: var(--text); font: inherit;
  font-size: 12px; cursor: pointer;
}
.chat-question button:hover { border-color: var(--primary); color: #7dd3fc; }
.chat-question button:disabled, .chat-question select:disabled { opacity: .48; cursor: default; }
.chat-question select {
  min-width: 190px; flex: 1; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 9px; background: #11141a; color: var(--text); font: inherit;
}
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 24px 14px; }
.chat-suggestions button {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px;
  background: transparent; color: var(--muted); font: inherit; font-size: 11px; cursor: pointer;
}
.chat-suggestions button:hover { border-color: var(--primary); color: var(--text); }
.chat-compose {
  display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end;
  margin: 0 20px; padding: 10px; border: 1px solid #343b47; border-radius: 13px;
  background: rgba(10,12,16,.7);
}
.chat-compose textarea {
  width: 100%; min-height: 44px; max-height: 140px; resize: vertical;
  padding: 9px 10px; border: 0; outline: 0; background: transparent;
  color: var(--text); font: inherit; font-size: 14px; line-height: 1.5;
}
.chat-privacy { margin: 9px 24px 18px; color: var(--muted); font-size: 10px; }

@media (max-width: 760px) {
  body.assistant-open {
    position: fixed; left: 0; right: 0; width: 100%;
  }
  .assistant-drawer {
    top: auto; right: 0; bottom: 0; width: 100%;
    height: min(72vh, 680px); height: min(72dvh, 680px);
    max-height: calc(100vh - env(safe-area-inset-top, 0px));
    max-height: calc(100dvh - env(safe-area-inset-top, 0px));
    transform: translateY(calc(100% + 18px));
  }
  .assistant-drawer.open { transform: translateY(0); }
  .assistant-shell { border-radius: 18px 18px 0 0; border-bottom: 0; }
  .assistant-shell::before {
    content: ""; display: block; position: absolute; top: 7px; left: 50%;
    width: 42px; height: 4px; border-radius: 999px; background: #64748b;
    transform: translateX(-50%);
  }
  .assistant-head { padding: 19px 17px 15px; }
  .assistant-head h2 { font-size: 18px; }
  .assistant-head p { display: none; }
  .assistant-head-actions { gap: 6px; }
  .assistant-head-actions .ai-status { display: none; }
  .assistant-reset { padding: 5px 7px; }
  .chat-log { min-height: 0; padding: 18px 16px; }
  .chat-bubble, .chat-tools { max-width: 94%; }
  .chat-trains { width: 100%; }
  .chat-review-card, .chat-job-card { width: 100%; }
  .chat-suggestions { padding: 0 16px 12px; }
  .chat-compose { margin: 0 12px; grid-template-columns: 1fr; }
  .chat-compose textarea, .chat-question select { font-size: 16px; }
  .chat-compose button { width: 100%; }
  .chat-privacy { margin: 8px 16px 14px; }
  .assistant-fab {
    right: 14px;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    width: 48px; height: 48px; justify-content: center; padding: 0;
    border-radius: 50%;
  }
  .assistant-fab > span:not(.assistant-fab-icon) { display: none; }
  .assistant-fab-icon { width: 25px; height: 25px; }
}

/* ---------- 설정: 카드 목록 ---------- */
/* .train-item(7칼럼 그리드)을 재사용하다 별칭이 96px 칼럼에서 잘렸다. */
.card-item {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 8px;
}
.card-item .card-name {
  flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px;
  flex-wrap: wrap;
}
/* 별칭은 길면 줄바꿈 대신 말줄임 — 뒤 4자리가 밀려나지 않아야 한다 */
.card-item .card-name b {
  font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 100%;
}
.card-item .card-tail {
  font-family: "SF Mono", Menlo, monospace; font-size: 12px; color: var(--muted);
  flex-shrink: 0;
}
.card-item .res-actions { margin-top: 0; flex-shrink: 0; }

/* 시트 결제 — 카드 선택 */
.pay-picks { display: flex; flex-direction: column; gap: 6px; }
.pay-pick {
  flex-direction: row; align-items: center; gap: 8px; color: var(--text);
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
}
.pay-pick:has(input:checked) { border-color: var(--primary); }

/* 반환 확인 모달 — 수수료·마일리지·위치 */
.rq-grid { display: grid; grid-template-columns: 90px 1fr; gap: 6px 10px; font-size: 13px; margin: 0 0 10px; }
.rq-grid .k { color: var(--muted); }
.rq-grid .v b { font-size: 15px; font-weight: 600; }
.rq-mlg { margin: 6px 0 10px; font-size: 13px; }
.rq-geo { font-size: 12px; margin: 0 0 10px; line-height: 1.5; }
.rq-policy summary { cursor: pointer; font-size: 12px; }
.rq-policy p, .rq-policy ul { font-size: 12px; }

/* 구간 분할 대안 (직통 매진 시 두 표로 나눠 가기) */
.split-hint {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin-top: 10px; padding: 10px 12px; border-radius: 10px; font-size: 13px;
  border: 1px dashed rgba(245,158,11,.5); background: rgba(245,158,11,.06);
}
.split-note { margin: 0 0 10px; }
.split-note p { margin: 0 0 8px; font-size: 12px; }
.split-note .chips { margin-bottom: 4px; }
.itin.split .itin-head .price { font-variant-numeric: tabular-nums; font-weight: 600; }
.itin .pill.same { background: rgba(59,130,246,.12); border-color: rgba(59,130,246,.4); color: #93c5fd; }
.itin .pill.xf { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.4); color: #fcd34d; }
.itin .leg .seat { font-size: 11px; color: var(--muted); margin-left: auto; white-space: nowrap; }
.itin .leg .price { font-size: 12px; font-variant-numeric: tabular-nums; }
.itin-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px; border-top: 1px solid var(--border); font-size: 11px;
}

/* AI 예매 확인 카드(구간이 여러 개면 경로 줄이 여러 개) / 채팅 구간 분할 카드 */
.chat-confirm-card .chat-review-route + .chat-review-route { margin-top: 2px; }
.chat-split-legs { flex-direction: column; align-items: flex-start; gap: 3px; font-size: 11px; }

/* 좌석 방향 — 등받이는 앉는 사람 등 뒤. 역방향 좌석은 반대편에 그린다.
   가로 배치(진행 ▶): 순방향 = 왼쪽, 역방향 = 오른쪽
   세로 배치(진행 ▲): 순방향 = 아래,  역방향 = 위 */
.seat-map .sm-seat::after { top: 4px; bottom: 4px; left: 2px; right: auto; width: 5px; height: auto; }
.seat-map .sm-seat.rev::after { left: auto; right: 2px; }
.seat-map.vmode .sm-seat::after { top: auto; bottom: 2px; left: 4px; right: 4px; width: auto; height: 5px; }
.seat-map.vmode .sm-seat.rev::after { top: 2px; bottom: auto; }
/* 색은 방향 두 가지로만 — 순방향 파랑, 역방향 보라(창측·내측 구분 없음).
   창측/내측은 창문 띠와 위치로 보인다. 선택불가는 아래 .off 가 흐리게 덮는다 */
.seat-map .sm-seat::after, .seat-map .sm-legend i::after { background: rgba(59,130,246,.55); }
.seat-map .sm-seat, .seat-map .sm-legend i.fwd {
  border-color: rgba(59,130,246,.45); background: rgba(59,130,246,.13);
}
.seat-map .sm-seat.off::after, .seat-map .sm-legend i.off::after { background: var(--border); }
/* 범례 '창문' 칩은 좌석이 아니다 — 등받이 선을 그리지 않는다 */
.seat-map .sm-legend i.sm-win-chip::after { display: none; }
/* 역방향은 위치만으로는 잘 안 보여 등받이·테두리를 보라색으로 칠한다
   (창측 파랑·안내 주황·선택 흰색과 겹치지 않는 색). 선택된 좌석은 흰 등받이 유지 */
.seat-map .sm-seat.rev::after { background: #a855f7; }
/* 역방향 칸 전체를 보라로. 선택불가·안내·선택은 아래 규칙이 다시 우선한다 */
.seat-map .sm-seat.rev, .seat-map .sm-seat.rev.win {
  background: rgba(168,85,247,.2); border-color: rgba(168,85,247,.7);
}
.seat-map .sm-seat.rev.off { background: transparent; border-color: var(--border); }
.seat-map .sm-seat.rev.noted { border-color: #f59e0b; }
.seat-map .sm-seat.rev.pk:hover { border-color: var(--primary); }
.seat-map .sm-seat.rev.sel { background: var(--primary); border-color: var(--primary); }
.seat-map .sm-seat.sel.rev::after { background: rgba(255,255,255,.85); }
.seat-map .sm-legend i::after { top: 3px; bottom: 3px; left: 2px; right: auto; width: 3px; height: auto; }
.seat-map .sm-legend i.rev::after { left: auto; right: 2px; background: #a855f7; }
.seat-map .sm-legend i.rev { background: rgba(168,85,247,.2); border-color: rgba(168,85,247,.7); }
.seat-map.vmode .sm-legend i::after { top: auto; bottom: 2px; left: 3px; right: 3px; width: auto; height: 3px; }
.seat-map.vmode .sm-legend i.rev::after { top: 2px; bottom: auto; }

/* AI 도우미 헤더 — 좁은 드로어에서 상태 배지가 오른쪽으로 잘렸다. 버튼 줄은 줄바꿈 허용,
   배지는 짧게(전체 문구는 title) + 넘치면 말줄임 */
.assistant-head { flex-wrap: wrap; }
.assistant-head > div:first-child { flex: 1 1 220px; min-width: 0; }
.assistant-head-actions { flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.ai-status { white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }

/* 채팅 카드의 결제 선택(자동 결제 + 카드) / 진행 중 작업 결제 변경 */
.chat-pay { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chat-pay select { min-width: 0; max-width: 100%; }
.chat-pay select:disabled { opacity: .5; }
.chat-job-card .chat-job-actions { display: flex; gap: 6px; flex-wrap: wrap; }

