/* MilesMap — a clear, quiet workspace for planning points transfers. */

:root {
  --bg-0: #f5f5f0;
  --bg-1: #fafaf7;
  --surface: #ffffff;
  --surface-2: #f0f1eb;
  --surface-3: #e4e8df;
  --line: #d5dbd0;
  --line-soft: #e5e9e1;
  --ink: #202d27;
  --ink-dim: #526059;
  --ink-faint: #657168;
  --gold: #245d45;
  --gold-soft: #245d4510;
  --rose: #526b5b;
  --good: #2b7050;
  --good-dim: #2b705014;
  --warn: #91621f;
  --warn-dim: #91621f14;
  --bad: #a73e41;
  --bad-dim: #a73e4112;
  --info: #4f6960;
  --display: "Instrument Sans", "Avenir Next", "Segoe UI", sans-serif;
  --text: "Instrument Sans", "Avenir Next", "Segoe UI", sans-serif;
  --mono: "Spline Sans Mono", "SF Mono", "Consolas", monospace;
  --radius-lg: 18px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 22px 44px -26px rgba(32, 45, 39, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  position: relative;
  min-height: 100dvh;
  margin: 0;
  font-family: var(--text);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: none;
}

#app {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 28px 80px;
}

.hidden {
  display: none !important;
}

::selection {
  background: var(--gold-soft);
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- type primitives ---------- */

h1, h2, h3 {
  margin: 0;
  font-weight: 600;
}

h2 {
  font-size: 15px;
  letter-spacing: 0.01em;
}

p {
  margin: 0;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.section-label {
  margin: 22px 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  gap: 8px;
}

.micro {
  font-size: 12px;
  color: var(--ink-dim);
  line-height: 1.45;
}

.mono, .mono-id {
  font-family: var(--mono);
  font-size: 12px;
}

.mono-id {
  color: var(--ink-faint);
  font-size: 11px;
}

/* ==========================================================================
   Topbar
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 24px;
  margin: 0 -28px 30px;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 250, 247, .96);
  backdrop-filter: blur(12px);
}

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

.brand-mark {
  display: block;
  width: 40px;
  height: 40px;
  flex: none;
}

.brand-mark::after {
  content: none;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-copy strong {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.045em;
}

.brand-copy span {
  margin-top: 3px;
  font-size: 11px;
  letter-spacing: .02em;
  color: var(--ink-dim);
}

.primary-nav {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-2);
}

.primary-nav button {
  border: 0;
  background: transparent;
  color: var(--ink-dim);
  font: 600 13px var(--text);
  min-height: 38px;
  padding: 8px 16px;
  border-radius: 7px;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.primary-nav button:hover {
  color: var(--ink);
}

.primary-nav button.active {
  background: var(--surface);
  color: var(--gold);
  box-shadow: 0 1px 3px rgba(32, 45, 39, .08);
}

.primary-nav button:active,
.action-button:active,
.ghost-button:active {
  transform: scale(0.98);
}

.topbar-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.global-search {
  position: relative;
}

.global-search input {
  width: 210px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-1);
  color: var(--ink);
  font: 400 13px var(--text);
}

.global-search input::placeholder {
  color: var(--ink-faint);
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-1);
  font-size: 12px;
  color: var(--ink-dim);
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
  flex: none;
}

.status-pill.loaded .status-dot {
  background: var(--good);
}

/* search menus (combos) */

.search-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  min-width: 260px;
  max-height: 340px;
  overflow: auto;
  z-index: 60;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: var(--shadow);
  padding: 6px;
}

.menu-heading {
  margin: 8px 10px 4px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}

.menu-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: 400 13px var(--text);
}

.menu-option:hover {
  background: var(--surface-3);
}

.menu-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.menu-copy strong {
  font-weight: 600;
  font-size: 13px;
}

.menu-empty {
  padding: 14px 12px;
  font-size: 13px;
  color: var(--ink-faint);
}

/* ==========================================================================
   Loading / error
   ========================================================================== */

.loading-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 18px;
  margin-top: 30px;
}

.loading-grid div {
  height: 300px;
  border-radius: var(--radius-lg);
  background: linear-gradient(110deg, var(--surface) 30%, var(--surface-2) 45%, var(--surface) 60%);
  background-size: 220% 100%;
  animation: shimmer 1.6s linear infinite;
}

@keyframes shimmer {
  to { background-position: -120% 0; }
}

.state-panel {
  margin-top: 30px;
  padding: 28px;
  border: 1px solid var(--bad);
  border-radius: var(--radius-lg);
  background: var(--bad-dim);
}

.state-panel h2 {
  font-family: var(--display);
  font-size: 20px;
  margin-bottom: 8px;
}

/* ==========================================================================
   Views + heads
   ========================================================================== */

.view {
  display: none;
}

.view.active {
  display: block;
  animation: view-in 260ms ease both;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.view-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  min-height: 156px;
  margin: 8px 0 28px;
  padding: 10px 0 14px;
}

.view-head::before {
  content: none;
}

.view-head::after {
  content: none;
}

.view-title {
  position: relative;
  z-index: 1;
  max-width: 720px;
}

.view-title h1 {
  font-family: var(--display);
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 650;
  letter-spacing: -.045em;
  line-height: 1.12;
}

.view-title h1 em {
  font-style: normal;
  color: var(--gold);
}

.view-sub {
  margin-top: 12px;
  max-width: 640px;
  color: var(--ink-dim);
  font-size: 15px;
  line-height: 1.58;
}

/* ==========================================================================
   Shared atoms
   ========================================================================== */

