@font-face {
  font-family: "Phosphor";
  src: url("/assets/phosphor-regular.woff2") format("woff2");
  font-display: block;
  font-style: normal;
  font-weight: normal;
}

:root {
  color-scheme: light;
  --stage: #ececea;
  --page: #f7f7f5;
  --surface: #ffffff;
  --surface-soft: #f1f2f4;
  --selected: #edf5ff;
  --selected-strong: #dcecff;
  --text: #111113;
  --secondary: #6e6e73;
  --tertiary: #707075;
  --line: #e6e7ea;
  --blue: #007aff;
  --blue-text: #0066cc;
  --blue-action: #0066cc;
  --green: #167a3f;
  --green-soft: #edf7f0;
  --amber: #a64b00;
  --amber-soft: #fff5e8;
  --red: #c62828;
  --red-soft: #fff0ef;
  --radius-large: 16px;
  --radius-small: 10px;
  --nav-height: 62px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

.ph {
  display: inline-block;
  flex: 0 0 auto;
  font-family: "Phosphor" !important;
  font-size: 24px;
  font-style: normal;
  font-weight: normal;
  line-height: 1;
  speak: never;
}

.ph-arrow-clockwise::before { content: "\e036"; }
.ph-arrow-left::before { content: "\e058"; }
.ph-caret-down::before { content: "\e136"; }
.ph-caret-right::before { content: "\e13a"; }
.ph-chart-line-up::before { content: "\e156"; }
.ph-check-circle::before { content: "\e184"; }
.ph-dots-three::before { content: "\e1fe"; }
.ph-funnel-simple::before { content: "\e268"; }
.ph-info::before { content: "\e2ce"; }
.ph-list-bullets::before { content: "\e2f2"; }
.ph-magnifying-glass::before { content: "\e30c"; }
.ph-sliders-horizontal::before { content: "\e434"; }
.ph-star::before { content: "\e46a"; }
.ph-user-circle::before { content: "\e4c4"; }
.ph-warning-circle::before { content: "\e4e2"; }
.ph-x::before { content: "\e4f6"; }

*,
*::before,
*::after {
  box-sizing: border-box;
  min-width: 0;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  background: var(--stage);
}

body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow: hidden;
  background: var(--stage);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select {
  color: inherit;
  font: inherit;
}

button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
label:has(input:focus-visible) {
  outline: 3px solid rgba(0, 122, 255, 0.32);
  outline-offset: 2px;
}

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

[hidden] {
  display: none !important;
}

.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;
}

.app-stage {
  display: grid;
  min-height: 100dvh;
  place-items: center;
}

.app-shell {
  position: relative;
  width: min(390px, 100%);
  height: min(844px, calc(100dvh - 40px));
  overflow: hidden;
  border: 1px solid rgba(17, 17, 19, 0.04);
  border-radius: 24px;
  background: var(--page);
  box-shadow: 0 8px 24px rgba(17, 17, 19, 0.055);
}

.app-scroll {
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: calc(var(--nav-height) + 34px + var(--safe-bottom));
  scrollbar-width: none;
}

.app-scroll::-webkit-scrollbar,
.filter-sheet::-webkit-scrollbar,
.search-sheet::-webkit-scrollbar {
  display: none;
}

.screen-content {
  padding: 4px 20px 32px;
}

.app-header,
.detail-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 20px 10px;
  background: var(--page);
}

.detail-header {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  padding-right: 12px;
  padding-left: 12px;
}

.app-header h1,
.detail-header h1 {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 32px;
}

.detail-header h1 {
  overflow: hidden;
  font-size: 20px;
  line-height: 26px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-header p,
.detail-header p {
  margin-top: 2px;
  color: var(--secondary);
  font-size: 12px;
  line-height: 18px;
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 2px;
}

.icon-button,
.text-icon-button {
  display: inline-flex;
  min-width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius-small);
  background: transparent;
  cursor: pointer;
}

.icon-button .ph {
  font-size: 26px;
}

.text-icon-button {
  width: auto;
  gap: 6px;
  padding: 0 7px;
  color: var(--blue-text);
  font-size: 14px;
  font-weight: 500;
}

.icon-button:hover,
.text-icon-button:hover {
  background: rgba(17, 17, 19, 0.035);
}

