:root {
  color-scheme: light;
  --primary: #e42026;
  --primary-strong: #bf171d;
  --ink: #202124;
  --muted: #5f6368;
  --line: #dadce0;
  --surface: #ffffff;
  --surface-soft: #f8fafd;
  --green: #188038;
  --blue: #1967d2;
  --amber: #f29900;
  --shadow: 0 1px 2px rgba(60, 64, 67, 0.16), 0 8px 24px rgba(60, 64, 67, 0.16);
  --shadow-soft: 0 1px 2px rgba(60, 64, 67, 0.14), 0 3px 10px rgba(60, 64, 67, 0.1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  font-family: "Be Vietnam Pro", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#map,
.compare-map {
  height: 100%;
}

body {
  min-width: 320px;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background: #eef2f6;
}

button,
input,
select {
  font: inherit;
}

button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

:focus-visible {
  outline: 3px solid rgba(228, 32, 38, 0.2);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

[hidden] {
  display: none !important;
}

#map,
.compare-map {
  position: fixed;
  inset: 0;
}

.compare-map {
  left: 50%;
  z-index: 1;
  border-left: 3px solid rgba(32, 33, 36, 0.22);
}

.map-app {
  position: relative;
  z-index: 2;
  min-height: 100%;
  pointer-events: none;
}

.app-panel,
.panel-collapse-toggle,
.right-controls,
.quick-dock,
.status-toast {
  pointer-events: auto;
}

/* ─── Panel: height fits content, not full viewport ─── */
.app-panel {
  position: fixed;
  top: calc(16px + var(--safe-top));
  left: calc(16px + var(--safe-left));
  z-index: 10;
  width: 392px;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, auto);
  /* no bottom anchor — height is content-driven */
  border: 1px solid rgba(218, 220, 224, 0.92);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
  transition: transform 180ms ease;
  max-height: calc(100vh - 32px - var(--safe-top) - var(--safe-bottom));
  overflow: hidden;
}

.panel-scroll {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 0;
  overflow-y: auto;
  padding: 0 14px 14px;
  overscroll-behavior: contain;
}

/* ─── Collapse toggle ─── */
.panel-collapse-toggle {
  position: fixed;
  top: calc(92px + var(--safe-top));
  left: calc(408px + var(--safe-left));
  z-index: 11;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 58px;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 14px 14px 0;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-soft);
  transition: left 180ms ease, border-radius 180ms ease, transform 180ms ease;
}

.panel-collapse-toggle svg {
  transition: transform 180ms ease;
}

body.is-panel-collapsed .app-panel {
  transform: translateX(calc(-100% - 18px));
}

body.is-panel-collapsed .panel-collapse-toggle {
  left: calc(10px + var(--safe-left));
  border-left: 1px solid var(--line);
  border-radius: 999px;
}

/* Rotate chevron when collapsed so it points right */
body.is-panel-collapsed .panel-collapse-toggle svg {
  transform: rotate(180deg);
}

body.is-panel-collapsed .quick-dock {
  left: calc(18px + var(--safe-left));
}

body.is-panel-collapsed .status-toast {
  width: min(360px, calc(100vw - 54px));
}

/* ─── Sheet handle (mobile) ─── */
.sheet-handle {
  display: none;
}

/* ─── App header ─── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 12px 14px 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
  color: var(--ink);
  font-weight: 600;
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.brand span {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.brand small {
  max-width: 260px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-actions {
  display: inline-flex;
  gap: 6px;
}

.mobile-only {
  display: none;
}

/* ─── Icon actions & map controls ─── */
.icon-action,
.map-control {
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.icon-action {
  width: 32px;
  height: 32px;
  border-radius: 999px;
}

.icon-action:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

/* ─── Search bar ─── */
.search-box {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  margin: 0 14px 10px;
  padding: 0 6px 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.12), 0 4px 16px rgba(60, 64, 67, 0.1);
}

.search-box:focus-within {
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.14), 0 6px 20px rgba(60, 64, 67, 0.14);
  border-color: rgba(228, 32, 38, 0.35);
}

.search-icon {
  color: var(--muted);
  flex-shrink: 0;
}

.search-box input {
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  background: transparent;
}

.search-box input::placeholder {
  color: #9aa0a6;
  font-weight: 400;
}

/* Compact icon-only submit button (red circle + arrow) */
.search-submit-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  color: #fff;
  background: var(--primary);
  flex-shrink: 0;
  transition: background 140ms ease;
}

