:root {
  --brand: #ff6b1a;
  --ink: #1d1d1f;
  --muted: #5f6368;
  --bg: #ffffff;
  --card: #f6f6f7;
  --line: #e2e2e5;
  --link: #b8470b;
  --green: #1b7f3a;
  --amber: #a15c07;
  --red: #b91c1c;
  --grey: #6b7280;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f2f2f2;
    --muted: #a8a8a8;
    --bg: #121212;
    --card: #1e1e20;
    --line: #2c2c2f;
    --link: #ff9a5c;
    --green: #4ade80;
    --amber: #fbbf24;
    --red: #f87171;
    --grey: #9ca3af;
  }
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font:
    16px / 1.5 system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a {
  color: var(--link);
}
.top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 3px solid var(--brand);
}
.top h1 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: 0.05em;
}
.home {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}
.beta {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
}
.banner {
  padding: 10px 16px;
  background: var(--amber);
  color: #fff;
  font-weight: 600;
}
main {
  padding: 16px;
  max-width: 40rem;
  margin: 0 auto;
}
.note,
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.875rem;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* --- controlli --- */
.controls {
  display: grid;
  gap: 10px;
}
input[type="search"],
input[type="text"] {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  cursor: pointer;
}
.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn.yes {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.btn.no {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.btn.back {
  min-height: 40px;
  margin-bottom: 8px;
}
.link {
  font: inherit;
  color: var(--link);
  background: none;
  border: 0;
  padding: 8px 0;
  text-decoration: underline;
  cursor: pointer;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  min-height: 40px;
  padding: 6px 14px;
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}
.chip[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

/* --- lista --- */
.summary {
  margin: 12px 0 4px;
}
.results {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: grid;
  gap: 10px;
}
.card {
  display: block;
  padding: 12px 14px;
  color: inherit;
  text-decoration: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.card-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.title {
  flex: 1;
  min-width: 0;
}
.dist {
  font-weight: 600;
  white-space: nowrap;
}
.addr {
  font-size: 0.875rem;
  color: var(--muted);
}
.status {
  margin-top: 6px;
}
.shape {
  margin-right: 4px;
}
.s-green,
.s-green .shape {
  color: var(--green);
}
.s-amber,
.s-amber .shape {
  color: var(--amber);
}
.s-red,
.s-red .shape {
  color: var(--red);
}
.s-grey,
.s-grey .shape {
  color: var(--grey);
}
.status strong,
.status .muted {
  color: var(--ink);
}
.status .muted {
  color: var(--muted);
}
.bars {
  font-size: 0.8rem;
  letter-spacing: 1px;
  color: var(--ink);
}
.extras {
  color: var(--muted);
  font-size: 0.875rem;
}
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.8rem;
}
.badge {
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

/* --- dettaglio --- */
.detail h2 {
  margin: 4px 0;
}
.fuel {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.report {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
.nav {
  margin: 16px 0 8px;
}
.nav .btn {
  width: 100%;
}
.note-box {
  padding: 10px 12px;
  border-left: 4px solid var(--amber);
  background: var(--card);
}

/* --- pannello --- */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgb(0 0 0 / 0.45);
  z-index: 10;
}
.sheet {
  width: 100%;
  max-width: 40rem;
  max-height: 90vh;
  overflow: auto;
  padding: 16px;
  background: var(--bg);
  border-radius: 18px 18px 0 0;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sheet-head h2 {
  margin: 0;
  font-size: 1.2rem;
}
.sheet-body {
  display: grid;
  gap: 10px;
  padding-top: 8px;
}
.icon {
  min-width: 44px;
  min-height: 44px;
  font-size: 1.2rem;
  color: var(--ink);
  background: none;
  border: 0;
  cursor: pointer;
}
fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
}
.radio {
  display: block;
  padding: 8px 0;
}
.ok {
  color: var(--green);
  font-weight: 700;
  font-size: 1.2rem;
}
.err {
  color: var(--red);
  font-weight: 600;
}

/* --- pagine --- */
.page h2 {
  margin-top: 0;
}
.page h3 {
  margin-bottom: 0.25rem;
}
.page h4 {
  margin: 1rem 0 0.25rem;
}
.page code {
  font-size: 0.875em;
  overflow-wrap: anywhere;
}
.tldr {
  padding: 4px 16px;
  border: 2px solid var(--brand);
  border-radius: 14px;
  background: var(--card);
}
.tldr ul {
  padding-left: 1.1rem;
}
.table-wrap {
  overflow-x: auto;
}
.page table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.page th,
.page td {
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.data-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 10px;
}
.data-list li {
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow-wrap: anywhere;
}
.foot {
  padding: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}
.foot p {
  margin: 0.25rem 0;
}
.admin-section {
  margin: 24px 0;
}
.admin-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 10px;
}
.admin-list .card p {
  margin: 0.25rem 0;
}
.admin-list.compact {
  gap: 4px;
  font-size: 0.875rem;
}
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.admin-section select,
.sheet textarea,
.sheet select {
  min-height: 44px;
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
}
.legal .card {
  margin: 10px 0;
}
.legal .card p {
  margin: 0.25rem 0;
}
