/* ============================================================
   TANQUE CERTO — Design System
   Paleta Neon Teal: #E6FF2B · #0B4650 · #F9F7F2 · #898A8D
   Séries de dados: gasolina #7A8E14 · álcool #0C96B3

   Camadas:
   1. Tokens          — variáveis de escala (cor, tipo, espaço, raio, sombra, z, motion)
   2. Base            — reset, corpo, superfícies do navegador
   3. Layout          — topbar, coluna do app, tabbar
   4. Componentes     — cada padrão de UI nomeado, só consome tokens
   5. Utilitários     — espaçamento e texto mínimos
   6. Motion          — entradas, reduced-motion
   ============================================================ */

/* ============================================================
   1 · TOKENS
   ============================================================ */
:root {
  color-scheme: dark;

  /* --- paleta base --- */
  --lime: #E6FF2B;
  --teal-900: #0B4650;
  --cream: #F9F7F2;
  --gray: #898A8D;

  /* --- superfícies (derivadas do teal-900) --- */
  --bg-0: #051A1F;
  --bg-1: #07262B;
  --bg-2: #0A333B;
  --teal-700: #115863;
  --teal-500: #1B8A97;

  /* --- accent em derivadas do lime --- */
  --lime-soft: #EFFFA0;
  --lime-dim: rgba(230, 255, 43, 0.12);
  --lime-border: rgba(230, 255, 43, 0.35);

  /* --- séries de dados (gasolina / álcool) --- */
  --serie-gas: #7A8E14;
  --serie-alc: #0C96B3;
  --serie-gas-text: #C6D96A;
  --serie-alc-text: #7FD6E4;

  /* --- status --- */
  --good: #4ADE80;
  --warn: #FBBF24;
  --bad: #F87171;

  /* --- texto (tinta cream sobre superfícies escuras) --- */
  --ink: #F9F7F2;
  --ink-2: rgba(249, 247, 242, 0.74);
  --ink-3: rgba(249, 247, 242, 0.56);
  --ink-4: rgba(249, 247, 242, 0.40);

  /* --- superfície translúcida e traços --- */
  --glass: rgba(11, 70, 80, 0.32);
  --line: rgba(249, 247, 242, 0.08);
  --line-2: rgba(249, 247, 242, 0.14);
  --field-bg: rgba(5, 26, 31, 0.55);

  /* --- tipografia --- */
  --font: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', monospace;

  --fs-micro: 9px;    /* assinatura da marca */
  --fs-label: 10.5px; /* etiquetas mono em caixa alta */
  --fs-eyebrow: 10px; /* kpi keys, theads */
  --fs-xs: 12px;      /* hints, notas */
  --fs-sm: 13px;      /* apoio, datas */
  --fs-body: 14px;    /* corpo padrão */
  --fs-md: 14px;      /* sinônimo de body p/ números mono */
  --fs-lg: 16px;      /* botões, inputs */
  --fs-xl: 18px;      /* títulos de modal, valores KPI */
  --fs-2xl: 24px;     /* título de página */
  --fs-hero: 40px;    /* veredito */

  /* --- espaçamento (base 4) --- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;

  /* --- raios --- */
  --r-xs: 9px;   /* ícone-marca, tags */
  --r-sm: 12px;  /* botões pequenos, fechar modal */
  --r-md: 14px;  /* campos, callouts, toast */
  --r-lg: 16px;  /* botões grandes, blocos de escolha */
  --r-xl: 18px;  /* cartões */
  --r-2xl: 22px; /* folha modal */
  --r-pill: 999px;

  /* --- sombras / elevação --- */
  --shadow-pop: 0 12px 32px -12px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 8px 24px -10px rgba(230, 255, 43, 0.5);
  --shadow-sheet: 0 18px 44px -14px rgba(0, 0, 0, 0.7);

  /* --- camadas --- */
  --z-topbar: 50;
  --z-tabbar: 60;
  --z-modal: 90;
  --z-chip: 94;
  --z-banner: 95;
  --z-toast: 100;

  /* --- movimento --- */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.22, 1.2, 0.36, 1);
  --t-fast: 0.18s ease;
  --t-med: 0.28s var(--ease-out);

  --tabbar-h: 62px;
}

