:root {
  --ink: #0e1116;
  --panel: #171b22;
  --edge: #262c36;
  --muted: #8b94a3;
  --accent: #ffc94a;
  --text: #e8ecf2;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h3 { font-size: 15px; }
img { max-width: 100%; display: block; }

.topbar { border-bottom: 1px solid var(--edge); }
.topbar nav {
  max-width: 1200px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 4px;
}
.brand { font-weight: 600; margin-right: 16px; }
.tab { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-size: 14px; }
.tab:hover { background: var(--panel); color: #fff; text-decoration: none; }
.tab-on { background: var(--panel); color: #fff; }
.tab-right { margin-left: auto; }

main { max-width: 1200px; margin: 0 auto; padding: 24px 20px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 600; margin: 8px 0 2px; }
.error-text { color: #fca5a5; }
.push-right { margin-left: auto; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

input, textarea, button {
  font: inherit; color: inherit;
  border-radius: 8px; border: 1px solid var(--edge);
  background: var(--ink); padding: 8px 12px;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
button { background: var(--accent); color: var(--ink); font-weight: 500; cursor: pointer; border: 0; }
button:hover { filter: brightness(1.1); }
button:disabled { opacity: .5; cursor: default; }
textarea { width: 100%; resize: vertical; }

.panel { background: var(--panel); border: 1px solid var(--edge); border-radius: 12px; padding: 16px; }
.panel label { font-weight: 500; }
.panel .row { margin-top: 12px; }
.panel .row input { flex: 1; min-width: 0; }

.empty {
  border: 1px dashed var(--edge); border-radius: 12px;
  padding: 40px; text-align: center; color: var(--muted);
}

.flash { border-radius: 8px; padding: 8px 12px; margin: 8px 0; font-size: 13px; }
.flash-success { background: rgba(16,185,129,.12); color: #6ee7b7; }
.flash-error { background: rgba(239,68,68,.12); color: #fca5a5; }
.flash-warn { background: rgba(245,158,11,.12); color: #fcd34d; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-top: 16px; }
.card { background: var(--panel); border: 1px solid var(--edge); border-radius: 12px; overflow: hidden; }
.card-body { padding: 12px; display: grid; gap: 8px; }
.price { color: var(--accent); font-weight: 600; white-space: nowrap; }
.meta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }

.thumb { position: relative; aspect-ratio: 4/3; background: var(--ink); display: grid; place-items: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-sm { border-radius: 8px; overflow: hidden; }
.star-form { position: absolute; top: 8px; right: 8px; margin: 0; }
.star-form button { background: rgba(0,0,0,.6); color: #fff; padding: 2px 8px; font-size: 18px; }

.badge { border: 1px solid; border-radius: 4px; padding: 1px 6px; font-size: 11px; text-transform: capitalize; }
.badge-good { background: rgba(16,185,129,.15); color: #6ee7b7; border-color: rgba(16,185,129,.3); }
.badge-bad { background: rgba(239,68,68,.15); color: #fca5a5; border-color: rgba(239,68,68,.3); }
.badge-unknown { background: rgba(255,255,255,.05); color: var(--muted); border-color: var(--edge); }

.link-danger, .link-muted { background: none; color: var(--muted); padding: 0; font-weight: 400; }
.link-danger:hover { color: #fca5a5; }
.link-muted:hover { color: #fff; }

.table-scroll { overflow-x: auto; border: 1px solid var(--edge); border-radius: 12px; margin-top: 12px; }
.compare { border-collapse: collapse; width: 100%; font-size: 14px; }
.compare th, .compare td { padding: 12px; text-align: left; vertical-align: top; border-left: 1px solid var(--edge); }
.compare th { background: var(--panel); min-width: 210px; }
.compare tbody tr { border-top: 1px solid var(--edge); }
.compare tbody tr:nth-child(odd) { background: rgba(255,255,255,.02); }
.rowhead {
  position: sticky; left: 0; z-index: 1;
  background: var(--ink); color: var(--muted);
  font-size: 13px; font-weight: 500; width: 130px; border-left: 0;
}
.best { background: rgba(16,185,129,.1); color: #6ee7b7; font-weight: 600; }

.map-layout { display: grid; gap: 16px; grid-template-columns: 1fr 320px; }
@media (max-width: 860px) { .map-layout { grid-template-columns: 1fr; } }
#map { height: 70vh; border-radius: 12px; border: 1px solid var(--edge); background: #10141a; }
.dealer {
  background: var(--panel); border: 1px solid var(--edge);
  border-radius: 12px; padding: 12px; margin-bottom: 12px; cursor: pointer;
}
.dealer:hover { border-color: var(--muted); }
.dealer ul { list-style: none; margin: 8px 0 0; padding: 8px 0 0; border-top: 1px solid var(--edge); }
.dealer li { margin-top: 4px; }
.pin {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--panel); color: var(--text); border: 2px solid var(--accent);
  font: 600 13px system-ui; box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--panel); color: var(--text); border: 1px solid var(--edge);
}
.leaflet-popup-content ul { list-style: none; margin: 8px 0 0; padding: 0; }

.gate {
  max-width: 360px; margin: 96px auto; padding: 24px;
  background: var(--panel); border: 1px solid var(--edge); border-radius: 12px;
}
.gate input, .gate button { width: 100%; margin-top: 12px; }

.bookmarklet {
  display: inline-block; background: var(--accent); color: var(--ink);
  padding: 8px 14px; border-radius: 8px; font-weight: 600; cursor: grab;
}
.bookmarklet:hover { text-decoration: none; filter: brightness(1.1); }
details.panel summary { cursor: pointer; font-weight: 500; }
kbd {
  background: var(--ink); border: 1px solid var(--edge);
  border-radius: 4px; padding: 1px 5px; font-size: 12px;
}
