/*
  Fuel Run — layout and components.
  Structure only: every colour, font, radius and proportion comes from the
  design tokens in theme.css. Nothing brand-specific is hardcoded here, so a
  brand pack restyles the app by replacing theme.css alone.

  Two-column grid on desktop (controls | results), single column under 780px.
*/

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: var(--fs-base)/1.55 var(--font-sans);
  background: var(--bg);
  color: var(--ink);
}

/* Header */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.logo { font-size: 20px; line-height: 1; }
.logo img { height: 22px; display: block; }
.tagline { color: var(--muted); font-size: 13px; }
.mode { margin-left: auto; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.mode.mock { background: var(--ok-bg); color: var(--ok); }
.mode.live { background: var(--good-bg); color: var(--good); }
.mode.snap { background: #E7EEF6; color: #24507F; }

/* Prominent data-currency banner (live vs snapshot vs sample) */
.datanotice { text-align: center; padding: 9px 16px; font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--line); }
.datanotice.snap { background: #E7EEF6; color: #24507F; }
.datanotice.live { background: var(--good-bg); color: var(--good); }
.datanotice.mock { background: var(--ok-bg); color: var(--ok); }

/* Layout */
.layout {
  display: grid; grid-template-columns: var(--sidebar-w) 1fr; gap: var(--gap);
  max-width: var(--maxw); margin: var(--gap) auto; padding: 0 20px;
}
@media (max-width: 780px) {
  .layout { grid-template-columns: 1fr; margin: 12px auto; }
  .controls { position: static !important; }
  .map { height: 300px !important; }
}

/* Controls */
.controls {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  align-self: start; position: sticky; top: 16px;
}
.controls h2 {
  margin: 0 0 14px; font-size: 12px; letter-spacing: .6px;
  text-transform: uppercase; color: var(--muted);
}
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field input:not([type="checkbox"]), .field select {
  width: 100%; padding: 9px 11px; font: inherit; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.field input:focus, .field select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); margin: 4px 0 12px; }

/* Brand multi-select */
.brand-list {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  max-height: 168px; overflow: auto; padding: 6px 8px;
}
.brand-list label {
  display: flex; align-items: center; gap: 10px; font-size: 13px;
  padding: 5px 6px; border-radius: 6px; cursor: pointer;
}
.brand-list label:hover { background: var(--bg); }
.brand-list input[type="checkbox"] { flex: 0 0 auto; width: 16px; height: 16px; margin: 0; accent-color: var(--brand); }
.linkrow { margin-top: 6px; font-size: 12px; color: var(--muted); }
.linkbtn { background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; padding: 0; }

.go {
  width: 100%; padding: 11px; font: 600 15px/1 var(--font-sans); color: var(--brand-ink);
  background: var(--brand); border: 0; border-radius: 10px; cursor: pointer; margin-top: 4px;
}
.go:hover { filter: brightness(1.05); }
.hint { font-size: 12px; color: var(--muted); margin: 12px 0 0; }

/* Results */
.results { min-width: 0; }
.headline {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.headline .big { font-size: 20px; font-weight: 650; }
.headline .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.headline.loading { color: var(--muted); }
.notice { font-size: 12px; color: var(--muted); margin-top: 8px; }

.listwrap {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow-x: auto; margin-bottom: 16px; box-shadow: var(--shadow);
}
.age { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.updated { display: block; font-size: 11px; color: var(--muted); font-weight: 400; margin-top: 3px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
tr:last-child td { border-bottom: 0; }
th { font-size: 11px; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.best td { background: var(--good-bg); }
.name { font-weight: 600; }
a.name { color: var(--ink); text-decoration: none; }
a.name:hover { color: var(--brand); text-decoration: underline; }
.brandtag { color: var(--muted); font-size: 12px; font-weight: 400; }
.tag {
  display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 999px;
  background: var(--ok-bg); color: var(--ok); margin-left: 4px;
}
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 13px; font-variant-numeric: tabular-nums; }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.ok   { background: var(--ok-bg);   color: var(--ok); }
.pill.bad  { background: var(--bad-bg);  color: var(--bad); }

.map { height: 380px; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.leaflet-popup-content { font: 13px var(--font-sans); }
.err { color: var(--bad); }

/* ROSA Cars brand: display font on headings, mono on the data figures. */
.brand, .headline .big, .controls h2 { font-family: var(--font-display); }
td.num, .pill { font-family: var(--font-mono); }
.brand { letter-spacing: .01em; }

/* Powered by Intelligentae footer */
.site-foot { text-align: center; padding: 20px; }
.powered { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); text-decoration: none; }
.powered:hover { color: var(--ink); }
.powered img { display: block; border-radius: 4px; }
.powered strong { color: var(--ink); font-weight: 600; }

/* Sortable column headers */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--ink); }
th .arr { font-size: 10px; margin-left: 3px; color: var(--muted); opacity: .5; }
th.active .arr { color: var(--brand); opacity: 1; }