.search-submit-btn:hover {
  background: var(--primary-strong);
}

/* ─── Tabs ─── */
.panel-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 44px;
  padding: 0 14px 8px;
}

.panel-tab {
  flex: 1 1 0;
  height: 34px;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.panel-tab:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.panel-tab.is-active {
  border-color: rgba(228, 32, 38, 0.18);
  color: var(--primary);
  background: rgba(228, 32, 38, 0.06);
  font-weight: 600;
}

/* ─── Panel sections ─── */
.panel-section {
  display: none;
}

.panel-section.is-active {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  justify-content: flex-start;
  gap: 10px;
}

/* ─── Section title — compact functional style ─── */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.section-title--compact {
  padding-top: 2px;
}

.section-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}

/* Legacy h1 in section-title — reduce to app-like size just in case */
.section-title h1 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
}

/* Hide the marketing eyebrow */
.eyebrow {
  display: none;
}

/* ─── Pills ─── */
.source-pill,
.demo-pill {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.source-pill {
  color: var(--blue);
  background: #e8f0fe;
}

.demo-pill {
  color: #b06000;
  background: #fff4e5;
}

/* ─── Cards ─── */
.state-card,
.layer-card,
.style-runtime,
.suggestion,
.trip-card,
.style-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.state-card {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.state-card strong,
.suggestion strong,
.trip-card strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.state-card p,
.suggestion span,
.trip-card p,
.style-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.suggestions,
.trip-list,
.style-cards {
  display: grid;
  gap: 6px;
}

.suggestion {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 54px;
  padding: 9px 11px;
  text-align: left;
  transition: background 100ms ease;
}

.suggestion:hover {
  background: rgba(228, 32, 38, 0.04);
}

/* ─── Route panel ─── */

/* Fields + swap button laid out side by side */
.route-fields-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.route-fields {
  position: relative;
  display: grid;
  gap: 7px;
}

/* Vertical connector line */
.route-fields::before {
  position: absolute;
  top: 26px;
  bottom: 26px;
  left: 11px;
  width: 2px;
  background: #e8eaed;
  content: "";
  border-radius: 1px;
}

.route-field {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

/* Phosphor icon markers — đi: map-pin (đỏ); đến: flag (đậm) */
.route-dot {
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.route-dot svg {
  width: 20px;
  height: 20px;
}

.route-dot--pickup {
  color: var(--primary);
}

.route-dot--dropoff {
  color: var(--ink);
}

.route-field input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 11px;
  color: var(--ink);
  background: var(--surface-soft);
  outline: 0;
  font-size: 13px;
  font-weight: 500;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.route-field input:focus {
  border-color: rgba(228, 32, 38, 0.4);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(228, 32, 38, 0.08);
}

.route-field input::placeholder {
  color: #9aa0a6;
  font-weight: 400;
}

/* Swap button — icon-only, compact */
.swap-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  box-shadow: var(--shadow-soft);
  flex-shrink: 0;
  transition: background 120ms ease, color 120ms ease;
}

.swap-btn:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

/* ─── Button rows ─── */
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.mode-button,
.ghost-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 13px;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.mode-button:hover,
.ghost-button:hover {
  background: var(--surface-soft);
}

.mode-button.is-active {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(228, 32, 38, 0.06);
  font-weight: 600;
}

.primary-button {
  flex: 1 1 auto;
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  padding: 0 16px;
  color: #fff;
  background: var(--primary);
  font-size: 14px;
  font-weight: 600;
  transition: background 140ms ease;
}

.primary-button:hover:not(:disabled) {
  background: var(--primary-strong);
}

/* ─── Route summary — Google-style ─── */
.route-summary {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.route-summary__main {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.route-summary__duration {
  color: var(--green);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.route-summary__distance {
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

.route-summary__provider {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

/* Legacy metric-grid (ops panel) */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.metric {
  display: grid;
  gap: 3px;
  min-height: 64px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.metric b {
  color: var(--ink);
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
}

.metric span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

/* ─── Layer card ─── */
.layer-card {
  display: grid;
  gap: 9px;
  padding: 11px;
}

.layer-card h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

/* ─── Trip card ─── */
.trip-card {
  display: grid;
  gap: 6px;
  padding: 10px 11px;
}

.trip-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.status-badge {
  display: inline-flex;
  min-height: 20px;
  align-items: center;
  border-radius: 999px;
  padding: 0 8px;
  color: #c2410c;
  background: #fff7ed;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

/* ─── Select field (style tab) ─── */
.select-field {
  display: grid;
  gap: 5px;
}

.select-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.select-field select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 11px;
  color: var(--ink);
  background: var(--surface-soft);
  outline: 0;
  font-size: 13px;
  font-weight: 500;
}

/* ─── Style runtime ─── */
.style-runtime {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.runtime-chip {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.runtime-chip b {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-chip span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ─── Style card ─── */
.style-card {
  display: grid;
  gap: 7px;
  padding: 10px 11px;
}

.style-card--loading {
  overflow: hidden;
}

.style-card header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.style-card strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.style-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.style-meta span {
  display: inline-flex;
  min-height: 20px;
  align-items: center;
  border-radius: 999px;
  padding: 0 7px;
  color: #344054;
  background: var(--surface-soft);
  font-size: 10px;
  font-weight: 500;
}

/* ─── Skeleton ─── */
.skeleton-line {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #edf0f3 0%, #f8fafd 45%, #edf0f3 100%);
  background-size: 220% 100%;
  animation: skeletonSweep 1.2s ease-in-out infinite;
}

.skeleton-line--short {
  width: 64%;
}

@keyframes skeletonSweep {
  0% {
    background-position: 100% 0;
  }

  100% {
    background-position: -100% 0;
  }
}

/* ─── Map controls (right side) ─── */
.right-controls {
  position: fixed;
  top: calc(18px + var(--safe-top));
  right: calc(18px + var(--safe-right));
  z-index: 9;
  display: grid;
  gap: 6px;
}

.map-control {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 18px;
  transition: background 120ms ease, color 120ms ease;
}

.map-control:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

#locateButton.map-control {
  color: #0066ff;
  border-color: rgba(0, 102, 255, 0.3);
}

#locateButton.map-control:hover,
#locateButton.map-control:focus-visible {
  background: rgba(0, 102, 255, 0.07);
}

/* ─── Quick dock ─── */
.quick-dock {
  position: fixed;
  right: calc(18px + var(--safe-right));
  bottom: calc(20px + var(--safe-bottom));
  left: calc(424px + var(--safe-left));
  z-index: 8;
  display: flex;
  justify-content: center;
  gap: 6px;
  overflow-x: auto;
  padding: 8px;
  pointer-events: auto;
}

.dock-chip {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-soft);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.dock-chip:hover {
  background: #fff;
  border-color: rgba(228, 32, 38, 0.3);
  color: var(--primary);
}

.dock-chip.is-active {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(228, 32, 38, 0.05);
}

/* ─── Status toast ─── */
.status-toast {
  position: fixed;
  right: calc(18px + var(--safe-right));
  bottom: calc(76px + var(--safe-bottom));
  z-index: 8;
  width: min(360px, calc(100vw - 460px));
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-soft);
}

.status-toast strong {
  font-size: 13px;
  font-weight: 600;
}

.status-toast p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.status-toast.is-error {
  border-color: rgba(220, 38, 38, 0.28);
  background: #fff7f7;
}

.status-toast.is-error strong {
  color: #b91c1c;
}

.status-retry {
  justify-self: start;
  margin-top: 6px;
  padding: 7px 12px;
  border: 1px solid rgba(229, 57, 53, 0.28);
  border-radius: 999px;
  background: #fff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease;
}

.status-retry:hover {
  background: rgba(228, 32, 38, 0.05);
}

/* ─── Map markers ─── */
.pin {
  display: block;
  width: 28px;
  height: 28px;
  pointer-events: none;
}

.pin__icon {
  display: block;
  width: 28px;
  height: 28px;
  line-height: 0;
  filter: drop-shadow(0 1px 2px rgba(32, 33, 36, 0.45));
}

.pin__icon svg {
  display: block;
  width: 28px;
  height: 28px;
}

.pin--pickup .pin__icon {
  color: var(--primary);
}

.pin--dropoff .pin__icon {
  color: var(--ink);
}

.pin__label {
  position: absolute;
  left: calc(100% + 4px);
  top: 50%;
  transform: translateY(-50%);
  max-width: 160px;
  overflow: hidden;
  padding: 3px 8px;
  border: 1px solid rgba(218, 220, 224, 0.85);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(32, 33, 36, 0.18);
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
  pointer-events: none;
}

.user-location-marker {
  position: relative;
  width: 42px;
  height: 42px;
  pointer-events: none;
}

.user-location-marker__ring {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(0, 102, 255, 0.14);
}

.user-location-marker__dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 21px;
  height: 21px;
  margin: -10.5px 0 0 -10.5px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: #0066ff;
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.24);
}

.driver-marker {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 3px solid #fff;
  border-radius: 11px;
  color: #fff;
  background: var(--primary);
  box-shadow: 0 10px 24px rgba(32, 33, 36, 0.28);
  font-size: 15px;
  font-weight: 700;
}

.driver-marker::before {
  position: absolute;
  inset: -8px;
  border: 2px solid rgba(228, 32, 38, 0.24);
  border-radius: 16px;
  content: "";
  animation: driverPulse 1.8s ease-out infinite;
}

.driver-marker--truck {
  background: var(--blue);
}

@keyframes driverPulse {
  0% {
    opacity: 0.72;
    transform: scale(0.8);
  }

  100% {
    opacity: 0;
    transform: scale(1.35);
  }
}

.maplibregl-ctrl-bottom-left,
.maplibregl-ctrl-bottom-right {
  z-index: 4;
}

/* ─── Mobile / tablet ─── */
@media (max-width: 920px) {
  .app-panel {
    position: fixed;
    top: auto;
    right: calc(10px + var(--safe-right));
    bottom: calc(10px + var(--safe-bottom));
    left: calc(10px + var(--safe-left));
    width: auto;
    /* on mobile, height is fixed via data-sheet; max-height guards full sheet */
    height: min(58vh, 560px);
    max-height: none;
    border-radius: 20px;
    transition: height 180ms ease, transform 180ms ease;
    /* restore grid to full-height with scroll on mobile */
    grid-template-rows: auto auto auto minmax(0, 1fr);
  }

  .panel-scroll {
    overflow-y: auto;
  }

  .panel-collapse-toggle {
    top: auto;
    bottom: calc(188px + var(--safe-bottom));
    left: calc(16px + var(--safe-left));
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 999px;
  }

  body.is-panel-collapsed .app-panel {
    transform: translateY(calc(100% + 16px));
  }

  body.is-panel-collapsed .panel-collapse-toggle {
    bottom: calc(98px + var(--safe-bottom));
    left: calc(16px + var(--safe-left));
  }

  .app-panel[data-sheet="peek"] {
    height: 172px;
  }

  .app-panel[data-sheet="half"] {
    height: min(58vh, 560px);
  }

  .app-panel[data-sheet="full"] {
    height: calc(100vh - 20px - var(--safe-top) - var(--safe-bottom));
  }

  .sheet-handle {
    display: block;
    width: 40px;
    height: 4px;
    margin: 8px auto 0;
    border-radius: 999px;
    background: #c9ced6;
  }

  .mobile-only {
    display: inline-grid;
  }

  .right-controls {
    top: calc(12px + var(--safe-top));
    right: calc(12px + var(--safe-right));
  }

  .quick-dock {
    right: calc(10px + var(--safe-right));
    bottom: calc(188px + var(--safe-bottom));
    left: calc(10px + var(--safe-left));
    justify-content: flex-start;
  }

  body.is-panel-collapsed .quick-dock,
  body.is-panel-collapsed .status-toast {
    bottom: calc(76px + var(--safe-bottom));
  }

  .status-toast {
    right: calc(10px + var(--safe-right));
    bottom: calc(188px + var(--safe-bottom));
    left: calc(10px + var(--safe-left));
    width: auto;
  }

  .compare-map {
    top: 0;
    left: 0;
    height: 42%;
    border-left: 0;
    border-bottom: 3px solid rgba(32, 33, 36, 0.22);
  }
}

@media (max-width: 560px) {
  .app-header {
    padding-right: 10px;
    padding-left: 10px;
  }

  .brand small {
    max-width: 190px;
  }

  .search-box {
    margin-right: 10px;
    margin-left: 10px;
  }

  .panel-tabs {
    gap: 3px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .panel-tab {
    font-size: 11px;
  }

  .panel-scroll {
    padding-right: 10px;
    padding-left: 10px;
  }

  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }

  .right-controls {
    grid-template-columns: repeat(2, 44px);
  }

  .status-toast {
    display: none;
  }

  .quick-dock {
    display: none;
  }
}