/* ============================================================
   2 · BASE
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg-0);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(560px 420px at 50% -12%, rgba(27, 138, 151, 0.16), transparent 70%),
    var(--bg-0);
}

/* superfícies do navegador tematizadas pela paleta */
::selection { background: var(--lime); color: var(--teal-900); }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: var(--teal-700); border-radius: var(--r-pill); }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

input, textarea { caret-color: var(--lime); }

/* ============================================================
   3 · LAYOUT
   ============================================================ */

/* --- barra superior --- */
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4) 10px;
  background: rgba(5, 26, 31, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--ink);
}

.brand-badge {
  width: var(--sp-8); height: var(--sp-8);
  border-radius: var(--r-xs);
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--lime), #cfe611);
  color: var(--teal-900);
  flex-shrink: 0;
}

.brand-badge svg { width: 17px; height: 17px; }

.brand-name {
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: -0.01em;
  line-height: 1;
}

.brand-name small {
  display: block;
  font-family: var(--mono);
  font-size: var(--fs-micro);
  font-weight: 500;
  color: var(--lime);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  margin-top: 3px;
}

.odo-chip {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 7px var(--sp-3);
  border-radius: var(--r-pill);
  border: 1px solid var(--line-2);
  background: rgba(7, 38, 43, 0.6);
}

.odo-chip b {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.odo-chip span { font-size: var(--fs-eyebrow); color: var(--ink-3); }

/* --- coluna única do app --- */
.app {
  max-width: 560px;
  margin: 0 auto;
  padding: var(--sp-1) var(--sp-4) calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 28px);
}

.page-title { padding: 10px 0 var(--sp-5); }

.page-title h1 {
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.page-title .sub {
  margin-top: 6px;
  color: var(--ink-3);
  font-size: 13.5px;
  line-height: 1.55;
}

.bloco { margin-bottom: var(--sp-6); }

.bloco-title {
  font-family: var(--mono);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bloco-title a { color: var(--lime); text-decoration: none; font-size: 11px; letter-spacing: 0.08em; }

.bloco-title .note {
  font-family: var(--mono);
  font-size: var(--fs-eyebrow);
  color: var(--ink-4);
  text-transform: none;
  letter-spacing: 0.03em;
}

.bloco-title .tools { display: flex; gap: var(--sp-3); }

.bloco-title--danger { color: var(--bad); }

/* ============================================================
   4 · COMPONENTES
   ============================================================ */

/* --- cartão --- */
.card {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: var(--sp-5) var(--sp-4);
}

/* --- linhas de preço (painel) --- */
.price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 6px 0;
}

.price-row + .price-row { border-top: 1px solid var(--line); }

.price-row .pr-label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14.5px;
  font-weight: 600;
  flex-shrink: 0;
}

.price-row .pr-label .dot { width: 10px; height: 10px; border-radius: 50%; }
.price-row .dot.alc { background: var(--serie-alc); box-shadow: 0 0 8px rgba(12, 150, 179, 0.8); }
.price-row .dot.gas { background: var(--serie-gas); box-shadow: 0 0 8px rgba(122, 142, 20, 0.8); }

.price-row .pr-input { position: relative; flex: 1; max-width: 170px; }

.price-row input {
  width: 100%;
  background: var(--field-bg);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 11px 40px 11px 14px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: var(--fs-xl);
  font-weight: 600;
  text-align: right;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -moz-appearance: textfield;
  appearance: textfield;
}

.price-row input::-webkit-outer-spin-button,
.price-row input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.price-row input:focus-visible { outline: none; }

.price-row input:focus {
  border-color: rgba(230, 255, 43, 0.5);
  box-shadow: 0 0 0 3px rgba(230, 255, 43, 0.1);
}

.price-row .rs {
  position: absolute;
  left: var(--sp-3); top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: var(--fs-sm);
  color: var(--ink-4);
  pointer-events: none;
}

