:root {
  color-scheme: light;
  --page: #f4f6f8;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --surface-soft: #f8fafc;
  --line: #d8dee8;
  --line-strong: #b7c0ce;
  --text: #101418;
  --muted: #667085;
  --quiet: #8a95a5;
  --accent: #0a66c2;
  --accent-soft: #e8f2ff;
  --accent-strong: #084f98;
  --ok: #087f5b;
  --ok-soft: #e7f7ef;
  --warn: #b85c00;
  --warn-soft: #fff3df;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --shadow: 0 20px 50px rgba(16, 24, 40, 0.10);
  --shadow-soft: 0 8px 24px rgba(16, 24, 40, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Noto Sans KR", "Segoe UI", system-ui, sans-serif;
  background:
    linear-gradient(180deg, #ffffff 0, #f4f6f8 260px, #eef2f6 100%);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 16px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

button:hover {
  background: var(--accent-strong);
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

button.secondary,
button.ghost,
button.primary-quiet {
  background: var(--surface-solid);
  color: var(--text);
  border-color: var(--line);
}

button.secondary:hover,
button.ghost:hover,
button.primary-quiet:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

button.danger {
  background: var(--danger);
}

button.danger:hover {
  background: #93180f;
}

button.small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  padding: 0 12px;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

input:focus,
select:focus {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(10, 102, 194, 0.13);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: 0;
}

h3 {
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: 0;
}

.app-shell {
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 48px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0 20px;
  background: rgba(244, 246, 248, 0.82);
  backdrop-filter: blur(18px);
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-symbol {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #111827;
  color: #ffffff;
  font-size: 18px;
  font-weight: 800;
}

#sessionLine {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.workspace {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.side,
.main-stack,
.stack {
  display: grid;
  gap: 14px;
}

.compact {
  gap: 12px;
}

.split-top {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.panel {
  border: 1px solid rgba(216, 222, 232, 0.86);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 18px;
  backdrop-filter: blur(18px);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-head h2 {
  min-width: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.ok {
  border-color: #b9e6d2;
  background: var(--ok-soft);
  color: var(--ok);
}

.badge.warn {
  border-color: #ffd18b;
  background: var(--warn-soft);
  color: var(--warn);
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.form-grid {
  display: grid;
  gap: 10px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 14px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf1f5;
}

.segmented button {
  min-height: 36px;
  background: transparent;
  color: var(--muted);
  border: 0;
  box-shadow: none;
}

.segmented button.active {
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 2px 10px rgba(16, 24, 40, 0.10);
}

.switch-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.switch {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-solid);
  padding: 0 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.switch input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(460px, 1fr);
  gap: 18px;
  align-items: stretch;
}

.auth-copy {
  display: grid;
  align-content: end;
  min-height: 430px;
  border: 1px solid rgba(216, 222, 232, 0.82);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 249, 252, 0.92)),
    repeating-linear-gradient(90deg, rgba(10, 102, 194, 0.08) 0 1px, transparent 1px 64px);
  box-shadow: var(--shadow);
  padding: 24px;
}

.auth-copy h2 {
  margin-top: 10px;
  font-size: 36px;
  line-height: 1.1;
}

.eyebrow {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.auth-grid {
  display: grid;
  gap: 14px;
}

.auth-status {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-solid);
  color: var(--muted);
  padding: 13px 14px;
  font-size: 14px;
}

.auth-status.ok,
.form-message.ok {
  color: var(--ok);
}

.auth-status.error,
.form-message.error,
.error,
.danger-text {
  color: var(--danger);
}

.form-message {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.train-list {
  display: grid;
  gap: 10px;
}

.train-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  padding: 12px;
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.train-row:hover,
.train-row.selected {
  background: #ffffff;
  border-color: rgba(10, 102, 194, 0.55);
  box-shadow: 0 0 0 4px rgba(10, 102, 194, 0.10);
}

.train-row input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.train-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.train-main strong {
  font-size: 15px;
}

.train-main span,
.train-date {
  color: var(--muted);
  font-size: 13px;
}

.car-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.seat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.seat-button {
  min-height: 40px;
  background: var(--surface-solid);
  color: var(--text);
  border-color: var(--line);
  font-size: 13px;
}

.seat-button.selected {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.session-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.session-grid div {
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
}

.session-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.session-grid strong {
  display: block;
  margin-top: 7px;
  font-size: 15px;
  line-height: 1.25;
}

.result-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.result-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.4fr) minmax(120px, 1fr) minmax(110px, 1fr) minmax(95px, auto);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 10px 12px;
  font-size: 13px;
}

.result-row span {
  color: var(--muted);
}

.empty {
  display: grid;
  place-items: center;
  min-height: 108px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.52);
  color: var(--quiet);
  text-align: center;
  padding: 18px;
  font-size: 14px;
}

.empty.compact {
  min-height: 52px;
}

.hidden {
  display: none !important;
}

@media (max-width: 1060px) {
  .workspace,
  .auth-layout {
    grid-template-columns: 1fr;
  }

  .auth-copy {
    min-height: 220px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 20px, 640px);
    padding-top: 10px;
  }

  .topbar {
    align-items: flex-start;
    padding-top: 10px;
  }

  .brand-symbol {
    width: 38px;
    height: 38px;
  }

  h1 {
    font-size: 24px;
  }

  .panel {
    padding: 14px;
  }

  .form-grid.two,
  .form-grid.four,
  .switch-grid,
  .action-row,
  .session-grid {
    grid-template-columns: 1fr;
  }

  .train-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .train-row .train-date,
  .train-row .badge {
    grid-column: 2;
    justify-self: start;
  }

  .result-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .topbar {
    display: grid;
  }

  #logoutButton {
    width: 100%;
  }

  .auth-copy h2 {
    font-size: 30px;
  }
}
