:root {
  --ink: #16382f;
  --ink-soft: #48675e;
  --cream: #f8f4e9;
  --paper: #fffdf8;
  --lime: #cce547;
  --lime-dark: #adc82b;
  --orange: #ff8c58;
  --line: #d8dfd4;
  --white: #ffffff;
  --shadow: 0 24px 70px rgba(25, 55, 45, 0.13);
}

* {
  box-sizing: border-box;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--cream);
  font-family: "Manrope", "Gowun Dodum", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.hidden {
  display: none !important;
}

.topbar {
  height: 78px;
  padding: 0 clamp(22px, 6vw, 90px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--paper);
  border-bottom: 1px solid rgba(22, 56, 47, 0.1);
  position: relative;
  z-index: 5;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.signed-in-user {
  max-width: 120px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-link,
.logout-button {
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.admin-link:hover,
.logout-button:hover {
  color: var(--orange);
}

.account-chip {
  min-width: 176px;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 24px;
  color: var(--ink-soft);
  background: #f2f3ed;
}

.account-chip > span:last-child {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.account-chip small {
  font-size: 9px;
  font-weight: 700;
  color: #7b8a84;
}

.account-chip strong {
  max-width: 145px;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: #a5b0ab;
}

.account-chip.configured .account-dot {
  background: #e7a93b;
}

.account-chip.verified {
  border-color: #a9c94c;
  background: #f1f8db;
}

.account-chip.verified .account-dot {
  background: #6a9d22;
  box-shadow: 0 0 0 4px rgba(106, 157, 34, 0.12);
}

.account-chip.error {
  border-color: #e7a187;
  background: #fff0e9;
}

.account-chip.error .account-dot {
  background: #c75c39;
}

.brand,
.footer-brand {
  color: var(--ink);
  text-decoration: none;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -1px;
}

.brand > span:last-child span,
.footer-brand span {
  color: var(--orange);
}

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

.brand-mark {
  width: 28px;
  height: 28px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 5px;
  gap: 2px;
}

.brand-mark span {
  display: block;
  background: var(--ink);
  border-radius: 10px;
}

nav {
  align-self: stretch;
  display: flex;
  gap: 28px;
}

.nav-link {
  border: 0;
  background: none;
  padding: 0 5px;
  cursor: pointer;
  font-weight: 700;
  color: #71827d;
  position: relative;
}

.nav-link.active {
  color: var(--ink);
}

.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--orange);
}

.trip-count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  margin-left: 4px;
  border-radius: 20px;
  background: var(--lime);
  color: var(--ink);
  font-size: 12px;
}

.help-button,
.settings-button,
.dialog-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #cfd8d2;
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}

.floating-help-button {
  position: fixed;
  top: 50%;
  right: 0;
  left: auto;
  inset-inline-start: auto;
  inset-inline-end: 0;
  z-index: 20;
  min-width: 116px;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 13px 18px 13px 15px;
  border: 0;
  border-radius: 18px 0 0 18px;
  color: var(--ink);
  background: var(--lime);
  box-shadow: 0 12px 32px rgba(22, 56, 47, 0.24);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transform: translateY(-50%);
  transition: padding 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.floating-help-button:hover {
  padding-right: 24px;
  background: #d9ee68;
  box-shadow: 0 15px 38px rgba(22, 56, 47, 0.3);
}

.floating-help-button:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
}

