/* Shared express editor: explicit theme tokens, scoped controls, no legacy overrides. */
.express-config,
#cc-express-modal {
  color: var(--ui-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-optical-sizing: auto;
}
#cfg-express-disclosure .express-config {
  padding: 0;
}
.express-config {
  font-size: 13px;
  line-height: 1.5;
}
.express-config .express-enable-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0;
  cursor: pointer;
  padding: 10px 0;
}
.express-enable-row strong {
  display: block;
  color: var(--ui-text);
  font-size: 14px;
  font-weight: 650;
}
.express-switch {
  position: relative;
  width: 42px;
  flex: 0 0 42px;
  height: 26px;
}
.express-switch input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.express-switch > span {
  display: block;
  height: 26px;
  border-radius: 20px;
  background: var(--ui-line);
  transition: background 160ms ease;
}
.express-switch > span::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
  transition: transform var(--ui-content-duration) var(--ui-ease-out);
}
.express-switch input:checked + span {
  background: var(--ui-accent);
}
.express-switch input:checked + span::before {
  transform: translateX(16px);
}
.express-switch input:focus-visible + span {
  outline: 2px solid var(--ui-focus);
  outline-offset: 3px;
}
.express-switch input:disabled + span {
  opacity: .5;
}
.express-config .express-note {
  margin: 10px 2px 16px;
  color: var(--ui-muted);
  font-size: 12px;
  line-height: 1.6;
}
.express-settings {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.express-settings:disabled .express-section {
  opacity: .5;
}
.express-section + .express-section {
  margin-top: 20px;
}
.express-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.express-config h4 {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: -.01em;
}
.express-count {
  flex-shrink: 0;
  color: var(--ui-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.express-config-button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--ui-line);
  border-radius: 10px;
  background: var(--ui-card);
  color: var(--ui-text);
  -webkit-tap-highlight-color: transparent;
}
.express-config-button:disabled {
  cursor: not-allowed;
}
.express-station-list {
  display: grid;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
  overflow-anchor: none;
  padding: 3px;
  margin: -3px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.express-station-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 6px 10px;
  border: 1px solid var(--ui-line);
  border-radius: 12px;
  background: var(--ui-card);
}
.express-station-index {
  color: var(--ui-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.express-station-name {
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 550;
}
.express-station-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 112px;
  gap: 4px;
}
.express-config .express-station-choice {
  position: relative;
  min-width: 44px;
  min-height: 44px;
  padding: 9px 4px 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ui-muted);
  font-size: 13px;
  white-space: nowrap;
}
.express-config .express-station-choice[aria-pressed="true"] {
  color: var(--ui-text);
  font-weight: 650;
}
.express-config .express-station-choice::after,
.express-config .express-tier-tab::after,
.express-direction-choice > span::after {
  content: '';
  position: absolute;
  bottom: 5px;
  left: calc(50% - 10px);
  width: 20px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  opacity: 0;
}
.express-config .express-station-choice[aria-pressed="true"]::after,
.express-config .express-tier-tab[aria-selected="true"]::after,
.express-direction-choice input:checked + span::after {
  opacity: 1;
}
.express-station-choice:focus-visible {
  outline: 2px solid var(--ui-text);
  outline-offset: 2px;
}
.express-config .express-station-choice:disabled {
  cursor: default;
  opacity: .45;
}
.express-direction-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  color: var(--ui-text);
}
.express-station-row > .express-direction-choices {
  grid-column: 2 / -1;
  border-top: 1px solid var(--ui-line);
}
.express-direction-choices .express-direction-choice {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
  min-height: 46px;
  margin: 0;
  padding: 0;
  cursor: pointer;
  text-align: center;
}
.express-direction-choices .express-direction-choice input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: inherit;
}
.express-direction-choice > span {
  position: relative;
  display: block;
  padding: 10px 2px 15px;
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  pointer-events: none;
}
.express-direction-choice input:checked + span {
  font-weight: 650;
}
.express-direction-choice input:focus-visible + span::after {
  opacity: 1;
  left: calc(50% - 16px);
  width: 32px;
  height: 3px;
}
.express-direction-choice input:disabled + span {
  opacity: .45;
}
@media (forced-colors: active) {
  .express-direction-choices .express-direction-choice input {
    opacity: 1;
    width: 16px;
    height: 16px;
    inset: 15px auto auto 0;
  }
  .express-direction-choice > span { padding-left: 20px; }
}
.express-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
#cc-express-modal {
  position: fixed;
  inset: 0;
  z-index: 30000;
  display: grid;
  place-items: center;
  padding: 16px;
}
#cc-express-modal.hidden {
  display: none;
}
.express-backdrop {
  position: absolute;
  inset: 0;
  background: var(--material-scrim,rgba(0, 0, 0, .4));
  backdrop-filter: blur(5px);
}
#cc-express-modal .cc-express-dialog {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(620px, calc(100vw - 32px));
  max-height: calc(var(--ui-layout-height, 100dvh) - 32px);
  overflow: hidden;
  border: 1px solid var(--ui-line);
  border-radius: 22px;
  background: var(--material-panel,var(--ui-surface));
  -webkit-backdrop-filter: var(--material-blur,none);
  backdrop-filter: var(--material-blur,none);
  box-shadow: var(--ui-shadow);
}
.express-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 16px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--ui-line);
}
.express-modal-header h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.4;
  letter-spacing: -.02em;
}
.express-close-button {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 23px;
  font-weight: 400;
}
.express-modal-body {
  min-height: 0;
  overflow: auto;
  padding: 20px 22px;
  overscroll-behavior: contain;
}
.cc-express-cell {
  white-space: nowrap;
}
.cc-express-open {
  border: 1px solid var(--ui-line);
  padding: 4px 10px;
  background: var(--ui-card);
  color: var(--ui-muted);
  cursor: pointer;
}
.cc-express-open.on {
  color: var(--ui-text);
  font-weight: 650;
}
@media (max-width:760px), (pointer:coarse) and (min-width:560px) and (max-height:520px) and (orientation:landscape) {
  #cc-express-modal {place-items:var(--ui-task-align,center);padding:var(--ui-sheet-top) var(--ui-sheet-right) var(--ui-sheet-bottom) var(--ui-sheet-left);}
  #cc-express-modal .cc-express-dialog {
    width:var(--ui-sheet-width,100%);
    max-height:calc(var(--ui-layout-height) - var(--ui-sheet-top) - var(--ui-sheet-bottom));
    border-radius:var(--ui-panel-radius);
  }
  .express-modal-header {
    padding: 16px;
  }
  .express-modal-body {
    padding: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .express-switch > span,
  .express-switch > span::before {
    transition: none;
  }
}
@media (prefers-reduced-transparency: reduce) {
  .express-backdrop {
    backdrop-filter: none;
    background: rgba(0, 0, 0, .6);
  }
}