.pill {
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-dim);
  font: 600 11px var(--mono);
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid var(--line);
  color: var(--ink-dim);
  background: var(--surface-2);
  text-decoration: none;
}

.badge.good { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); background: var(--good-dim); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: var(--warn-dim); }
.badge.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: var(--bad-dim); }
.badge.info { color: var(--info); }
.badge.tone-a { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 45%, transparent); background: var(--gold-soft); }
.badge.tone-b { color: var(--rose); border-color: color-mix(in srgb, var(--rose) 45%, transparent); background: color-mix(in srgb, var(--rose) 14%, transparent); }
.badge.link:hover { color: var(--gold); }

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.rate-chip {
  font: 600 11px var(--mono);
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--gold-soft);
  color: var(--gold);
  white-space: nowrap;
}

.rate-chip.muted-chip {
  background: var(--surface-3);
  color: var(--ink-faint);
}

.value-chip {
  font: 500 11px var(--mono);
  color: var(--good);
  white-space: nowrap;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-row button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-dim);
  font: 600 12px var(--text);
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.chip-row button small {
  color: var(--ink-faint);
  font-weight: 500;
}

.chip-row button.active {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-soft);
}

.action-button {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 40px;
  padding: 9px 18px;
  background: var(--gold);
  color: #ffffff;
  font: 600 13px var(--text);
  cursor: pointer;
  transition: filter 160ms ease, transform 160ms ease;
}

.action-button:hover {
  filter: brightness(1.08);
}

.ghost-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 38px;
  padding: 8px 14px;
  background: var(--surface);
  color: var(--ink-dim);
  font: 600 12.5px var(--text);
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.ghost-button:hover {
  color: var(--gold);
  border-color: var(--gold);
}

.ghost-button.small {
  padding: 5px 12px;
  font-size: 11.5px;
  align-self: flex-start;
}

.link-button {
  border: 0;
  background: none;
  padding: 0;
  color: var(--ink-dim);
  font: 500 12px var(--text);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-button:hover {
  color: var(--gold);
}

.link-button.strong {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  text-decoration: none;
}

.icon-button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-faint);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 11px;
  cursor: pointer;
  flex: none;
}

.icon-button:hover:not(:disabled) {
  color: var(--bad);
  border-color: var(--bad);
}

.icon-button:disabled {
  opacity: 0.35;
  cursor: default;
}

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

.wallet-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wallet-picker {
  position: relative;
}

.wallet-picker-button {
  color: var(--ink);
  border-color: var(--ink-dim);
}

.wallet-picker-menu {
  position: absolute;
  z-index: 12;
  top: calc(100% + 8px);
  right: 0;
  width: min(360px, calc(100vw - 48px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 54px -22px rgba(32, 45, 39, 0.48);
}

.wallet-picker-search {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
}

.wallet-picker-search > span,
.picker-issuer {
  color: var(--ink-faint);
  font: 600 10px var(--text);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.wallet-picker-search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-1);
  color: var(--ink);
  padding: 9px 10px;
  font: 400 13px var(--text);
}

.wallet-picker-search input:focus {
  border-color: var(--gold);
  outline: none;
}

.wallet-picker-options {
  max-height: min(340px, 42vh);
  overflow: auto;
  padding-top: 4px;
  overscroll-behavior: contain;
}

.picker-issuer {
  margin: 10px 8px 5px;
}

.card-choice {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 140ms ease;
}

.card-choice:hover,
.card-choice.selected {
  background: var(--gold-soft);
}

.card-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.card-choice-mark {
  width: 17px;
  height: 17px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg-1);
  display: grid;
  place-items: center;
}

.card-choice input:checked + .card-choice-mark {
  border-color: var(--gold);
  background: var(--gold);
}

.card-choice input:checked + .card-choice-mark::after {
  content: "";
  width: 7px;
  height: 4px;
  border-left: 2px solid var(--surface);
  border-bottom: 2px solid var(--surface);
  transform: rotate(-45deg) translateY(-1px);
}

.card-choice input:focus-visible + .card-choice-mark {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.card-choice-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1.3;
}

.card-choice-copy strong {
  color: var(--ink);
  font-size: 12.5px;
}

.card-choice-copy small {
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 11px;
  white-space: normal;
}

.picker-empty {
  padding: 18px 8px;
  color: var(--ink-faint);
  font-size: 12.5px;
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--ink-faint);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.empty-state strong {
  color: var(--ink-dim);
}

.empty-state.tall {
  padding: 44px 28px;
  align-items: flex-start;
}

.panel-card {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px 18px;
}

.panel-card .section-label {
  margin-top: 0;
}

.fact-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
  color: var(--ink-faint);
}

.fact-line:last-child {
  border-bottom: 0;
}

.fact-line strong {
  color: var(--ink);
  text-align: right;
  font-size: 12.5px;
}

/* fields */

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--ink-faint);
}

.field > span {
  font-weight: 600;
  letter-spacing: 0.04em;
}

.field > span small {
  font-weight: 400;
  color: var(--ink-faint);
}

.field input,
.field select,
.combo input,
.directory-filter {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-1);
  color: var(--ink);
  padding: 9px 12px;
  font: 400 13.5px var(--text);
  min-width: 0;
}

.field input:focus,
.field select:focus,
.combo input:focus,
.directory-filter:focus {
  border-color: var(--gold);
  outline: none;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-1);
}

.segmented button {
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  font: 600 12.5px var(--mono);
  padding: 8px 14px;
  cursor: pointer;
}

.segmented button.active {
  background: var(--gold-soft);
  color: var(--gold);
}