.floating-help-icon {
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-button {
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  cursor: pointer;
}

.settings-button:hover {
  border-color: var(--lime-dark);
  background: #f2f7df;
}

.hero {
  height: 430px;
  overflow: hidden;
  background: var(--ink);
  color: white;
  position: relative;
  padding: 75px clamp(24px, 9vw, 140px);
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 600px;
}

.eyebrow,
.section-kicker {
  font-size: 12px;
  letter-spacing: 0.17em;
  font-weight: 800;
  color: var(--orange);
  margin: 0 0 14px;
}

.hero h1 {
  font-size: clamp(44px, 5vw, 72px);
  line-height: 1.07;
  letter-spacing: -0.06em;
  margin: 0 0 20px;
}

.hero h1 em {
  color: var(--lime);
  font-style: normal;
}

.hero-copy > p:last-child {
  color: #c0d2cb;
  font-family: "Gowun Dodum", sans-serif;
  font-size: 17px;
}

.hero-art {
  position: absolute;
  inset: 0 0 0 45%;
}

.sun {
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  right: 17%;
  top: 47px;
  background: var(--orange);
  opacity: 0.95;
}

.mountain {
  position: absolute;
  width: 460px;
  height: 270px;
  bottom: 0;
  right: -80px;
  clip-path: polygon(0 100%, 46% 4%, 100% 100%);
}

.mountain-back {
  background: #2e5a4e;
  right: 200px;
  width: 390px;
  height: 220px;
}

.mountain-front {
  background: #264c42;
}

.train {
  position: absolute;
  z-index: 2;
  width: 430px;
  height: 92px;
  border-radius: 75px 18px 16px 38px;
  background: #f3f3ec;
  right: 8%;
  bottom: 68px;
  transform: skewX(-8deg);
  box-shadow: 0 17px 0 -7px #101d19;
}

.train::after {
  content: "";
  position: absolute;
  width: 120px;
  height: 100%;
  right: 0;
  border-radius: 10px 50px 50px 8px;
  background: var(--lime);
}

.train-window {
  position: absolute;
  z-index: 2;
  left: 60px;
  top: 23px;
  width: 240px;
  height: 27px;
  border-radius: 8px;
  background: repeating-linear-gradient(90deg, #315e53 0 35px, #e7efe9 35px 43px);
}

.train-stripe {
  position: absolute;
  height: 8px;
  background: var(--orange);
  bottom: 18px;
  left: 30px;
  right: 100px;
}

.rail {
  position: absolute;
  height: 3px;
  width: 620px;
  right: 0;
  bottom: 53px;
  background: #a9c1b8;
  transform: rotate(-3deg);
}

.rail-two {
  bottom: 39px;
}

.search-wrap {
  position: relative;
  z-index: 3;
  max-width: 1160px;
  margin: -38px auto 0;
  padding: 0 22px;
}

.search-card {
  background: var(--paper);
  padding: 34px 40px 38px;
  box-shadow: var(--shadow);
  border-radius: 4px 24px 4px 24px;
}

.search-heading,
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 25px;
}

h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.route-row,
.details-row {
  display: flex;
  align-items: flex-end;
  gap: 15px;
}

.route-row {
  margin-bottom: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
}

.field > span {
  font-size: 12px;
  font-weight: 800;
  color: #6f7f79;
}

.field select,
.field input {
  width: 100%;
  height: 55px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 8px;
  padding: 0 16px;
  color: var(--ink);
  outline: none;
  font-weight: 700;
}

.route-field select {
  height: 68px;
  font-size: 21px;
}

.field select:focus,
.field input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(204, 229, 71, 0.4);
}

.swap-button {
  flex: 0 0 46px;
  height: 46px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 0.65;
  cursor: pointer;
  transition: transform 0.25s ease;
}

.swap-button:hover {
  transform: rotate(180deg);
  background: var(--lime);
}

.primary-button {
  border: 0;
  border-radius: 8px;
  background: var(--lime);
  min-height: 55px;
  padding: 0 24px;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
  transition: background 0.2s ease, transform 0.2s ease;
}

