:root {
  --brand: #142b49;
  --brand-2: #2a4a75;
  --accent: #d6b24c;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #edf2f7;
  --text: #142b49;
  --muted: #677382;
  --line: #e4e9ee;
  --cheap: #1f9d55;
  --mid: #e0a100;
  --pricey: #d64545;
  --shadow: 0 6px 24px rgba(20, 43, 73, .14);
  --radius: 14px;
  --top-h: 60px;
  --fuels-h: 50px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .fab.locate { color: var(--accent); }
  :root:not([data-theme="light"]) {
    --bg: #0b1626; --surface: #112238; --surface-2: #1a2f4b; --text: #edf2f7;
    --muted: #9aa8b8; --line: #243a57; --shadow: 0 6px 24px rgba(0, 0, 0, .45);
  }
}
:root[data-theme="dark"] .fab.locate { color: var(--accent); }
:root[data-theme="dark"] {
  --bg: #0b1626; --surface: #112238; --surface-2: #1a2f4b; --text: #edf2f7;
  --muted: #9aa8b8; --line: #243a57; --shadow: 0 6px 24px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: Poppins, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text);
  display: flex; flex-direction: column; overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ---------- header ---------- */
.top {
  height: var(--top-h); flex: none;
  display: flex; align-items: center; gap: 14px; padding: 0 16px;
  background: var(--brand); color: #fff; z-index: 1100; position: relative;
}
.logo { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-family: "Libre Baskerville", Georgia, serif; font-weight: 700; font-size: 19px; }
.logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.logo-name { color: #fff; font-size: 17px; font-weight: 700; white-space: nowrap; }
.logo-sub { font-family: Poppins, system-ui, sans-serif; font-size: 10px; font-weight: 600; letter-spacing: 1.4px; text-transform: uppercase; color: var(--accent); white-space: nowrap; margin-top: 2px; }
.search { position: relative; flex: 1; max-width: 560px; display: flex; align-items: center; }
.search > svg { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; height: 40px; border: 0; border-radius: 999px;
  padding: 0 14px 0 38px; background: var(--surface); color: var(--text); outline: none;
}
.search input:focus { box-shadow: 0 0 0 3px rgba(214, 178, 76, .6); }
.suggest {
  position: absolute; top: 46px; left: 0; right: 0; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); color: var(--text); border-radius: 12px; box-shadow: var(--shadow);
  max-height: 60vh; overflow: auto;
}
.suggest li { padding: 9px 10px; border-radius: 8px; cursor: pointer; display: flex; gap: 10px; align-items: center; }
.suggest li:hover, .suggest li.on { background: var(--surface-2); }
.suggest .ico { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: 13px; }
.suggest small { display: block; color: var(--muted); font-size: 12px; }
.suggest .sec { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); padding: 8px 10px 4px; cursor: default; }
.suggest .sec:hover { background: none; }
#lang { background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 8px; height: 34px; padding: 0 8px; }
#lang option { color: #000; }