/* --- botões --- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 52px;
  padding: 13px var(--sp-5);
  border-radius: var(--r-lg);
  border: none;
  font-family: var(--font);
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--t-fast), filter var(--t-fast), background var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}

.btn svg { width: 18px; height: 18px; }

.btn-primary {
  background: linear-gradient(135deg, var(--lime), #d4ea12);
  color: var(--teal-900);
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { transform: scale(0.98); }

.btn-ghost {
  background: rgba(249, 247, 242, 0.06);
  border: 1px solid var(--line-2);
  color: var(--ink);
  font-weight: 600;
}

.btn-ghost:hover { background: rgba(249, 247, 242, 0.1); }
.btn-ghost:active { background: rgba(249, 247, 242, 0.12); }

.btn-danger {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--bad);
}

.btn-danger:active { transform: scale(0.98); }

.btn-sm {
  width: auto;
  min-height: 40px;
  padding: 9px var(--sp-4);
  font-size: 14px;
  border-radius: var(--r-sm);
}

.btn-sm svg { width: 15px; height: 15px; }

/* fileira de ações lado a lado (cada botão estica por igual) */
.btn-row { display: flex; gap: 9px; }
.btn-row .btn { flex: 1; }
.btn-row--inline { margin-top: var(--sp-4); }

/* --- veredito --- */
.verdict {
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(11, 70, 80, 0.45), rgba(7, 38, 43, 0.6));
  padding: var(--sp-6) var(--sp-5);
  text-align: center;
  animation: verdict-in 0.45s var(--ease-spring);
}

@keyframes verdict-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } }

.verdict .v-kicker {
  font-family: var(--mono);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.verdict .v-fuel {
  margin-top: var(--sp-2);
  font-size: var(--fs-hero);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
}

.verdict .v-fuel svg { width: 34px; height: 34px; }
.verdict.alc-win { border-color: rgba(12, 150, 179, 0.45); }
.verdict.alc-win .v-fuel { color: var(--serie-alc-text); }
.verdict.gas-win { border-color: rgba(230, 255, 43, 0.4); }
.verdict.gas-win .v-fuel { color: var(--lime); }

.verdict .v-eco {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.3);
  color: var(--good);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
}

.verdict .v-eco svg { width: 14px; height: 14px; }

.verdict .v-tank {
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-2);
}

.verdict .v-tank b { font-family: var(--mono); color: var(--ink); }

/* barras de custo/km */
.cmp { margin-top: var(--sp-5); text-align: left; }

.cmp-row { padding: var(--sp-3) 0; }
.cmp-row + .cmp-row { border-top: 1px solid var(--line); }

.cmp-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.cmp-name { display: flex; align-items: center; gap: var(--sp-2); font-size: 14px; font-weight: 600; color: var(--ink-2); }
.cmp-name .dot { width: 9px; height: 9px; border-radius: 50%; }

.cmp-val { font-family: var(--mono); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 7px; }

.cmp-tag {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(74, 222, 128, 0.14);
  color: var(--good);
}