.icon-button:active,
.text-icon-button:active,
.candidate-row:active,
.route-list-row:active,
.simulation-route-header:active,
.bottom-navigation button:active {
  background: var(--surface-soft);
}

.icon-button.is-selected,
.icon-button.selected,
.text-icon-button.is-selected,
.text-icon-button.selected {
  color: var(--blue);
  background: var(--selected);
}

.icon-button:disabled,
.text-icon-button:disabled {
  color: var(--tertiary);
  cursor: default;
  opacity: 0.55;
}

.is-spinning {
  animation: spin 0.9s linear infinite;
}

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

.status-mark {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 6px;
  color: var(--secondary);
  font-size: 13px;
  font-style: normal;
  font-weight: 500;
  line-height: 20px;
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
}

.status-mark.is-success,
.status-mark.success { color: var(--green); }
.status-mark.is-warning,
.status-mark.warning { color: var(--amber); }
.status-mark.is-danger,
.status-mark.danger { color: var(--red); }
.status-mark.is-unavailable,
.status-mark.unavailable { color: var(--tertiary); }

.data-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid #f2d7b4;
  border-radius: var(--radius-small);
  color: var(--amber);
  background: var(--amber-soft);
}

.data-notice.is-success,
.data-notice.success {
  border-color: #cce5d3;
  color: var(--green);
  background: var(--green-soft);
}

.data-notice.is-danger,
.data-notice.danger {
  border-color: #f1ccca;
  color: var(--red);
  background: var(--red-soft);
}

.data-notice > div {
  display: grid;
  flex: 1 1 auto;
  gap: 1px;
}

.data-notice strong,
.data-notice span {
  font-size: 13px;
  line-height: 19px;
}

.data-notice span {
  color: var(--secondary);
}

.notice-action {
  min-width: 76px;
  min-height: 44px;
  margin: -6px -8px -6px 0;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--amber);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.decision-panel,
.route-decision,
.simulation-summary {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  background: var(--surface);
}

.decision-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.decision-heading > div > span {
  color: var(--secondary);
  font-size: 13px;
  line-height: 20px;
}

.decision-heading h2 {
  margin-top: 1px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 36px;
}

.decision-primary-grid,
.simulation-primary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.decision-primary-grid .metric-block + .metric-block,
.simulation-primary-grid .metric-block + .metric-block {
  padding-left: 16px;
  border-left: 1px solid var(--line);
}

.metric-block {
  display: grid;
  align-content: start;
  gap: 4px;
}

.metric-block > span,
.metric-block > small {
  color: var(--secondary);
  font-size: 13px;
  line-height: 20px;
}

.metric-value,
.route-list-value,
.candidate-return,
.leg-values,
.tier-row,
.simulation-result {
  font-variant-numeric: tabular-nums;
}

.metric-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
}

.metric-value strong {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 26px;
}

.metric-value small {
  color: var(--secondary);
  font-size: 12px;
  line-height: 18px;
}

.metric-block.is-emphasis .metric-value strong,
.metric-block.emphasis .metric-value strong {
  font-size: 30px;
  line-height: 38px;
}

.metric-block.is-success .metric-value strong,
.metric-block.success .metric-value strong { color: var(--green); }
.metric-block.is-warning .metric-value strong,
.metric-block.warning .metric-value strong { color: var(--amber); }
.metric-block.is-danger .metric-value strong,
.metric-block.danger .metric-value strong { color: var(--red); }
.metric-block.is-unavailable .metric-value strong,
.metric-block.unavailable .metric-value strong { color: var(--tertiary); }

.scope-copy {
  margin: 8px 0 0;
  color: var(--secondary);
  font-size: 12px;
  line-height: 18px;
}

.scope-copy span {
  display: block;
  margin-top: 2px;
  color: var(--tertiary);
}

.supporting-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.supporting-metrics .metric-value {
  gap: 0 4px;
  white-space: nowrap;
}

.supporting-metrics .metric-value strong {
  font-size: 16px;
}

.direction-link {
  display: grid;
  width: 100%;
  min-height: 56px;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 10px 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.direction-link span {
  color: var(--secondary);
  font-size: 13px;
  line-height: 20px;
}

.direction-link strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  line-height: 21px;
}

.direction-link > :last-child {
  color: var(--tertiary);
}

