:root {
  --bg: #08111f;
  --panel: rgba(12, 24, 42, .92);
  --panel-solid: #0d192b;
  --panel-soft: #12213a;
  --line: rgba(255,255,255,.10);
  --text: #f4f7ff;
  --muted: #94a4be;
  --accent: #6d5dfc;
  --accent-2: #24c8a5;
  --good: #2acb7b;
  --warn: #f5b83b;
  --bad: #ff5b6e;
  --shadow: 0 24px 80px rgba(0,0,0,.34);
  --radius: 22px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.glass { background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.brand-lockup { display: flex; gap: 13px; align-items: center; }
.brand-lockup h1, .brand-lockup p { margin: 0; }
.brand-lockup h1 { font-size: 26px; }
.brand-lockup p, .brand-lockup small { color: var(--muted); display: block; margin-top: 2px; }
.brand-lockup.compact strong { display: block; font-size: 16px; }
.brand-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: linear-gradient(135deg, var(--accent), #2f9bff); box-shadow: 0 10px 24px rgba(109,93,252,.35); }
.primary, .secondary, .ghost, .icon-button { border: 0; border-radius: 12px; min-height: 42px; padding: 0 16px; font-weight: 700; }
.primary { background: linear-gradient(135deg, var(--accent), #477bff); color: white; box-shadow: 0 10px 26px rgba(109,93,252,.28); }
.secondary { background: var(--panel-soft); color: var(--text); display: inline-flex; align-items: center; justify-content: center; }
.ghost { background: rgba(255,255,255,.055); border: 1px solid var(--line); color: var(--text); display: inline-flex; align-items: center; justify-content: center; }
.ghost:hover, .secondary:hover { background: rgba(255,255,255,.1); }
.icon-only { width: 42px; padding: 0; }
.alert { border-radius: 13px; padding: 12px 14px; margin-bottom: 16px; }
.alert.error { background: rgba(255,91,110,.13); border: 1px solid rgba(255,91,110,.35); }
.alert.success { background: rgba(42,203,123,.13); border: 1px solid rgba(42,203,123,.35); }

/* Auth */
.auth-page { background: radial-gradient(circle at 15% 15%, #1e2e78 0, transparent 30%), radial-gradient(circle at 85% 80%, #0f6e67 0, transparent 28%), var(--bg); }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(440px, 100%); padding: 30px; border-radius: 28px; }
.form-stack { display: grid; gap: 16px; margin: 26px 0 18px; }
label { display: grid; gap: 8px; color: #dce5f5; font-size: 14px; font-weight: 650; }
input, select { width: 100%; min-height: 44px; padding: 0 13px; color: var(--text); background: #091527; border: 1px solid var(--line); border-radius: 12px; outline: none; }
input:focus, select:focus { border-color: rgba(109,93,252,.8); box-shadow: 0 0 0 3px rgba(109,93,252,.16); }
.subtle-link { color: var(--muted); font-size: 14px; }

/* Map */
.map-page { height: 100vh; overflow: hidden; }
#map { position: fixed; inset: 0; background: #dbe3d4; }
.topbar { position: fixed; z-index: 1000; top: 14px; left: 18px; right: 18px; height: 64px; border-radius: 19px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.fuel-strip { position: fixed; z-index: 1000; top: 90px; left: 50%; transform: translateX(-50%); border-radius: 16px; padding: 7px; display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 430px); }
.fuel-chips { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; }
.fuel-chip { white-space: nowrap; border: 0; color: var(--muted); background: transparent; min-height: 38px; padding: 0 13px; border-radius: 10px; font-weight: 800; }
.fuel-chip.active { color: white; background: linear-gradient(135deg, var(--accent), #477bff); }
.switch-row { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 7px; white-space: nowrap; padding: 0 8px; font-size: 13px; }
.switch-row input, .toggle-line input, .choice-pill input, .channel-card input { width: auto; min-height: 0; }
.icon-button { width: 40px; padding: 0; color: white; background: rgba(255,255,255,.07); border: 1px solid var(--line); }
.station-list { position: fixed; z-index: 999; top: 90px; bottom: 18px; left: 18px; width: 350px; border-radius: 22px; overflow: hidden; display: flex; flex-direction: column; }
.list-header { padding: 19px 18px 12px; display: flex; align-items: center; justify-content: space-between; }
.list-header h2 { margin: 0; font-size: 20px; }
.list-header p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.mobile-close { display: none; border: 0; color: white; background: transparent; font-size: 26px; }
.search-box { margin: 0 14px 12px; display: flex; align-items: center; gap: 8px; background: #091527; border: 1px solid var(--line); border-radius: 13px; padding: 0 11px; }
.search-box input { border: 0; background: transparent; padding: 0; box-shadow: none; }
.station-items { overflow-y: auto; padding: 0 10px 12px; }
.station-row { width: 100%; border: 0; border-radius: 15px; padding: 11px 10px; display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center; color: white; background: transparent; text-align: left; }
.station-row:hover, .station-row.active { background: rgba(255,255,255,.07); }
.score-badge { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-weight: 900; font-size: 15px; border: 1px solid rgba(255,255,255,.12); }
.score-badge.good, .map-marker.good { background: #126e49; }
.score-badge.ok, .map-marker.ok { background: #836b14; }
.score-badge.risk, .map-marker.risk { background: #883b2e; }
.score-badge.bad, .map-marker.bad { background: #7a283a; }
.score-badge.none, .map-marker.none { background: #344158; }
.station-main strong { display: block; font-size: 14px; }
.station-main small { display: block; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }
.station-meta { text-align: right; color: var(--muted); font-size: 11px; }
.station-meta strong { display: block; color: #dce5f5; margin-bottom: 4px; }
.station-drawer { position: fixed; z-index: 999; top: 90px; right: 18px; bottom: 18px; width: 370px; border-radius: 22px; overflow-y: auto; }
.drawer-empty { min-height: 100%; display: grid; place-content: center; text-align: center; padding: 36px; color: var(--muted); }
.drawer-empty h2 { color: var(--text); margin: 12px 0 6px; }
.pin-art { font-size: 48px; }
.drawer-body { padding: 20px; }
.drawer-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.drawer-head h2 { margin: 0; font-size: 22px; }
.drawer-head p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.drawer-score { font-size: 34px; font-weight: 950; }
.score-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0; }
.metric { background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 15px; padding: 12px; }
.metric strong { display: block; font-size: 20px; }
.metric small { color: var(--muted); }
.route-row, .report-row, .feedback-row { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0; }
.route-row a, .mini-action { border-radius: 11px; min-height: 38px; padding: 0 12px; display: inline-flex; align-items: center; border: 1px solid var(--line); background: rgba(255,255,255,.055); color: white; font-weight: 700; font-size: 12px; }
.mini-action { cursor: pointer; }
.mini-action.available { border-color: rgba(42,203,123,.4); }
.mini-action.unavailable { border-color: rgba(255,91,110,.4); }
.evidence-title { margin: 22px 0 10px; font-size: 15px; }
.evidence-card { border-top: 1px solid var(--line); padding: 13px 0; }
.evidence-card:first-of-type { border-top: 0; }
.evidence-meta { display: flex; flex-wrap: wrap; gap: 7px; color: var(--muted); font-size: 11px; }
.evidence-card p { margin: 7px 0; font-size: 13px; line-height: 1.45; white-space: pre-wrap; }
.evidence-card a { color: #8db8ff; font-size: 12px; }
.map-marker { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; color: white; font-weight: 950; border: 3px solid rgba(255,255,255,.9); box-shadow: 0 5px 16px rgba(0,0,0,.35); }
.marker-cluster div { background: var(--panel-solid) !important; color: white; font-weight: 900; }
.marker-cluster { background: rgba(109,93,252,.35) !important; }
.mobile-list-button { display: none; }
.toast { position: fixed; z-index: 2000; bottom: 25px; left: 50%; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: #111d31; border: 1px solid var(--line); border-radius: 13px; padding: 12px 16px; transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Dashboard */
.dashboard-page { background: radial-gradient(circle at 5% 0, #1a2a62 0, transparent 25%), var(--bg); min-height: 100vh; }
.page-header { position: sticky; top: 0; z-index: 50; height: 68px; border-radius: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; }
.page-header nav { display: flex; gap: 8px; }
.dashboard-shell { width: min(1100px, calc(100% - 30px)); margin: 28px auto 60px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.span-2 { grid-column: span 2; }
.panel-card { background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.section-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-title h2 { margin: 0; font-size: 20px; }
.section-title p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.panel-card label + label { margin-top: 16px; }
.panel-card output { color: var(--accent-2); font-weight: 900; }
.choice-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-pill { display: block; }
.choice-pill input { position: absolute; opacity: 0; }
.choice-pill span { display: block; border: 1px solid var(--line); padding: 10px 15px; border-radius: 12px; color: var(--muted); }
.choice-pill input:checked + span { background: rgba(109,93,252,.2); color: white; border-color: var(--accent); }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toggle-line { display: flex; align-items: center; gap: 10px; }
.channel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.channel-card { grid-template-columns: auto auto 1fr; align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: 15px; padding: 13px; }
.channel-card.disabled { opacity: .45; }
.channel-card small { display: block; color: var(--muted); margin-top: 4px; font-weight: 500; }
.channel-icon { width: 38px; height: 38px; border-radius: 12px; background: rgba(109,93,252,.18); display: grid; place-items: center; font-size: 19px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.status-badge { display: inline-flex; border-radius: 999px; padding: 6px 9px; font-size: 11px; font-weight: 800; }
.status-badge.good { background: rgba(42,203,123,.15); color: #63e9a4; }
.status-badge.warn { background: rgba(245,184,59,.15); color: #ffd06a; }
.status-badge.bad { background: rgba(255,91,110,.15); color: #ff8e9d; }
.source-table { overflow-x: auto; }
.source-row { display: grid; grid-template-columns: minmax(240px,2fr) .7fr .7fr 1fr .6fr; gap: 10px; align-items: center; min-width: 850px; border-top: 1px solid var(--line); padding: 13px 8px; font-size: 13px; }
.source-row span small { display: block; color: var(--muted); margin-top: 3px; }
.source-head { color: var(--muted); font-size: 11px; border-top: 0; }
.truth-note { margin-top: 18px; padding: 14px; background: rgba(245,184,59,.08); border: 1px solid rgba(245,184,59,.2); border-radius: 13px; color: #dfc886; font-size: 13px; }
.unassigned-list { display: grid; gap: 12px; }
.unassigned-card { background: rgba(255,255,255,.035); border: 1px solid var(--line); border-radius: 16px; padding: 15px; }
.unassigned-card .meta { display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 11px; }
.unassigned-card form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.empty-state { color: var(--muted); padding: 30px 0; text-align: center; }

@media (max-width: 1050px) {
  .station-drawer { width: 330px; }
  .station-list { width: 310px; }
  .fuel-strip { max-width: calc(100vw - 380px); }
  .top-actions .ghost:nth-child(2), .top-actions .ghost:nth-child(3) { display: none; }
}
@media (max-width: 760px) {
  .topbar { left: 8px; right: 8px; top: 8px; height: 58px; }
  .topbar .brand-lockup small { display: none; }
  .top-actions .ghost:not(#locateBtn), .top-actions .icon-only { display: none; }
  .fuel-strip { top: 75px; left: 8px; right: 8px; transform: none; max-width: none; overflow: hidden; }
  .switch-row { display: none; }
  .station-list { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: 65vh; transform: translateY(calc(100% + 20px)); transition: .25s ease; z-index: 1200; }
  .station-list.open { transform: translateY(0); }
  .mobile-close { display: block; }
  .mobile-list-button { display: block; position: fixed; z-index: 1000; bottom: 18px; left: 50%; transform: translateX(-50%); border: 1px solid var(--line); border-radius: 999px; padding: 12px 18px; color: white; background: var(--panel-solid); box-shadow: var(--shadow); }
  .station-drawer { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: 70vh; transform: translateY(calc(100% + 20px)); transition: .25s ease; z-index: 1250; }
  .station-drawer.open { transform: translateY(0); }
  .settings-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .channel-grid { grid-template-columns: 1fr; }
  .page-header { padding: 0 12px; }
  .page-header nav .ghost:nth-child(2) { display: none; }
  .dashboard-shell { width: calc(100% - 16px); margin-top: 12px; }
  .panel-card { padding: 16px; border-radius: 17px; }
}


/* Product UI v3 */
.source-banner{position:fixed;z-index:1200;top:92px;left:50%;transform:translateX(-50%);max-width:min(760px,calc(100vw - 760px));padding:10px 16px;border-radius:14px;font-size:13px;box-shadow:0 10px 30px #0005}.source-banner.warning{border:1px solid #f0b64b88}.source-banner.good{border:1px solid #31b86b77}.source-banner a{color:#fff;text-decoration:underline}.station-drawer{display:none}.station-drawer.open{display:block}.drawer-close{position:sticky;top:10px;float:right;z-index:5;width:36px;height:36px;border-radius:50%;border:1px solid var(--border);background:var(--panel-solid);color:var(--text);font-size:24px}.named-marker{display:flex;align-items:center;gap:7px;min-width:125px;max-width:180px;height:38px;padding:4px 10px 4px 4px;border-radius:20px;background:var(--panel-solid);border:2px solid #fff;box-shadow:0 5px 18px #0008;color:#fff}.named-marker span{display:grid;place-items:center;min-width:28px;height:28px;border-radius:50%;font-weight:900;background:#566074}.named-marker strong{font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.named-marker.good span{background:#17894a}.named-marker.ok span{background:#887110}.named-marker.risk span{background:#a75d1d}.named-marker.bad span{background:#a92e43}.named-marker.none span{background:#566074}.station-tooltip{background:var(--panel-solid)!important;border:1px solid var(--border)!important;color:#fff!important;font-weight:700;border-radius:10px!important;box-shadow:0 5px 15px #0005!important}.station-tooltip:before{display:none}.station-row{min-height:86px}.score-badge{width:56px;height:56px;display:grid;place-content:center;text-align:center;border-radius:16px}.score-badge strong{font-size:18px}.score-badge small{font-size:9px}.station-main em{font-size:11px;font-style:normal;color:#a9b3c9}.station-meta small{font-size:10px;color:#95a0b7}.drawer-score{min-width:76px;height:76px;border-radius:22px;display:grid;place-content:center;text-align:center;background:#465067}.drawer-score strong{font-size:28px}.drawer-score small{font-size:10px}.drawer-score.good{background:#147946}.drawer-score.ok{background:#7d6b13}.drawer-score.risk{background:#95521d}.drawer-score.bad{background:#93283e}.decision-line{padding:12px 14px;border-radius:12px;font-weight:800;background:#2b3448}.decision-line.good{color:#77eda5}.decision-line.ok{color:#f0dd70}.decision-line.risk{color:#ffb46a}.decision-line.bad{color:#ff788b}.trip-facts{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0}.trip-facts span{padding:7px 10px;border-radius:10px;background:#111a2a;color:#bdc7dc;font-size:12px}.evidence-status{font-size:12px;font-weight:800;color:#d7def0;margin-top:6px}.loading-card{padding:30px;border-radius:14px;background:#111a2a;color:var(--muted);text-align:center}.settings-truth{margin-bottom:16px}.narrow-dashboard{max-width:900px}.simple-settings{grid-template-columns:1fr 1fr}.channel-list{display:flex;gap:10px;flex-wrap:wrap}.channel-token{padding:9px 12px;border-radius:12px;background:#111a2a;border:1px solid var(--border)}.alert.warning{background:#4d3612;color:#ffe5a8;border:1px solid #a87827}.alert.error{background:#4a1520;color:#ffc1ca;border:1px solid #9b3145}
@media(max-width:1100px){.source-banner{max-width:calc(100vw - 40px);top:154px}.station-drawer{right:10px;width:360px}.station-list{width:330px}.fuel-strip{left:350px;right:16px}}
@media(max-width:760px){.source-banner{top:132px;left:8px;right:8px;transform:none;max-width:none}.station-drawer{display:block}.simple-settings{grid-template-columns:1fr}.simple-settings .span-2{grid-column:1}.named-marker{min-width:105px;max-width:135px}.named-marker strong{font-size:10px}}
.source-table-wide .source-row { grid-template-columns: minmax(210px,1.6fr) .75fr .55fr .55fr 1fr 1fr minmax(180px,1.2fr); }
.source-error { display:block; margin-top:6px; color:var(--muted); max-width:360px; white-space:normal; overflow-wrap:anywhere; }
@media (max-width:1100px){ .source-table-wide .source-row{ grid-template-columns:1fr 1fr; gap:10px; } .source-table-wide .source-head{ display:none; } }

/* Fluid map layout v4 — every panel scales with the viewport. */
:root {
  --map-gap: clamp(10px, 1.1vw, 18px);
  --map-top: clamp(78px, 6.2vw, 92px);
  --list-width: clamp(300px, 24vw, 390px);
  --drawer-width: clamp(330px, 28vw, 440px);
}
.map-page { width: 100%; height: 100dvh; min-height: 560px; overflow: hidden; }
.topbar {
  top: var(--map-gap); left: var(--map-gap); right: var(--map-gap);
  width: auto; min-width: 0; gap: 12px;
}
.top-actions { min-width: 0; max-width: 68%; overflow-x: auto; scrollbar-width: none; }
.top-actions > * { flex: 0 0 auto; }
.fuel-strip {
  top: var(--map-top);
  left: calc(var(--map-gap) + var(--list-width) + var(--map-gap));
  right: calc(var(--map-gap) + var(--drawer-width) + var(--map-gap));
  width: auto; max-width: none; min-width: 0; transform: none;
  justify-content: space-between; overflow: hidden;
}
.fuel-chips { flex: 1 1 auto; min-width: 0; padding-bottom: 2px; }
.fuel-chip { flex: 0 0 auto; font-size: clamp(13px, 1vw, 17px); padding-inline: clamp(10px, 1.1vw, 17px); }
.switch-row { flex: 0 0 auto; min-width: max-content; }
.station-list {
  top: var(--map-top); left: var(--map-gap); bottom: var(--map-gap);
  width: var(--list-width); max-width: calc(100vw - 2 * var(--map-gap));
}
.station-drawer {
  top: var(--map-top); right: var(--map-gap); bottom: var(--map-gap);
  width: var(--drawer-width); max-width: calc(100vw - 2 * var(--map-gap));
}
.station-row { grid-template-columns: clamp(52px, 4.5vw, 64px) minmax(0, 1fr) max-content; }
.station-main { min-width: 0; }
.station-main strong { font-size: clamp(14px, 1vw, 17px); overflow-wrap: anywhere; }
.station-main small { max-width: none; }
.station-meta { min-width: 62px; }
.score-badge { width: clamp(52px, 4.5vw, 62px); height: clamp(52px, 4.5vw, 62px); padding: 5px; }
.score-badge strong { font-size: clamp(19px, 1.8vw, 25px); line-height: 1; }
.score-badge small { font-size: 8px; line-height: 1.05; margin-top: 4px; text-align: center; }
.map-marker { border-radius: 50%; width: 38px; height: 38px; }
.map-marker span { font-size: 20px; line-height: 1; }
.named-marker {
  width: max-content; min-width: 105px; max-width: min(260px, 34vw); height: auto; min-height: 42px;
  align-items: center; padding: 5px 12px 5px 5px; border-radius: 18px;
}
.named-marker strong {
  white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.12;
  overflow-wrap: anywhere; font-size: 12px; max-width: 210px;
}
.named-marker span { flex: 0 0 30px; }
.drawer-head { padding-right: 34px; }
.drawer-score { min-width: 96px; max-width: 120px; height: auto; min-height: 76px; padding: 8px; }
.drawer-score strong { font-size: 30px; }
.drawer-score small { line-height: 1.1; }
.score-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric { min-width: 0; }
.metric strong { font-size: clamp(17px, 1.5vw, 22px); overflow-wrap: anywhere; }

@media (max-width: 1280px) {
  :root { --list-width: clamp(290px, 29vw, 350px); }
  .fuel-strip { right: var(--map-gap); }
  .station-drawer {
    z-index: 1350; width: min(430px, calc(100vw - 2 * var(--map-gap)));
    box-shadow: -14px 0 60px rgba(0,0,0,.48);
  }
  .top-actions { max-width: 72%; }
}

@media (max-width: 980px) {
  .topbar .brand-lockup small { display: none; }
  .topbar { height: 60px; }
  .top-actions { max-width: calc(100% - 180px); }
  .top-actions .ghost { min-height: 38px; padding-inline: 12px; font-size: 13px; }
  .fuel-strip { top: 82px; }
  .station-list { top: 82px; }
  .station-drawer { top: 82px; }
  .switch-row span { display: none; }
}

@media (max-width: 820px) {
  :root { --map-gap: 8px; }
  .map-page { min-height: 480px; }
  .topbar { top: 8px; left: 8px; right: 8px; height: 58px; padding-inline: 10px; }
  .brand-icon { width: 38px; height: 38px; }
  .brand-lockup.compact strong { font-size: 14px; }
  .top-actions { max-width: calc(100% - 145px); }
  .top-actions .ghost:not(#locateBtn), .top-actions .icon-only { display: none; }
  .fuel-strip {
    top: 74px; left: 8px; right: 8px; height: 54px; padding: 6px;
    border-radius: 15px;
  }
  .fuel-chip { min-height: 40px; font-size: 14px; padding-inline: 13px; }
  .switch-row { display: none; }
  .station-list {
    top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: min(72dvh, 620px);
    transform: translateY(calc(100% + 24px)); transition: transform .24s ease; z-index: 1400;
  }
  .station-list.open { transform: translateY(0); }
  .mobile-close { display: block; }
  .mobile-list-button {
    display: block; position: fixed; z-index: 1200; bottom: 18px; left: 50%; transform: translateX(-50%);
    border: 1px solid var(--line); border-radius: 999px; padding: 12px 18px; color: white;
    background: var(--panel-solid); box-shadow: var(--shadow); white-space: nowrap;
  }
  .station-drawer {
    display: block; top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: min(78dvh, 700px);
    transform: translateY(calc(100% + 24px)); transition: transform .24s ease; z-index: 1450;
  }
  .station-drawer.open { transform: translateY(0); }
  .score-grid { grid-template-columns: 1fr; }
  .metric { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .metric small { text-align: right; }
  .named-marker { max-width: 190px; }
  .named-marker strong { max-width: 145px; }
}

@media (max-width: 460px) {
  .top-actions #locateBtn { width: 40px; padding: 0; font-size: 0; }
  .top-actions #locateBtn::before { content: '⌖'; font-size: 20px; }
  .fuel-strip { right: 8px; }
  .fuel-chips { mask-image: linear-gradient(to right, #000 88%, transparent); }
  .station-row { grid-template-columns: 52px minmax(0,1fr); }
  .station-meta { grid-column: 2; display: flex; gap: 12px; text-align: left; }
  .station-meta strong { margin: 0; }
  .named-marker { max-width: 160px; }
  .named-marker strong { max-width: 115px; font-size: 10px; }
}

/* Numeric probability markers: always 0–100, never symbolic shortcuts. */
.map-marker span { font-size: 13px; font-variant-numeric: tabular-nums; letter-spacing: -.4px; }
.named-marker span { font-size: 12px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.score-badge strong, .drawer-score strong { font-variant-numeric: tabular-nums; letter-spacing: -1px; }
.score-badge small, .drawer-score small { text-transform: none; }

.telegram-login-shell { max-width: 1040px; margin: 0 auto; padding: 96px 18px 40px; }
.telegram-login-grid { display:grid; grid-template-columns:minmax(280px, 420px) minmax(0,1fr); gap:18px; align-items:start; }
.telegram-qr-card { display:flex; flex-direction:column; align-items:center; justify-content:center; min-height:460px; text-align:center; }
.telegram-qr-frame { width:min(360px, 82vw); aspect-ratio:1; display:grid; place-items:center; border-radius:24px; padding:16px; background:#fff; overflow:hidden; }
.telegram-qr-frame img { width:100%; height:100%; object-fit:contain; image-rendering:auto; }
.telegram-state-dot { display:inline-flex; align-items:center; gap:8px; padding:8px 11px; border-radius:999px; background:#111a2a; }
.telegram-state-dot::before { content:''; width:9px; height:9px; border-radius:50%; background:#f3b34c; }
.telegram-state-dot.live::before { background:#52df8a; box-shadow:0 0 0 5px rgba(82,223,138,.12); }
.telegram-channel-status { display:grid; gap:10px; margin-top:16px; }
.telegram-channel-row { display:grid; grid-template-columns:minmax(130px,1fr) auto; gap:12px; align-items:center; padding:12px; border-radius:14px; background:#111a2a; border:1px solid var(--border); }
.telegram-channel-row small { display:block; margin-top:4px; color:var(--muted); overflow-wrap:anywhere; }
.telegram-login-actions { display:flex; gap:10px; flex-wrap:wrap; margin-top:16px; }
@media(max-width:760px){ .telegram-login-shell{padding-top:78px}.telegram-login-grid{grid-template-columns:1fr}.telegram-qr-card{min-height:380px}.telegram-channel-row{grid-template-columns:1fr} }

/* Telegram session page: hidden must override the QR grid display rule. */
.telegram-qr-frame[hidden] { display: none !important; }

/* v6: complete station map, Russian fuel labels, usable geolocation UI. */
.fuel-chips { scroll-snap-type: x proximity; overscroll-behavior-x: contain; }
.fuel-chip { scroll-snap-align: start; }
.station-main em { display:block; margin-top:4px; color:#7f91ad; font-size:11px; font-style:normal; }
.start-location-marker {
  width:36px; height:36px; border-radius:50%; display:grid; place-items:center;
  background:#2563eb; color:#fff; border:3px solid #fff; font-size:20px; font-weight:900;
  box-shadow:0 6px 20px rgba(0,0,0,.38);
}
.location-dialog-backdrop {
  position:fixed; inset:0; z-index:2200; display:grid; place-items:center; padding:18px;
  background:rgba(3,8,18,.66); backdrop-filter:blur(6px);
}
.location-dialog-backdrop[hidden] { display:none !important; }
.location-dialog { position:relative; width:min(520px,100%); border-radius:24px; padding:26px; }
.location-dialog h2 { margin:0 40px 10px 0; font-size:24px; }
.location-dialog p { color:var(--muted); line-height:1.5; }
.location-actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:18px; }
.location-message { margin-top:14px; padding:12px 14px; border-radius:13px; background:rgba(245,184,59,.11); border:1px solid rgba(245,184,59,.35); color:#ffe3a0; line-height:1.4; }
.location-help { font-size:12px; }
.manual-location-banner {
  position:fixed; z-index:2100; left:50%; top:145px; transform:translateX(-50%);
  display:flex; align-items:center; gap:12px; padding:12px 14px; border-radius:14px; font-weight:750;
}
.manual-location-banner[hidden] { display:none !important; }
.manual-location-banner button { border:0; border-radius:9px; padding:7px 10px; background:rgba(255,255,255,.12); color:#fff; }
.manual-location-mode { cursor:crosshair !important; }

/* Live Telegram Web is shown directly through a protected noVNC iframe. */
.telegram-live-shell { max-width:1380px; margin:0 auto; padding:92px 18px 40px; display:grid; grid-template-columns:minmax(0,2fr) minmax(320px,.8fr); gap:18px; align-items:start; }
.telegram-live-card { min-width:0; }
.telegram-live-heading { gap:18px; }
.telegram-vnc-wrap { width:100%; min-height:620px; aspect-ratio:16/10; border-radius:18px; overflow:hidden; background:#050914; border:1px solid var(--line); }
.telegram-vnc-wrap iframe { width:100%; height:100%; min-height:620px; border:0; display:block; background:#050914; }
.telegram-live-actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:14px; }
.telegram-live-actions form { margin:0; }
.telegram-live-help { margin-top:14px; }
.telegram-channel-row { border-color:var(--line); }

@media (max-width:900px) {
  .telegram-live-shell { grid-template-columns:1fr; padding-top:82px; }
  .telegram-vnc-wrap, .telegram-vnc-wrap iframe { min-height:540px; }
}
@media (max-width:820px) {
  .fuel-strip { overflow:visible; }
  .fuel-chips { overflow-x:auto; -webkit-overflow-scrolling:touch; padding-right:12px; }
  .fuel-chips::after { content:''; flex:0 0 14px; }
  .manual-location-banner { top:138px; width:max-content; max-width:calc(100vw - 16px); }
}
@media (max-width:520px) {
  .fuel-chip { padding-inline:12px; font-size:13px; }
  .location-dialog { padding:22px 18px; }
  .location-actions > * { width:100%; }
  .telegram-live-shell { padding-inline:8px; }
  .telegram-vnc-wrap, .telegram-vnc-wrap iframe { min-height:500px; }
}