.cmp-track { height: 10px; border-radius: 6px; background: rgba(5, 26, 31, 0.7); overflow: hidden; }
.cmp-fill { height: 100%; border-radius: 6px; width: 0; transition: width 0.9s var(--ease-out); }
.cmp-fill.alc { background: linear-gradient(90deg, #097a91, var(--serie-alc)); }
.cmp-fill.gas { background: linear-gradient(90deg, #5c6d0e, var(--serie-gas)); }

/* medidor solto (consumo do carro, custo/km dos relatórios) */
.meter-item { padding: var(--sp-3) 0; }
.meter-item.is-empty { opacity: 0.55; }

.parity {
  margin-top: var(--sp-4);
  padding: 11px 13px;
  border-radius: var(--r-md);
  border: 1px dashed rgba(249, 247, 242, 0.16);
  font-size: var(--fs-xs);
  color: var(--ink-2);
  line-height: 1.5;
  text-align: left;
}

.parity b { font-family: var(--mono); color: var(--lime); }

.v-base {
  margin-top: var(--sp-3);
  font-family: var(--mono);
  font-size: var(--fs-label);
  color: var(--ink-4);
  letter-spacing: 0.03em;
}

/* --- KPIs 2×2 --- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.stat {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 13px 14px;
}

.stat .s-k {
  font-family: var(--mono);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: 6px;
}

.stat .s-v {
  font-family: var(--mono);
  font-size: var(--fs-xl);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.stat .s-v small { font-size: 11px; color: var(--ink-4); font-weight: 500; }

/* --- listas (últimos / histórico) --- */
.rows { display: flex; flex-direction: column; }

.row-item { border-bottom: 1px solid var(--line); }
.row-item:last-child { border-bottom: none; }

.row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 2px;
  width: 100%;
  background: none;
  border: none;
  color: var(--ink);
  font-family: var(--font);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.row-main--static { cursor: default; }

.row-left { display: flex; align-items: center; gap: 11px; min-width: 0; }

.fdot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.fdot.gas { background: var(--serie-gas); }
.fdot.alc { background: var(--serie-alc); }

.row-left .rl-t b { display: block; font-size: var(--fs-body); font-weight: 600; }
.row-left .rl-t span { font-size: 11.5px; color: var(--ink-3); }

.row-right { text-align: right; flex-shrink: 0; }
.row-right b { display: block; font-family: var(--mono); font-size: 14px; font-weight: 600; }
.row-right span { font-size: 11px; color: var(--ink-3); font-family: var(--mono); }

.row-detail { display: none; padding: 2px 2px 14px; }
.row-item.open .row-detail { display: block; }

.row-detail .rd-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px var(--sp-4);
  font-size: var(--fs-xs);
  color: var(--ink-3);
  margin-bottom: 11px;
}

.row-detail .rd-grid b { color: var(--ink); font-family: var(--mono); font-weight: 600; }

.row-detail .rd-actions { display: flex; gap: var(--sp-2); }

/* --- formulários --- */
.field { margin-bottom: 15px; }

.field > label {
  display: block;
  font-family: var(--mono);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 7px;
}

.input {
  width: 100%;
  min-height: 50px;
  padding: var(--sp-3) 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: var(--field-bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: var(--fs-lg); /* 16px evita zoom automático no iOS */
  font-weight: 500;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
}

.input:focus-visible { outline: none; }

.input:focus {
  border-color: rgba(230, 255, 43, 0.5);
  box-shadow: 0 0 0 3px rgba(230, 255, 43, 0.1);
}

.input::placeholder { color: var(--ink-4); font-family: var(--font); }
.input--text { font-family: var(--font); }

.input.error { border-color: rgba(248, 113, 113, 0.6); }

.input-affix { position: relative; }
.input-affix .affix {
  position: absolute;
  right: 14px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: var(--fs-sm);
  color: var(--ink-4);
  pointer-events: none;
}
.input-affix .input { padding-right: 46px; }

.field-hint { font-size: var(--fs-xs); color: var(--ink-4); margin-top: 5px; }
.field-error { display: none; font-size: var(--fs-xs); color: var(--bad); margin-top: 5px; }
.field.has-error .field-error { display: block; }

.duo { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }

/* seletor de combustível */
.fuel-seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.fuel-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-2);
  background: rgba(5, 26, 31, 0.5);
  cursor: pointer;
  transition: all var(--t-fast);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.fuel-opt .fdot { width: 12px; height: 12px; }
.fuel-opt .fdot.gas { box-shadow: 0 0 9px rgba(122, 142, 20, 0.8); }
.fuel-opt .fdot.alc { box-shadow: 0 0 9px rgba(12, 150, 179, 0.8); }

.fuel-opt b { font-size: 15px; font-weight: 700; }

.fuel-opt.sel-gas { border-color: rgba(230, 255, 43, 0.55); background: rgba(122, 142, 20, 0.16); }
.fuel-opt.sel-alc { border-color: rgba(12, 150, 179, 0.65); background: rgba(12, 150, 179, 0.16); }

/* switch */
.switch-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 13px 15px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: rgba(5, 26, 31, 0.5);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.switch-field .txt b { display: block; font-size: var(--fs-body); font-weight: 600; }
.switch-field .txt span { font-size: 11.5px; color: var(--ink-3); }

.switch {
  position: relative;
  width: 48px; height: 28px;
  flex-shrink: 0;
  border-radius: var(--r-pill);
  background: rgba(249, 247, 242, 0.14);
  transition: background 0.22s ease;
}

.switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--cream);
  transition: transform 0.22s cubic-bezier(0.5, 1.6, 0.4, 1);
}

.switch-field.on { border-color: var(--lime-border); }
.switch-field.on .switch { background: var(--lime); }
.switch-field.on .switch::after { transform: translateX(20px); background: var(--teal-900); }

/* total ao vivo */
.total-live {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 15px;
  border-radius: var(--r-md);
  border: 1px dashed rgba(230, 255, 43, 0.3);
  background: rgba(230, 255, 43, 0.05);
  font-size: 13px;
  color: var(--ink-2);
}

.total-live b { font-family: var(--mono); font-size: var(--fs-xl); font-weight: 600; color: var(--lime); }

/* callout de edição (warn) */
.banner-edit {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px;
  margin-bottom: 14px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.08);
  font-size: 13px;
  color: var(--warn);
}