.evidence-row {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: start;
  gap: 8px;
  margin-top: 14px;
  color: var(--secondary);
}

.evidence-row.is-success .ph { color: var(--green); }
.evidence-row.is-warning .ph { color: var(--amber); }
.evidence-row.is-danger .ph { color: var(--red); }

.evidence-row span {
  color: var(--secondary);
  font-size: 12px;
  line-height: 19px;
}

.evidence-row .ph {
  font-size: 18px;
}

.candidate-section {
  margin-top: 32px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-heading h2,
.route-notes h2 {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 26px;
}

.section-heading h2 span {
  color: var(--tertiary);
  font-size: 13px;
  font-weight: 500;
}

.section-heading p {
  margin-top: 2px;
  color: var(--secondary);
  font-size: 12px;
  line-height: 18px;
}

.sort-summary {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  color: var(--secondary);
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 12px;
  cursor: pointer;
  line-height: 18px;
}

.candidate-list,
.route-list,
.simulation-list {
  border-top: 1px solid var(--line);
}

.candidate-row {
  display: grid;
  width: 100%;
  min-height: 104px;
  grid-template-columns: 24px minmax(0, 1fr) 110px 18px;
  grid-template-areas:
    "rank identity return caret"
    "rank direction direction caret";
  align-items: center;
  gap: 6px 10px;
  padding: 14px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.candidate-row.is-selected,
.candidate-row.selected,
.route-list-row.is-selected,
.route-list-row.selected {
  margin-inline: -8px;
  padding-inline: 8px;
  border-radius: var(--radius-small);
  background: var(--selected);
}

.candidate-rank {
  grid-area: rank;
  align-self: start;
  padding-top: 2px;
  color: var(--tertiary);
  font-size: 13px;
}

.candidate-identity {
  display: grid;
  grid-area: identity;
  align-content: start;
  gap: 1px;
}

.candidate-identity > strong {
  font-size: 17px;
  font-weight: 600;
  line-height: 23px;
}

.candidate-identity > small,
.candidate-return small,
.candidate-direction small {
  color: var(--secondary);
  font-size: 12px;
  line-height: 17px;
}

.candidate-return {
  display: grid;
  grid-area: return;
  align-content: start;
  justify-items: end;
  gap: 1px;
  text-align: right;
}

.candidate-return strong {
  font-size: 14px;
  font-weight: 600;
  line-height: 21px;
  white-space: nowrap;
}

.candidate-return.is-success strong,
.candidate-return.success strong { color: var(--green); }
.candidate-return.is-warning strong,
.candidate-return.warning strong { color: var(--amber); }
.candidate-return.is-danger strong,
.candidate-return.danger strong { color: var(--red); }
.candidate-return.is-unavailable strong,
.candidate-return.unavailable strong { color: var(--tertiary); }

.candidate-direction {
  display: grid;
  grid-area: direction;
  gap: 1px;
}

.candidate-direction strong {
  font-size: 13px;
  font-weight: 500;
  line-height: 19px;
}

.row-caret {
  grid-area: caret;
  color: var(--tertiary);
  font-size: 19px;
}

.read-only-footnote {
  margin: 26px 0 8px;
  color: var(--tertiary);
  font-size: 12px;
  line-height: 18px;
  text-align: center;
}

.list-toolbar {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.list-toolbar button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue-text);
  font-size: 13px;
  cursor: pointer;
}

.list-toolbar .ph {
  font-size: 19px;
}

.list-toolbar button:last-child {
  max-width: 58%;
  justify-content: flex-end;
  color: var(--secondary);
  text-align: right;
}

.route-list-row {
  display: grid;
  width: 100%;
  min-height: 108px;
  grid-template-columns: 20px minmax(0, 1fr) 112px 16px;
  align-items: center;
  gap: 8px;
  padding: 14px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.route-list-rank,
.simulation-rank {
  align-self: start;
  padding-top: 2px;
  color: var(--tertiary);
  font-size: 13px;
}

.route-list-main,
.route-list-value,
.route-title-line {
  display: grid;
}

.route-list-main {
  gap: 2px;
}

.route-title-line {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.route-title-line > strong {
  font-size: 17px;
  font-weight: 600;
  line-height: 23px;
}

.route-direction-copy {
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
}

.route-source-copy {
  display: grid;
  color: var(--secondary);
  font-size: 12px;
  line-height: 17px;
}

.route-list-value {
  justify-items: end;
  gap: 2px;
  text-align: right;
}

.route-list-value em {
  color: var(--secondary);
  font-size: 12px;
  font-style: normal;
  line-height: 17px;
}

.route-list-value strong {
  font-size: 13px;
  font-weight: 600;
  line-height: 20px;
}

.route-list-value small {
  color: var(--secondary);
  font-size: 12px;
  line-height: 17px;
}

.route-list-value.is-success strong,
.route-list-value.success strong { color: var(--green); }
.route-list-value.is-warning strong,
.route-list-value.warning strong { color: var(--amber); }
.route-list-value.is-danger strong,
.route-list-value.danger strong { color: var(--red); }
.route-list-value.is-unavailable strong,
.route-list-value.unavailable strong { color: var(--tertiary); }

.route-list-row > :last-child {
  color: var(--tertiary);
}

.route-detail {
  display: grid;
  gap: 20px;
}

.route-decision {
  padding-top: 18px;
}

.route-decision-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 16px;
  margin-top: 18px;
}

.route-decision-grid .metric-block:nth-child(even) {
  padding-left: 16px;
  border-left: 1px solid var(--line);
}

.route-decision-grid .metric-block.is-emphasis .metric-value strong,
.route-decision-grid .metric-block.emphasis .metric-value strong {
  font-size: 24px;
  line-height: 32px;
}

.route-decision-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--secondary);
  font-size: 12px;
  line-height: 18px;
}