.switch-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-dim);
  cursor: pointer;
  align-self: end;
  padding-bottom: 9px;
}

.switch-field input {
  accent-color: var(--gold);
}

/* toggle switch */

.switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 20px;
  flex: none;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  transition: background 140ms ease;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ink-faint);
  transition: transform 160ms ease, background 160ms ease;
}

.switch input:checked + span {
  background: var(--gold-soft);
  border-color: var(--gold);
}

.switch input:checked + span::after {
  transform: translateX(14px);
  background: var(--gold);
}

.switch input:focus-visible + span {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ==========================================================================
   PLAN — pulse
   ========================================================================== */

.plan-head {
  align-items: center;
}

.plan-pulse {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  flex: none;
}

.pulse-dial {
  position: relative;
  width: 84px;
  height: 84px;
  flex: none;
}

.pulse-dial svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--surface-3);
  stroke-width: 6;
}

.ring-fg {
  fill: none;
  stroke: var(--good);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dasharray 420ms ease;
}

.pulse-dial.warn .ring-fg { stroke: var(--warn); }
.pulse-dial.bad .ring-fg { stroke: var(--bad); }

.pulse-num {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
}

.pulse-num strong {
  font-family: var(--display);
  font-size: 19px;
  font-weight: 600;
}

.pulse-num span {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.pulse-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(110px, auto));
  gap: 8px 26px;
  margin: 0;
}

.pulse-stats div {
  display: flex;
  flex-direction: column;
}

.pulse-stats dt {
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.pulse-stats dd {
  margin: 0;
  font: 500 15px var(--mono);
}

/* ==========================================================================
   PLAN — flow board (signature)
   ========================================================================== */

.flow-board {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr minmax(300px, 380px);
  gap: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg-1);
  overflow: visible;
}

.flow-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
}

.flow-ribbon {
  opacity: 0.42;
  pointer-events: auto;
  cursor: pointer;
  transition: opacity 160ms ease;
  animation: ribbon-in 480ms ease both;
  animation-delay: calc(var(--ribbon-index, 0) * 70ms);
}

.flow-ribbon:hover {
  opacity: 0.75;
}

@keyframes ribbon-in {
  from { opacity: 0; }
}

.flow-label {
  font: 500 10.5px var(--mono);
  fill: var(--ink-dim);
  text-anchor: middle;
  paint-order: stroke;
  stroke: var(--bg-1);
  stroke-width: 4px;
  pointer-events: none;
}

.flow-col {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.wallet-col {
  grid-column: 1;
}

.needs-col {
  grid-column: 3;
}

/* wallet tiles */

.wallet-list,
.need-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card-tile {
  --card-hue: var(--rose);
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 16px 18px 14px;
  transition: opacity 180ms ease, border-color 180ms ease;
}

.card-tile::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--card-hue);
}

.card-tile.disabled {
  opacity: 0.45;
}

.card-tile header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.card-remove {
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  padding: 3px 0 3px 8px;
  font: 600 10.5px var(--text);
  cursor: pointer;
}

.card-remove:hover {
  color: var(--bad);
}

.card-tile .issuer {
  font: 600 9.5px var(--mono);
  letter-spacing: 0.22em;
  color: var(--ink-faint);
}

.card-tile h3 {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.card-wallet-note {
  margin: -3px 0 9px;
  color: var(--ink-faint);
  font-size: 11.5px;
  line-height: 1.35;
}

.card-tile .balance {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.card-tile .balance input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: 500 21px var(--mono);
  padding: 0 0 4px;
  -moz-appearance: textfield;
  appearance: textfield;
}

.card-tile .balance input::-webkit-outer-spin-button,
.card-tile .balance input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.card-tile .balance input:focus {
  outline: none;
  border-bottom-color: var(--card-hue);
}

.card-tile .balance .unit {
  font: 600 10.5px var(--mono);
  color: var(--ink-faint);
  letter-spacing: 0.06em;
  flex: none;
}

.used-bar {
  height: 3px;
  border-radius: 3px;
  background: var(--surface-3);
  margin: 10px 0 8px;
  overflow: hidden;
}

.used-bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--card-hue);
  transition: width 380ms ease;
}

.card-tile footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: var(--ink-faint);
}

.card-tile footer [data-used-label] {
  color: color-mix(in srgb, var(--card-hue) 75%, var(--ink));
  font-weight: 500;
}

.cap-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wallet-empty {
  min-height: 170px;
  justify-content: center;
  align-items: flex-start;
  gap: 8px;
}

.wallet-empty .action-button {
  margin-top: 4px;
}

/* need tiles */

.need-tile {
  display: flex;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 14px 16px;
}

.need-ring {
  position: relative;
  width: 64px;
  height: 64px;
  flex: none;
  align-self: center;
}

.need-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.need-ring .ring-fg {
  stroke: var(--good);
  stroke-width: 7;
}

.need-ring .ring-fg.bad {
  stroke: var(--warn);
}

.ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 600 13px var(--mono);
}

.need-fields {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.need-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.need-top-row select {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-1);
  color: var(--gold);
  font: 600 11px var(--text);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 10px;
}

.need-name {
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 600 15px var(--text);
  padding: 0;
  border-bottom: 1px dashed transparent;
  border-radius: 0;
}

.need-name:hover,
.need-name:focus {
  border-bottom-color: var(--line);
  outline: none;
}

.need-name::placeholder {
  color: var(--ink-faint);
}

.need-program {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-1);
  color: var(--ink-dim);
  font: 400 12.5px var(--text);
  padding: 6px 10px;
  max-width: 100%;
}