.primary-button:hover:not(:disabled) {
  background: var(--lime-dark);
  transform: translateY(-2px);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.details-row .primary-button {
  flex: 0 0 180px;
}

.recent-searches {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.recent-searches-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.recent-searches-header strong {
  font-size: 13px;
}

.recent-searches-header button {
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.recent-search-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.recent-search-chip {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: white;
  text-align: left;
  cursor: pointer;
}

.recent-search-chip:hover {
  border-color: var(--orange);
  background: #fff7f2;
}

.recent-search-chip strong,
.recent-search-chip span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-search-chip strong {
  font-size: 13px;
}

.recent-search-chip span {
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 11px;
}

.results-section {
  max-width: 1116px;
  margin: 80px auto 100px;
  padding: 0 22px;
}

.filter-chip {
  border: 1px solid var(--line);
  background: transparent;
  padding: 8px 15px;
  border-radius: 20px;
  margin-left: 5px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.filter-chip.active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.notice {
  display: flex;
  gap: 10px;
  align-items: center;
  background: #eef1e8;
  padding: 12px 17px;
  border-radius: 8px;
  color: var(--ink-soft);
  margin-bottom: 16px;
  font-size: 13px;
}

.notice span {
  display: grid;
  place-items: center;
  flex: 0 0 21px;
  height: 21px;
  border: 1px solid #789087;
  border-radius: 50%;
  font-weight: 800;
}

.notice p {
  margin: 0;
}

.notice strong {
  color: var(--ink);
}

.connection-status {
  margin: -4px 0 16px;
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-soft);
  background: var(--paper);
  font-size: 12px;
  font-weight: 700;
}

.connection-status.ready {
  border-color: #a8c458;
  color: var(--ink);
  background: #f3f8df;
}

.connection-status.error {
  border-color: #e7a187;
  color: #873b24;
  background: #fff0e9;
}

.retry-selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 18px;
  padding: 16px 18px;
  border: 1px solid #e7a187;
  border-radius: 10px;
  background: #fff7f2;
}

.retry-selection-bar strong,
.retry-selection-bar span {
  display: block;
}

.retry-selection-copy {
  flex: 1;
}

.retry-selection-bar span {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.55;
}

.retry-selection-controls {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.retry-duration-field {
  display: grid;
  gap: 5px;
}

.retry-duration-field > span {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
}

.retry-duration-field select {
  min-width: 132px;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: white;
  font-weight: 700;
}

.retry-selection-actions {
  display: flex;
  gap: 8px;
}

.retry-selection-actions button {
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}

.retry-selection-actions .primary-button {
  border: 0;
  gap: 0;
}

.retry-selection-actions .primary-button.stop {
  color: white;
  background: #a2482d;
}

.retry-selection-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.text-link {
  border: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
}

.monitor-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--ink);
  color: white;
  padding: 18px 20px;
  margin-bottom: 16px;
  border-radius: 5px 14px 5px 14px;
}

.monitor-copy,
.monitor-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.monitor-copy strong {
  font-size: 15px;
}

.monitor-copy p {
  margin: 4px 0 0;
  color: #afc4bc;
  font-size: 12px;
}

.monitor-signal {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border: 2px solid #8aa098;
  border-radius: 50%;
}

.monitor-panel.running .monitor-signal {
  border: 0;
  background: var(--lime);
  box-shadow: 0 0 0 5px rgba(204, 229, 71, 0.14);
  animation: monitor-pulse 1.6s infinite;
}

@keyframes monitor-pulse {
  50% {
    box-shadow: 0 0 0 10px rgba(204, 229, 71, 0);
  }
}

.monitor-actions select,
.monitor-button {
  height: 40px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
}

.monitor-actions select {
  border: 1px solid #5c766d;
  background: #23463c;
  color: white;
  padding: 0 10px;
}

.monitor-button {
  border: 0;
  background: var(--lime);
  color: var(--ink);
  padding: 0 17px;
  cursor: pointer;
}

.monitor-panel.running .monitor-button {
  background: var(--orange);
}

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

.train-card {
  background: var(--paper);
  border: 1px solid #e1e4dc;
  border-radius: 4px 14px 4px 14px;
  display: grid;
  grid-template-columns: 120px 1fr 170px 150px;
  align-items: center;
  padding: 24px 25px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.train-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(30, 60, 49, 0.1);
}

.train-name strong {
  display: block;
  font-size: 18px;
}

.train-name span,
.duration,
.fare span {
  color: #788780;
  font-size: 12px;
}

.times {
  display: flex;
  align-items: center;
  gap: 18px;
}

.times strong {
  font-size: 25px;
}

.time-line {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 90px;
}

.time-line::before,
.time-line::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
}

.time-line i {
  height: 1px;
  flex: 1;
  background: #bcc8c3;
}

