:root,
[data-theme="dark"] {
  --bg-app: #111215;
  --bg-panel: #16181c;
  --bg-subpanel: #131519;
  --bg-card: #1a1d22;
  --bg-card-hover: #20242b;
  --bg-leader: #1b2219;
  --bg-input: #101215;
  --bg-button: #22262e;
  --bg-button-hover: #2a2f39;

  --border-dim: #262a32;
  --border-mid: #333944;
  --border-strong: #464e5d;

  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;

  /* Muted, utilitarian signal colours (no neon) */
  --sage: #86b368;
  --sage-bg: rgba(134, 179, 104, 0.13);
  --sage-border: rgba(134, 179, 104, 0.42);

  --ochre: #cfa04c;
  --ochre-bg: rgba(207, 160, 76, 0.13);
  --ochre-border: rgba(207, 160, 76, 0.38);

  --brick: #c76b60;
  --brick-bg: rgba(199, 107, 96, 0.13);
  --brick-border: rgba(199, 107, 96, 0.38);

  --steel: #7ba3c4;
  --steel-bg: rgba(123, 163, 196, 0.14);

  --panel-overlay: rgba(20, 22, 26, 0.96);
  --grain-opacity: 0.036;
}

[data-theme="light"] {
  --bg-app: #e7e5e0;
  --bg-panel: #f3f2ee;
  --bg-subpanel: #eae8e2;
  --bg-card: #faf9f6;
  --bg-card-hover: #ffffff;
  --bg-leader: #eef3ea;
  --bg-input: #ffffff;
  --bg-button: #e6e4de;
  --bg-button-hover: #dcd9d0;

  --border-dim: #d4d1c8;
  --border-mid: #b8b4a9;
  --border-strong: #8c887d;

  --text-primary: #18181b;
  --text-secondary: #3f3f46;
  --text-muted: #71717a;

  --sage: #3f6e26;
  --sage-bg: rgba(63, 110, 38, 0.11);
  --sage-border: rgba(63, 110, 38, 0.4);

  --ochre: #966816;
  --ochre-bg: rgba(150, 104, 22, 0.11);
  --ochre-border: rgba(150, 104, 22, 0.35);

  --brick: #a33b30;
  --brick-bg: rgba(163, 59, 48, 0.1);
  --brick-border: rgba(163, 59, 48, 0.35);

  --steel: #2e5c82;
  --steel-bg: rgba(46, 92, 130, 0.11);

  --panel-overlay: rgba(245, 244, 240, 0.97);
  --grain-opacity: 0.025;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-app);
  color: var(--text-primary);
  font-size: 14px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .brand-name, .station-title {
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: -0.02em;
}

.mono {
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

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

/* Subtle Tactile Film Grain Overlay */
.grain-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

/* App Shell */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

/* Utilitarian Top Header Bar */
.topbar {
  min-height: 48px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-mid);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 12px;
  z-index: 1200;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

/* UK Number-Plate / Road Sign Badge */
.uk-plate {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  background: #1f4b8f;
  color: #f4f4f5;
  padding: 4px 6px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  line-height: 1;
}

.brand-title-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.brand-name {
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: 0.04em;
}

.brand-sep {
  color: var(--text-muted);
  font-weight: 400;
}

.brand-index-tag {
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

/* Search Box */
.search-cluster {
  flex: 1;
  max-width: 490px;
  position: relative;
}

.search-box-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-mid);
  border-radius: 4px;
  height: 32px;
  padding: 0 3px 0 9px;
  transition: border-color 0.12s;
}

.search-box-wrap:focus-within {
  border-color: var(--text-secondary);
}

.search-prefix {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 6px;
  user-select: none;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.82rem;
  min-width: 0;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.gps-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-button);
  border: 1px solid var(--border-mid);
  border-radius: 3px;
  height: 24px;
  padding: 0 7px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.gps-btn:hover {
  background: var(--bg-button-hover);
  border-color: var(--border-strong);
}

.gps-btn svg {
  width: 12px;
  height: 12px;
}

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  z-index: 2000;
}

.autocomplete-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-dim);
  padding: 7px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.8rem;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover {
  background: var(--bg-card-hover);
}

.autocomplete-type {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.64rem;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 2px;
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* Topbar Right Controls */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.mode-tabs {
  display: inline-flex;
  border: 1px solid var(--border-mid);
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-input);
}