@media (pointer: coarse) {
  .express-config button, #cc-express-modal button { min-height:44px; }
  .express-close-button { flex-basis:44px; width:44px; height:44px; }
  /* The whole enable row is a label; preserve its larger toggle target. */
  .express-enable-row { min-height:44px; }
}

/* Service tabs use the same underline selection as station choices. */
.express-tier-tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0,1fr);
  gap: 3px;
  padding: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--ui-line);
}
.express-config .express-tier-tab {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  min-height: max(44px, calc(44px / var(--ui-desktop-scale, 1)));
  min-width: 0;
  padding: 8px 3px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ui-muted);
  font-size: 15px;
  font-weight: 600;
  transition: color 120ms ease;
}
.express-config .express-tier-tab[aria-selected="true"] {
  color: var(--ui-text);
  font-weight: 650;
}
.express-tier-tab::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--service-color);
}
.express-config .express-local-summary { padding: 16px; line-height: 1.65; }
.express-config .express-enable-row[hidden],
.express-config .express-settings[hidden],
.express-config .express-tier-tab:active { opacity: .82; }
.express-config .express-tier-tab:focus-visible { outline: 2px solid var(--ui-focus); outline-offset: 1px; }
@media (prefers-reduced-motion: reduce) {
  .express-config .express-tier-tab { transition: none; }
}

@media (max-width: 360px) {
  .express-config .express-tier-tab {
    font-size: 14px;
    padding-inline: 1px;
  }
}

.express-headways { margin-bottom: 20px; }
.express-headway-grid {
  border: 1px solid var(--ui-line);
  border-radius: 12px;
  background: var(--ui-card);
  padding: 10px 12px;
  container-type: inline-size;
}
.express-headway-row {
  display: grid;
  grid-template-columns: minmax(135px, 1.4fr) repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: center;
  min-height: 52px;
}
.express-headway-header { min-height: 30px; color: var(--ui-muted); font-size: 12px; }
.express-headway-header > span:not(:first-child) { text-align: center; padding-right: 29px; }
.express-headway-direction { font-size: 13px; font-weight: 550; overflow-wrap: anywhere; text-wrap: balance; }
.express-headway-value {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  gap: 5px;
  align-items: center;
  margin: 0;
}
.express-headway-value input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 3px;
  border: 1px solid var(--ui-line);
  border-radius: 10px;
  background: var(--ui-field);
  color: var(--ui-text);
  font: inherit;
  font-variant-numeric: tabular-nums;
  text-align: center;
  appearance: textfield;
}
.express-headway-value input::-webkit-inner-spin-button { appearance: none; }
.express-headway-value span { font-size: 11px; color: var(--ui-muted); }
@container (max-width: 420px) {
  .express-headway-row { grid-template-columns: minmax(65px, 1fr) repeat(3, minmax(0, 1fr)); gap: 6px; }
  .express-headway-value { grid-template-columns: minmax(0, 1fr); gap: 2px; text-align: center; }
  .express-headway-header > span:not(:first-child) { padding-right: 0; }
  .express-headway-value input { min-height: 40px; font-size: 16px; }
  .express-headway-value span { line-height: 1; }
}
