/* ——— Locale fonts (Dari / Pashto / English) ———
   Body = Regular (400). Titles = SemiBold/Medium via weight range so
   UI rules that use 500/600/700 all hit the real bold file (no faux-bold). */
@font-face {
  font-family: 'Yekan Bakh FaNum';
  src: url('/static/fonts/YekanBakhFaNum-Regular.ttf') format('truetype');
  font-weight: 100 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Yekan Bakh FaNum';
  src: url('/static/fonts/YekanBakhFaNum-SemiBold.ttf') format('truetype');
  font-weight: 500 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IRANSans FaNum';
  src: url('/static/fonts/IRANSans(FaNum).ttf') format('truetype');
  font-weight: 100 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IRANSans FaNum';
  src: url('/static/fonts/IRANSans(FaNum)_Medium.ttf') format('truetype');
  font-weight: 500 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SF UI Display';
  src: url('/static/fonts/SFUIDisplay-Regular.otf') format('opentype');
  font-weight: 100 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SF UI Display';
  src: url('/static/fonts/SFUIDisplay-Semibold.otf') format('opentype');
  font-weight: 500 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --brand: #0c4da8;
  --brand-dark: #083878;
  --brand-soft: #e8f1ff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --panel: #ffffff;
  --surface: #f4f7fb;
  --sidebar-width: 392px;
  --sidebar-float-gap: 12px;
  --sidebar-inset: 0px;
  --ok: #059669;
  --dest: #dc2626;
  --warn: #92400e;
  --warn-bg: #fffbeb;
  --err: #b91c1c;
  --err-bg: #fef2f2;
  --shadow: 0 12px 40px rgba(15, 23, 42, 0.1);
  --shadow-panel: 0 0 0 1px rgba(15, 23, 42, 0.06), 4px 0 24px rgba(15, 23, 42, 0.06);
  --shadow-panel-float: 0 10px 40px rgba(15, 23, 42, 0.14), 0 0 0 1px rgba(15, 23, 42, 0.05);
  --radius: 14px;
  --radius-sm: 10px;
  --font-body: 'Yekan Bakh FaNum', Tahoma, Arial, sans-serif;
  --font-heading: 'Yekan Bakh FaNum', Tahoma, Arial, sans-serif;
  --weight-body: 400;
  --weight-heading: 600;
}

html[lang='fa'] {
  --font-body: 'Yekan Bakh FaNum', Tahoma, Arial, sans-serif;
  --font-heading: 'Yekan Bakh FaNum', Tahoma, Arial, sans-serif;
  --weight-body: 400;
  --weight-heading: 600;
}

html[lang='ps'] {
  --font-body: 'IRANSans FaNum', Tahoma, Arial, sans-serif;
  --font-heading: 'IRANSans FaNum', Tahoma, Arial, sans-serif;
  --weight-body: 400;
  --weight-heading: 500;
}

html[lang='en'] {
  --font-body: 'SF UI Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading: 'SF UI Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --weight-body: 400;
  --weight-heading: 600;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: var(--font-body);
  font-weight: var(--weight-body);
  color: var(--ink);
  background: var(--surface);
  -webkit-tap-highlight-color: transparent;
}

.panel,
.top-chrome,
.map-fab,
input,
#search,
#message,
footer.attribution,
.maplibregl-popup-content,
.maplibregl-ctrl-group button {
  font-family: var(--font-body);
  font-weight: var(--weight-body);
}

h1,
h2,
h3,
.tag,
label,
.section-title,
.route-summary,
.od-chip .value,
.result .name,
button,
.lang-switch button {
  font-family: var(--font-heading);
}

.sub,
.banner,
.hint,
.od-chip .label,
#message,
footer.attribution {
  font-family: var(--font-body);
  font-weight: var(--weight-body);
}

h1,
h2,
h3,
.tag,
label,
.section-title,
button.primary,
button.secondary,
.lang-switch button[aria-pressed='true'],
.od-chip .value,
.result .name,
.route-summary .metric {
  font-weight: var(--weight-heading);
}

#map {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: pan-x pan-y pinch-zoom;
}

.map-load-overlay {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  display: grid;
  place-items: center;
  background: rgba(241, 238, 230, 0.62);
  font-size: 14px;
  color: var(--muted);
}

.map-load-overlay[hidden] {
  display: none !important;
}

.map-debug-badge {
  position: fixed;
  z-index: 4;
  bottom: max(56px, env(safe-area-inset-bottom));
  inset-inline-start: max(12px, env(safe-area-inset-left));
  max-width: min(320px, 70vw);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 10px;
  line-height: 1.35;
  font-family: ui-monospace, monospace;
  background: rgba(15, 23, 42, 0.82);
  color: #e2e8f0;
  pointer-events: none;
  white-space: pre-wrap;
}

.map-debug-badge[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#map.map-pick-active {
  cursor: crosshair;
}

body.map-pick-origin #map,
body.map-pick-dest #map {
  outline: 3px solid rgba(13, 91, 215, 0.35);
  outline-offset: -3px;
}

.map-pick-banner {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #eff6ff;
  border: 1px solid #93c5fd;
  font-size: 13px;
  line-height: 1.4;
  color: var(--brand-dark);
}

.top-chrome {
  position: absolute;
  z-index: 6;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
}

.top-chrome > * {
  pointer-events: auto;
}