.route-decision-meta span:last-child {
  white-space: nowrap;
}

.leg-stack,
.paired-legs {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  background: var(--surface);
}

.leg-spine {
  position: absolute;
  z-index: 0;
  top: 34px;
  bottom: 34px;
  left: 34px;
  width: 1px;
  background: var(--line);
}

.leg-block {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 144px;
  grid-template-columns: 28px minmax(0, 1fr) 124px;
  align-items: start;
  gap: 12px;
  padding: 20px 16px 20px 20px;
}

.leg-block + .leg-block {
  border-top: 1px solid var(--line);
}

.leg-index {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--secondary);
  font-size: 12px;
  font-weight: 600;
}

.leg-copy,
.leg-values {
  display: grid;
  gap: 2px;
}

.leg-copy p {
  margin-bottom: 3px;
  color: var(--secondary);
  font-size: 12px;
  line-height: 17px;
}

.leg-copy h3 {
  font-size: 17px;
  font-weight: 600;
  line-height: 23px;
}

.leg-copy h3 span {
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}

.leg-copy > span,
.leg-copy small,
.leg-values span,
.leg-values small {
  color: var(--secondary);
  font-size: 12px;
  line-height: 17px;
}

.leg-values {
  justify-items: end;
  padding-top: 22px;
  text-align: right;
}

.leg-values strong {
  font-size: 14px;
  font-weight: 600;
  line-height: 21px;
  white-space: nowrap;
}

.leg-values span,
.leg-values small {
  white-space: nowrap;
}

.evidence-panel,
.execution-evidence {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  background: var(--surface);
}

.evidence-panel > button,
.execution-evidence > button {
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border: 0;
  background: transparent;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.evidence-panel > button > :last-child,
.execution-evidence > button > :last-child,
.simulation-route-header > :last-child {
  transition: transform 160ms ease;
}

.evidence-panel.is-expanded > button > :last-child,
.evidence-panel.expanded > button > :last-child,
.evidence-panel > button[aria-expanded="true"] > :last-child,
.execution-evidence.is-expanded > button > :last-child,
.execution-evidence > button[aria-expanded="true"] > :last-child,
.simulation-route.is-expanded .simulation-route-header > :last-child,
.simulation-route.expanded .simulation-route-header > :last-child,
.simulation-route-header[aria-expanded="true"] > :last-child {
  transform: rotate(180deg);
}

.evidence-grid,
.evidence-list {
  display: grid;
  padding: 0 16px 8px;
}

.evidence-grid > span,
.evidence-grid > div,
.evidence-list > span {
  display: grid;
  min-height: 48px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line);
  color: var(--secondary);
  font-size: 12px;
  line-height: 18px;
}

.evidence-grid strong,
.evidence-list strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  text-align: right;
}

