:root {
  color-scheme: light;
  --navy-950: #06142f;
  --navy-900: #071b3d;
  --navy-800: #0b2b5b;
  --blue-600: #087cff;
  --blue-500: #1f91ff;
  --orange-500: #ff9d16;
  --green-500: #15bd87;
  --red-500: #f05263;
  --ink: #10213d;
  --muted: #687792;
  --line: #dfe7f3;
  --paper: #fff;
  --shadow: 0 18px 52px rgb(7 27 61 / 18%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; color: var(--ink); }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; clip: rect(0,0,0,0); overflow: hidden; white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 999; top: -4rem; left: 1rem; background: #fff; color: var(--navy-900); padding: .7rem 1rem; border-radius: .7rem; }
.skip-link:focus { top: 1rem; }

.app-shell, .map { position: fixed; inset: 0; }
.map { background: #e8eef5; }
.maplibregl-ctrl-bottom-left { left: 8px; bottom: max(164px, calc(env(safe-area-inset-bottom) + 150px)); }
.maplibregl-ctrl-attrib { font-size: 10px; border-radius: 8px; }

.topbar {
  position: fixed; z-index: 20; top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  width: min(1180px, calc(100% - 28px)); display: grid; grid-template-columns: auto minmax(260px, 640px) auto;
  gap: 14px; align-items: center; pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand, .search-wrap, .location-button { background: rgb(255 255 255 / 95%); box-shadow: 0 10px 32px rgb(7 27 61 / 15%); backdrop-filter: blur(18px); }
.brand { display: flex; align-items: center; gap: 10px; padding: 9px 16px 9px 9px; border-radius: 18px; color: var(--navy-900); text-decoration: none; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; color: white; background: linear-gradient(145deg, var(--blue-500), #0758d1); box-shadow: inset 0 0 0 2px rgb(255 255 255 / 30%); }
.brand b, .brand small { display: block; }
.brand b { font-size: 16px; }
.brand small { color: var(--muted); font-size: 10px; }
.search-wrap { position: relative; display: flex; border-radius: 18px; min-width: 0; }
.search-wrap::before { content: "⌕"; position: absolute; left: 16px; top: 50%; transform: translateY(-52%); color: var(--blue-600); font-size: 26px; }
#place-search { width: 100%; height: 60px; padding: 0 50px 0 52px; border: 1px solid transparent; border-radius: 18px; outline: 0; color: var(--ink); background: transparent; font-size: 17px; }
#place-search:focus { border-color: #8bc6ff; box-shadow: 0 0 0 4px rgb(31 145 255 / 13%); }
.icon-button { border: 0; background: transparent; color: var(--muted); width: 42px; height: 42px; border-radius: 50%; font-size: 22px; }
.icon-button:hover { background: #edf4fd; color: var(--navy-900); }
.search-clear { position: absolute; right: 8px; top: 9px; }
.suggestions { position: absolute; top: calc(100% + 8px); left: 0; right: 0; max-height: min(52vh, 420px); overflow: auto; padding: 7px; border-radius: 18px; background: #fff; box-shadow: var(--shadow); }
.suggestion { display: flex; width: 100%; gap: 11px; padding: 12px; border: 0; border-radius: 12px; text-align: left; background: transparent; color: var(--ink); }
.suggestion:hover, .suggestion:focus { background: #eef6ff; outline: none; }
.suggestion span:first-child { flex: 0 0 auto; color: var(--blue-600); }
.suggestion b, .suggestion small { display: block; }
.suggestion small { color: var(--muted); margin-top: 2px; }
.location-button { display: flex; align-items: center; gap: 7px; height: 60px; padding: 0 18px; border: 0; border-radius: 18px; color: var(--navy-900); font-weight: 700; }
.location-button:first-letter { color: var(--blue-600); }

.fuel-filters { position: fixed; z-index: 15; top: calc(max(14px, env(safe-area-inset-top)) + 76px); left: 50%; transform: translateX(-50%); display: flex; gap: 7px; max-width: calc(100% - 24px); overflow-x: auto; padding: 3px; scrollbar-width: none; }
.fuel-filters::-webkit-scrollbar { display: none; }
.fuel-chip { white-space: nowrap; border: 1px solid rgb(255 255 255 / 75%); border-radius: 999px; padding: 10px 15px; color: #34435d; background: rgb(255 255 255 / 94%); box-shadow: 0 7px 22px rgb(7 27 61 / 12%); }
.fuel-chip.active { color: #fff; border-color: var(--navy-900); background: var(--navy-900); }
.fuel-chip.success.active { border-color: var(--green-500); background: var(--green-500); }

.chat-button { position: fixed; z-index: 15; top: calc(max(14px, env(safe-area-inset-top)) + 130px); left: 50%; transform: translateX(-50%); display: grid; grid-template-columns: auto auto; column-gap: 8px; align-items: center; padding: 10px 18px; border: 1px solid rgb(255 255 255 / 25%); border-radius: 999px; color: #fff; background: linear-gradient(135deg, #0b2b5b, #087cff); box-shadow: 0 12px 30px rgb(0 81 184 / 30%); }
.chat-button > span:nth-child(2) { font-weight: 750; }
.chat-button small { grid-column: 2; text-align: left; color: #dcecff; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.add-station-button { position:fixed; z-index:14; left:18px; bottom:max(165px,calc(env(safe-area-inset-bottom) + 152px)); display:flex; align-items:center; gap:8px; padding:9px 14px 9px 9px; border:0; border-radius:999px; color:#fff; background:var(--navy-900); box-shadow:0 10px 30px rgb(7 27 61 / 23%); font-weight:750; }
.add-station-button span { display:grid; place-items:center; width:30px; height:30px; border-radius:50%; color:var(--navy-900); background:var(--orange-500); font-size:22px; }

.map-actions { position: fixed; z-index: 12; right: 18px; top: 48%; display: grid; overflow: hidden; border-radius: 16px; background: #fff; box-shadow: 0 10px 30px rgb(7 27 61 / 16%); }
.map-action { width: 48px; height: 48px; border: 0; color: var(--navy-900); background: #fff; font-size: 26px; }
.map-action + .map-action { border-top: 1px solid var(--line); }
.map-action:hover { background: #eef6ff; }

.location-prompt { position: fixed; z-index: 18; top: 196px; left: 50%; transform: translateX(-50%); width: min(540px, calc(100% - 28px)); display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 15px 44px 15px 15px; border: 1px solid #cfe4ff; border-radius: 18px; background: #fff; box-shadow: var(--shadow); }
.location-prompt p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.prompt-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: #e9f4ff; color: var(--blue-600); font-size: 24px; }
.prompt-close { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: var(--navy-900); color: #fff; font-size: 20px; line-height: 1; display: grid; place-items: center; cursor: pointer; z-index: 2; }
.prompt-close:hover { background: var(--blue-600); }
.primary { border: 0; border-radius: 13px; color: #fff; background: linear-gradient(135deg, var(--blue-600), #0759d5); font-weight: 750; }
.primary.small { padding: 10px 14px; }

.sheet { position: fixed; z-index: 16; left: 50%; bottom: 0; width: min(780px, 100%); transform: translate(-50%, calc(100% - 142px)); max-height: min(78vh, 760px); padding: 6px 20px max(16px, env(safe-area-inset-bottom)); border-radius: 28px 28px 0 0; background: rgb(255 255 255 / 98%); box-shadow: 0 -16px 48px rgb(7 27 61 / 18%); transition: transform .28s ease; }
.sheet.open { transform: translate(-50%, 0); }
.sheet-handle { display: grid; place-items: center; width: 100%; height: 22px; border: 0; background: transparent; }
.sheet-handle span { width: 52px; height: 5px; border-radius: 99px; background: #d7dfeb; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; min-height: 69px; }
.sheet h1 { margin: 0; color: var(--navy-900); font-size: 23px; }
.sheet-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.sort-row { display: flex; gap: 6px; margin: 4px 0 12px; overflow-x: auto; scrollbar-width: none; }
.sort { flex: 1 0 auto; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #fff; color: var(--muted); }
.sort.active { color: var(--blue-600); border-color: #8ec9ff; background: #edf7ff; }
.station-list { max-height: calc(min(78vh, 760px) - 170px); overflow-y: auto; overscroll-behavior: contain; padding: 2px 2px 10px; }
.station-card { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; width: 100%; margin: 8px 0; padding: 14px; border: 1px solid var(--line); border-radius: 19px; background: #fff; text-align: left; color: var(--ink); box-shadow: 0 5px 18px rgb(18 44 82 / 6%); }
.station-card:hover { border-color: #9ecfff; transform: translateY(-1px); }
.brand-badge { display: grid; place-items: center; align-self: start; width: 51px; height: 51px; padding: 4px; border-radius: 15px; color: #fff; background: var(--brand, var(--navy-800)); font-size: 12px; font-weight: 850; text-align: center; line-height: 1.05; box-shadow: inset 0 0 0 2px rgb(255 255 255 / 20%); }
.station-main { min-width: 0; }
.station-main h3 { margin: 1px 0 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--navy-950); font-size: 17px; }
.station-main p { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.fuel-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.fuel-tag { display: inline-flex; align-items: center; gap: 5px; width: max-content; padding: 5px 8px; border-radius: 9px; background: #eaf3ff; color: var(--navy-800); font-size: 12px; font-weight: 750; }
.fuel-tag.available { background: #e2f8ef; color: #087c57; }
.fuel-tag.low { background: #fff1d8; color: #925500; }
.fuel-tag.unavailable { background: #ffe8ec; color: #a62b3e; }
.distance { color: var(--navy-800); font-weight: 800; white-space: nowrap; }
.sheet-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px 13px; padding: 14px 5px 5px; color: #8a96aa; font-size: 11px; }
.sheet-footer a { color: #6c7a91; }
.sheet-footer span { width: 100%; text-align: center; }
.empty-state { padding: 30px 18px; text-align: center; color: var(--muted); }

.station-marker { position: relative; display: block; border: 0; padding: 0; background: transparent; line-height: 1; }
.station-marker-card { position: relative; display: block; min-width: 110px; max-width: 220px; padding: 9px 10px 8px; border: 2px solid var(--orange-500); border-radius: 15px; color: #fff; background: linear-gradient(145deg, var(--navy-900), #123b75); box-shadow: 0 8px 20px rgb(5 24 55 / 28%); }
.station-marker-name { display: block; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 850; }
.station-marker-fuels { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.marker-fuel { width: max-content; padding: 3px 6px; border-radius: 7px; color: #fff; background: rgb(255 255 255 / 14%); font-size: 10px; font-weight: 750; }
.marker-fuel.available { color: #082d24; background: #65e4ba; }
.marker-fuel.low { color: #533300; background: #ffc760; }
.marker-dot { width: 34px; height: 34px; display: grid; place-items: center; border: 3px solid var(--orange-500); border-radius: 50%; color: #fff; background: var(--navy-800); box-shadow: 0 6px 15px rgb(7 27 61 / 27%); font-size: 10px; font-weight: 850; }
.marker-cluster { width: 42px; height: 42px; display: grid; place-items: center; border: 3px solid rgb(255 255 255 / 90%); border-radius: 50%; color: #fff; background: linear-gradient(145deg, var(--blue-600), var(--navy-900)); box-shadow: 0 8px 18px rgb(8 124 255 / 38%); font-size: 14px; font-weight: 850; transition: transform .15s ease; }
.station-marker-cluster:hover .marker-cluster { transform: scale(1.12); }

.panel-dialog { width: min(620px, calc(100% - 24px)); max-height: min(88vh, 780px); padding: 0; overflow: hidden; border: 0; border-radius: 25px; color: var(--ink); background: #fff; box-shadow: 0 30px 90px rgb(3 18 43 / 40%); }
.panel-dialog::backdrop { background: rgb(2 14 34 / 55%); backdrop-filter: blur(3px); }
.dialog-close-row { position: absolute; z-index: 2; right: 12px; top: 12px; margin: 0; }
.dialog-close { width: 42px; height: 42px; border: 0; border-radius: 50%; background: #edf2f8; color: var(--navy-900); font-size: 24px; }
.detail-scroll { max-height: min(88vh, 780px); overflow-y: auto; padding: 26px; }
.detail-hero { padding-right: 48px; }
.detail-hero h2 { margin: 0; color: var(--navy-950); font-size: 27px; }
.detail-hero p { margin: 6px 0 0; color: var(--muted); }
.status-question { margin: 22px 0 12px; font-size: 20px; }
.detail-fuels { display: grid; gap: 8px; }
.fuel-editor { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 9px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 15px; background: #f9fbfe; }
.fuel-editor b { color: var(--navy-800); }
.fuel-editor input { width: 94px; padding: 9px; border: 1px solid #cad6e6; border-radius: 10px; }
.status-select { padding: 9px; border: 1px solid #cad6e6; border-radius: 10px; color: var(--ink); background: #fff; }
.report-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 13px; }
.field { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.field input { min-width: 0; padding: 11px; border: 1px solid #cad6e6; border-radius: 11px; }
.submit-report { width: 100%; margin-top: 14px; padding: 13px; }
.route-link { display: inline-flex; margin-top: 13px; color: var(--blue-600); font-weight: 700; }
.dialog-title { display: flex; justify-content: space-between; align-items: center; padding: 20px 20px 13px; border-bottom: 1px solid var(--line); }
.dialog-title h2 { margin: 0; }
.dialog-title p { margin: 3px 0 0; color: var(--muted); }
.chat-messages { height: min(58vh, 520px); overflow-y: auto; padding: 16px; background: #f5f8fc; }
.chat-message { width: fit-content; max-width: 84%; margin: 0 0 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px 15px 15px; background: #fff; }
.chat-message b { font-size: 12px; color: var(--navy-800); }
.chat-message time { margin-left: 7px; color: #8b97a9; font-size: 10px; }
.chat-message p { margin: 5px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-compose { display: grid; grid-template-columns: 1fr auto; gap: 9px; padding: 13px; border-top: 1px solid var(--line); }
.chat-compose textarea { resize: none; padding: 11px; border: 1px solid #cbd8e8; border-radius: 14px; outline: none; }
.station-comments { margin-top:22px; padding-top:18px; border-top:1px solid var(--line); }
.station-comments h3 { margin:0 0 10px; }
.station-comment-list { display:grid; gap:7px; max-height:230px; overflow-y:auto; padding:8px; border-radius:13px; background:#f5f8fc; }
.station-comment { padding:9px 10px; border-radius:11px; background:#fff; }
.station-comment b { font-size:11px; color:var(--blue-600); }
.station-comment p { margin:4px 0 0; white-space:pre-wrap; overflow-wrap:anywhere; }
.station-comment-form { display:grid; grid-template-columns:1fr auto; gap:7px; margin-top:8px; }
.station-comment-form input { min-width:0; padding:11px; border:1px solid #cad6e6; border-radius:11px; }
.station-comment-form button { padding:0 15px; }
.add-station-form { display:grid; grid-template-columns:1fr 1fr; gap:12px; padding:20px; }
.add-station-form .wide { grid-column:1 / -1; }
.send-button { width: 52px; border: 0; border-radius: 15px; color: #fff; background: var(--blue-600); font-size: 20px; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: max(164px, calc(env(safe-area-inset-bottom) + 150px)); transform: translateX(-50%); max-width: calc(100% - 30px); padding: 11px 16px; border-radius: 12px; color: #fff; background: var(--navy-900); box-shadow: var(--shadow); }

@media (max-width: 760px) {
  .topbar { grid-template-columns: 1fr auto; gap: 8px; width: calc(100% - 20px); }
  .brand { display: none; }
  .search-wrap { min-width: 0; }
  #place-search { height: 54px; }
  .search-clear { top: 6px; }
  .location-button { width: 54px; height: 54px; padding: 0; justify-content: center; font-size: 22px; }
  .location-button span { display: none; }
  .fuel-filters { top: calc(max(14px, env(safe-area-inset-top)) + 64px); justify-content: flex-start; }
  .chat-button { top: calc(max(14px, env(safe-area-inset-top)) + 116px); }
  .map-actions { right: 10px; }
  .location-prompt { top: 178px; grid-template-columns: auto 1fr; }
  .location-prompt .primary { grid-column: 1 / -1; }
  .sheet { padding-inline: 14px; }
  .panel-dialog { width: 100%; max-width: none; max-height: 92vh; margin: auto 0 0; border-radius: 25px 25px 0 0; }
  .detail-scroll { max-height: 92vh; padding: 23px 17px max(24px, env(safe-area-inset-bottom)); }
  .fuel-editor { grid-template-columns: 1fr auto; }
  .fuel-editor input { grid-column: 1 / -1; width: 100%; }
  .chat-messages { height: 62vh; }
  .add-station-button { left:10px; font-size:12px; }
  .add-station-form { grid-template-columns:1fr; max-height:75vh; overflow-y:auto; }
  .add-station-form .wide { grid-column:auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