.need-points {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.need-points input {
  width: 130px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: 500 18px var(--mono);
  padding: 0 0 3px;
  -moz-appearance: textfield;
  appearance: textfield;
}

.need-points input::-webkit-outer-spin-button,
.need-points input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.need-points input:focus {
  outline: none;
  border-bottom-color: var(--gold);
}

.need-points span {
  font: 600 10.5px var(--mono);
  color: var(--ink-faint);
}

.short-line {
  font: 500 11.5px var(--text);
  color: var(--warn);
  min-height: 17px;
}

/* ==========================================================================
   PLAN — strategies, tradeoffs, detail
   ========================================================================== */

.strategy-row {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 26px 0 14px;
}

.strategy-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.strategy-title {
  font-family: var(--display);
  font-size: 21px;
  font-weight: 600;
}

.strategy-sub {
  margin-top: 5px;
  font-size: 13px;
  color: var(--ink-dim);
  max-width: 560px;
}

.strategy-pills {
  display: grid;
  grid-template-columns: 1.12fr 1fr 1fr;
  gap: 12px;
}

.strategy-pill {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 14px 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font-family: var(--text);
  transition: border-color 160ms ease, background 160ms ease;
}

.strategy-pill:hover {
  border-color: var(--ink-faint);
}

.strategy-pill.active {
  border-color: var(--gold);
  background: linear-gradient(180deg, var(--gold-soft), transparent 80%), var(--surface);
}

.strategy-head {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.strategy-head strong {
  font-size: 15px;
}

.strategy-rank {
  font: 560 17px var(--display);
  color: var(--gold);
}

.strategy-select {
  margin-left: auto;
  font: 600 11px var(--text);
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-faint);
  white-space: nowrap;
}

.strategy-pill:hover .strategy-select {
  color: var(--gold);
  border-color: var(--gold);
}

.strategy-select.on {
  color: var(--gold);
  border-color: var(--gold);
  background: var(--gold-soft);
}

.strategy-desc {
  font-size: 12.5px;
  color: var(--ink-dim);
  line-height: 1.45;
}

.strategy-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px 14px;
  margin-top: 2px;
}

.s-metric {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.s-metric strong {
  font: 500 17px var(--mono);
}

.s-metric small {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.s-metric.warn strong {
  color: var(--warn);
}

.cov-bar {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 8px;
  height: 3px;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
}

.cov-bar i {
  display: block;
  height: 100%;
  background: var(--gold);
  border-radius: 3px;
  transition: width 380ms ease;
}

.plan-settings {
  display: flex;
  align-items: center;
  gap: 10px;
  align-self: center;
}

.setting-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
}

.tradeoffs {
  margin-bottom: 22px;
}

.tradeoffs .section-label {
  margin: 10px 0 8px;
}

.tradeoff-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tradeoff-item {
  font-size: 12.5px;
  color: var(--ink-dim);
  padding: 8px 14px;
  border-left: 2px solid var(--warn);
  background: var(--surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* allocation detail */

.allocation-detail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 16px;
}

.need-plan {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 18px 20px;
}

.need-plan.warn {
  border-color: color-mix(in srgb, var(--warn) 35%, transparent);
}

.need-plan.flash {
  animation: flash 1.1s ease;
}

@keyframes flash {
  0%, 60% { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
}

.need-plan-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.need-plan-name {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.need-plan-name strong {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
}

.type-tag {
  font: 600 10px var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-faint);
}

.type-tag.hotel { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 40%, transparent); }
.type-tag.flight { color: var(--info); border-color: color-mix(in srgb, var(--info) 40%, transparent); }

.goal-progress {
  font: 500 13px var(--mono);
  color: var(--ink-dim);
  white-space: nowrap;
}

.allocation-row {
  --card-hue: var(--rose);
  border-top: 1px solid var(--line-soft);
  padding: 12px 0 12px 12px;
  border-left: 2px solid var(--card-hue);
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.allocation-chain {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.chain-node {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--ink);
  font: 600 13px var(--text);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: text-decoration-color 140ms ease, color 140ms ease;
}

.chain-node:hover {
  color: var(--gold);
  text-decoration-color: var(--gold);
}

.chain-arrow {
  color: var(--ink-faint);
  font-size: 12px;
}

.allocation-numbers {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.allocation-numbers .mono {
  font-size: 13px;
}

.allocation-numbers strong.mono {
  font-size: 14px;
  color: var(--gold);
}

.allocation-numbers .rate {
  color: var(--ink-faint);
  margin-left: auto;
}

.check-details summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--ink-faint);
  user-select: none;
}

.check-details summary:hover {
  color: var(--ink-dim);
}

.check-details[open] summary {
  margin-bottom: 6px;
}

.shortfall-line {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--warn);
  border-top: 1px solid var(--line-soft);
  padding-top: 10px;
}

.caution-list {
  margin: 4px 0 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--ink-dim);
}

.caution-list li.good::marker { color: var(--good); }
.caution-list li.warn::marker { color: var(--warn); }
.caution-list li.bad::marker { color: var(--bad); }
.caution-list li.bad { color: var(--bad); }

/* ==========================================================================
   EXPLORE
   ========================================================================== */

.explore-controls {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
  margin-bottom: 20px;
}

.combo-field {
  flex: 1;
  min-width: 220px;
}

.combo {
  position: relative;
  display: flex;
}

.combo input {
  width: 100%;
}

.combo-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: var(--surface-3);
  color: var(--ink-faint);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 10px;
  cursor: pointer;
}

.combo-clear:hover {
  color: var(--bad);
}

.small-field {
  width: 150px;
}