.evidence-grid .is-success,
.evidence-list .is-success { color: var(--green); }
.evidence-grid .is-warning,
.evidence-list .is-warning { color: var(--amber); }
.evidence-grid .is-danger,
.evidence-list .is-danger { color: var(--red); }
.evidence-grid .is-unavailable,
.evidence-list .is-unavailable { color: var(--tertiary); }

.route-notes {
  padding: 2px 2px 0;
}

.route-notes p {
  position: relative;
  margin-top: 8px;
  padding-left: 14px;
  color: var(--secondary);
  font-size: 13px;
  line-height: 20px;
}

.route-notes p::before {
  position: absolute;
  top: 8px;
  left: 1px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--tertiary);
  content: "";
}

.simulation-summary {
  margin-bottom: 14px;
}

.simulation-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin-top: 18px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.simulation-mini-grid > span,
.simulation-mini-grid > div {
  display: grid;
  min-height: 68px;
  align-content: center;
  gap: 2px;
  border-bottom: 1px solid var(--line);
}

.simulation-mini-grid > :nth-child(even) {
  padding-left: 16px;
  border-left: 1px solid var(--line);
}

.simulation-mini-grid small {
  color: var(--secondary);
  font-size: 12px;
  line-height: 17px;
}

.simulation-mini-grid strong {
  font-size: 17px;
  font-weight: 600;
  line-height: 23px;
}

.simulation-mini-grid em {
  color: var(--secondary);
  font-size: 12px;
  font-style: normal;
  font-weight: 400;
}

.simulation-summary.is-failure,
.simulation-summary.failure {
  padding-top: 24px;
  text-align: center;
}

.simulation-summary.is-failure h2,
.simulation-summary.failure h2 {
  font-size: 20px;
  font-weight: 600;
  line-height: 28px;
}

.simulation-summary.is-failure > p,
.simulation-summary.failure > p {
  margin: 6px auto 18px;
  color: var(--secondary);
  font-size: 13px;
  line-height: 20px;
}

.simulation-scope {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 2px 14px;
  color: var(--secondary);
  font-size: 12px;
  line-height: 18px;
}

.simulation-route {
  border-bottom: 1px solid var(--line);
}

.simulation-route-header {
  display: grid;
  width: 100%;
  min-height: 82px;
  grid-template-columns: 20px minmax(0, 1fr) 116px 18px;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.simulation-route.is-expanded .simulation-route-header,
.simulation-route.expanded .simulation-route-header {
  color: var(--blue-text);
}

.simulation-identity {
  display: grid;
  gap: 2px;
}

.simulation-identity strong {
  font-size: 16px;
  font-weight: 600;
  line-height: 22px;
}

.simulation-identity small {
  color: var(--secondary);
  font-size: 12px;
  line-height: 17px;
}

.simulation-result {
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  line-height: 17px;
  text-align: right;
}

.simulation-result.is-success,
.simulation-result.success { color: var(--green); }
.simulation-result.is-warning,
.simulation-result.warning { color: var(--amber); }
.simulation-result.is-danger,
.simulation-result.danger,
.simulation-result.is-unavailable,
.simulation-result.unavailable { color: var(--red); }

.simulation-route-body {
  margin: 0 0 12px 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface);
}

.simulation-route-body > p {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--secondary);
  font-size: 12px;
  line-height: 17px;
}

.tier-list {
  display: grid;
}

.tier-row {
  display: grid;
  min-height: 74px;
  grid-template-columns: 58px minmax(0, 1fr) 96px;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.tier-row.is-target,
.tier-row.is-selected,
.tier-row.selected {
  background: var(--selected);
}

.tier-row.is-unavailable,
.tier-row.unavailable {
  color: var(--secondary);
  background: #fafafa;
}

.tier-notional,
.tier-cost,
.tier-result {
  display: grid;
  gap: 1px;
}

.tier-notional strong {
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}

.tier-notional span {
  width: max-content;
  padding: 1px 5px;
  border-radius: 5px;
  color: var(--blue-text);
  background: var(--selected);
  font-size: 12px;
  line-height: 15px;
}

.tier-cost span,
.tier-cost small {
  color: var(--secondary);
  font-size: 12px;
  line-height: 16px;
}

.tier-result {
  grid-template-columns: 1fr auto;
  align-items: center;
  justify-items: end;
  text-align: right;
}

.tier-result strong {
  font-size: 12px;
  font-weight: 600;
  line-height: 17px;
}

.tier-result.is-success strong,
.tier-result.success strong { color: var(--green); }
.tier-result.is-warning strong,
.tier-result.warning strong { color: var(--amber); }
.tier-result.is-danger strong,
.tier-result.danger strong { color: var(--red); }
.tier-result.is-unavailable strong,
.tier-result.unavailable strong { color: var(--tertiary); }

.simulation-route-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 10px 12px;
  color: var(--secondary);
  font-size: 12px;
  line-height: 18px;
}

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

