/* Shared interface: calm surfaces, clear hierarchy, generous touch targets. */
:root {
  --green: #12644b;
  --green-dark: #0b4d39;
  --mint: #edf5ef;
  --ink: #1e332b;
  --muted: #69776f;
  --line: #e3e9e2;
  --bg: #f7f8f5;
}
body { color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
.panel-eyebrow { display:block; color:#73836f; font-size:9px; font-weight:600; letter-spacing:1.4px; margin-bottom:13px; }
button, a, input, select { touch-action: manipulation; }
button, a { transition: background-color .18s, border-color .18s, color .18s, box-shadow .18s; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #39997b; outline-offset: 4px;
}
.app-header {
  height: 86px; gap: 24px; padding: 0 max(32px, calc((100vw - 1120px) / 2));
  background: #fff; border-bottom: 1px solid var(--line);
}
.brand { gap: 10px; }
.brand strong { font-size: 27px; font-weight: 850; letter-spacing: -1.6px; }
.brand-icon { width: 38px; height: 38px; border-radius: 12px; background: var(--green); }
.brand-icon .icon { width: 24px; height: 24px; }
.brand-tagline { display: inline-flex !important; margin: 0; padding: 0; border: 0; color: var(--muted); font-size: 11px; white-space: nowrap; }
.top-nav {
  height: 48px; gap: 3px; margin: 0 auto; padding: 4px; border: 1px solid #eef1ec;
  border-radius: 14px; background: #f4f6f2;
}
.nav-item { min-width: 96px; min-height: 38px; justify-content: center; gap: 8px; padding: 0 15px; border-radius: 10px; font-size: 13px; color: #69776f; }
.nav-item .icon { width: 18px; height: 18px; }
.nav-item.active { background: #fff; color: var(--green); box-shadow: 0 2px 7px #193b2510; }
.nav-item.active::after { display: none; }
.nav-item:hover:not(.active) { color: var(--green); background: #eaf0e8; }
.header-actions { margin-left: 0; gap: 15px; }
.header-region { display: inline-flex; align-items: center; gap: 7px; color: #69776f; font-size: 12px; white-space: nowrap; }
.header-region .status-dot { width: 6px; height: 6px; background: #439779; }
.icon-button, .app-header .help-button { min-width: 44px; min-height: 44px; width: 44px; height: 44px; color: #69776f; }
.icon-button:hover { background: #edf4ee; color: var(--green); }
.app-layout:not(.has-home) {
  display: grid; grid-template-columns: 350px minmax(0, 1fr); align-items: start;
  gap: 28px; width: calc(100% - 64px); max-width: 1120px; padding: 40px 0 48px;
  min-height: calc(100dvh - 86px);
}
.sidebar {
  min-width: 0; display: flex; flex-direction: column; padding: 26px;
  background: #fff; border: 1px solid var(--line); border-radius: 24px;
  box-shadow: 0 5px 18px #263d2a03;
}
.search-panel h1, .favorites-panel h1 { font-size: 26px; letter-spacing: -1.2px; line-height: 1.4; margin: 0 0 10px; }
.search-panel > p, .favorites-panel > p, .panel-description { margin: 0 0 24px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.station-fields { display: block; border-color: var(--line); border-radius: 16px; padding: 17px 15px 17px 39px; background: #fcfdfb; }
.station-field label { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.station-field input { font-size: 18px; color: var(--ink); line-height: 30px; min-height: 40px; }
.station-field input::placeholder { font-size: 14px; color: #718076; }
.input-wrap { min-height: 44px; }
.clear-input { flex-shrink: 0; width: 36px; min-height: 44px; padding: 0; font-size: 23px; color: #85938a; }
.field-divider { display: block; margin: 12px 28px 12px 0; background: #e7ede5; }
.field-rail { display: flex; left: 17px; top: 46px; height: 91px; }
.field-rail i { width: 9px; height: 9px; }
.field-rail span { flex: 1; height: auto; margin: 5px 0; border-color: #b2c7b5; }
.swap-button { top: calc(50% - 22px); right: 10px; left: auto; transform: none; width: 44px; height: 44px; border-radius: 13px; border-color: var(--line); color: var(--green); box-shadow: 0 2px 5px #193b2506; }
.swap-button .icon { width: 19px; height: 19px; }
.route-options { margin: 16px 0; gap: 8px; }
.option { min-height: 44px; height: auto; border-radius: 10px; color: #627268; font-size: 12px; }
.option .icon { width: 16px; height: 16px; }
.option.active { border-color: #c0d8c7; background: #edf5ef; color: var(--green); }
.primary-button { min-height: 50px; height: auto; padding: 13px 16px; border-radius: 12px; font-size: 14px; }
.search-button { min-height: 52px; }
.form-error { font-size: 13px; line-height: 1.8; color: #a04132; }
.recent-section { margin-top: 25px; }
.section-label h2, .section-label h3 { font-size: 14px; }
.section-label > button { min-height: 44px; padding: 5px; color: #69776f; font-size: 12px; }
.recent-route { min-height: 56px; padding: 12px 0; gap: 10px; font-size: 13px; }
.recent-route > span:first-child { display: grid; place-items: center; flex-shrink: 0; width: 30px; height: 30px; background: #f4f7f1; color: #718271; border-color: var(--line); }
.recent-route .icon { width: 15px; height: 15px; }
.recent-names { gap: 6px; flex-wrap: wrap; }
.recent-route:hover { color: var(--green); }
.favorites-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.favorites-heading h1 { margin: 0; }
.favorites-heading #favorites-add { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 13px; }
.saved-route { display: flex; align-items: center; flex-wrap: nowrap; gap: 11px; min-height: 86px; margin-top: 12px; padding: 14px 10px 14px 14px; border: 1px solid var(--line); border-radius: 15px; background: #fcfdfb; }
.saved-route:hover { border-color: #b7d0bd; background: #f4f8f1; }
.saved-number { display: grid; place-items: center; flex-shrink: 0; min-width: 31px; height: 31px; border-radius: 9px; background: #e9f2e9; color: var(--green); font-size: 13px; font-weight: 700; }
.saved-route .saved-main { min-width: 0; min-height: 44px; padding: 0; font-size: 14px; font-weight: 600; line-height: 1.8; overflow-wrap: anywhere; }
.saved-main small { margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 400; }
.remove-saved { flex-shrink: 0; width: 36px; min-height: 44px; border-radius: 10px; color: #6c7a71; font-size: 22px; }
.remove-saved:hover { background: #f8eae5; color: #a04132; }
.empty-state { margin: 14px 0 4px; padding: 30px 15px; border: 1px dashed #d6e2d1; border-radius: 16px; color: var(--muted); font-size: 14px; line-height: 1.9; }
.empty-state strong { display: block; margin-bottom: 7px; color: var(--ink); font-size: 17px; }
.workspace { min-width: 0; padding: 0; background: transparent; border: 0; }
.workspace-heading { align-items: flex-start; margin-bottom: 20px; padding: 0 2px; }
.workspace-heading h2 { margin: 2px 0 5px; font-size: 26px; letter-spacing: -1.2px; }
.workspace-heading > p, .workspace-heading p { font-size: 13px; line-height: 1.7; color: var(--muted); }
.map-card { height: 580px; min-height: 440px; border: 1px solid var(--line); border-radius: 24px; background: #fff; }
.map-top { height: 67px; padding: 0 21px; background: linear-gradient(#fff 70%, #ffffff00); }
.map-title { gap: 8px; }
.map-title strong { font-size: 14px; }
.map-title > span > .icon { width: 18px; height: 18px; }
.map-label { padding: 4px 6px; border-radius: 6px; color: #69776f; font-size: 10px; }
.map-reset { min-height: 44px; gap: 6px; color: #607669; font-size: 12px; }
.map-reset .icon { width: 15px; height: 15px; }
.map-canvas { inset: 63px 3px 62px; background-size: 18px 18px; background-image: radial-gradient(#dce5da .7px, transparent .7px); }


.map-legend { height: 62px; padding: 0 16px; gap: 8px; justify-content: flex-start; background: #fff; border-top-color: var(--line); scrollbar-width: thin; }
.legend-item { min-width: 34px; min-height: 44px; gap: 5px; font-size: 10px; color: #66766b; }
.legend-item span { width: 22px; height: 22px; font-size: 11px; }
.legend-item.dimmed { opacity: .42; }
.station-popover { top: 74px; right: 18px; width: 225px; padding: 16px; border-color: #d9e5d7; border-radius: 17px; box-shadow: 0 10px 32px #183b2519; }
.popover-head { margin-bottom: 8px; }
.popover-head strong { font-size: 19px; }
.popover-head button { width: 44px; height: 44px; font-size: 23px; }
.popover-lines { flex-wrap: wrap; gap: 6px; }
.line-badge { min-height: 22px; min-width: 22px; padding: 0 7px; font-size: 11px; }
.popover-actions button { min-height: 44px; border-radius: 10px; font-size: 13px; }
.route-result { padding-top: 22px; border-top: 1px solid var(--line); margin-top: 26px; }
.result-top > span { font-size: 13px; }
.save-route { min-height: 44px; font-size: 12px; color: #69776f; }
.save-route.saved { color: #996e15; }
.route-summary { margin: 15px 0 12px; }
.route-summary strong { font-size: 44px; color: var(--green); letter-spacing: -2px; }
.route-summary > span { font-size: 16px; margin-bottom: 4px; }
.route-summary > small { color: var(--muted); font-size: 11px; margin-left: 6px; }
.result-meta { flex-wrap: wrap; gap: 7px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.result-track { gap: 6px; margin: 20px 0 14px; }
.route-timeline { margin-bottom: 17px; padding: 8px 0; border-color: var(--line); }
.route-segment { min-height: 74px; gap: 10px; padding: 13px 0; }
.route-segment::before { top: -20px; bottom: 35px; }
.segment-copy { min-width: 0; }
.segment-copy strong { font-size: 15px; }
.segment-copy p { color: var(--muted); font-size: 11px; line-height: 1.7; margin: 5px 0 0; }
.segment-end { max-width: 72px; text-align: right; color: #617365; font-size: 11px; line-height: 1.7; }
.route-disclaimer { color: var(--muted); font-size: 11px; line-height: 1.9; margin-top: 12px; }
.result-home-button { margin-bottom: 10px; }
.result-home-button + .route-home-button { background: #f1f6ed; color: var(--green); border: 1px solid #d5e2cf; }
.suggestions { top: 66px; left: -25px; right: -8px; padding: 6px; border-color: #d3e2d4; border-radius: 14px; box-shadow: 0 10px 28px #183b2518; }
.suggestion { min-height: 48px; padding: 10px 9px; border-radius: 9px; font-size: 14px; }
.suggestion .line-badge { min-height: 20px; min-width: 20px; font-size: 10px; }
.suggestion-empty { color: var(--muted); font-size: 13px; line-height: 1.8; }
.modal { padding: 28px; border-color: #dde7d8; border-radius: 24px; box-shadow: 0 24px 100px #14392626; }
.modal::backdrop { background: #1d33284a; backdrop-filter: blur(7px); }
.modal-top > strong { font-size: 17px; }
.modal > p { color: #617166; font-size: 14px; line-height: 1.9; }
.history-clear-button { min-height: 44px; font-size: 13px; color: #69776f; }
.station-picker-modal { width: 470px; max-height: calc(100dvh - 40px); }
.station-picker-modal .modal-top { margin-bottom: 18px; }
.station-picker-modal .modal-top h2 { margin: 0; font-size: 21px; }
#station-picker-input { min-height: 52px; padding: 13px 16px; border-color: #d9e4d6; border-radius: 13px; background: #f7faf4; color: var(--ink); font-size: 16px; }
#station-picker-input::placeholder { color: #718076; }
button.station-choice { min-height: 54px; padding: 12px; border-radius: 11px; color: var(--ink); font-size: 15px; }
.station-choice-lines { color: #697a6a; font-size: 11px; }
.station-picker-empty { color: var(--muted); font-size: 14px; }
.journey-mode { padding: 7px 10px; border-radius: 7px; color: #796c36; font-size: 11px; }
.journey-current > small { color: var(--muted); font-size: 13px; }
.journey-current h2 { color: var(--ink); font-size: 41px; }
.journey-current p { color: var(--muted); font-size: 13px; line-height: 1.9; }
.journey-stop { color: #71806c; font-size: 11px; }
.alarm-config { padding: 19px; border-radius: 15px; background: #f4f8f0; border-color: #dfe9d8; }
.alarm-row { min-height: 38px; font-size: 13px; }
.alarm-row > label { color: #536c50; }
.alarm-row + .alarm-row { margin-top: 10px; }
.alarm-row select { min-height: 44px; padding: 8px 10px; border-radius: 9px; font-size: 13px; color: var(--ink); }
.switch { flex-shrink: 0; width: 44px; height: 26px; background: #c8d4c4; }
.switch::before { content: ''; position: absolute; inset: -9px 0; border-radius: 20px; }
.switch::after { width: 20px; height: 20px; left: 3px; top: 3px; box-shadow: 0 1px 3px #183b2515; }
.switch[aria-checked=true]::after { transform: translateX(18px); }
.switch:disabled { opacity: .5; cursor: default; }
.secondary-button { min-height: 44px; padding: 10px 13px; font-size: 12px; border-radius: 10px; color: #456e49; }
.journey-actions .primary-button { font-size: 13px; }
.journey-footnote { color: #69776f !important; font-size: 11px !important; line-height: 1.9 !important; }
.arrival-banner { border-radius: 12px; color: var(--green); font-size: 13px; }
.toast { bottom: 28px; max-width: min(480px, calc(100vw - 32px)); padding: 15px 23px; border-radius: 13px; background: #203d2af5; font-size: 13px; line-height: 1.7; }
@media (max-width: 1100px) {
  .brand-tagline { display: none !important; }
  .app-header { gap: 18px; }
  .app-layout:not(.has-home) { grid-template-columns: 330px minmax(0, 1fr); gap: 23px; }
  .sidebar { padding: 23px; }
  .map-card { height: 560px; }
  .legend-item { font-size: 0; }
}
@media (max-width: 900px) {
  .app-header { padding: 0 25px; gap: 16px; }
  .top-nav { margin: 0 auto; }
  .nav-item { min-width: 90px; padding: 0 12px; }
  .header-region { display: none; }
  .app-layout:not(.has-home) { width: calc(100% - 48px); grid-template-columns: 310px minmax(0, 1fr); gap: 20px; padding-top: 30px; }
  .sidebar { padding: 22px; }
  .map-top { padding: 0 14px; }
  .map-title strong { font-size: 12px; }
  .map-label { display: none; }
  .map-reset { font-size: 11px; }
  .map-legend { padding: 0 10px; gap: 5px; }
}
@media (max-width: 720px) {
  body { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  .app-header { height: 70px; padding: 0 22px; gap: 12px; }
  .brand { gap: 9px; }
  .brand strong { font-size: 26px; }
  .brand-icon { width: 35px; height: 35px; border-radius: 11px; }
  .brand-icon .icon { width: 23px; height: 23px; }
  .brand-tagline, .header-region { display: none !important; }
  .app-header .header-actions { margin-left: auto; }
  .app-header .help-button { min-width: 44px; min-height: 44px; }
  .app-header .top-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; height: auto; min-height: 72px;
    margin: 0; padding: 8px 17px calc(8px + env(safe-area-inset-bottom, 0px));
    gap: 8px; justify-content: space-around; background: #fffffff5; border: 0;
    border-top: 1px solid var(--line); border-radius: 0; box-shadow: 0 -5px 24px #193b2505;
    backdrop-filter: blur(12px);
  }
  .app-header .nav-item {
    flex: 1; flex-direction: column; gap: 4px; min-width: 0; min-height: 54px;
    padding: 7px 10px; font-size: 11px; font-weight: 600; border-radius: 12px;
  }
  .app-header .nav-item .icon { width: 20px; height: 20px; }
  .nav-item.active { background: #edf5ed; box-shadow: none; }
  .app-layout:not(.has-home) {
    display: flex; flex-direction: column; gap: 26px; width: 100%; max-width: 600px;
    padding: 24px 18px 28px; min-height: calc(100dvh - 150px);
  }
  .sidebar { width: 100%; padding: 24px; border-radius: 22px; }
  .search-panel h1, .favorites-panel h1 { font-size: 25px; }
  .station-fields { display: block; grid-template-columns: none; padding: 17px 15px 17px 39px; }
  .station-field input { font-size: 18px; }
  .field-rail { display: flex; }
  .field-divider { display: block; }
  .swap-button { top: calc(50% - 22px); left: auto; right: 10px; transform: none; }
  .route-options { margin: 16px 0; }
  .option { font-size: 13px; }
  .recent-section { margin-top: 20px; }
  #recent-routes { display: block; padding-bottom: 0; overflow: visible; }
  .recent-route { width: 100%; margin: 0; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; font-size: 13px; }
  .recent-route > span:first-child { width: 30px; height: 30px; }
  .recent-route > span:last-child { display: inline; }
  .workspace { width: 100%; padding: 0; border: 0; }
  .workspace-heading { margin-bottom: 17px; padding: 0 3px; }
  .workspace-heading h2 { font-size: 24px; }
  .map-card { min-height: 430px; height: 450px; border-radius: 22px; }
  .map-top { height: 62px; padding: 0 16px; }
  .map-title strong { font-size: 13px; }
  .map-reset { font-size: 11px; }
  .map-canvas { top: 60px; bottom: 62px; }
  .map-legend { height: 62px; gap: 7px; padding: 0 14px; }

  .station-popover { right: 12px; top: 67px; }
  .favorites-panel { padding-bottom: 0; }
  .saved-route { padding-left: 14px; }
  .route-result { margin-bottom: 0; }
  .route-timeline { max-height: none; overflow: visible; }
  .modal { max-width: calc(100vw - 28px); padding: 22px; border-radius: 22px; }
  .station-picker-modal { max-height: calc(100dvh - 32px); }
  .station-picker-results, #station-picker-results { max-height: min(360px, 50dvh); }
  .station-picker-modal .modal-top h2 { font-size: 20px; }
  .journey-current h2 { font-size: 36px; }
  .journey-stop { font-size: 10px; }
  .journey-actions { flex-wrap: wrap; }
  .journey-actions .primary-button { min-width: 55%; }
  .toast { bottom: calc(91px + env(safe-area-inset-bottom, 0px)); font-size: 13px; }
}
@media (max-width: 370px) {
  .app-header { padding: 0 18px; }
  .sidebar { padding: 19px; }
  .app-layout:not(.has-home) { padding-left: 14px; padding-right: 14px; }
  .saved-route { gap: 8px; padding-left: 10px; }
  .saved-route .saved-main { font-size: 13px; }
  .map-title { gap: 5px; }
  .map-title strong { font-size: 12px; }
  .alarm-config { padding: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.service-links{display:flex;flex-wrap:wrap;gap:10px 16px;padding:16px 0}.service-links a{color:#2877d7;font-size:13px;text-underline-offset:3px}.test-connection-settings{margin-top:18px}.test-connection-settings summary{cursor:pointer;color:#68778b;font-size:13px;padding:10px 0}

.route-home-button{min-height:48px;width:100%;font:inherit;font-size:14px;margin-top:8px}