.banner-edit svg { width: 14px; height: 14px; flex-shrink: 0; }

/* filtros chip */
.chips { display: flex; gap: var(--sp-2); overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }

.chip-f {
  flex-shrink: 0;
  min-height: 38px;
  padding: 9px var(--sp-4);
  border-radius: var(--r-pill);
  border: 1px solid var(--line-2);
  background: rgba(5, 26, 31, 0.5);
  color: var(--ink-2);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}

.chip-f:hover { border-color: rgba(249, 247, 242, 0.26); }
.chip-f.active { background: var(--lime-dim); border-color: var(--lime-border); color: var(--lime); }

/* --- gráficos e tabelas --- */
.chart-box { position: relative; height: 230px; }
.chart-box canvas { width: 100% !important; }

.chart-legend { display: flex; gap: var(--sp-4); margin-top: var(--sp-3); }
.chart-legend .lg { display: flex; align-items: center; gap: 7px; font-size: var(--fs-xs); color: var(--ink-2); }
.chart-legend .sw { width: 11px; height: 11px; border-radius: var(--r-xs); }

details.tbl { margin-top: var(--sp-3); }
details.tbl summary {
  list-style: none;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 9px 0;
  -webkit-tap-highlight-color: transparent;
}
details.tbl summary::before { content: '▸ '; color: var(--lime); }
details.tbl[open] summary::before { content: '▾ '; }

.tbl-wrap { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

table.data th {
  font-family: var(--mono);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-4);
  text-align: left;
  padding: var(--sp-2) 10px var(--sp-2) 0;
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}

table.data td {
  padding: 9px 10px 9px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  white-space: nowrap;
}

table.data td.num, table.data th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
table.data td.strong { color: var(--ink); font-weight: 600; }

/* resumo por combustível */
.res-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.res-line:last-child { border-bottom: none; }
.res-line .k { color: var(--ink-3); }
.res-line .v { font-family: var(--mono); font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }

.res-head { margin-bottom: 6px; }
.res-head--empty {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fuel-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.fuel-badge .dot { width: 7px; height: 7px; border-radius: 50%; }
.fuel-badge.gas { background: rgba(122, 142, 20, 0.15); color: var(--serie-gas-text); border: 1px solid rgba(122, 142, 20, 0.4); }
.fuel-badge.gas .dot { background: var(--serie-gas); }
.fuel-badge.alc { background: rgba(12, 150, 179, 0.15); color: var(--serie-alc-text); border: 1px solid rgba(12, 150, 179, 0.4); }
.fuel-badge.alc .dot { background: var(--serie-alc); }

/* nota de abertura de bloco explicativo */
.lead-note {
  padding: 6px 0 var(--sp-3);
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.55;
}

.lead-note b { color: var(--ink); font-weight: 600; }
.lead-note .win-alc { color: var(--serie-alc-text); }
.lead-note .win-gas { color: var(--lime); }

/* nota curta de ausência de dados */
.muted-note { font-size: 13px; color: var(--ink-3); }

/* --- estados vazios / skeleton / toast --- */
.empty { text-align: center; padding: 36px var(--sp-4); }

.empty .empty-art {
  width: 64px; height: 64px;
  margin: 0 auto 14px;
  border-radius: var(--r-xl);
  display: grid;
  place-items: center;
  background: rgba(11, 70, 80, 0.5);
  border: 1px solid var(--line-2);
  color: var(--teal-500);
}

.empty .empty-art svg { width: 28px; height: 28px; }
.empty h3 { font-size: var(--fs-lg); font-weight: 600; margin-bottom: 6px; }
.empty p { font-size: 13px; color: var(--ink-3); line-height: 1.55; margin-bottom: var(--sp-4); }
.empty .btn { width: auto; }

/* variante compacta para dentro de cartões */
.empty--tight { padding: var(--sp-5) var(--sp-1); }
.empty--tight h3 { font-size: 14px; }
.empty--tight p { margin-bottom: var(--sp-3); }

.empty-note { margin: 0; }

.skeleton { position: relative; overflow: hidden; background: rgba(249, 247, 242, 0.05); border-radius: var(--sp-2); }
.skeleton::after {
  content: '';
  position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(249, 247, 242, 0.07), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.skel-line { height: 12px; margin-bottom: 10px; }
.skel-line.w60 { width: 60%; }
.skel-line.w80 { width: 80%; }
.skel-block { height: 200px; border-radius: var(--r-xl); }

.toast-zone {
  position: fixed;
  left: var(--sp-4); right: var(--sp-4);
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 14px);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  max-width: 528px;
  margin: 0 auto;
}

.toast {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: rgba(10, 51, 59, 0.97);
  box-shadow: var(--shadow-pop);
  animation: toast-in 0.3s var(--ease-spring);
  font-size: 14px;
}

.toast svg { width: 17px; height: 17px; flex-shrink: 0; }
.toast.ok svg { color: var(--good); }
.toast.err svg { color: var(--bad); }
.toast.out { animation: toast-out 0.25s ease forwards; }

@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px); } }