.explore-body {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  gap: 20px;
  align-items: start;
}

.directory {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
  padding: 16px;
  position: sticky;
  top: 74px;
  max-height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
}

.directory-filter {
  width: 100%;
  margin-bottom: 10px;
}

.directory .chip-row {
  margin-bottom: 10px;
}

.directory-list {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}

.directory-list .section-label {
  margin: 14px 0 4px;
}

.directory-item {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.dir-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 11px 12px;
  cursor: pointer;
  font-family: var(--text);
  font-size: 13px;
  transition: border-color 140ms ease;
}

.dir-main:hover {
  border-color: var(--ink-faint);
}

.directory-item.active .dir-main {
  border-color: var(--gold);
  background: linear-gradient(180deg, var(--gold-soft), transparent 70%), var(--surface);
}

.directory-item.inactive .dir-main {
  opacity: 0.6;
}

.dir-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dir-top strong {
  font-size: 13.5px;
  min-width: 0;
}

.dir-info {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-faint);
  font: italic 600 12px var(--display);
  width: 26px;
  cursor: pointer;
  flex: none;
}

.dir-info:hover {
  color: var(--gold);
  border-color: var(--gold);
}

/* route workspace */

.route-workspace {
  display: grid;
  grid-template-columns: minmax(250px, 330px) 1fr;
  gap: 20px;
  align-items: start;
}

.route-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 180px);
  overflow: auto;
}

.route-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 11px 13px;
  cursor: pointer;
  font-family: var(--text);
  transition: border-color 140ms ease;
}

.route-item:hover {
  border-color: var(--ink-faint);
}

.route-item.active {
  border-color: var(--gold);
  background: linear-gradient(180deg, var(--gold-soft), transparent 70%), var(--surface);
}

.route-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.route-top strong {
  font-size: 13px;
  line-height: 1.35;
}

.route-meta {
  display: flex;
  gap: 10px;
  font-size: 11.5px;
  color: var(--ink-faint);
}

.route-stage {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.stage-head h2 {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
}

/* metro strip */

.metro {
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  padding: 18px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
}

.metro-stop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 130px;
  padding: 14px 12px 10px;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: center;
  font-family: var(--text);
}

.metro-stop .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2.5px solid var(--gold);
  background: var(--bg-1);
  flex: none;
}

.metro-stop.start .dot,
.metro-stop.end .dot {
  background: var(--gold);
}

.metro-stop strong {
  font-size: 13px;
  line-height: 1.3;
}

.metro-stop:hover strong {
  color: var(--gold);
}

.metro-hop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  padding-top: 18px;
  min-width: 90px;
  position: relative;
}

.metro-hop::before {
  content: "";
  position: absolute;
  top: 19px;
  left: -40px;
  right: -40px;
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--gold) 0 6px, transparent 6px 11px);
  opacity: 0.55;
  z-index: 0;
}

.metro-hop .rate-chip,
.metro-hop .badge {
  position: relative;
  z-index: 1;
}

/* limit strip */

.limit-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 30px;
  align-items: center;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}

.limit-note {
  flex: 1 1 240px;
}