.fare strong {
  display: block;
  font-size: 19px;
}

.fare .available-text {
  color: #3f711d;
}

.fare .soldout-text {
  color: #a2482d;
}

.train-actions {
  display: grid;
  gap: 7px;
}

.select-train,
.retry-booking-button {
  min-height: 44px;
}

.retry-booking-button {
  border: 1px solid var(--orange);
  border-radius: 8px;
  color: #8c3f25;
  background: #fff3ed;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.retry-booking-button:hover {
  color: white;
  background: var(--orange);
}

.retry-booking-button.active {
  color: white;
  background: #a2482d;
  border-color: #a2482d;
}

.retry-booking-button.selected {
  color: var(--ink);
  background: var(--lime);
  border-color: #91aa31;
}

.retry-booking-button:disabled {
  cursor: wait;
  opacity: 0.85;
}

.empty-state {
  text-align: center;
  padding: 60px 25px;
  background: var(--paper);
  border: 1px dashed #c7d0ca;
  color: var(--ink-soft);
}

.trips-view {
  min-height: calc(100vh - 230px);
  max-width: 1000px;
  margin: 0 auto;
  padding: 70px 24px 110px;
}

.page-intro {
  margin-bottom: 35px;
}

.page-intro h1 {
  margin: 0 0 10px;
  font-size: 46px;
}

.page-intro > p:last-child {
  color: var(--ink-soft);
}

.saved-trip-list {
  display: grid;
  gap: 18px;
}

.saved-trip {
  background: var(--paper);
  border-radius: 5px 18px 5px 18px;
  padding: 27px 30px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  border-left: 7px solid var(--lime);
  box-shadow: 0 8px 28px rgba(25, 55, 45, 0.08);
}

.saved-trip .route {
  font-size: 26px;
  font-weight: 800;
  margin: 7px 0 12px;
}

.saved-trip .meta {
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 14px;
}

.payment-reminder {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-left: 4px solid var(--orange);
  color: var(--ink-soft);
  background: #fff3ec;
  font-size: 13px;
  line-height: 1.55;
}

.payment-reminder strong {
  color: #8c3f25;
}

.delete-trip {
  border: 0;
  background: transparent;
  align-self: start;
  cursor: pointer;
  color: #9a6c5d;
  font-size: 13px;
  text-decoration: underline;
}

.saved-trip-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

footer {
  min-height: 150px;
  padding: 35px clamp(22px, 7vw, 100px);
  color: #93a69f;
  background: #102a23;
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  align-items: center;
  gap: 30px;
  font-size: 12px;
}

.footer-brand {
  color: white;
}

dialog {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  max-width: calc(100vw - 30px);
}

dialog::backdrop {
  background: rgba(10, 28, 23, 0.7);
  backdrop-filter: blur(4px);
}

.dialog-shell,
.message-shell {
  width: min(660px, calc(100vw - 30px));
  max-height: 92vh;
  overflow: auto;
  padding: 36px 42px;
  background: var(--paper);
  border-radius: 6px 24px 6px 24px;
  position: relative;
}

.dialog-close {
  position: absolute;
  right: 22px;
  top: 20px;
  font-size: 24px;
  line-height: 1;
}

.dialog-route {
  color: var(--ink-soft);
}

.car-selector {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
  margin: 25px 0 15px;
  padding: 13px;
  background: #eef1e8;
  border-radius: 8px;
}

.car-arrow {
  border: 0;
  background: none;
  font-size: 20px;
  cursor: pointer;
}

.seat-legend {
  display: flex;
  justify-content: center;
  gap: 18px;
  font-size: 11px;
  color: var(--ink-soft);
  margin-bottom: 18px;
}

.seat-legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.seat-legend i {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  border: 1px solid #b8c4bf;
}

.seat-legend .occupied {
  background: #d9ddd9;
}

.seat-legend .chosen {
  background: var(--orange);
  border-color: var(--orange);
}