/* --- navegação inferior (abas) --- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: var(--z-tabbar);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(5, 22, 26, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}

.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: var(--tabbar-h);
  color: var(--ink-4);
  text-decoration: none;
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: color var(--t-fast);
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.tabbar a svg { width: 22px; height: 22px; }
.tabbar a:hover { color: var(--ink-2); }
.tabbar a.active { color: var(--lime); }
.tabbar a.active::before {
  content: '';
  position: absolute;
  top: 0;
  width: 34px; height: 2.5px;
  border-radius: 0 0 3px 3px;
  background: var(--lime);
  box-shadow: 0 2px 10px rgba(230, 255, 43, 0.6);
}

/* --- modal (folha inferior) --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(3, 14, 17, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.modal-backdrop.open { opacity: 1; pointer-events: auto; }

.modal {
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  background: linear-gradient(165deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line-2);
  border-bottom: none;
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  padding: 14px var(--sp-5) calc(var(--sp-5) + env(safe-area-inset-bottom, 0px) + 2px);
  transform: translateY(30px);
  transition: transform 0.28s cubic-bezier(0.22, 1.1, 0.36, 1);
}

.modal-backdrop.open .modal { transform: translateY(0); }

.modal-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.modal-head h3 { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.02em; }
.modal-head p { font-size: var(--fs-sm); color: var(--ink-3); margin-top: 3px; }

.modal-close {
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.modal-close svg { width: 15px; height: 15px; }

.modal-actions { display: flex; gap: 10px; margin-top: var(--sp-5); }
.modal-actions .btn { flex: 1; }

/* --- ajustes --- */
.range-field { padding: 14px 15px; border-radius: var(--r-md); border: 1px solid var(--line-2); background: rgba(5, 26, 31, 0.5); }
.range-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--sp-3); }
.range-top span { font-size: var(--fs-sm); color: var(--ink-3); }
.range-val { font-family: var(--mono); font-size: var(--fs-xl); font-weight: 600; color: var(--lime); }

input[type=range] {
  width: 100%; height: 6px;
  -webkit-appearance: none; appearance: none;
  border-radius: var(--sp-1);
  background: linear-gradient(90deg, var(--teal-500), var(--lime-border));
  outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: var(--sp-6); height: var(--sp-6);
  border-radius: 50%;
  background: var(--lime); border: var(--sp-1) solid var(--teal-900);
  box-shadow: 0 0 12px rgba(230, 255, 43, 0.5);
}
input[type=range]::-moz-range-thumb {
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--lime); border: var(--sp-1) solid var(--teal-900);
}

.range-marks { display: flex; justify-content: space-between; margin-top: var(--sp-2); font-family: var(--mono); font-size: var(--fs-eyebrow); color: var(--ink-4); }

.info-note {
  display: flex;
  gap: 11px;
  padding: 13px 14px;
  border-radius: var(--r-md);
  background: rgba(27, 138, 151, 0.09);
  border: 1px solid rgba(27, 138, 151, 0.28);
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.55;
}