.limit-strip.good { border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.limit-strip.warn { border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.limit-strip.bad { border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: var(--bad-dim); }

.limit-fact,
.limit-note {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.limit-fact span,
.limit-note span {
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
}

.limit-fact strong {
  font-size: 14px;
}

.limit-note strong {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-dim);
  line-height: 1.4;
}

.stage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

/* reachability */

.origin-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.origin-hero h2 {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
  margin: 2px 0 6px;
}

.origin-hero .micro {
  max-width: 560px;
}

.layer-map {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.map-layer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.map-layer-head .eyebrow {
  margin: 0;
}

.map-node-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.map-node {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 11px 13px;
  cursor: pointer;
  font-family: var(--text);
  transition: border-color 140ms ease, transform 140ms ease;
}

.map-node:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
}

.map-node strong {
  font-size: 13px;
}

/* ==========================================================================
   TRIPS
   ========================================================================== */

.trip-controls {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.trip-controls input {
  font-family: var(--mono);
  text-transform: uppercase;
  width: 110px;
}

.trip-arrow {
  color: var(--gold);
  font-size: 18px;
  padding-bottom: 9px;
}

.trip-detail {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.trip-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.trip-summary h2 {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
}

.note-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}

.trip-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.trip-card > p {
  font-size: 13px;
  color: var(--ink-dim);
}

.trip-rank-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.trip-rank-line strong {
  font-size: 15px;
}

.program-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.program-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-1);
  color: var(--ink);
  padding: 6px 11px;
  cursor: pointer;
  font: 600 12px var(--text);
  transition: border-color 140ms ease;
}

.program-chip .mono {
  font-size: 10.5px;
  color: var(--ink-faint);
  font-weight: 400;
}

.program-chip:hover {
  border-color: var(--gold);
}

.program-chip.primary {
  border-color: color-mix(in srgb, var(--gold) 55%, transparent);
  background: var(--gold-soft);
}

.program-chip.bad {
  border-color: color-mix(in srgb, var(--bad) 45%, transparent);
  opacity: 0.7;
}

/* ==========================================================================
   VERIFY
   ========================================================================== */

.verify-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.verify-controls .directory-filter {
  max-width: 280px;
  margin: 0;
}

.watch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.watch-item {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.watch-item strong {
  font-size: 13.5px;
}

.watch-item p {
  font-size: 12.5px;
  color: var(--ink-dim);
  line-height: 1.5;
}

.watch-item .link-button {
  align-self: flex-start;
}

.watch-item.tone-bad { border-left: 3px solid var(--bad); }
.watch-item.tone-warn { border-left: 3px solid var(--warn); }
.watch-item.tone-good { border-left: 3px solid var(--good); }
.watch-item.tone-info { border-left: 3px solid var(--info); }

.sources-block {
  margin-top: 34px;
}

.sources-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
}

.source-item {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--bg-1);
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.source-item strong {
  font: 600 12px var(--mono);
  color: var(--gold);
}

.source-item p {
  font-size: 12px;
  color: var(--ink-dim);
}

.source-url {
  font: 400 11px var(--mono);
  color: var(--ink-faint);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-url:hover {
  color: var(--gold);
}

/* ==========================================================================
   Drawer
   ========================================================================== */

.drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(32, 45, 39, 0.34);
  backdrop-filter: blur(2px);
  z-index: 70;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(480px, 94vw);
  z-index: 80;
  background: var(--bg-1);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  animation: drawer-in 240ms cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

@keyframes drawer-in {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.drawer-head h2 {
  font-family: var(--display);
  font-size: 21px;
  font-weight: 600;
}

.drawer-body {
  overflow-y: auto;
  padding: 18px 22px 40px;
}

.drawer-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.wallet-rate-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wallet-rate-row {
  --card-hue: var(--rose);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--card-hue);
  border-radius: var(--radius-sm);
  background: var(--surface);
  flex-wrap: wrap;
}

.wallet-rate-name {
  font-weight: 600;
  font-size: 13px;
  min-width: 54px;
}

.valuation-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
}

.terminal-item {
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
  background: var(--warn-dim);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.terminal-item strong {
  font-size: 13px;
}

.terminal-item p {
  font-size: 12.5px;
  color: var(--ink-dim);
}

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

.edge-card {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.limit-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.limit-row {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 10px;
  font-size: 11.5px;
  align-items: baseline;
}

.limit-row span {
  color: var(--ink-faint);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 10px;
}

.limit-row strong {
  font-weight: 500;
  color: var(--ink-dim);
  line-height: 1.4;
}

.limit-row.bad strong { color: var(--bad); }
.limit-row.warn strong { color: var(--warn); }
.limit-row.good strong { color: var(--good); }

.note-line {
  margin-top: 6px;
}

body.drawer-open {
  overflow: hidden;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1180px) {
  .flow-board {
    grid-template-columns: 1fr 1fr;
    gap: 22px;
  }

  .wallet-col {
    grid-column: 1;
  }

  .needs-col {
    grid-column: 2;
  }

  .flow-canvas {
    display: none;
  }

  .route-workspace {
    grid-template-columns: 1fr;
  }

  .route-list {
    max-height: 340px;
  }
}

@media (max-width: 960px) {
  .topbar {
    flex-wrap: wrap;
    gap: 12px;
  }

  .topbar-tools {
    width: 100%;
  }

  .global-search {
    flex: 1;
  }

  .global-search input {
    width: 100%;
  }

  .explore-body {
    grid-template-columns: 1fr;
  }

  .directory {
    position: static;
    max-height: 420px;
  }

  .view-head {
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
    min-height: 0;
  }

  .plan-pulse {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  #app {
    padding: 0 16px 44px;
  }

  .topbar {
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 18px;
    padding-right: 18px;
  }

  body::before {
    background-position: 58% top;
    opacity: 0.38;
  }

  .view-head {
    padding: 12px 0;
    border-radius: 0;
  }

  .view-head::before {
    right: -230px;
    bottom: -220px;
  }

  .view-head::after {
    right: 68px;
    bottom: 28px;
  }

  .view-title h1 {
    font-size: clamp(28px, 7vw, 34px);
  }

  .view-sub {
    font-size: 14px;
  }

  .flow-board {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .wallet-col,
  .needs-col {
    grid-column: 1;
  }

  .allocation-detail {
    grid-template-columns: 1fr;
  }

  .strategy-pills {
    grid-template-columns: 1fr;
  }

  .limit-strip {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .pulse-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 16px;
  }

  .plan-pulse {
    flex-wrap: wrap;
  }
}

/* ==========================================================================
   Motion + a11y
   ========================================================================== */

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

/* Card transfer rules and monthly usage */
.card-details-link { margin: 0 0 12px; font-size: 12px; }
.transfer-usage { display: grid; gap: 5px; margin: 12px 0; font-size: 11px; }
.transfer-usage input { width: 100%; min-width: 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: inherit; font: inherit; }
.transfer-usage small { font-size: 10px; line-height: 1.4; opacity: .75; }
.limit-row strong { overflow-wrap: anywhere; }

/* MilesMap planner guidance and shared application affordances. */
.brand { color: var(--ink); text-decoration: none; flex: none; }
.topbar-tools, .view-title, .explore-main, .flow-col { min-width: 0; }
.view-title h1 { text-wrap: balance; }
.eyebrow { font-size: 10.5px; letter-spacing: .12em; }
.col-head h2 { font-size: 16px; letter-spacing: -.02em; }
.global-search input { min-height: 40px; border-radius: 8px; }
.status-pill { padding: 8px 10px; font-size: 11px; border-color: transparent; background: transparent; }
.search-menu { background: var(--surface); }
.menu-option { min-height: 42px; }
.field input, .field select, .combo input, .directory-filter { min-height: 42px; background: var(--surface); }
.field input:focus-visible, .field select:focus-visible, .combo input:focus-visible,
.directory-filter:focus-visible, .need-name:focus-visible, .need-points input:focus-visible,
.card-tile .balance input:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.field > span { color: var(--ink-dim); }
.field > span small { letter-spacing: 0; }
.need-tile { border-radius: 10px; padding: 16px; }
.need-program { min-height: 40px; background: var(--surface); font-size: 13px; }
.need-top-row select { min-height: 32px; border-radius: 6px; letter-spacing: .04em; }
.need-name { width: 100%; min-width: 0; min-height: 30px; }
.need-points input { min-width: 0; max-width: 100%; }
.card-tile .balance input { min-height: 40px; }
.card-tile .issuer { font-size: 10px; letter-spacing: .1em; }
.card-tile h3 { letter-spacing: -.025em; }
.card-remove { min-height: 32px; }
.transfer-usage input { min-height: 38px; font-size: 13px; background: var(--bg-1); }
.transfer-usage small { font-size: 11px; opacity: 1; color: var(--ink-dim); }
.strategy-row { margin-top: 34px; }
.strategy-title { letter-spacing: -.025em; }
.strategy-pill { border-radius: 10px; padding: 18px; }
.strategy-pill.active { background: var(--gold-soft); border-width: 1px; }
.strategy-desc { color: var(--ink-dim); }
.strategy-sub { max-width: 68ch; line-height: 1.55; }
.need-plan { border-radius: 12px; }
.directory-item.active .dir-main, .route-item.active { background: var(--gold-soft); }
.directory { top: 96px; max-height: calc(100dvh - 116px); }
.route-list { max-height: calc(100dvh - 220px); }
.dir-info { width: 32px; font-style: normal; font-family: var(--text); }
.empty-state { border-style: dashed; padding: 22px; color: var(--ink-dim); }
.empty-state strong { color: var(--ink); font-size: 15px; }
.empty-state-action { align-self: flex-start; margin-top: 8px; }
.planner-guide { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 0 0 24px; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.guide-step { display: flex; align-items: flex-start; gap: 12px; padding: 0 22px; min-width: 0; }
.guide-step:first-child { padding-left: 0; }
.guide-step + .guide-step { border-left: 1px solid var(--line); }
.guide-step > span:first-child, .guide-number { display: grid; place-items: center; width: 26px; height: 26px; flex: none; background: var(--surface-3); color: var(--gold); border-radius: 50%; font: 600 11px var(--mono); }
.guide-step strong { display: block; font-size: 13px; font-weight: 600; color: var(--ink); }
.guide-step p, .guide-step small { display: block; margin-top: 3px; color: var(--ink-dim); font-size: 12px; line-height: 1.5; }
.planner-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: 14px; flex-wrap: wrap; }
.planner-toolbar > div { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.storage-note { display: flex; align-items: center; gap: 7px; color: var(--ink-dim); font-size: 12px; line-height: 1.5; }
.storage-note::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); flex: none; }
.trust-note { border-left: 2px solid var(--gold); padding: 10px 14px; margin: 16px 0; background: var(--gold-soft); color: var(--ink-dim); font-size: 12px; line-height: 1.6; }
.trust-note strong { color: var(--ink); }
.trust-note a { color: var(--gold); text-underline-offset: 3px; }
.goal-field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; min-width: 0; }
.goal-field > span { font-size: 10.5px; font-weight: 600; color: var(--ink-dim); }
.goal-field input, .goal-field select { width: 100%; min-width: 0; }
.goal-field .need-points { width: 100%; }
.goal-field > span small { margin-left: 5px; font-size: 10px; font-weight: 400; color: var(--ink-faint); }
.card-tile .balance, .need-points { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 8px; align-items: baseline; }
.card-tile .balance .balance-label, .need-points .goal-input-label { grid-column: 1 / -1; color: var(--ink-dim); font: 600 10.5px var(--text); }
.need-points input { width: 100%; }
.guide-step.done > span:first-child { color: var(--gold); background: var(--gold-soft); }
.plan-pulse { display: grid; grid-template-columns: 84px minmax(0, 1fr); width: min(410px, 100%); gap: 12px 18px; }
.pulse-footnote { grid-column: 1 / -1; border-top: 1px solid var(--line-soft); padding-top: 10px; font-size: 10.5px; line-height: 1.5; }
.pulse-welcome { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 4px 16px; grid-column: 1 / -1; padding: 6px 0; }
.pulse-welcome img { grid-column: 1; grid-row: 1 / 3; }
.pulse-welcome strong { align-self: end; color: var(--ink); font-size: 14px; }
.pulse-welcome p { grid-column: 2; color: var(--ink-dim); font-size: 12px; line-height: 1.5; }
.trip-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -4px 0 24px; }
.trip-presets > span { color: var(--ink-dim); font-size: 12px; margin-right: 2px; }
.trip-presets button { min-height: 32px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink-dim); background: var(--surface); font: 500 12px var(--text); cursor: pointer; }
.trip-presets button:hover { color: var(--gold); border-color: var(--gold); }
.app-footer { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 32px; padding-top: 24px; margin-top: 44px; border-top: 1px solid var(--line); color: var(--ink-dim); font-size: 12px; }
.app-footer p { max-width: 64ch; }
.app-footer a { color: var(--gold); text-underline-offset: 3px; }
.app-footer strong { font-weight: 600; color: var(--ink); }
.app-footer > div { display: flex; flex-direction: column; gap: 3px; flex: none; }
.app-footer > a { flex: none; }
.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; }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 100; padding: 12px 18px; border-radius: 8px; background: var(--gold); color: #fff; font: 600 14px var(--text); text-decoration: none; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
button:disabled { cursor: not-allowed; }
input[aria-invalid="true"] { border-color: var(--bad); }
.field-error { color: var(--bad); font-size: 12px; line-height: 1.5; }
@media (max-width: 1180px) {
  .topbar { gap: 16px; }
  .primary-nav button { padding-inline: 12px; }
  .status-pill { display: none; }
  .strategy-pills { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .topbar { position: static; }
  .topbar-tools { width: auto; flex: 1; }
  .global-search { width: 100%; }
  .global-search input { width: 100%; }
  .view-head { min-height: 0; padding: 12px 0; gap: 20px; }
  .plan-pulse { align-self: flex-start; }
  .directory { position: static; max-height: 420px; }
  .planner-guide { gap: 16px; }
  .guide-step { padding-inline: 12px; gap: 8px; }
}
@media (max-width: 720px) {
  .topbar { display: grid; grid-template-columns: 1fr; gap: 12px; padding: 16px; margin-bottom: 24px; }
  .brand { gap: 9px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-copy strong { font-size: 19px; }
  .primary-nav { grid-row: 3; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; }
  .primary-nav button { min-height: 42px; padding: 8px 4px; font-size: 12px; white-space: nowrap; }
  .topbar-tools { grid-row: 2; width: 100%; }
  .view-head { margin-top: 0; margin-bottom: 20px; }
  .view-sub { line-height: 1.6; }
  .planner-guide { grid-template-columns: 1fr; gap: 14px; margin-bottom: 20px; }
  .guide-step, .guide-step:first-child { padding: 0; }
  .guide-step + .guide-step { border-left: 0; }
  .guide-step p, .guide-step small { margin-top: 1px; }
  .planner-toolbar { align-items: flex-start; gap: 12px; }
  .planner-toolbar > div { width: 100%; }
  .planner-toolbar .ghost-button { flex: 1; }
  .plan-pulse { width: 100%; padding: 14px; gap: 12px 18px; grid-template-columns: 72px minmax(0, 1fr); }
  .pulse-dial { width: 72px; height: 72px; }
  .pulse-stats { flex: 1; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
  .pulse-stats dt { font-size: 9px; letter-spacing: .04em; }
  .pulse-stats dd { font-size: 12px; overflow-wrap: anywhere; }
  .flow-board { border-radius: 12px; padding: 14px; gap: 28px; }
  .col-head { align-items: center; gap: 8px; }
  .wallet-head-actions { gap: 6px; }
  .col-head h2 { font-size: 15px; }
  .wallet-head-actions .pill { display: none; }
  .card-tile { padding: 14px; }
  .need-tile { padding: 12px; gap: 10px; }
  .need-ring { width: 48px; height: 48px; }
  .ring-label { font-size: 11px; }
  .need-fields { gap: 10px; }
  .need-program { width: 100%; }
  .need-top-row select { min-height: 40px; font-size: 10px; }
  .need-points { flex-wrap: wrap; gap: 4px 8px; }
  .need-points input { width: 100%; }
  .strategy-pills { grid-template-columns: 1fr; }
  .strategy-title { font-size: 20px; }
  .strategy-intro { gap: 16px; }
  .trip-grid, .watch-grid, .sources-list, .map-node-list, .stage-grid { grid-template-columns: minmax(0, 1fr); }
  .route-workspace { grid-template-columns: minmax(0, 1fr); }
  .explore-controls { padding: 16px; gap: 14px; }
  .combo-field { flex-basis: 100%; min-width: 0; }
  .small-field { min-width: 0; width: auto; }
  .trip-controls { gap: 10px; }
  .trip-controls .small-field { flex: 1; }
  .trip-controls input { width: 100%; }
  .trip-controls .action-button { flex-basis: 100%; }
  .trip-controls .trip-arrow { padding-bottom: 12px; }
  .trip-summary, .stage-head { align-items: flex-start; flex-wrap: wrap; }
  .trip-summary h2 { font-size: 19px; }
  .trip-presets { gap: 6px; }
  .trip-presets > span { width: 100%; }
  .app-footer { flex-direction: column; margin-top: 32px; }
  .drawer { width: 100%; }
  .drawer-head { padding: 18px 16px; }
  .drawer-body { padding: 18px 16px 32px; }
  .drawer-head h2 { font-size: 20px; }
  .loading-grid { grid-template-columns: 1fr; }
  .loading-grid div { height: 180px; }
  .action-button, .ghost-button, .icon-button, .dir-info, .combo-clear, .card-remove,
  .trip-presets button { min-height: 44px; }
  .icon-button, .dir-info { min-width: 36px; }
  .combo-clear { width: 36px; border-radius: 6px; }
  .field input, .field select, .combo input, .directory-filter, .need-program,
  .need-name, .card-tile .balance input, .transfer-usage input { min-height: 44px; font-size: 16px; }
  .card-tile .balance input { font-size: 21px; }
  .global-search input { font-size: 16px; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .view.active, .drawer { animation: none; }
  .loading-grid div { animation: none; background: var(--surface-2); }
}
.menu-option.keyboard-active { background: var(--gold-soft); color: var(--gold); outline: 1px solid var(--gold); outline-offset: -1px; }
.balance .field-error, .need-points .field-error { grid-column: 1 / -1; font: 400 12px var(--text); }
.app-footer > div { display: grid; gap: 4px; min-width: 155px; }
#tripHelp { margin: 8px 0 18px; }
#walletPickerDone { width: 100%; margin-top: 10px; }
#storageNote { max-width: 70ch; }
.planner-start { margin-top: 20px; min-width: 160px; }
.strategy-row { scroll-margin-top: 100px; }
@media (max-width: 720px) { .planner-start { margin-top: 16px; } .strategy-row { scroll-margin-top: 20px; } }