.lang-switch {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.lang-switch button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--weight-body);
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  min-height: 36px;
}

.lang-switch button[aria-pressed='true'] {
  background: var(--brand);
  color: #fff;
}

.chrome-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 13px;
  font-weight: var(--weight-heading);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.chrome-pill:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.panel-toggle .panel-toggle-icon {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: linear-gradient(145deg, #0d5bd7, #38bdf8);
  position: relative;
  flex-shrink: 0;
}

.panel-toggle .panel-toggle-icon::after {
  content: '';
  position: absolute;
  inset: 3px 4px 3px 7px;
  border-radius: 3px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-left-width: 4px;
}

body.panel-collapsed .panel-toggle .panel-toggle-icon::after {
  inset: 3px 7px 3px 4px;
  border-left-width: 2px;
  border-right-width: 4px;
}

.panel {
  position: absolute;
  z-index: 5;
  top: max(58px, calc(env(safe-area-inset-top) + 46px));
  width: min(var(--sidebar-width), calc(100% - 24px));
  max-height: min(82vh, 760px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
  transition:
    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.25s ease,
    visibility 0.35s;
}

.panel-inner {
  overflow: auto;
  padding: 14px 16px 16px;
  flex: 1;
  min-height: 0;
}

html[dir='rtl'] body.panel-collapsed .panel {
  transform: translateX(calc(100% + 28px));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

html[dir='ltr'] body.panel-collapsed .panel {
  transform: translateX(calc(-100% - 28px));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.panel-toolbar {
  display: flex;
  justify-content: flex-start;
  margin: -6px 0 4px;
}

html[dir='ltr'] .panel-toolbar {
  justify-content: flex-end;
}

.panel-edge-toggle {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.panel-edge-toggle:hover {
  background: #e2e8f0;
  color: var(--ink);
}

.panel-edge-icon {
  display: block;
  width: 10px;
  height: 10px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
  margin-inline-start: 3px;
}

html[dir='ltr'] .panel-edge-icon {
  transform: rotate(-135deg);
  margin-inline-start: -3px;
}

html[dir='rtl'] .panel {
  right: max(12px, env(safe-area-inset-right));
  left: auto;
}

html[dir='ltr'] .panel {
  left: max(12px, env(safe-area-inset-left));
  right: auto;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--brand), #1a7fd4);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px rgba(12, 77, 168, 0.25);
}

.brand-monogram {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
  color: #fff;
}

h1 {
  font-size: 1.2rem;
  margin: 0;
  line-height: 1.25;
  color: var(--ink);
}

.hero-tagline {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: var(--weight-body);
}

.hero-lead {
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
  margin: 10px 0 14px;
}

.section-title {
  font-size: 12px;
  font-weight: var(--weight-heading);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--brand-dark);
  margin: 0 0 8px;
}

.search-block {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  inset-inline-start: 12px;
  width: 18px;
  height: 18px;
  border: 2px solid #94a3b8;
  border-radius: 50%;
  pointer-events: none;
}

.search-icon::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 2px;
  background: #94a3b8;
  bottom: -1px;
  inset-inline-end: -5px;
  transform: rotate(45deg);
}

.search-field input[type='search'] {
  padding-inline-start: 40px;
  padding-inline-end: 40px;
  border: 1px solid #cbd5e1;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-field input[type='search']:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(12, 77, 168, 0.15);
}

.search-clear {
  position: absolute;
  inset-inline-end: 6px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
}

.search-actions {
  margin-top: 8px;
}

.search-submit {
  width: 100%;
}

.search-empty {
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 0;
  line-height: 1.55;
}

.route-section {
  margin-bottom: 12px;
}

.collapsed-discover {
  position: fixed;
  z-index: 4;
  top: max(72px, calc(env(safe-area-inset-top) + 56px));
  inset-inline-start: max(16px, env(safe-area-inset-left));
  max-width: min(360px, calc(100% - 32px));
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.collapsed-discover-text {
  margin: 0;
  flex: 1 1 180px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
}

button.primary.compact {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 8px 16px;
}

.banner {
  font-size: 12px;
  line-height: 1.65;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--warn-bg);
  color: var(--warn);
  margin: 0 0 10px;
  border: 1px solid #fde68a;
}

.od-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.od-chip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
  min-height: 44px;
}

.od-row-solo {
  margin-bottom: 10px;
}

.od-chip-text {
  flex: 1;
  min-width: 0;
}

.od-clear {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.od-clear:hover {
  background: #fee2e2;
  color: var(--dest);
}

.od-chip .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.od-chip.origin .dot {
  background: var(--ok);
}

.od-chip.dest .dot {
  background: var(--dest);
}

.od-chip .label {
  font-size: 11px;
  color: var(--muted);
  display: block;
}

.od-chip .value {
  font-weight: 600;
  word-break: break-word;
}

.od-chip .near-hint {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--muted);
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

button.primary,
button.secondary {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  flex: 1;
}

button.primary {
  background: var(--brand);
  color: #fff;
}

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

button.secondary {
  background: #e8f0fe;
  color: var(--brand-dark);
}

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

label {
  display: block;
  font-size: 13px;
  margin: 10px 0 6px;
}

input[type='search'],
input[type='text'] {
  height: 44px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
}

input:disabled {
  background: #eef2f7;
  color: #94a3b8;
}

.search-status {
  flex: 1 1 100%;
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.search-status.loading {
  color: var(--brand-dark);
}

.nearby-bar {
  margin-top: 8px;
  max-width: 100%;
}

.nearby-bar-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
}

.nearby-controls {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Equal 3-up cards: origin row + radius row */
.nearby-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-width: 100%;
}

.nearby-origin-status {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

button.nearby-toggle {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  min-height: 34px;
  min-width: 44px;
  cursor: pointer;
  line-height: 1.2;
}

button.nearby-card,
button.nearby-origin-btn,
button.nearby-radius-btn {
  appearance: none;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 72px;
  margin: 0;
  border: 1px solid #e8eaed;
  background: #fff;
  color: #202124;
  border-radius: 12px;
  padding: 10px 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  box-shadow:
    0 1px 2px rgba(60, 64, 67, 0.18),
    0 1px 3px 1px rgba(60, 64, 67, 0.08);
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.12s ease;
}

button.nearby-card:hover:not(:disabled),
button.nearby-origin-btn:hover:not(:disabled),
button.nearby-radius-btn:hover:not(:disabled) {
  background: #f8f9fa;
  border-color: #dadce0;
}

button.nearby-card:active:not(:disabled) {
  transform: translateY(1px);
}

.nearby-card-icon {
  font-size: 18px;
  line-height: 1;
}

.nearby-card-value {
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
  color: #1a73e8;
  font-variant-numeric: tabular-nums;
}

.nearby-card-label {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #3c4043;
}

button.nearby-toggle:focus-visible,
button.nearby-card:focus-visible,
button.nearby-origin-btn:focus-visible,
button.nearby-radius-btn:focus-visible {
  outline: 2px solid var(--brand, #1a73e8);
  outline-offset: 2px;
}

button.nearby-toggle[aria-pressed='true'],
button.nearby-card[aria-pressed='true'],
button.nearby-origin-btn[aria-pressed='true'],
button.nearby-radius-btn[aria-pressed='true'] {
  border-color: #1a73e8;
  background: #e8f0fe;
  color: #174ea6;
  box-shadow:
    0 0 0 1px #1a73e8,
    0 1px 2px rgba(26, 115, 232, 0.2);
}

button.nearby-card[aria-pressed='true'] .nearby-card-label,
button.nearby-origin-btn[aria-pressed='true'] .nearby-card-label,
button.nearby-radius-btn[aria-pressed='true'] .nearby-card-label {
  color: #174ea6;
}

button.nearby-card:disabled,
button.nearby-card[aria-disabled='true'],
button.nearby-origin-btn:disabled,
button.nearby-origin-btn[aria-disabled='true'] {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  background: #f8f9fa;
}

.search-categories {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  max-width: 100%;
}

.search-category-primary,
.search-category-more-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
}

.search-category-more-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 100%;
}

button.search-category-chip,
button.search-category-more {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  min-height: 34px;
  min-width: 44px;
  cursor: pointer;
  line-height: 1.2;
}

button.search-category-chip:hover,
button.search-category-more:hover {
  border-color: #93c5fd;
  background: #eff6ff;
}

button.search-category-chip:focus-visible,
button.search-category-more:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

button.search-category-chip.active,
button.search-category-more.has-selection {
  border-color: var(--brand);
  background: #dbeafe;
  color: var(--brand-dark);
}

button.search-category-chip.active {
  box-shadow: inset 0 0 0 1px var(--brand);
}

.results {
  max-height: min(280px, 42vh);
  overflow: auto;
  margin-top: 8px;
  -webkit-overflow-scrolling: touch;
}

.results-empty {
  padding: 12px 10px;
  border-radius: 12px;
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  text-align: center;
}

.results-empty strong {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}

.results-empty span {
  font-size: 12px;
  color: var(--muted);
}

.result {
  width: 100%;
  text-align: start;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  padding: 10px 10px 8px;
  margin: 6px 0;
  min-height: 52px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.result-body {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
}

.result-icon {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 17px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
}

.result-icon.cat-health {
  background: #fef2f2;
  border-color: #fecaca;
}

.result-icon.cat-education {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.result-icon.cat-worship {
  background: #f5f3ff;
  border-color: #ddd6fe;
}

.result-icon.cat-market {
  background: #fff7ed;
  border-color: #fed7aa;
}

.result-icon.cat-transport {
  background: #ecfeff;
  border-color: #a5f3fc;
}

.result-icon.cat-place {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.result-icon.cat-place-pin {
  background: #fce8e6;
  border-color: #fad2cf;
  font-size: 0;
}

.result-icon.cat-place-pin .location-pin-svg {
  display: block;
}

.result-text {
  flex: 1;
  min-width: 0;
}

.result-main {
  cursor: pointer;
}

.result-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
  padding-inline-start: 46px;
}

.place-detail {
  margin-top: 10px;
  padding: 0;
  border-radius: 16px;
  border: 1px solid #e8eaed;
  background: #fff;
  box-shadow:
    0 1px 2px rgba(60, 64, 67, 0.3),
    0 2px 6px 2px rgba(60, 64, 67, 0.15);
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: min(72vh, 640px);
  overflow: hidden;
}

/* Full place card: lift the base max-height cap when place detail is showing. */
html.consumer-ui.place-panel-open .place-detail,
html.consumer-ui .search-panel .place-detail:not([hidden]) {
  max-height: none !important;
  height: auto;
  flex: 1 1 auto;
}

.place-detail-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.place-hero {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 260px;
  background: #e8eaed;
  overflow: hidden;
}

.place-hero.has-photo {
  aspect-ratio: 16 / 10;
  max-height: 280px;
}

.place-hero-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.place-hero-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    linear-gradient(165deg, #7cb3d9 0%, #a8c5a0 38%, #c4a574 72%, #8b7355 100%);
}

.place-hero-fallback[data-tone="health"] {
  background: linear-gradient(160deg, #81c784 0%, #4db6ac 45%, #26a69a 100%);
}
.place-hero-fallback[data-tone="edu"] {
  background: linear-gradient(160deg, #64b5f6 0%, #5c6bc0 50%, #3949ab 100%);
}
.place-hero-fallback[data-tone="food"] {
  background: linear-gradient(160deg, #ffb74d 0%, #ff8a65 50%, #e57373 100%);
}
.place-hero-fallback[data-tone="transit"],
.place-hero-fallback[data-tone="road"] {
  background: linear-gradient(160deg, #90a4ae 0%, #78909c 50%, #546e7a 100%);
}
.place-hero-fallback[data-tone="commerce"] {
  background: linear-gradient(160deg, #ce93d8 0%, #ab47bc 55%, #8e24aa 100%);
}
.place-hero-fallback[data-tone="culture"],
.place-hero-fallback[data-tone="lodging"] {
  background: linear-gradient(160deg, #a1887f 0%, #8d6e63 50%, #6d4c41 100%);
}
.place-hero-fallback[data-tone="city"] {
  background: linear-gradient(165deg, #7cb3d9 0%, #a8c5a0 38%, #c4a574 72%, #8b7355 100%);
}

.place-hero-fallback-icon {
  position: relative;
  z-index: 1;
  font-size: 48px;
  line-height: 1;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.25));
  opacity: 0.92;
}

.place-hero-fallback::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(32, 33, 36, 0.18), transparent 42%),
    radial-gradient(ellipse at 70% 30%, rgba(255, 255, 255, 0.2), transparent 50%);
}

.place-hero-photo-count {
  position: absolute;
  inset-inline-end: 12px;
  bottom: 12px;
  z-index: 1;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(32, 33, 36, 0.72);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: grid;
  place-items: center;
  backdrop-filter: blur(4px);
}

.place-detail-titles .place-discovery-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.place-detail-titles .place-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #e8f0fe;
  color: #174ea6;
}

.place-detail-titles .place-chip.is-open {
  background: #e6f4ea;
  color: #137333;
}

.place-detail-titles .place-chip.is-closed {
  background: #fce8e6;
  color: #c5221f;
}

.place-round-action.place-round-link {
  text-decoration: none;
  color: inherit;
}

.place-hours-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.place-hours-label {
  font-size: 12px;
  font-weight: 600;
  color: #5f6368;
}

.place-detail-contact-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.place-contact-row {
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8f9fa;
  color: #1a73e8;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.place-contact-row:hover {
  background: #e8f0fe;
}

.place-photos-note,
.place-detail-source-note,
.place-detail-empty {
  margin: 8px 0 0;
  font-size: 12px;
  color: #80868b;
  line-height: 1.4;
}

.place-photo-thumb {
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.place-detail-close-overlay {
  position: absolute !important;
  top: 10px;
  inset-inline-end: 10px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.3);
  color: #3c4043;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.place-detail-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 16px 12px;
}

.place-detail-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.place-action-row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 4px;
  padding: 2px 0 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.place-round-action {
  flex: 1 1 0;
  min-width: 56px;
  max-width: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--m-primary, #007F87);
  cursor: pointer;
  font: inherit;
}

.place-round-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--m-border, #dadce0);
  background: #fff;
  color: var(--m-primary, #007F87);
}

.place-round-action.is-primary .place-round-icon {
  background: var(--m-primary, #007F87);
  border-color: var(--m-primary, #007F87);
  color: #fff;
}

.place-round-action.is-saved .place-round-icon {
  background: var(--m-selected, #BDEBF0);
  border-color: var(--m-primary, #007F87);
}

.place-round-label {
  font-size: 12px;
  line-height: 1.2;
  font-weight: 500;
  color: var(--m-primary, #007F87);
  text-align: center;
  white-space: nowrap;
}

.place-facts {
  margin: 0;
  padding: 0;
}

.place-facts-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 500;
  color: #202124;
}

.place-facts-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: #3c4043;
}

.place-detail-footer-links {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 8px;
  border-top: 1px solid #e8eaed;
  padding-top: 8px;
}

.place-text-link {
  display: block;
  width: auto;
  min-height: 0;
  margin: 0;
  padding: 10px 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: start;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  color: #1a73e8;
  cursor: pointer;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  transition: color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.place-text-link[hidden] {
  display: none !important;
}

.place-text-link:hover {
  background: transparent;
  color: #174ea6;
  text-decoration: underline;
}

.place-text-link:active {
  transform: none;
}

#placeDetailReport.place-text-link {
  color: #d93025;
}

#placeDetailReport.place-text-link:hover {
  color: #a50e0e;
}

.place-photo-overlay {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(32, 33, 36, 0.72);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  pointer-events: none;
}

.place-detail-icon {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 22px;
  background: #f1f3f4;
  border: 0;
}

.place-detail-icon[hidden] {
  display: none !important;
}

.place-detail-icon.cat-place-pin {
  background: #fce8e6;
  border-color: transparent;
  font-size: 0;
}

.place-detail-icon.cat-place-pin .location-pin-svg {
  display: block;
  width: 22px;
  height: 22px;
}

.place-detail-titles {
  flex: 1;
  min-width: 0;
  padding-top: 0;
}

.place-detail-name {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 400;
  color: #202124;
  overflow-wrap: anywhere;
  letter-spacing: -0.01em;
}

.place-detail-alt {
  margin: 4px 0 0;
  font-size: 14px;
  color: #5f6368;
  overflow-wrap: anywhere;
}

.place-detail-meta {
  margin: 6px 0 0;
  font-size: 13px;
  color: #70757a;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.place-detail-boundary-note {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.45;
  color: #5f6368;
  background: #f8f9fa;
  border: 1px solid #e8eaed;
  overflow-wrap: anywhere;
}

.place-detail-boundary-note[data-boundary-status='unavailable'] {
  color: #5f6368;
  background: #f8f9fa;
  border-color: #e8eaed;
}

.place-detail-boundary-note[data-boundary-status='available'] {
  color: #137333;
  background: #e6f4ea;
  border-color: #ceead6;
}

.place-detail-section {
  margin: 0;
  padding: 12px;
  border-radius: 12px;
  background: #f8f9fa;
  border: 1px solid #e8eaed;
}

.place-detail-section-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #5f6368;
  text-transform: none;
}

.place-detail-body {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.place-detail-empty {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: #5f6368;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #e8eaed;
  background: #f8f9fa;
}

.place-detail-identity {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.place-detail-address,
.place-detail-hours,
.place-detail-source,
.place-detail-source-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text, #0f172a);
  overflow-wrap: anywhere;
}

.place-detail-address-parts {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  font-size: 12px;
  line-height: 1.45;
  min-width: 0;
}

.place-detail-address-parts dt {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}

.place-detail-address-parts dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.place-detail-hours.is-unsupported {
  color: #475569;
}

.place-detail-hours-block {
  display: grid;
  gap: 6px;
}

.place-hours-badge {
  display: inline-flex;
  align-self: start;
  width: fit-content;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: #e2e8f0;
  color: #334155;
}

.place-hours-badge.is-open {
  background: #ecfdf5;
  color: #047857;
}

.place-hours-badge.is-closed {
  background: #fef2f2;
  color: #b91c1c;
}

.place-detail-hours.is-missing {
  color: var(--muted, #64748b);
  font-style: italic;
}

.place-detail-missing {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.place-missing-row {
  margin: 0;
}

.place-missing-btn {
  width: 100%;
  text-align: start;
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.place-missing-btn:hover,
.place-missing-btn:focus-visible {
  background: #eff6ff;
  border-color: #93c5fd;
  outline: none;
}

.place-detail-photos {
  display: grid;
  gap: 6px;
}

.place-photos-label {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text, #0f172a);
}

.place-photos-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}

.place-photo-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 148px;
  height: 110px;
  border-radius: 8px;
  overflow: hidden;
  background: #e2e8f0;
  border: 1px solid #dadce0;
}

.place-photo-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.place-photo-thumb.is-pending {
  border-color: #f9ab00;
}

.place-photo-status {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(32, 33, 36, 0.78);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  pointer-events: none;
}

.place-photos-note {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
}

.place-discovery-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.place-chip {
  display: inline-flex;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: #f1f5f9;
  color: #475569;
}

.place-chip.is-open {
  background: #ecfdf5;
  color: #047857;
}

.place-chip.is-closed {
  background: #fef2f2;
  color: #b91c1c;
}

.place-detail-source,
.place-detail-source-note {
  color: var(--muted);
  font-size: 11px;
}

.place-detail-source-note {
  font-style: italic;
}

.place-detail-contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

a.place-detail-call,
a.place-detail-website,
a.place-detail-email {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  unicode-bidi: isolate;
  max-width: 100%;
  overflow-wrap: anywhere;
}

button.place-detail-close {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.place-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.place-detail-actions-primary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.place-action-card {
  appearance: none;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 64px;
  margin: 0;
  padding: 10px 6px;
  border: 1px solid #e8eaed;
  border-radius: 12px;
  background: #fff;
  color: #1a73e8;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.12);
  display: grid;
  place-items: center;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.place-action-card:hover {
  background: #f8f9fa;
  border-color: #dadce0;
}

.place-action-card:focus-visible {
  outline: 2px solid #1a73e8;
  outline-offset: 2px;
}

.place-detail-actions-secondary {
  flex: 0 0 auto;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 8px 16px 16px;
  border-top: 1px solid #e8eaed;
  background: #fff;
}

.place-detail-actions-secondary .result-action {
  flex: 1 1 auto;
  width: 100%;
}

button.result-action.secondary-action {
  background: #e8f0fe;
  border-color: #aecbfa;
  color: #174ea6;
}

button.result-action.ghost-action {
  background: transparent;
  flex: 1 1 100%;
  border-color: #dadce0;
  color: #5f6368;
}

button.result-action {
  flex: 1;
  min-height: 44px;
  min-width: 72px;
  border-radius: 24px;
  border: 1px solid #dadce0;
  background: #f8f9fa;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

button.result-action:hover {
  border-color: #93c5fd;
  background: #eff6ff;
}

button.compact {
  flex: 1;
  min-height: 40px;
  font-size: 12px;
  padding: 8px 10px;
}

.map-pick-row {
  margin-bottom: 8px;
}

.result.active,
.result:hover {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.result .name {
  font-size: 14px;
}

.result .meta {
  font-family: var(--font-body);
  font-weight: var(--weight-body);
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* Alternate/local name line (distinct from location · category · distance meta). */
.result .meta.place-alt-name {
  font-size: 12px;
  color: #475569;
}

.result .meta.place-explore-meta {
  color: var(--ink-muted, #5c6570);
  font-size: 0.85em;
}
.result .meta.place-location-meta {
  font-size: 11px;
  color: var(--muted);
}

.route-summary {
  font-size: 14px;
  line-height: 1.75;
  padding: 12px;
  border-radius: 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  margin: 8px 0;
  display: none;
}

.route-summary.visible {
  display: block;
}

.route-summary .metric {
  color: var(--brand-dark);
}

.route-snap-note,
.route-continuity-note {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.4;
}
.route-continuity-note {
  background: #eff6ff;
  color: #1e40af;
}

.via-stops-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
}

.od-chip.via .dot {
  background: #ca8a04;
}

.via-stops-actions {
  margin: 8px 0 4px;
}

.offline-nav-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 4px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
}

.offline-nav-toggle input {
  width: 16px;
  height: 16px;
}

.offline-maps-open-link {
  display: inline-flex;
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: #1a73e8;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.offline-nav-hint {
  margin: 0 0 8px;
  font-size: 0.82rem;
  color: #0f766e;
}

.route-profile-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 12px 0 6px;
  padding: 4px;
  border-radius: 12px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
}

.route-profile-btn {
  appearance: none;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #334155;
  font: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  padding: 10px 12px;
  cursor: pointer;
}

.route-profile-btn.is-active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.route-profile-btn[data-profile="transit"].is-active {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #fff;
}
.route-profile-btn[data-profile="walking"].is-active {
  color: #0f766e;
}

.route-profile-hint {
  margin: 0 0 8px;
  font-size: 0.82rem;
  color: #5f6368;
}

.arrive-by-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8f9fa;
  border: 1px solid #e8eaed;
}

.arrive-by-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: #3c4043;
}

.arrive-by-input {
  min-width: 7.5rem;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid #dadce0;
  background: #fff;
  font: inherit;
  color: #202124;
}

.arrive-by-clear {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: #e8eaed;
  color: #5f6368;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.arrive-by-hint {
  flex: 1 1 100%;
  font-size: 0.78rem;
  color: #5f6368;
}

.route-eta-note.is-warn {
  color: #b45309;
  font-weight: 600;
}

.route-eta-block {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.route-eta-block[data-mode="walking"] {
  background: #f0fdfa;
  border-color: #99f6e4;
}

.route-eta-row.walk-long {
  color: #b45309;
  font-weight: 600;
}

.route-eta-row {
  margin: 0 0 4px;
  font-size: 0.92rem;
  line-height: 1.45;
}

.route-eta-row.muted {
  color: var(--muted, #64748b);
  font-size: 0.82rem;
}

.traffic-pill {
  display: inline-block;
  margin-inline-start: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  vertical-align: middle;
}

.traffic-pill.traffic-free {
  background: #ecfdf5;
  color: #047857;
}

.traffic-pill.traffic-light {
  background: #eff6ff;
  color: #1d4ed8;
}

.traffic-pill.traffic-moderate {
  background: #fff7ed;
  color: #c2410c;
}

.traffic-pill.traffic-heavy {
  background: #fef2f2;
  color: #b91c1c;
}

.snap-ghost-pin {
  width: 18px;
  height: 18px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  opacity: 0.45;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.35);
  pointer-events: none;
}

.snap-ghost-pin.snap-ghost-origin {
  background: #059669;
}

.snap-ghost-pin.snap-ghost-dest {
  background: #dc2626;
}

.route-alt-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.route-alt-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: inherit;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #bfdbfe;
  background: #fff;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.route-alt-card[aria-selected='true'] {
  border-color: #1d4ed8;
  background: #dbeafe;
}

.route-alt-none {
  margin: 8px 0 0;
}

.route-steps {
  margin: 10px 0 0;
  padding-inline-start: 1.2em;
  max-height: 220px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.55;
}

#message {
  font-size: 13px;
  line-height: 1.75;
  padding: 10px 12px;
  background: var(--surface);
  border-radius: 10px;
  min-height: 44px;
  margin-top: 8px;
}

#message.loading {
  background: #eff6ff;
  color: var(--brand-dark);
}

#message.error {
  background: var(--err-bg);
  color: var(--err);
}

#message.success {
  background: #ecfdf5;
  color: #047857;
}

.chrome-toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: var(--z-toast, 30);
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  font-size: var(--text-sm, 13px);
  line-height: var(--line-tight, 1.35);
  text-align: center;
  box-shadow: var(--shadow-fab, 0 2px 8px rgba(15, 23, 42, 0.16));
  pointer-events: none;
}

.chrome-toast.loading {
  background: rgba(12, 77, 168, 0.95);
}

.chrome-toast.error {
  background: rgba(185, 28, 28, 0.95);
}

.chrome-toast.success {
  background: rgba(5, 150, 105, 0.95);
}

@media (max-width: 900px) {
  .chrome-toast {
    bottom: max(96px, calc(env(safe-area-inset-bottom, 0px) + 72px));
  }
}

footer.attribution {
  font-size: 10px;
  color: var(--muted);
  margin-top: 10px;
  line-height: 1.65;
}

.map-fab {
  position: absolute;
  z-index: 4;
  bottom: max(100px, calc(env(safe-area-inset-bottom) + 88px));
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 0;
  background: var(--panel);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 22px;
  display: grid;
  place-items: center;
}

html[dir='rtl'] .map-fab {
  left: max(12px, env(safe-area-inset-left));
}

html[dir='ltr'] .map-fab {
  right: max(12px, env(safe-area-inset-right));
}

html,
body {
  overflow-x: hidden;
}

/* Legacy non-consumer panel geometry only — consumer-ui uses consumer-layout.css @900px. */
@media (max-width: 640px) {
  html:not(.consumer-ui) .panel {
    top: auto;
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 8px !important;
    right: 8px !important;
    width: auto;
    max-height: min(46vh, 420px);
    padding: 12px 14px;
  }

  html:not(.consumer-ui) .results {
    max-height: min(180px, 32vh);
  }

  .map-pick-row {
    flex-direction: column;
  }

  .map-pick-row button.compact {
    width: 100%;
  }

  html:not(.consumer-ui)[dir='rtl'] body.panel-collapsed .panel,
  html:not(.consumer-ui)[dir='ltr'] body.panel-collapsed .panel {
    transform: translateY(calc(100% + 24px));
  }

  .top-chrome {
    flex-wrap: wrap;
    gap: 8px;
  }

  .panel-toggle-label {
    display: none;
  }

  .chrome-pill.panel-toggle {
    min-width: 44px;
    padding: 8px 10px;
    justify-content: center;
  }

  h1 {
    font-size: 1.1rem;
  }
}

.route-preview-block {
  margin: 4px 0 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid #bfdbfe;
  background: var(--brand-soft);
}

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

.route-preview-head .section-title {
  margin: 0;
}

.route-preview-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  background: #fff;
  color: var(--brand-dark);
  border: 1px solid #93c5fd;
}

.route-preview-cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.route-preview-card {
  width: 100%;
  text-align: start;
  border: 1px solid #dbeafe;
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 10px 12px;
  cursor: pointer;
  min-height: 44px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.route-preview-card:hover:not(:disabled) {
  border-color: var(--brand);
  box-shadow: 0 2px 8px rgba(12, 77, 168, 0.08);
}

.route-preview-card[aria-selected='true'] {
  border-color: var(--brand);
  background: #f0f7ff;
  box-shadow: inset 0 0 0 1px var(--brand);
}

.route-preview-card:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.route-preview-card-title {
  font-size: 13px;
  font-weight: var(--weight-heading);
  color: var(--ink);
}

.route-preview-card-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.route-preview-select {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.route-preview-hint {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.55;
  color: var(--muted);
}

.route-preview-summary {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #bfdbfe;
  font-size: 13px;
  line-height: 1.65;
}

.route-preview-summary.visible {
  display: block;
}

.route-preview-summary .metric {
  font-weight: var(--weight-heading);
}

.live-routing-hint {
  margin: 0 0 10px;
  font-size: 11px;
  color: var(--muted);
}

.banner.banner-preview-ok {
  background: #ecfdf5;
  color: #047857;
  border-color: #6ee7b7;
}

.result.active {
  border-color: var(--brand);
  background: #f0f7ff;
}

.result .result-action {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 12px;
}

/* MapLibre control polish — glass chips like modern map apps */
.maplibregl-ctrl-group {
  border-radius: 12px !important;
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(15, 23, 42, 0.06) !important;
  border: none !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.92) !important;
}

.maplibregl-ctrl-group button {
  min-width: 38px;
  min-height: 38px;
}

.maplibregl-ctrl-attrib {
  font-size: 10px !important;
  max-width: min(280px, 45vw);
}

@media (min-width: 901px) {
  body.layout-desktop {
    --sidebar-inset: 0px;
    background: #e4ddd2;
  }

  html[dir='rtl'] body.layout-desktop #map,
  html[dir='ltr'] body.layout-desktop #map {
    inset: 0;
  }

  body.layout-desktop .panel {
    top: max(var(--sidebar-float-gap), env(safe-area-inset-top));
    bottom: max(var(--sidebar-float-gap), env(safe-area-inset-bottom));
    max-height: calc(100vh - 2 * var(--sidebar-float-gap) - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    width: min(var(--sidebar-width), calc(100vw - 2 * var(--sidebar-float-gap)));
    border-radius: var(--radius);
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--shadow-panel-float);
    transform: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  html[dir='rtl'] body.layout-desktop.drawer-open .panel.app-drawer {
    left: max(var(--sidebar-float-gap), env(safe-area-inset-left));
    right: auto;
    transform: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  html[dir='ltr'] body.layout-desktop.drawer-open .panel.app-drawer {
    right: max(var(--sidebar-float-gap), env(safe-area-inset-right));
    left: auto;
    transform: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  html[dir='rtl'] body.layout-desktop.drawer-closed .panel.app-drawer {
    transform: translateX(calc(-100% - var(--sidebar-float-gap) - 8px));
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  html[dir='ltr'] body.layout-desktop.drawer-closed .panel.app-drawer {
    transform: translateX(calc(100% + var(--sidebar-float-gap) + 8px));
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

/* ——— Phase 6.9.2 premium: floating search + dock + contextual drawer ——— */
.float-search-hub {
  position: fixed;
  z-index: 6;
  top: max(12px, env(safe-area-inset-top));
  inset-inline-start: max(12px, env(safe-area-inset-left));
  width: min(392px, calc(100vw - 88px));
  pointer-events: none;
}

.float-search-card {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.14);
  padding: 8px 10px 10px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.float-search-field {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.float-search-field input[type='search'] {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  height: 42px;
  padding-inline-start: 36px;
}

.float-search-field input[type='search']:focus {
  outline: none;
  box-shadow: none;
}

.float-search-go {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 12px;
  font-size: 18px;
  line-height: 1;
}

.float-search-hub .search-status {
  margin: 4px 4px 0;
}

.float-search-body {
  margin-top: 8px;
  max-height: min(52vh, 420px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.float-search-hub.is-expanded .float-search-card {
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.16);
}

.map-dock {
  position: fixed;
  z-index: 6;
  bottom: max(20px, env(safe-area-inset-bottom));
  inset-inline-end: max(12px, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 10px 32px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

button.dock-btn {
  width: 44px;
  height: 44px;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: #f8fafc;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

button.dock-btn:hover {
  border-color: #bfdbfe;
  background: #eff6ff;
}

button.dock-btn[aria-pressed='true'] {
  background: var(--brand-soft);
  border-color: #93c5fd;
  color: var(--brand-dark);
}

.dock-glyph {
  font-size: 20px;
  line-height: 1;
}

.dock-lang {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

button.dock-lang-btn {
  font-size: 11px;
  font-weight: var(--weight-heading);
}

.panel.app-drawer .panel-header-compact {
  margin-bottom: 8px;
}

.panel.app-drawer .hero-lead {
  display: none;
}

.panel-toolbar {
  align-items: center;
  gap: 8px;
}

button.drawer-close {
  margin-inline-start: auto;
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
}


@media (max-width: 900px) {
  .float-search-hub {
    width: calc(100vw - 24px);
    inset-inline-start: 12px;
    inset-inline-end: 12px;
  }

  .map-dock {
    flex-direction: row;
    flex-wrap: wrap;
    max-width: calc(100vw - 24px);
    inset-inline-end: 12px;
    inset-inline-start: 12px;
    justify-content: center;
  }

  .dock-lang {
    flex-direction: row;
    border-top: none;
    padding-top: 0;
  }

  body.drawer-open .panel.app-drawer {
    display: flex;
  }
}

/* Phase 5 — saved places / recent searches (device-local) */
.user-library {
  margin-top: 8px;
  padding: 0 2px 8px;
}

.user-library-head {
  margin-bottom: 8px;
}

.user-library-hint {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.user-library-block {
  margin-bottom: 12px;
}

.user-library-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.user-library-subtitle {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

button.text-btn {
  border: none;
  background: transparent;
  color: #2563eb;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 6px;
  min-height: 32px;
}

.user-library-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-library-row {
  display: flex;
  align-items: stretch;
  gap: 4px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

button.user-library-main {
  flex: 1;
  text-align: start;
  border: none;
  background: transparent;
  padding: 8px 10px;
  cursor: pointer;
  min-height: 44px;
}

button.user-library-main .name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

button.user-library-main .meta {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

button.user-library-remove {
  border: none;
  background: #f8fafc;
  color: var(--muted);
  min-width: 40px;
  cursor: pointer;
  font-size: 18px;
}

button.user-library-remove:hover {
  background: #fee2e2;
  color: #b91c1c;
}

.user-library-empty {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

button.result-action.is-saved {
  background: #ecfdf5;
  border-color: #6ee7b7;
}

.place-detail-names {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  margin: 0;
  padding: 0;
  font-size: 13px;
  color: #5f6368;
}

.place-detail-names dt {
  font-weight: 500;
  color: #202124;
}

.place-detail-names dd,
.place-detail-names .place-detail-name-value {
  margin: 0;
  color: #3c4043;
  overflow-wrap: anywhere;
  /* Name values sit on the trailing edge opposite the language label */
  text-align: end;
  direction: auto;
  unicode-bidi: plaintext;
  justify-self: end;
}

.user-library-filter {
  width: 100%;
  min-height: var(--touch-min, 44px);
  margin: 0 0 var(--space-2, 8px);
  padding: 0 var(--space-3, 12px);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--panel);
}

.user-library-rename {
  flex: 0 0 auto;
  padding: 4px 8px;
  font-size: var(--text-xs, 12px);
}

#ctrlFullscreen[aria-pressed='true'] {
  color: var(--brand);
}

@media (prefers-reduced-motion: reduce) {
  .panel,
  #map,
  .panel-edge-toggle,
  .route-preview-card,
  .float-search-card,
  .nav-rail,
  .side-panel-stack,
  .route-alt-card,
  .user-library-row,
  .place-detail {
    transition: none !important;
    animation: none !important;
  }
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