.mode-tab {
  border: none;
  border-right: 1px solid var(--border-dim);
  background: transparent;
  height: 30px;
  padding: 0 10px;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.mode-tab:last-child {
  border-right: none;
}

.mode-tab:hover {
  color: var(--text-primary);
}

.mode-tab.active {
  background: var(--bg-button);
  color: var(--text-primary);
  font-weight: 600;
}

.mini-count {
  font-size: 0.66rem;
  padding: 0 4px;
  border-radius: 2px;
  background: var(--bg-subpanel);
  border: 1px solid var(--border-mid);
}

.util-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 9px;
  background: var(--bg-input);
  border: 1px solid var(--border-mid);
  border-radius: 4px;
  font-size: 0.74rem;
  cursor: pointer;
}

.util-btn:hover {
  border-color: var(--border-strong);
}

.util-btn-kicker {
  font-size: 0.62rem;
  color: var(--text-muted);
  border-right: 1px solid var(--border-dim);
  padding-right: 6px;
}

.feed-status-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 9px;
  border-radius: 4px;
  font-size: 0.71rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg-input);
  border: 1px solid var(--border-mid);
}

.feed-status-btn:hover {
  border-color: var(--border-strong);
}

.status-led {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ochre);
}

.feed-status-btn.live {
  border-color: var(--sage-border);
  color: var(--text-primary);
}
.feed-status-btn.live .status-led {
  background: var(--sage);
}

.feed-status-btn.syncing .status-led {
  background: var(--steel);
}

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  border: 1px solid var(--border-mid);
  background: var(--bg-input);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.icon-btn:hover {
  border-color: var(--border-strong);
}

.icon-btn svg {
  width: 15px;
  height: 15px;
}

.icon-btn-sm {
  width: 22px;
  height: 22px;
  border-radius: 3px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.78rem;
}

.icon-btn-sm:hover {
  border-color: var(--border-mid);
  color: var(--text-primary);
}

/* Vehicle Popover */
.popover-card {
  position: fixed;
  top: 52px;
  right: 140px;
  width: 300px;
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 12px 14px;
  z-index: 2200;
}

.popover-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-dim);
}

.popover-header h4 {
  font-size: 0.86rem;
  font-weight: 600;
}

.popover-header p {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.slider-group {
  margin-top: 10px;
}

.slider-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-bottom: 4px;
}

.slider-group input[type="range"] {
  width: 100%;
  accent-color: var(--sage);
}

.slider-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-top: 6px;
}

.slider-presets button {
  padding: 3px 0;
  font-size: 0.7rem;
  border-radius: 3px;
  border: 1px solid var(--border-mid);
  background: var(--bg-input);
  cursor: pointer;
}

.slider-presets button:hover {
  border-color: var(--text-secondary);
}

/* Main Split Workspace */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 428px 1fr;
  min-height: 0;
}

/* Left Sidebar */
.sidebar {
  background: var(--bg-panel);
  border-right: 1px solid var(--border-mid);
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 900;
}

/* Corridor Route Box */
.route-planner-box {
  padding: 10px 12px;
  background: var(--bg-subpanel);
  border-bottom: 1px solid var(--border-mid);
}

.route-box-header h3 {
  font-size: 0.84rem;
  font-weight: 600;
}

.route-box-header p {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.route-inputs {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 8px;
}

.route-field {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-input);
  border: 1px solid var(--border-mid);
  border-radius: 4px;
  height: 30px;
  padding: 0 8px;
}

.route-field input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.8rem;
}

.route-code {
  font-size: 0.64rem;
  font-weight: 600;
  color: var(--text-muted);
  width: 32px;
  border-right: 1px solid var(--border-dim);
}

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