.seat-map {
  max-width: 350px;
  margin: 0 auto 28px;
  display: grid;
  grid-template-columns: repeat(2, 1fr) 30px repeat(2, 1fr);
  gap: 9px;
}

.seat {
  height: 39px;
  border: 1px solid #b8c4bf;
  border-radius: 6px 6px 10px 10px;
  background: white;
  font-size: 11px;
  cursor: pointer;
}

.seat:nth-child(5n + 3) {
  grid-column: 4;
}

.seat.occupied {
  background: #d9ddd9;
  color: #9aa59f;
  border-color: #d9ddd9;
  cursor: not-allowed;
}

.seat.selected {
  color: white;
  background: var(--orange);
  border-color: var(--orange);
}

.dialog-summary {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: center;
  gap: 20px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.booking-options {
  display: grid;
  gap: 16px;
  margin: 28px 0 20px;
}

.waiting-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f1f3eb;
  font-size: 14px;
  font-weight: 700;
}

.waiting-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--ink);
}

.reservation-warning {
  padding: 14px 16px;
  margin-bottom: 16px;
  border-left: 4px solid var(--orange);
  color: var(--ink-soft);
  background: #fff3ec;
  font-size: 12px;
  line-height: 1.6;
}

.dialog-primary {
  width: 100%;
}

.loading-state {
  display: grid;
  place-items: center;
  gap: 12px;
}

.loading-state p {
  margin: 0;
}

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid #dce3d8;
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error-state {
  border-color: #e3a18c;
  color: #8d3d26;
  background: #fff8f3;
}

.official-dialog-button {
  width: 100%;
  margin-top: 12px;
  min-height: 48px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  color: var(--ink);
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}

.official-dialog-button:hover {
  color: white;
  background: var(--ink);
}

.dialog-summary div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.dialog-summary span {
  font-size: 11px;
  color: var(--ink-soft);
}

.message-shell {
  width: min(400px, calc(100vw - 30px));
  text-align: center;
  padding: 42px;
}

.message-shell .primary-button {
  width: 100%;
  margin-top: 24px;
}

.message-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--lime);
  font-size: 25px;
  font-weight: 800;
}

.message-body {
  color: var(--ink-soft);
  line-height: 1.7;
}

.reservation-success .message-shell {
  width: min(560px, calc(100vw - 30px));
  padding: 28px 36px;
  text-align: left;
}

.reservation-success .message-icon {
  width: 46px;
  height: 46px;
  margin-bottom: 12px;
  margin-left: 0;
  color: white;
  background: var(--orange);
  font-size: 21px;
}

.reservation-success h2 {
  font-size: 26px;
}

.payment-required {
  display: grid;
  gap: 3px;
  margin: 14px 0;
  padding: 10px 14px;
  border-left: 5px solid var(--orange);
  color: #8c3f25;
  background: #fff0e9;
}

.payment-required span {
  font-size: 13px;
}

.reservation-success-summary {
  display: grid;
  gap: 0;
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
}

.reservation-success-summary > div {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 14px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
}

.reservation-success-summary > div:last-child {
  border-bottom: 0;
}

