:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #294149;
  background: #f5faf9;
  font-synthesis: none;
  color-scheme: light;
  --surface: #ffffff;
  --surface-soft: #f2f8f7;
  --ink: #294149;
  --muted: #6a7d82;
  --line: #dceae7;
  --line-strong: #bfd5d1;
  --primary: #3f8f88;
  --primary-hover: #347871;
  --primary-soft: #e5f4f1;
  --start: #3b9765;
  --via: #6383a3;
  --end: #cf675b;
  --focus: rgba(63, 143, 136, 0.22);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { min-height: 100vh; min-height: 100dvh; font-size: 15px; line-height: 1.45; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex="0"]:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px var(--focus);
}

.app-shell {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(350px, 400px) 1fr;
  overflow: hidden;
}

.sidebar {
  position: relative;
  z-index: 2;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 18px 20px;
  background:
    radial-gradient(circle at 100% 5%, rgba(126, 206, 193, 0.16) 0, rgba(126, 206, 193, 0.05) 125px, transparent 220px),
    linear-gradient(155deg, #ffffff 0%, #fbfefd 52%, #f2faf8 100%);
  border-right: 1px solid var(--line);
  box-shadow: 3px 0 22px rgba(42, 88, 82, 0.055);
}

.sidebar::before,
.sidebar::after {
  content: "";
  position: absolute;
  z-index: -1;
  border: 1px solid rgba(84, 162, 149, 0.12);
  border-radius: 50%;
  pointer-events: none;
}
.sidebar::before {
  top: -78px;
  right: -68px;
  width: 190px;
  height: 190px;
}
.sidebar::after {
  top: -38px;
  right: -28px;
  width: 108px;
  height: 108px;
}

.brand-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex: 0 0 auto;
  margin-bottom: 13px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 3px;
}
.plan-file-menu-wrap { position: relative; }
.plan-file-menu {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 2100;
  width: 166px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(16, 24, 40, 0.16);
}
.plan-file-menu[hidden] { display: none; }
.plan-file-menu-item {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #344054;
  font-size: 12.5px;
  font-weight: 700;
  text-align: left;
}
.plan-file-menu-item:hover,
.plan-file-menu-item:focus-visible { background: var(--surface-soft); color: var(--ink); }
.plan-file-menu-item .ui-icon { width: 15px; height: 15px; }