.native-field-inline {
  font-size: 0.73rem;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.checkbox-inline {
  font-size: 0.73rem;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.util-submit-btn {
  background: var(--text-primary);
  color: var(--bg-app);
  border: 1px solid var(--text-primary);
  border-radius: 4px;
  height: 27px;
  padding: 0 11px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
}

.util-submit-btn:hover {
  opacity: 0.9;
}

.route-summary-note {
  margin-top: 7px;
  padding: 5px 8px;
  border-radius: 3px;
  border-left: 2px solid var(--steel);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.71rem;
}

/* Quick City Links (Tabular Underline Tabs, Not Bubble Chips) */
.quick-cities {
  display: flex;
  justify-content: space-between;
  gap: 0;
  padding: 0 6px;
  overflow-x: auto;
  background: var(--bg-subpanel);
  border-bottom: 1px solid var(--border-dim);
  scrollbar-width: none;
}

.quick-cities::-webkit-scrollbar {
  display: none;
}

.city-link {
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 5px 4px 4px;
  font-size: 0.67rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.city-link:hover {
  color: var(--text-secondary);
}

.city-link.active {
  color: var(--text-primary);
  border-bottom-color: var(--ochre);
  font-weight: 600;
}

/* Fuel Grade Selector — Mix Pill Nozzle Badges Inside Sharp Utility Tabs */
.fuel-grade-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-dim);
}

.fuel-pill {
  background: var(--bg-input);
  border: 1px solid var(--border-dim);
  border-radius: 4px;
  padding: 5px 3px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.fuel-pill:hover {
  border-color: var(--border-mid);
}

.fuel-pill.active {
  background: var(--bg-card-hover);
  border-color: var(--text-secondary);
}

/* Intentional Pill Shape Reserved for UK Pump Grade Identifiers */
.nozzle-badge {
  font-size: 0.66rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.nozzle-badge.petrol {
  background: rgba(134, 179, 104, 0.16);
  border-color: rgba(134, 179, 104, 0.45);
  color: var(--sage);
}
.nozzle-badge.super {
  background: rgba(134, 179, 104, 0.1);
  border-color: rgba(134, 179, 104, 0.35);
  color: #a3c989;
}
.nozzle-badge.diesel {
  background: rgba(244, 244, 245, 0.08);
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.nozzle-badge.diesel-plus {
  background: var(--steel-bg);
  border-color: rgba(123, 163, 196, 0.4);
  color: var(--steel);
}
.nozzle-badge.eco {
  background: var(--ochre-bg);
  border-color: var(--ochre-border);
  color: var(--ochre);
}

.fuel-name {
  font-size: 0.66rem;
  color: var(--text-secondary);
}

/* Asymmetric Native-Style Filter Controls */
.controls-bar {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border-dim);
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.native-filters-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.native-control {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

/* Asymmetric natural proportions rather than 3 identical boxes */
.native-control.w-radius {
  flex: 0 0 auto;
}
.native-control.w-sort {
  flex: 0 1 auto;
}
.native-control.w-brand {
  flex: 1 1 110px;
}

.native-control label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-muted);
  flex-shrink: 0;
}

.native-select {
  width: 100%;
  height: 26px;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-mid);
  border-radius: 3px;
  padding: 0 6px;
  font-size: 0.75rem;
  outline: none;
  cursor: pointer;
}

.native-select:hover,
.native-select:focus {
  border-color: var(--border-strong);
}

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

.filter-tag {
  border: 1px solid var(--border-dim);
  background: var(--bg-subpanel);
  border-radius: 3px;
  padding: 3px 7px;
  font-size: 0.7rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.filter-tag:hover {
  border-color: var(--border-mid);
  color: var(--text-primary);
}

.filter-tag.active {
  background: var(--ochre-bg);
  border-color: var(--ochre-border);
  color: var(--ochre);
  font-weight: 600;
}

.text-toggle-link {
  margin-left: auto;
  border: none;
  background: transparent;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-toggle-link:hover {
  color: var(--text-primary);
}

/* Compact Telemetry Strip (Grid with Hairline Vertical Dividers) */
.telemetry-strip {
  display: grid;
  grid-template-columns: 1fr 1fr 1.1fr 0.75fr;
  border-bottom: 1px solid var(--border-mid);
  background: var(--bg-subpanel);
}

.tele-cell {
  padding: 6px 10px;
  border-right: 1px solid var(--border-dim);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
}

.tele-cell:last-child {
  border-right: none;
}

.tele-key {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  color: var(--text-muted);
}

.tele-val {
  font-size: 0.82rem;
  font-weight: 600;
}

.tele-cell.low .tele-val {
  color: var(--sage);
}

.tele-cell.spread .tele-val {
  color: var(--ochre);
}

/* Operator Index Drawer */
.brand-insights {
  padding: 8px 10px;
  background: var(--bg-input);
  border-bottom: 1px solid var(--border-mid);
}

.insights-title-row {
  display: flex;
  justify-content: space-between;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.brand-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-bar-row {
  display: grid;
  grid-template-columns: 92px 1fr 48px;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
}

.brand-bar-track {
  height: 5px;
  background: var(--bg-panel);
  border: 1px solid var(--border-dim);
}

.brand-bar-fill {
  height: 100%;
  background: var(--text-secondary);
}

/* Forecourt Cards List — High Density, 6px Radius, 1px Borders, Zero Drop-Shadow */
.station-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 9px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.station-card {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: 6px;
  padding: 9px 10px;
  cursor: pointer;
  position: relative;
  transition: border-color 0.1s, background 0.1s;
}

.station-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-mid);
}

.station-card.selected {
  border-color: var(--text-primary);
  background: var(--bg-card-hover);
}

/* #1 Cheapest Card: Visually Distinct Leader Card (Breaking AI Symmetry) */
.station-card.leader {
  background-color: var(--bg-leader);
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(134, 179, 104, 0.055) 0px,
    rgba(134, 179, 104, 0.055) 4px,
    transparent 4px,
    transparent 10px
  );
  border-color: var(--sage-border);
  border-left: 3px solid var(--sage);
  padding: 10px 11px 10px 10px;
}

.station-card.leader.selected {
  border-color: var(--sage);
  border-left-width: 4px;
}

.leader-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
  padding-bottom: 4px;
  border-bottom: 1px dashed rgba(134, 179, 104, 0.28);
}

.leader-kicker {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--sage);
}