.info-note svg { width: var(--sp-4); height: var(--sp-4); color: var(--serie-alc-text); flex-shrink: 0; margin-top: 1px; }

.danger-zone { border: 1px solid rgba(248, 113, 113, 0.26); border-radius: var(--r-xl); overflow: hidden; }
.dz-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-3);
  padding: 14px 15px;
  border-bottom: 1px solid var(--line);
}
.dz-row:last-child { border-bottom: none; }
.dz-txt b { font-size: 14px; display: block; }
.dz-txt span { font-size: var(--fs-xs); color: var(--ink-3); }

.privacy {
  text-align: center;
  font-size: 11px;
  color: var(--ink-4);
  padding: 6px var(--sp-5) 0;
  line-height: 1.6;
}

/* ============================================================
   5 · UTILITÁRIOS
   ============================================================ */
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }

.mono { font-family: var(--mono); }
.text-good { color: var(--good); }
.text-dim { color: var(--ink-3); }
.hide { display: none !important; }

/* ============================================================
   6 · MOTION
   ============================================================ */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.5s ease, transform 0.5s var(--ease-out); }
.reveal.is-in { opacity: 1; transform: translateY(0); }
.d1 { transition-delay: 0.06s; } .d2 { transition-delay: 0.12s; } .d3 { transition-delay: 0.18s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ============================================================
   PWA — banner de instalação + chip offline
   ============================================================ */
#tcInstallBanner {
  position: fixed;
  left: var(--sp-3); right: var(--sp-3);
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + var(--sp-3));
  z-index: var(--z-banner);
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.3s ease, transform 0.3s var(--ease-spring);
  pointer-events: none;
  max-width: 536px;
  margin: 0 auto;
}

#tcInstallBanner.tc-ib-mostra { opacity: 1; transform: translateY(0); pointer-events: auto; }

.tc-ib-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 15px;
  border-radius: var(--r-xl);
  border: 1px solid var(--line-2);
  background: linear-gradient(160deg, #0D3A43, #07262B);
  box-shadow: var(--shadow-sheet), 0 0 0 1px rgba(230, 255, 43, 0.06);
}

.tc-ib-icone {
  width: 46px; height: 46px;
  flex-shrink: 0;
  border-radius: var(--r-lg);
  display: grid;
  place-items: center;
  background: rgba(230, 255, 43, 0.08);
  border: 1px solid rgba(230, 255, 43, 0.2);
}

.tc-ib-icone svg { width: 26px; height: 26px; }

.tc-ib-txt { flex: 1; min-width: 0; }
.tc-ib-txt b { display: block; font-size: 14.5px; font-weight: 700; letter-spacing: -0.01em; }
.tc-ib-txt > span { display: block; font-size: 11.5px; color: var(--ink-3); line-height: 1.45; margin-top: 3px; }

.tc-ib-acoes { display: flex; align-items: center; gap: var(--sp-2); flex-shrink: 0; }

.tc-ib-btn {
  border: none;
  font-family: var(--font);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tc-ib-instalar {
  padding: 10px 18px;
  border-radius: var(--r-sm);
  background: var(--lime);
  color: var(--teal-900);
  font-size: 14px;
  font-weight: 700;
}

.tc-ib-btn.tc-ib-fechar,
.tc-ib-acoes button:not(.tc-ib-instalar) {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  background: rgba(249, 247, 242, 0.06);
  color: var(--ink-3);
}

.tc-ib-btn.tc-ib-fechar svg { width: 14px; height: 14px; }

#tcOfflineChip {
  position: fixed;
  left: var(--sp-3); right: var(--sp-3);
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + var(--sp-3));
  z-index: var(--z-chip);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 0 auto;
  max-width: 536px;
  padding: 10px var(--sp-4);
  border-radius: var(--r-pill);
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: var(--warn);
  font-size: 13px;
  font-weight: 600;
  animation: toast-in 0.3s ease;
}

#tcOfflineChip svg { width: 15px; height: 15px; }

/* ============================================================
   BREAKPOINTS — coluna única, apenas mais respiro
   ============================================================ */
@media (min-width: 720px) {
  .app { padding-top: var(--sp-5); }
  .page-title h1 { font-size: 28px; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .verdict .v-fuel { font-size: 46px; }
  .chart-box { height: 260px; }
}