/* ---------- fuel chips ---------- */
.fuels {
  height: var(--fuels-h); flex: none; display: flex; gap: 8px; align-items: center;
  padding: 0 16px; overflow-x: auto; background: var(--surface); border-bottom: 1px solid var(--line);
  scrollbar-width: none; z-index: 1090; position: relative;
}
.fuels::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 600; font-size: 14px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip .dot { width: 9px; height: 9px; border-radius: 50%; }
.chip.on { background: var(--brand); border-color: var(--accent); color: #fff; box-shadow: inset 0 0 0 1px var(--accent); }

/* ---------- pestañas Mapa / TCS / TankBillig ---------- */
.views { flex: none; display: flex; background: var(--surface-2); border-radius: 999px; padding: 3px; margin-right: 6px; }
.views button { border: 0; background: none; height: 28px; padding: 0 12px; border-radius: 999px; font-weight: 600; font-size: 13px; color: var(--muted); white-space: nowrap; }
.views button.on { background: var(--brand); color: #fff; box-shadow: inset 0 0 0 1px var(--accent); }
.sep { flex: none; width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.tcs-note { flex: none; font-size: 12px; color: var(--muted); white-space: nowrap; }
.tcs-note a { color: var(--text); font-weight: 600; }
.extview { position: absolute; inset: 0; z-index: 1050; background: var(--surface); overflow: hidden; }
.extview { display: flex; flex-direction: column; }
.extview iframe { width: 100%; flex: 1; min-height: 0; border: 0; display: block; }
.tb-hint { flex: none; background: var(--accent); color: #142b49; font-size: 12px; font-weight: 600; padding: 8px 14px; line-height: 1.4; }
.extview[hidden], .tb-hint[hidden] { display: none; }
body.view-tcs .search { visibility: hidden; }
body.view-ext .listbtn { display: none !important; }

/* ---------- layout ---------- */
.layout { flex: 1; display: flex; min-height: 0; position: relative; }
.panel {
  width: 380px; flex: none; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0; z-index: 500;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 8px; gap: 10px; }
.panel-title { font-weight: 700; font-size: 16px; font-family: "Libre Baskerville", Georgia, serif; }
.panel-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.sort { display: flex; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.sort button { border: 0; background: none; padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); }
.sort button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 4px 16px 12px; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.stat span { display: block; font-size: 11px; color: var(--muted); }
.stat b { font-size: 17px; font-variant-numeric: tabular-nums; }
.list { list-style: none; margin: 0; padding: 0 8px 16px; overflow-y: auto; flex: 1; }
.item {
  display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center;
  padding: 10px 8px; border-radius: 12px; cursor: pointer;
}
.item:hover, .item.on { background: var(--surface-2); }
.item .name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .addr { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.item .price { text-align: right; }
.item .price b { font-size: 18px; font-variant-numeric: tabular-nums; }
.item .price small { display: block; font-size: 11px; color: var(--muted); }
.empty { padding: 30px 16px; text-align: center; color: var(--muted); font-size: 14px; }

.brand-badge {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  font-weight: 800; font-size: 11px; color: #fff; letter-spacing: -.2px; text-transform: uppercase;
}

/* ---------- map ---------- */
.mapwrap { flex: 1; position: relative; min-width: 0; }
#map { position: absolute; inset: 0; background: var(--surface-2); }
.demo-badge {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 450;
  background: rgba(20, 43, 73, .85); color: #fff; font-size: 12px; padding: 6px 12px; border-radius: 999px;
  pointer-events: none; white-space: nowrap; max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis;
}
.fab {
  position: absolute; z-index: 450; border: 0; background: var(--surface); color: var(--brand);
  box-shadow: var(--shadow); border-radius: 12px; height: 44px; min-width: 44px;
  display: grid; place-items: center; font-weight: 700;
}
.locate { right: 10px; bottom: 100px; }
.listbtn { display: none; left: 50%; transform: translateX(-50%); bottom: 24px; padding: 0 20px; border-radius: 999px; background: var(--brand); color: #fff; }

.pin {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px 3px 3px; border-radius: 999px;
  background: var(--surface); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.25);
  font-weight: 700; font-size: 13px; white-space: nowrap; border: 2px solid var(--c);
  transform: translate(-50%, -100%); position: relative; font-variant-numeric: tabular-nums;
}
.pin::after {
  content: ""; position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--c); border-bottom: 0;
}
.pin i { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 8px; color: #fff; font-weight: 800; }
.pin.sel { background: var(--c); color: #fff; z-index: 1000; }
.pin.na { --c: #9aa7a5; color: var(--muted); font-weight: 600; }
.leaflet-marker-icon.pin-wrap { background: none; border: 0; }

.cluster {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--surface); border: 3px solid var(--c); border-radius: 999px; box-shadow: 0 2px 10px rgba(0,0,0,.25);
  color: var(--text); width: 100%; height: 100%; line-height: 1.05;
}
.cluster b { font-size: 13px; font-variant-numeric: tabular-nums; }
.cluster small { font-size: 9px; color: var(--muted); font-weight: 600; }
.leaflet-marker-icon.cluster-wrap { background: none; }
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: #2b7cff; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(43,124,255,.25); }

/* ---------- detail ---------- */
.detail {
  position: absolute; left: 0; top: 0; bottom: 0; width: 380px; z-index: 600;
  background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto;
  padding: 16px 16px 28px; box-shadow: var(--shadow);
}
.d-head { display: flex; gap: 12px; align-items: flex-start; }
.d-head h2 { margin: 0; font-size: 19px; line-height: 1.25; font-family: "Libre Baskerville", Georgia, serif; }
.d-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.d-close { margin-left: auto; border: 0; background: var(--surface-2); width: 34px; height: 34px; border-radius: 50%; font-size: 18px; flex: none; }
.d-actions { display: flex; gap: 8px; margin: 14px 0 6px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px; text-decoration: none; color: var(--text);
}
.btn.primary { background: var(--accent); color: #142b49; border-color: var(--accent); }
.btn.small { height: 32px; padding: 0 10px; font-size: 13px; }
.d-hours { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.fuelrow { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 10px; }
.fuelrow.cur { border-color: var(--brand-2); box-shadow: inset 0 0 0 1px var(--brand-2); }
.fuelrow .r1 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.fuelrow .fname { font-weight: 600; }
.fuelrow .fprice { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.fuelrow .fprice small { font-size: 12px; font-weight: 500; color: var(--muted); }
.fuelrow .r2 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 4px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); font-size: 11px; font-weight: 600; }
.tag.ok { color: var(--cheap); }
.tag.mine { background: var(--accent); color: #2b2205; }
.fuelrow .r3 { display: flex; gap: 8px; margin-top: 10px; }
.edit { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.edit input { width: 110px; height: 36px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; background: var(--surface); font-variant-numeric: tabular-nums; }
.d-note { font-size: 12px; color: var(--muted); margin-top: 16px; line-height: 1.5; }

.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 3000;
  background: #142b49; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow);
}

/* ---------- mobile ---------- */
@media (max-width: 760px) {
  :root { --top-h: 56px; }
  .top { gap: 10px; padding: 0 12px; }
  .logo span { display: none; }
  .panel { position: absolute; inset: 0; width: auto; border: 0; transform: translateY(100%); transition: transform .25s ease; z-index: 700; }
  body.show-list .panel { transform: none; }
  .listbtn { display: grid; z-index: 800; position: fixed; }
  body.show-list .locate { display: none; }
  .detail {
    top: auto; width: auto; right: 0; max-height: 72%; border-right: 0; border-radius: 18px 18px 0 0; z-index: 900;
    padding-top: 22px;
  }
  .detail::before { content: ""; position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 40px; height: 4px; border-radius: 2px; background: var(--line); }
  .demo-badge { top: 8px; font-size: 11px; }
  .leaflet-control-zoom { display: none; }
  .locate { bottom: 84px; }
}