.card-main-grid {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: start;
  gap: 8px;
}

.station-card.leader .card-main-grid {
  grid-template-columns: 1fr auto;
}

.rank-num {
  font-size: 0.7rem;
  color: var(--text-muted);
  padding-top: 2px;
}

.station-identity {
  min-width: 0;
}

.title-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.station-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.station-card.leader .station-title {
  font-size: 0.96rem;
  font-weight: 700;
}

.micro-tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.6rem;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 2px;
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
  flex-shrink: 0;
  text-transform: uppercase;
}

.micro-tag.msa {
  border-color: var(--brick-border);
  color: var(--brick);
  background: var(--brick-bg);
}

.micro-tag.sup {
  border-color: var(--border-mid);
  color: var(--text-secondary);
}

.station-address {
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.postcode-inline {
  color: var(--text-secondary);
  font-size: 0.7rem;
}

.price-block {
  text-align: right;
  flex-shrink: 0;
}

.pump-price {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

.station-card.leader .pump-price {
  font-size: 1.38rem;
}

.pump-price.cheap {
  color: var(--sage);
}
.pump-price.mid {
  color: var(--text-primary);
}
.pump-price.high {
  color: var(--brick);
}

.pump-unit {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 1px;
}

.tank-cost-line {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.card-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px solid var(--border-dim);
  font-size: 0.7rem;
}

.meta-readout {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.delta-badge {
  font-size: 0.67rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 2px;
}

.delta-badge.pos {
  background: var(--sage-bg);
  border: 1px solid var(--sage-border);
  color: var(--sage);
}

.delta-badge.neg {
  background: var(--brick-bg);
  border: 1px solid var(--brick-border);
  color: var(--brick);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.util-mini-btn {
  border: 1px solid var(--border-mid);
  background: var(--bg-subpanel);
  border-radius: 3px;
  height: 22px;
  padding: 0 7px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.67rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.util-mini-btn:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.fav-btn.saved {
  color: var(--ochre);
  border-color: var(--ochre-border);
  background: var(--ochre-bg);
}

.empty-state {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

/* Right OpenStreetMap Stage */
.map-stage {
  position: relative;
  height: 100%;
  width: 100%;
  background: #101214;
}

.osm-map {
  height: 100%;
  width: 100%;
  z-index: 100;
}

/* Muted Dark Filter on Official OpenStreetMap Tiles */
.leaflet-layer.osm-dark-tiles {
  filter: invert(100%) hue-rotate(180deg) brightness(88%) contrast(94%) saturate(55%);
}

/* Roadside Forecourt Price-Tag / Totem Markers (Not Generic Pills) */
.osm-price-marker {
  background: transparent;
  border: none;
}

.totem-pin {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  background: #17191d;
  border: 1px solid #454c59;
  border-radius: 3px;
  color: #f4f4f5;
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 6px));
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
  transition: transform 0.1s ease, border-color 0.1s ease;
}

/* Downward price-tag pointer stem anchored to exact station coordinate */
.totem-pin::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -5px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #454c59;
}

.totem-brand {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 2px 4px;
  display: flex;
  align-items: center;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  background: #272b33;
  color: #d4d4d8;
}

/* Subtle heritage operator tab tints */
.totem-brand.b-tesco { background: #1e3a5f; color: #e2e8f0; }
.totem-brand.b-asda { background: #2d4f28; color: #dcfce7; }
.totem-brand.b-sains { background: #6b3818; color: #ffedd5; }
.totem-brand.b-morri { background: #2c4a34; color: #fef08a; }
.totem-brand.b-costco { background: #5c2228; color: #fee2e2; }
.totem-brand.b-shell { background: #694b16; color: #fef3c7; }
.totem-brand.b-bp { background: #224d2c; color: #dcfce7; }
.totem-brand.b-esso { background: #1e385c; color: #dbeafe; }
.totem-brand.b-jet { background: #5e4b15; color: #fef9c3; }
.totem-brand.b-texaco { background: #572020; color: #fee2e2; }
.totem-brand.b-gulf { background: #5c3a19; color: #ffedd5; }

.totem-price {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 5px;
  letter-spacing: -0.02em;
}

.totem-pin.cheap {
  border-color: #6b9451;
}
.totem-pin.cheap::after {
  border-top-color: #6b9451;
}
.totem-pin.cheap .totem-price {
  color: #98c77a;
  background: #1a2417;
}

.totem-pin.mid .totem-price {
  color: #e4e4e7;
}

.totem-pin.high {
  border-color: #8c4a42;
}
.totem-pin.high::after {
  border-top-color: #8c4a42;
}
.totem-pin.high .totem-price {
  color: #d6857c;
}

.totem-pin:hover,
.totem-pin.active {
  transform: translate(-50%, calc(-100% - 8px)) scale(1.1);
  border-color: #f4f4f5;
  z-index: 999 !important;
}
.totem-pin.active::after {
  border-top-color: #f4f4f5;
}

/* Search Centre Crosshair */
.center-pulse-icon {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  transform: rotate(45deg);
  background: var(--ochre);
  border: 2px solid #111215;
}

/* Utilitarian Map Overlays */
.map-requery-btn {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 600;
  background: var(--panel-overlay);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  height: 28px;
  padding: 0 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.map-requery-btn:hover {
  border-color: var(--text-primary);
}

.route-floating-banner {
  position: absolute;
  top: 46px;
  left: 12px;
  max-width: calc(100% - 24px);
  z-index: 600;
  background: var(--panel-overlay);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--steel);
  border-radius: 4px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.route-banner-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  font-size: 0.76rem;
}

.route-badge {
  background: var(--steel-bg);
  border: 1px solid rgba(123, 163, 196, 0.4);
  color: var(--steel);
  font-size: 0.64rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 2px;
}

.map-style-switcher {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 600;
  background: var(--panel-overlay);
  border: 1px solid var(--border-mid);
  border-radius: 4px;
  display: inline-flex;
  overflow: hidden;
}

.tile-btn {
  border: none;
  border-right: 1px solid var(--border-dim);
  background: transparent;
  height: 26px;
  padding: 0 9px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.69rem;
  color: var(--text-muted);
  cursor: pointer;
}

.tile-btn:last-child {
  border-right: none;
}

.tile-btn.active {
  background: var(--bg-button);
  color: var(--text-primary);
  font-weight: 600;
}

.map-legend {
  position: absolute;
  bottom: 22px;
  left: 12px;
  z-index: 500;
  background: var(--panel-overlay);
  border: 1px solid var(--border-mid);
  border-radius: 4px;
  padding: 4px 9px;
  display: flex;
  gap: 10px;
  font-size: 0.68rem;
  color: var(--text-secondary);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.swatch {
  width: 8px;
  height: 8px;
  border-radius: 1px;
  display: inline-block;
}
.swatch.cheap { background: var(--sage); }
.swatch.mid { background: #71717a; }
.swatch.high { background: var(--brick); }

/* Sleek, Compact Utilitarian Forecourt Details Panel */
.detail-drawer {
  position: absolute;
  bottom: 22px;
  right: 54px;
  width: 334px;
  max-width: calc(100% - 68px);
  z-index: 650;
  background: var(--panel-overlay);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 11px 12px;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-dim);
}

.drawer-kicker-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.drawer-operator {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.64rem;
  text-transform: uppercase;
  color: var(--ochre);
  font-weight: 600;
}

.drawer-header h3 {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.2;
}

.drawer-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.35;
}

.copy-pc-btn {
  display: inline-block;
  border: 1px solid var(--border-mid);
  background: var(--bg-input);
  border-radius: 2px;
  padding: 0 5px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.66rem;
  color: var(--text-primary);
  cursor: pointer;
}

.copy-pc-btn:hover {
  border-color: var(--text-secondary);
}

/* Compact Tabular Fuel Grade Ticker */
.drawer-grades-table {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(68px, 1fr));
  border: 1px solid var(--border-dim);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 9px;
  background: var(--bg-input);
}

.grade-cell {
  padding: 5px 6px;
  border-right: 1px solid var(--border-dim);
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.grade-cell:last-child {
  border-right: none;
}

.grade-cell.highlight {
  background: var(--sage-bg);
}

.grade-cell .g-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.6rem;
  color: var(--text-muted);
}

.grade-cell.highlight .g-label {
  color: var(--sage);
  font-weight: 600;
}

.grade-cell .g-price {
  font-size: 0.88rem;
  font-weight: 700;
}

.drawer-calc-strip {
  margin-top: 8px;
  padding: 5px 8px;
  background: var(--bg-subpanel);
  border: 1px solid var(--border-dim);
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  font-size: 0.71rem;
  color: var(--text-secondary);
}

.drawer-amenities {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.amenity-tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  padding: 1px 5px;
  border-radius: 2px;
  background: var(--bg-subpanel);
  border: 1px solid var(--border-dim);
  color: var(--text-muted);
}

/* Standard Utilitarian Web Tool Action Row (No Big Glossy App Buttons) */
.drawer-actions-bar {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr 0.85fr;
  gap: 4px;
  margin-top: 9px;
}

.util-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 27px;
  padding: 0 6px;
  border-radius: 3px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--border-mid);
  background: var(--bg-button);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

.util-nav-btn:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.util-nav-btn.primary {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: var(--bg-app);
  font-weight: 600;
}

.util-nav-btn.primary:hover {
  opacity: 0.9;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 11, 13, 0.76);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 3000;
}

.modal-card {
  width: 100%;
  max-width: 470px;
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 18px 20px;
}

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

.modal-badge-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.gov-tag {
  font-size: 0.63rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 2px;
  background: #1d5ca3;
  color: #f4f4f5;
}

.mode-badge {
  font-size: 0.63rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 2px;
  border: 1px solid var(--sage-border);
  background: var(--sage-bg);
  color: var(--sage);
}

.modal-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
}

.modal-header p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.4;
}

.sync-status-box {
  margin-top: 12px;
  padding: 9px 11px;
  border-radius: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border-mid);
}

.sync-status-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
}

.sync-msg {
  font-size: 0.74rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.modal-actions {
  display: flex;
  gap: 7px;
}

.util-action-primary {
  flex: 1;
  height: 32px;
  background: var(--text-primary);
  color: var(--bg-app);
  border: 1px solid var(--text-primary);
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.util-action-secondary {
  height: 32px;
  padding: 0 12px;
  background: var(--bg-button);
  border: 1px solid var(--border-mid);
  border-radius: 4px;
  font-size: 0.78rem;
  cursor: pointer;
}

.modal-footer-notes {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border-dim);
  font-size: 0.71rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 5px;
  line-height: 1.45;
}

code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.9em;
  background: var(--bg-input);
  border: 1px solid var(--border-dim);
  padding: 0 4px;
  border-radius: 2px;
}

.muted-xs {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4000;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toast {
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 7px 12px;
  border-radius: 4px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.74rem;
}

/* Leaflet Control Polish */
.leaflet-bar {
  border: 1px solid var(--border-mid) !important;
  border-radius: 4px !important;
  box-shadow: none !important;
  overflow: hidden;
}

.leaflet-bar a {
  background: var(--panel-overlay) !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--border-dim) !important;
  width: 28px !important;
  height: 28px !important;
  line-height: 28px !important;
}

/* Responsive Layout */
@media (max-width: 1220px) {
  .topbar {
    flex-wrap: wrap;
    padding: 7px 10px;
  }
  .search-cluster {
    order: 3;
    max-width: 100%;
    flex-basis: 100%;
  }
  .workspace {
    grid-template-columns: 396px 1fr;
  }
}

@media (max-width: 880px) {
  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: 45% 55%;
  }
  .sidebar {
    order: 2;
    border-right: none;
    border-top: 1px solid var(--border-mid);
  }
  .map-stage {
    order: 1;
  }
  .detail-drawer {
    width: calc(100% - 62px);
    right: 48px;
    bottom: 10px;
  }
}