.loading-state > span,
.loading-state > p {
  color: var(--secondary);
  font-size: 13px;
  line-height: 20px;
}

.loading-state > p {
  margin-top: 4px;
}

.loading-block {
  height: 92px;
  border-radius: var(--radius-large);
  background: var(--surface-soft);
  animation: loading-pulse 1.4s ease-in-out infinite alternate;
}

.loading-block.is-large,
.loading-block.large {
  height: 286px;
}

@keyframes loading-pulse {
  from { opacity: 0.58; }
  to { opacity: 1; }
}

.empty-state,
.error-state {
  display: grid;
  min-height: 360px;
  align-content: center;
  justify-items: center;
  padding: 32px 20px;
  color: var(--secondary);
  text-align: center;
}

.empty-state h2,
.error-state h2 {
  margin: 12px 0 4px;
  color: var(--text);
  font-size: 19px;
  font-weight: 600;
  line-height: 26px;
}

.empty-state p,
.error-state p {
  max-width: 280px;
  font-size: 13px;
  line-height: 20px;
}

.error-state > :first-child {
  color: var(--red);
}

.inline-primary-action,
.primary-sheet-action {
  min-height: 48px;
  border: 0;
  border-radius: var(--radius-small);
  background: var(--blue-action);
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.inline-primary-action {
  margin-top: 18px;
  padding: 0 22px;
}

.inline-primary-action:active,
.primary-sheet-action:active {
  background: #005ebd;
}

.inline-primary-action:disabled,
.primary-sheet-action:disabled {
  background: #b8bdc5;
  cursor: default;
}

.overlay-layer {
  position: absolute;
  z-index: 60;
  inset: 0;
  overflow: hidden;
}

.search-sheet {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 20px calc(24px + var(--safe-bottom));
  background: var(--page);
  scrollbar-width: none;
}

.sheet-header {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sheet-header h2 {
  font-size: 21px;
  font-weight: 600;
  line-height: 28px;
}

.sheet-reset {
  min-width: 44px;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--blue-text);
  font-size: 14px;
  cursor: pointer;
}

.search-field {
  display: grid;
  min-height: 48px;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--secondary);
}

.search-field:focus-within {
  border-color: var(--blue);
}

.search-field input {
  width: 100%;
  height: 44px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 15px;
}

.search-field input::placeholder {
  color: var(--tertiary);
}

.search-field input::-webkit-search-cancel-button {
  display: none;
  -webkit-appearance: none;
}

.search-field button {
  display: grid;
  width: 44px;
  min-width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--secondary);
  cursor: pointer;
}

.sheet-caption,
.search-result-count {
  margin: 8px 2px 0;
  color: var(--secondary);
  font-size: 12px;
  line-height: 17px;
}

.search-result-count {
  margin-top: 20px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}

.search-results {
  margin-top: 6px;
  border-top: 1px solid var(--line);
}

.search-results > button {
  display: grid;
  width: 100%;
  min-height: 72px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.search-results > button > span {
  display: grid;
  gap: 2px;
}

.search-results > button > span:last-child {
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  text-align: right;
}

.search-results strong {
  font-size: 16px;
  font-weight: 600;
  line-height: 22px;
}

.search-results small {
  color: var(--secondary);
  font-size: 12px;
  line-height: 17px;
}

.search-results .empty-state {
  min-height: 300px;
}

.overlay-layer.is-bottom,
.overlay-layer.bottom {
  display: flex;
  align-items: flex-end;
}

.sheet-scrim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(17, 17, 19, 0.32);
}