.brand-lockup { display: flex; align-items: center; gap: 8px; }
.brand-logo {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #e3f3f0;
  color: #34766f;
}
.brand-logo svg { width: 23px; height: 23px; overflow: visible; }
.brand-logo svg path:first-child { fill: currentColor; }
.brand-logo svg path:last-child {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.brand { color: #34766f; font-size: 29px; font-weight: 780; line-height: 1; letter-spacing: -0.045em; }
.tagline { margin-top: 2px; color: var(--muted); font-size: 13.5px; }
.tagline-row { display: flex; align-items: center; gap: 6px; }
.about-help-btn {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #b8cbc8;
  border-radius: 50%;
  background: #f5faf9;
  color: #4e7f79;
  font-size: 11px;
  font-weight: 750;
  line-height: 1;
}
.about-help-btn:hover,
.about-help-btn:focus-visible { border-color: #69afa5; background: #e7f5f2; color: #34766f; }
.about-usage {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.about-usage h3 {
  margin: 0 0 9px;
  color: var(--ink);
  font-size: 14px;
}
.about-usage ol {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.about-usage li + li { margin-top: 7px; }
.about-usage strong { color: var(--ink); }

.header-icon-btn,
.icon-btn,
.remove-btn {
  display: grid;
  place-items: center;
  border: 0;
}

.header-icon-btn {
  width: 36px;
  height: 36px;
  padding: 8px;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
}

.header-icon-btn:hover { background: rgba(227, 244, 240, 0.9); color: #34766f; }
.cost-symbol { font-size: 18px; font-weight: 650; line-height: 1; }

.view-tabs {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid rgba(207, 229, 224, 0.82);
  background: rgba(232, 244, 241, 0.82);
}
.view-tab {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #667085;
  font-size: 13px;
  font-weight: 700;
  transition: color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}
.view-tab:hover:not(:disabled) { color: var(--ink); }
.view-tab.active {
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 4px rgba(39, 89, 82, 0.1);
  color: #34766f;
}
.view-tab:disabled { cursor: not-allowed; opacity: 0.46; }
.route-ready-dot {
  width: 7px;
  height: 7px;
  display: none;
  border-radius: 50%;
  background: var(--start);
}
.view-tab.ready .route-ready-dot { display: block; }

.credit-meter {
  flex: 0 0 auto;
  grid-column: 1 / -1;
  margin: 0 2px 2px;
}
.credit-meter-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 11.5px;
}
.credit-meter-copy strong {
  color: #34766f;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.credit-meter-track {
  height: 4px;
  overflow: hidden;
  margin-top: 5px;
  border-radius: 999px;
  background: #e4efed;
}
.credit-meter-track span {
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: #69afa5;
  transition: width 180ms ease, background 180ms ease;
}
.credit-meter.low .credit-meter-copy strong { color: #a45b28; }
.credit-meter.low .credit-meter-track span { background: #dfa35f; }

.tab-panel { min-height: 0; }
.tab-panel[hidden] { display: none; }
.tab-panel.active { display: flex; }
.plan-panel {
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
}
.planner-scroll {
  width: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-right: 3px;
}

.entry-panel { width: 100%; min-width: 0; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.entry-panel > .field-label:first-child { margin-top: 0; }
.section-heading { margin: 16px 0 15px; }
.section-heading h1 {
  margin: 0;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: -0.025em;
}
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.address-entry-heading {
  margin: 17px 0 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.field-label {
  display: block;
  margin: 13px 0 7px;
  color: #475467;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.search-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
  margin: 9px 0 20px;
}
.search-row { display: grid; grid-template-columns: minmax(0, 1fr) 46px; gap: 9px; }
input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: 0;
  background: var(--surface);
  color: var(--ink);
  font-size: 14.5px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
input::placeholder { color: #98a2b3; }
input:focus { border-color: #7e8997; }

#addressInput {
  height: 46px;
  padding: 0 16px;
  border-color: #b9d8d3;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 3px 12px rgba(52, 118, 111, 0.08);
  font-size: 15px;
}
#addressInput::placeholder { color: #7b8f8c; }
#addressInput:hover { border-color: #8fc1ba; }
#addressInput:focus {
  border-color: #5eaaa0;
  box-shadow: 0 0 0 3px rgba(105, 175, 165, 0.16), 0 4px 14px rgba(52, 118, 111, 0.1);
}

.icon-btn {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  transition: background 140ms ease, transform 140ms ease;
}
.icon-btn:hover { background: var(--primary-hover); }
.icon-btn:active { transform: translateY(1px); }

.role-selector,
.mode-selector { display: grid; min-width: 0; gap: 5px; }
.role-selector { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mode-selector { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.role-selector-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.planning-options {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.planning-option-line {
  min-width: 0;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}
.option-label { margin: 0; color: #687d80; font-size: 11.5px; font-weight: 700; }
.planning-option-line .mode-selector,
.route-type-selector {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.role-btn,
.mode-btn {
  min-height: 34px;
  display: flex;
  gap: 5px;
  place-items: center;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}
.role-btn:hover,
.mode-btn:hover { border-color: var(--line-strong); background: var(--surface-soft); color: var(--ink); }
.role-btn.active,
.mode-btn.active {
  border-color: #9fd3ca;
  background: var(--primary-soft);
  box-shadow: 0 1px 3px rgba(45, 108, 99, 0.08);
  color: #286b65;
}
.role-btn:disabled { cursor: not-allowed; opacity: 0.38; }
.planning-option-line .mode-btn,
.route-type-btn {
  min-width: 0;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
}
.planning-option-line .mode-btn:hover,
.route-type-btn:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
  color: var(--ink);
}
.planning-option-line .mode-btn[aria-pressed="true"],
.route-type-btn[aria-pressed="true"] {
  border-color: #a7d5e6;
  background: #e9f6fb;
  box-shadow: 0 1px 3px rgba(46, 116, 143, 0.08);
  color: #296b84;
}
.planning-option-line .mode-btn[aria-pressed="true"]:hover,
.route-type-btn[aria-pressed="true"]:hover {
  border-color: #8cc8de;
  background: #def1f8;
  color: #225a6f;
}
.route-type-btn[aria-pressed="true"] {
  border-color: #ead39a;
  background: #fff7df;
  box-shadow: 0 1px 3px rgba(138, 103, 31, 0.07);
  color: #77591d;
}
.route-type-btn[aria-pressed="true"]:hover {
  border-color: #dfc276;
  background: #fff2cc;
  color: #654913;
}
.role-selector .start-role.active {
  border-color: #a9ddbd;
  background: #eaf8ef;
  color: #277248;
}
.role-selector .waypoint-role.active {
  border-color: #bfd3e6;
  background: #edf4fb;
  color: #496d91;
}
.role-selector .end-role.active {
  border-color: #efbeb7;
  background: #fff0ed;
  color: #a64d43;
}
.start-role:not(.active) .ui-icon { color: var(--start); }
.waypoint-role:not(.active) .ui-icon { color: var(--via); }
.end-role:not(.active) .ui-icon { color: var(--end); }

.plan-panel .icon-btn .ui-icon,
.plan-panel .role-btn .ui-icon,
.plan-panel .mode-btn .ui-icon { width: 15px; height: 15px; }
.plan-panel .primary-btn .ui-icon { width: 16px; height: 16px; }
.plan-panel .remove-btn .ui-icon,
.plan-panel .suggestion-pin .ui-icon { width: 15px; height: 15px; }

.stops-panel { width: 100%; min-width: 0; padding: 10px 0; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.point-list { width: 100%; min-width: 0; display: grid; gap: 6px; overflow-x: hidden; }
.empty-plan {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #8a94a3;
  font-size: 12.5px;
}
.empty-plan .ui-icon { width: 15px; height: 15px; }
.point-card {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) minmax(68px, auto) 30px;
  gap: 7px;
  align-items: center;
  min-height: 46px;
  padding: 6px 4px 6px 7px;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  transition: background 130ms ease, border-color 130ms ease;
}
.point-card:hover { border-color: var(--line-strong); background: var(--surface-soft); }
.point-dot { width: 10px; height: 10px; border-radius: 50%; }
.point-dot.start { background: var(--start); }
.point-dot.waypoint { background: var(--via); }
.point-dot.end { background: var(--end); }
.point-main { min-width: 0; }
.point-address {
  overflow: hidden;
  color: #344054;
  font-size: 13.5px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.point-role-select {
  width: auto;
  min-width: 68px;
  max-width: 76px;
  height: 34px;
  padding: 0 26px 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: var(--surface);
  color: #475467;
  font-size: 12.5px;
}
.remove-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: transparent;
  color: #98a2b3;
}
.remove-btn:hover { background: #fceeee; color: var(--end); }
.remove-btn .ui-icon { width: 15px; height: 15px; }

.planner-action {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 47px;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  background: rgba(248, 251, 252, 0.96);
}
.clear-route-btn {
  width: 47px;
  min-height: 47px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface);
  color: var(--muted);
}
.clear-route-btn:hover { border-color: #d9a5a5; background: #fceeee; color: var(--end); }
.clear-route-btn .ui-icon { width: 17px; height: 17px; }
.summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-bottom: 17px; }
.summary-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 4px 8px;
  min-height: 64px;
  padding: 13px 14px;
  border: 1px solid #edf0f3;
  border-radius: 11px;
  background: var(--surface-soft);
}
.summary-card[hidden] { display: none; }
.summary-label {
  grid-column: 1;
  grid-row: 1;
  color: #667085;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.summary strong {
  grid-column: 1;
  grid-row: 2;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.metric-icon {
  grid-column: 2;
  grid-row: 1 / span 2;
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #627084;
}
.metric-icon .ui-icon { width: 19px; height: 19px; }

.primary-btn {
  width: 100%;
  min-height: 47px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 16px;
  border: 0;
  border-radius: 11px;
  background: var(--primary);
  color: #fff;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.005em;
  transition: background 140ms ease, transform 140ms ease, opacity 140ms ease;
}
.primary-btn:hover:not(:disabled) { background: var(--primary-hover); }
.primary-btn:active:not(:disabled) { transform: translateY(1px); }
.primary-btn:disabled { cursor: not-allowed; opacity: 0.42; }
.primary-btn .ui-icon { width: 18px; height: 18px; }

.status { flex: 0 0 auto; margin: 6px 2px; color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.status:empty { display: none; }
.status.error { color: #b42318; }
.route-panel {
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
  padding-top: 5px;
}
.route-heading { flex: 0 0 auto; margin-bottom: 16px; }
.route-eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--start);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}
.route-heading h1 {
  margin: 0;
  color: var(--ink);
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: -0.025em;
}
.route-heading p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.route-heading .route-explanation {
  margin-top: 10px;
  padding: 9px 10px;
  border-left: 3px solid var(--start);
  border-radius: 0 8px 8px 0;
  background: rgba(235, 244, 239, 0.72);
  color: #475467;
  font-size: 12px;
  line-height: 1.45;
}
.itinerary-heading {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
  color: #344054;
  font-size: 13px;
}
.itinerary-heading span { color: var(--muted); font-size: 12px; }
.result-list {
  min-height: 0;
  flex: 1 1 auto;
  display: grid;
  align-content: start;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 9px -4px 0 0;
  padding: 2px 8px 8px 0;
  scrollbar-gutter: stable;
}
.result-node { display: grid; grid-template-columns: 27px 1fr; gap: 9px; align-items: start; color: #344054; font-size: 13.5px; }
.result-seq {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: #475467;
  font-size: 11.5px;
  font-weight: 700;
}
.result-node-copy { min-width: 0; }
.result-node-role {
  display: block;
  margin: -1px 0 1px;
  color: var(--via);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}
.result-node-role.start { color: var(--start); }
.result-node-role.end { color: var(--end); }
.result-address { line-height: 1.4; overflow-wrap: anywhere; }
.result-leg {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 4px 0 9px 12px;
  padding: 5px 0 5px 23px;
  border-left: 1px solid #d6dce3;
  color: #788597;
  font-size: 12.5px;
}
.result-leg .ui-icon { width: 14px; height: 14px; }
.result-leg-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.result-leg-costs {
  color: #5f6f83;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.secondary-btn {
  flex: 0 0 auto;
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface);
  color: #344054;
  font-size: 13.5px;
  font-weight: 700;
}
.secondary-btn:hover { border-color: #9ca6b2; background: var(--surface-soft); }
.route-actions {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.route-actions .secondary-btn { display: flex; align-items: center; justify-content: center; gap: 6px; }
.route-actions .ui-icon { width: 15px; height: 15px; }

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 20px;
}
.settings-modal[hidden] { display: none; }
.settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
}
.settings-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 430px);
  padding: 18px;
  border: 1px solid rgba(227, 231, 236, 0.9);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 28px 60px rgba(15, 23, 42, 0.24);
}
.settings-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.settings-eyebrow {
  color: var(--start);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.settings-header h2 {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.03em;
}
.settings-close-btn {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  color: var(--muted);
}
.settings-copy {
  margin: 12px 0 16px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.settings-field {
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}
.settings-field input,
.settings-field select {
  width: 100%;
  height: 44px;
}
.settings-field select {
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  outline: 0;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
}
.settings-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}
.settings-actions .secondary-btn {
  width: auto;
  min-width: 140px;
}
.contact-dialog { width: min(100%, 390px); }
.contact-copy { margin-bottom: 18px; }
.contact-email {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 14px;
  border: 1px solid #a9d8d0;
  border-radius: 11px;
  background: var(--primary-soft);
  color: #286b65;
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
  transition: border-color 140ms ease, background 140ms ease;
}
.contact-email:hover { border-color: #83c5ba; background: #d9efeb; }
.contact-email .ui-icon { width: 17px; height: 17px; }

.address-suggestions {
  position: absolute;
  top: calc(100% + 7px);
  right: 55px;
  left: 0;
  z-index: 1200;
  max-height: 290px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 14px 34px rgba(16, 24, 40, 0.14);
}
.address-suggestions[hidden] { display: none; }
.suggestion-item {
  width: 100%;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 12px 13px;
  border: 0;
  border-bottom: 1px solid #eff1f4;
  background: var(--surface);
  color: #344054;
  text-align: left;
  font-size: 13.5px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.suggestion-item:last-child { border-bottom: 0; }
.suggestion-item:hover,
.suggestion-item.active { background: var(--surface-soft); }
.suggestion-pin { padding-top: 1px; color: #7b8794; }
.suggestion-pin .ui-icon { width: 17px; height: 17px; }
.suggestion-empty { padding: 13px; color: var(--muted); font-size: 13.5px; }

.map-wrap { position: relative; min-width: 0; min-height: 0; height: 100%; }
#map { position: absolute; inset: 0; }
.map-hint {
  position: absolute;
  top: 18px;
  left: 50%;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 32px);
  padding: 9px 13px;
  transform: translateX(-50%);
  border: 1px solid rgba(213, 219, 226, 0.92);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 5px 18px rgba(16, 24, 40, 0.1);
  color: #475467;
  font-size: 12.5px;
  line-height: 1.2;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}
.map-hint:hover:not(:disabled) {
  border-color: rgba(124, 135, 149, 0.7);
  color: var(--ink);
}
.map-hint:disabled {
  cursor: wait;
  opacity: 0.68;
}
.map-hint .ui-icon { width: 16px; height: 16px; flex: 0 0 auto; }

.leaflet-div-icon { border: 0; background: transparent; }
.custom-marker {
  width: 22px;
  height: 22px;
  transform: rotate(-45deg);
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  box-shadow: 0 2px 7px rgba(16, 24, 40, 0.28);
}
.custom-marker.start { background: var(--start); }
.custom-marker.roundtrip {
  background: linear-gradient(135deg, var(--start) 0 50%, var(--end) 50% 100%);
}
.custom-marker.waypoint { background: var(--via); }
.custom-marker.end { background: var(--end); }
.custom-marker.numbered {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
}
.marker-number {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  transform: rotate(45deg);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.user-location-marker {
  width: 24px;
  height: 24px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #2563eb;
  box-shadow: 0 0 0 7px rgba(37, 99, 235, 0.18), 0 3px 12px rgba(16, 24, 40, 0.28);
}

.ui-icon,
.feather.ui-icon {
  width: 22px;
  height: 22px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.has-tooltip { position: relative; }
.has-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 2000;
  padding: 6px 8px;
  transform: translate(-50%, 4px);
  border-radius: 6px;
  background: #40576b;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease;
}
.has-tooltip:hover::after,
.has-tooltip:focus-visible::after {
  transform: translate(-50%, 0);
  opacity: 1;
  visibility: visible;
}

.remove-btn.has-tooltip::after {
  top: 50%;
  right: calc(100% + 8px);
  bottom: auto;
  left: auto;
  transform: translate(4px, -50%);
}

.remove-btn.has-tooltip:hover::after,
.remove-btn.has-tooltip:focus-visible::after {
  transform: translate(0, -50%);
}

#clearBtn.has-tooltip::after {
  right: 0;
  left: auto;
  transform: translate(0, 4px);
}

#clearBtn.has-tooltip:hover::after,
#clearBtn.has-tooltip:focus-visible::after {
  transform: translate(0, 0);
}

#planFileMenuBtn.has-tooltip::after,
#contactBtn.has-tooltip::after,
#settingsBtn.has-tooltip::after,
#addAddressBtn.has-tooltip::after {
  top: calc(100% + 8px);
  bottom: auto;
  left: auto;
  right: 0;
  transform: translate(0, 4px);
}

#planFileMenuBtn.has-tooltip:hover::after,
#planFileMenuBtn.has-tooltip:focus-visible::after,
#contactBtn.has-tooltip:hover::after,
#contactBtn.has-tooltip:focus-visible::after,
#settingsBtn.has-tooltip:hover::after,
#settingsBtn.has-tooltip:focus-visible::after,
#addAddressBtn.has-tooltip:hover::after,
#addAddressBtn.has-tooltip:focus-visible::after {
  transform: translate(0, 0);
}

@media (max-width: 780px) {
  .app-shell { grid-template-columns: 1fr; grid-template-rows: 54% 46%; }
  .sidebar { padding: 14px 16px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand-row { margin-bottom: 10px; }
  .brand { font-size: 20px; }
  .tagline { font-size: 12.5px; }
  .header-icon-btn { width: 36px; height: 36px; }
  .view-tab { min-height: 34px; padding: 6px 10px; }
  .status { min-height: 16px; margin: 5px 2px; font-size: 12px; }
  .entry-panel { padding-bottom: 12px; }
  .field-label { margin-top: 12px; }
  .stops-panel { padding: 9px 0; }
  .planner-action { padding-top: 8px; }
  .primary-btn { min-height: 42px; }
  .route-heading { margin-bottom: 10px; }
  .route-heading h1 { font-size: 18px; }
  .route-heading .route-subtitle { display: none; }
  .summary { margin-bottom: 10px; }
  .summary-card { min-height: 52px; padding: 10px 12px; }
  .summary strong { font-size: 17px; }
  .summary-label { font-size: 10px; }
  .secondary-btn { min-height: 40px; margin-top: 7px; }
  .map-wrap { height: 100%; }
  .map-hint { top: 12px; font-size: 12px; white-space: normal; }
  .settings-dialog { padding: 16px; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-actions .secondary-btn { width: 100%; }
}

@media (max-height: 650px) and (min-width: 781px) {
  .sidebar { padding-top: 14px; padding-bottom: 14px; }
  .brand-row { margin-bottom: 10px; }
  .tagline { display: none; }
  .status { margin-top: 4px; margin-bottom: 4px; }
  .field-label { margin-top: 11px; }
  .entry-panel { padding-bottom: 12px; }
  .role-btn,
  .mode-btn,
  input,
  .icon-btn { min-height: 40px; height: 40px; }
}