.reservation-success-summary dt {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.reservation-success-summary dd {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.payment-next-step {
  color: var(--ink);
}

.payment-next-step ol {
  margin: 6px 0 8px;
  padding-left: 22px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
}

.payment-next-step p {
  margin: 0;
  color: #8c3f25;
  font-size: 12px;
  font-weight: 800;
}

.reservation-success .message-shell .primary-button {
  min-height: 50px;
  margin-top: 16px;
}

.settings-shell {
  width: min(540px, calc(100vw - 32px));
}

.help-dialog-shell {
  width: min(560px, calc(100vw - 30px));
}

.help-dialog-description {
  margin: 8px 0 26px;
  color: var(--ink-soft);
  line-height: 1.65;
}

.help-steps {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.help-steps li {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.help-steps li:last-child {
  border-bottom: 0;
}

.help-step-number {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background: var(--lime);
  font-size: 13px;
  font-weight: 800;
}

.help-steps strong {
  font-size: 14px;
}

.help-steps p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.55;
}

.help-dialog-note {
  margin: 18px 0;
  padding: 13px 15px;
  border-left: 4px solid var(--orange);
  color: var(--ink-soft);
  background: #fff3ec;
  font-size: 12px;
}

.settings-description {
  margin: 8px 0 24px;
  color: var(--ink-soft);
  line-height: 1.65;
}

.settings-fields {
  display: grid;
  gap: 18px;
}

.settings-fields .field {
  min-width: 0;
}

.settings-fields input {
  width: 100%;
  margin-top: 8px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--paper);
}

.settings-fields input:focus {
  outline: 2px solid rgba(173, 200, 43, 0.28);
  border-color: var(--lime-dark);
}

.settings-fields small {
  display: block;
  margin-top: 7px;
  color: #71827d;
  line-height: 1.5;
}

.settings-warning {
  margin: 18px 0 0;
  padding: 12px 14px;
  border: 1px solid #e7a187;
  border-radius: 8px;
  color: #9b452b;
  background: #fff0e9;
  line-height: 1.5;
}

.account-security-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.account-security-section p {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
}

.secondary-button {
  flex: 0 0 auto;
  padding: 10px 13px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  color: var(--ink);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.secondary-button:hover {
  color: white;
  background: var(--ink);
}

@media (max-width: 520px) {
  .account-security-section {
    align-items: stretch;
    flex-direction: column;
  }

  .account-security-section .secondary-button {
    width: 100%;
  }
}

.toast {
  position: fixed;
  z-index: 20;
  right: 24px;
  bottom: 24px;
  width: min(390px, calc(100vw - 32px));
  padding: 19px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 13px;
  color: white;
  background: var(--ink);
  border: 1px solid #416359;
  border-radius: 6px 18px 6px 18px;
  box-shadow: 0 18px 50px rgba(8, 28, 22, 0.3);
  animation: toast-in 0.35s ease both;
}

@keyframes toast-in {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
}

.toast-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background: var(--lime);
  font-weight: 800;
}

.toast p {
  color: #bbcec7;
  font-size: 12px;
  margin: 5px 0 0;
}

.toast button {
  border: 0;
  color: white;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
}

@media (max-width: 850px) {
  .recent-search-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-art {
    left: 55%;
    opacity: 0.65;
  }

  .hero-copy {
    max-width: 55%;
  }

  .details-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .details-row .primary-button {
    width: 100%;
  }

  .train-card {
    grid-template-columns: 100px 1fr;
    gap: 20px;
  }

  .monitor-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .monitor-actions {
    justify-content: flex-end;
  }

  .fare,
  .select-train {
    grid-column: auto;
  }
}

@media (max-width: 620px) {
  .recent-search-list {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 0 18px;
  }

  nav {
    gap: 8px;
  }

  .nav-link {
    font-size: 12px;
  }

  .floating-help-button {
    top: auto;
    right: 14px;
    left: auto;
    inset-inline-start: auto;
    inset-inline-end: 14px;
    bottom: 18px;
    min-width: auto;
    min-height: 52px;
    padding: 11px 15px;
    border-radius: 16px;
    transform: none;
  }

  .floating-help-button:hover {
    padding-right: 15px;
  }

  .floating-help-icon {
    width: 21px;
    height: 21px;
    flex-basis: 21px;
  }

  .help-dialog-shell {
    padding: 34px 20px 24px;
  }

  .account-chip {
    min-width: 0;
    width: 46px;
    height: 46px;
    padding: 0;
    justify-content: center;
  }

  .account-chip > span:last-child {
    display: none;
  }

  .retry-selection-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .retry-selection-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .retry-selection-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .hero {
    height: 370px;
    padding: 58px 24px;
  }

  .hero-copy {
    max-width: 100%;
  }

  .hero h1 {
    font-size: 47px;
  }

  .hero-art {
    left: 5%;
    opacity: 0.18;
  }

  .search-card {
    padding: 28px 20px;
  }

  .search-heading,
  .results-header {
    align-items: flex-start;
    gap: 15px;
    flex-direction: column;
  }

  .route-row {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .route-row .route-field:last-child {
    grid-row: 2;
    grid-column: 1;
  }

  .swap-button {
    grid-row: 1 / span 2;
    grid-column: 2;
    align-self: center;
    transform: rotate(90deg);
  }

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

  .train-card {
    grid-template-columns: 1fr;
  }

  .times {
    width: 100%;
  }

  .train-actions,
  .select-train {
    width: 100%;
  }

  .dialog-shell {
    padding: 34px 20px;
  }

  .dialog-summary {
    grid-template-columns: 1fr 1fr;
  }

  .dialog-summary .primary-button {
    grid-column: 1 / -1;
  }

  .saved-trip {
    grid-template-columns: 1fr;
  }

  footer {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .monitor-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .monitor-actions select,
  .monitor-button {
    width: 100%;
  }

  .toast {
    right: 16px;
    bottom: 16px;
  }
}

.auth-page {
  min-height: 100vh;
}

.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(380px, 1fr) minmax(440px, 0.8fr);
}

.auth-visual {
  padding: clamp(36px, 7vw, 90px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: white;
  background:
    radial-gradient(circle at 75% 20%, rgba(204, 229, 71, 0.9) 0 8%, transparent 8.2%),
    linear-gradient(145deg, #102a23, #315e53);
}

.auth-brand {
  color: white;
}

.auth-brand .brand-mark {
  border-color: white;
}

.auth-brand .brand-mark span {
  background: white;
}

.auth-visual h1 {
  margin: 18px 0;
  font-size: clamp(45px, 6vw, 78px);
  line-height: 1.05;
  letter-spacing: -0.06em;
}

.auth-visual em {
  color: var(--lime);
  font-style: normal;
}

.auth-panel {
  display: grid;
  place-items: center;
  padding: 28px;
  background: var(--cream);
}

.auth-card,
.admin-card {
  width: min(440px, 100%);
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: 6px 24px 6px 24px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.auth-description {
  margin: 10px 0 28px;
  color: var(--ink-soft);
}

.auth-card .field,
.admin-card .field {
  margin-top: 18px;
}

.auth-submit {
  width: 100%;
  margin-top: 24px;
}

.auth-error,
.admin-success {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
}

.auth-error {
  color: #873b24;
  background: #fff0e9;
  border: 1px solid #e7a187;
}

.admin-success {
  color: #315e1a;
  background: #eff8da;
  border: 1px solid #a8c458;
}

.admin-page {
  max-width: 1180px;
  min-height: calc(100vh - 78px);
  margin: 0 auto;
  padding: 70px 24px 110px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  align-items: start;
  gap: 24px;
}

.admin-card {
  width: 100%;
}

.admin-card small {
  display: block;
  margin-top: 8px;
  color: var(--ink-soft);
}

.user-list-card {
  min-width: 0;
}

.admin-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-table-wrap {
  overflow-x: auto;
  margin-top: 20px;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
}

.user-table th,
.user-table td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
}

.user-table th {
  color: var(--ink-soft);
  font-size: 11px;
}

.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  color: #873b24;
  background: #fff0e9;
  font-size: 11px;
  font-weight: 800;
}

.status-badge.active {
  color: #315e1a;
  background: #eff8da;
}

.admin-action-message {
  margin: 16px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  color: #315e1a;
  background: #eff8da;
  border: 1px solid #a8c458;
  font-size: 12px;
}

.admin-action-message.error {
  color: #873b24;
  background: #fff0e9;
  border-color: #e7a187;
}

.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 230px;
}

.user-actions button {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: white;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.user-actions button:hover:not(:disabled) {
  border-color: var(--ink);
  background: #f1f3eb;
}

.user-actions button.danger {
  color: #873b24;
  border-color: #e7a187;
}

.user-actions button.danger:hover:not(:disabled) {
  color: white;
  background: #a2462a;
  border-color: #a2462a;
}

.user-actions button:disabled {
  cursor: wait;
  opacity: 0.5;
}

.protected-account {
  color: var(--ink-soft);
  font-size: 11px;
}

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

  .auth-visual {
    min-height: 280px;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }
}