.filter-sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  max-height: 82%;
  overflow-y: auto;
  padding: 8px 20px calc(16px + var(--safe-bottom));
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  scrollbar-width: none;
}

.sheet-handle {
  width: 36px;
  height: 4px;
  margin: 0 auto 4px;
  border-radius: 2px;
  background: var(--line);
}

.filter-sheet fieldset {
  margin: 16px 0 0;
  padding: 0;
  border: 0;
}

.filter-sheet legend {
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 600;
  line-height: 21px;
}

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

.filter-options button {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface);
  font-size: 13px;
  cursor: pointer;
}

.filter-options button small {
  color: var(--secondary);
}

.filter-options button.is-selected,
.filter-options button.selected,
.filter-options button[aria-pressed="true"] {
  border-color: var(--blue);
  color: var(--blue-text);
  background: var(--selected);
}

.sort-options {
  border-top: 1px solid var(--line);
}

.sort-options label {
  display: grid;
  min-height: 48px;
  grid-template-columns: 0 1fr 20px;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  cursor: pointer;
}

.sort-options input {
  width: 0;
  height: 0;
  opacity: 0;
}

.sort-options i {
  display: block;
  width: 18px;
  height: 18px;
  border: 1px solid var(--tertiary);
  border-radius: 50%;
}

.sort-options label:has(input:checked) {
  color: var(--blue-text);
}

.sort-options label:has(input:checked) i {
  border: 5px solid var(--blue);
}

.primary-sheet-action {
  position: sticky;
  bottom: 0;
  width: 100%;
  margin-top: 16px;
}

.bottom-navigation {
  position: absolute;
  z-index: 40;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  min-height: calc(var(--nav-height) + var(--safe-bottom));
  grid-template-columns: repeat(3, 1fr);
  padding: 0 8px var(--safe-bottom);
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.bottom-navigation button {
  display: grid;
  min-height: var(--nav-height);
  align-content: center;
  justify-items: center;
  gap: 3px;
  padding: 4px 0 2px;
  border: 0;
  background: transparent;
  color: var(--tertiary);
  cursor: pointer;
}

.bottom-navigation button span {
  font-size: 12px;
  line-height: 16px;
}

.bottom-navigation button .ph {
  font-size: 25px;
}

.app-shell.is-detail .bottom-navigation {
  display: none;
}

.app-shell.is-detail .app-scroll {
  padding-bottom: calc(24px + var(--safe-bottom));
}

.failure-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.failure-grid span {
  display: grid;
  gap: 3px;
  padding-top: 16px;
}

.failure-grid span + span {
  border-left: 1px solid var(--line);
}

.failure-grid small {
  color: var(--secondary);
  font-size: 12px;
}

.failure-grid strong {
  font-size: 18px;
  font-weight: 600;
}

.bottom-navigation button.is-selected,
.bottom-navigation button.selected,
.bottom-navigation button[aria-current="page"] {
  color: var(--blue);
}

.toast {
  position: absolute;
  z-index: 80;
  right: 20px;
  bottom: calc(var(--nav-height) + 18px + var(--safe-bottom));
  left: 20px;
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(17, 17, 19, 0.06);
  font-size: 13px;
  font-weight: 500;
}

.toast.is-success,
.toast.success { color: var(--green); }
.toast.is-warning,
.toast.warning { color: var(--amber); }
.toast.is-danger,
.toast.danger { color: var(--red); }

@media (max-width: 480px) {
  html,
  body {
    width: 100%;
    min-height: 100%;
    background: var(--page);
  }

  body {
    display: block;
    padding: 0;
  }

  .app-stage {
    width: 100%;
    min-height: 100dvh;
  }

  .app-shell {
    width: 100%;
    height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
}

@media (max-width: 360px) {
  .screen-content {
    padding-right: 16px;
    padding-left: 16px;
  }

  .app-header {
    padding-right: 16px;
    padding-left: 16px;
  }

  .metric-block.is-emphasis .metric-value strong,
  .metric-block.emphasis .metric-value strong {
    font-size: 27px;
  }

  .candidate-row {
    grid-template-columns: 20px minmax(0, 1fr) 104px 16px;
  }

  .route-list-row {
    grid-template-columns: 18px minmax(0, 1fr) 104px 14px;
  }

  .leg-block {
    grid-template-columns: 26px minmax(0, 1fr) 116px;
    gap: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
