/* fontes próprias (licença OFL): iguais em qualquer aparelho, sem depender de site externo */
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 600; font-display: swap; src: url(/static/barlow-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 700; font-display: swap; src: url(/static/barlow-700.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-weight: 400 700; font-display: swap; src: url(/static/inter.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Poppins"; font-weight: 600; font-display: swap; src: url(/static/poppins-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Poppins"; font-weight: 700; font-display: swap; src: url(/static/poppins-700.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Playfair Display"; font-weight: 700; font-display: swap; src: url(/static/playfair-700.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* Mecânico Pro — folha de estilo única das três telas (consulta, visualizador, admin).
   Ideia visual: a oficina. Fundo cinza de primer, painéis brancos, tinta quase preta e o amarelo de fusível
   só nas ações. A única cor "decorativa" é a do fio: cada sistema do veículo (elétrica, injeção, ABS...)
   tem sempre a mesma cor de fio, na faixa lateral da lista e no filtro. */

:root {
  color-scheme: light dark;
  --primer: #e4e8ec;
  --panel: #ffffff;
  --ink: #11171d;
  --muted: #4f5b66;
  --line: #bfc7cf;
  --accent: #f6b800;
  --accent-ink: #11171d;
  --danger: #b3261e;
  --ok: #17703f;
  --canvas: #c9ced3;
  /* cores de fio (VM, AZ, VD, LR, RX, MR, CZ, RS) */
  --w0: #d62b2b; --w1: #1d69d1; --w2: #1e9e55; --w3: #e2711d;
  --w4: #7b3fc4; --w5: #8a5a36; --w6: #6e7a86; --w7: #d6458f;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, "Segoe UI", Roboto, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, "Segoe UI", Roboto, sans-serif;
  --radius: 4px;
}

/* tema: segue o aparelho, a menos que a pessoa escolha claro ou escuro no botão do canto da tela (data-theme no <html>) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primer: #0f1317;
    --panel: #171d23;
    --ink: #ecf0f3;
    --muted: #9aa7b3;
    --line: #2d3640;
    --danger: #ff8a80;
    --ok: #62d394;
    --canvas: #0b0e11;
    --focus: #f6b800;
    --w1: #4c8df0; --w4: #a073e6; --w5: #b88459; --w6: #93a0ac;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
    --primer: #0f1317;
    --panel: #171d23;
    --ink: #ecf0f3;
    --muted: #9aa7b3;
    --line: #2d3640;
    --danger: #ff8a80;
    --ok: #62d394;
    --canvas: #0b0e11;
    --focus: #f6b800;
    --w1: #4c8df0; --w4: #a073e6; --w5: #b88459; --w6: #93a0ac;
}
:root[data-theme="light"] { color-scheme: light; }

.w0 { --wire: var(--w0); } .w1 { --wire: var(--w1); } .w2 { --wire: var(--w2); } .w3 { --wire: var(--w3); }
.w4 { --wire: var(--w4); } .w5 { --wire: var(--w5); } .w6 { --wire: var(--w6); } .w7 { --wire: var(--w7); }
.w-none { --wire: var(--line); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--primer);
  color: var(--ink);
  font: 1.0625rem/1.5 var(--body);
}
[hidden] { display: none !important; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); line-height: 1.1; margin: 0; letter-spacing: -0.005em; }
h1 { font-size: clamp(2rem, 6.5vw, 3.25rem); font-weight: 700; }
h2 { font-size: 1.5rem; font-weight: 700; }
p { margin: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 3px solid var(--focus, var(--ink)); outline-offset: 2px; }

.wrap { max-width: 96rem; margin: 0 auto; padding: 0 clamp(1rem, 3vw, 2.5rem); }

/* ---------- barra superior ---------- */
.topbar { background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem; min-height: 3.5rem; }
.brand { font: 700 1.35rem var(--display); text-decoration: none; margin-right: auto; }
.topbar .who { color: var(--muted); font-size: 0.9375rem; overflow-wrap: anywhere; }

/* ---------- botões, campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 3rem; padding: 0 1.25rem;
  border: 2px solid var(--ink); border-radius: var(--radius);
  background: transparent; color: var(--ink);
  font: 600 1rem var(--display); letter-spacing: 0.01em; text-decoration: none; cursor: pointer;
}
.btn:hover { background: color-mix(in srgb, var(--ink) 9%, transparent); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); border-color: var(--ink); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 86%, var(--ink)); }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-small { min-height: 2.5rem; padding: 0 0.9rem; font-size: 0.9375rem; }
.btn-quiet { border-color: transparent; }
.btn-quiet:hover { border-color: var(--line); }

.field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.field > label, .field > .label { font-size: 0.9375rem; font-weight: 600; }
.hint { color: var(--muted); font-size: 0.875rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"],
input[type="file"], input[type="date"], input[type="tel"], textarea, select {
  width: 100%; min-height: 3rem; padding: 0.5rem 0.75rem;
  border: 2px solid var(--line); border-radius: var(--radius);
  background: var(--panel); color: var(--ink); font: inherit;
}
input:focus-visible, select:focus-visible { border-color: var(--ink); outline-offset: 1px; }
select:disabled { opacity: 0.55; }
.check { display: flex; align-items: flex-start; gap: 0.6rem; }
.check input { width: 1.25rem; height: 1.25rem; margin-top: 0.2rem; accent-color: var(--ink); flex: none; }

.error { color: var(--danger); font-weight: 600; }
.notice {
  padding: 0.75rem 1rem; border: 2px solid var(--line); border-left-width: 6px; border-radius: var(--radius);
  background: var(--panel);
}
.notice.is-error { border-color: var(--danger); }
.notice.is-ok { border-color: var(--ok); }

/* ---------- entrar ---------- */
.login { max-width: 26rem; margin: 0 auto; padding: 3rem 1rem 4rem; }
.login h1 { margin-bottom: 0.5rem; }
.login p.lead { color: var(--muted); margin-bottom: 1.5rem; }
.login form { display: grid; gap: 1rem; }

/* ---------- consulta ---------- */
.search-head { padding: 1.25rem 0 0.5rem; }
.search-head h1 { margin-bottom: 1.25rem; }
.filters { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 40rem) { .filters { grid-template-columns: repeat(3, 1fr); } }
.systems { margin-top: 1.25rem; }
.systems .label { font-size: 0.9375rem; font-weight: 600; margin-bottom: 0.5rem; display: block; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.55rem; min-height: 2.75rem; padding: 0 0.9rem;
  border: 2px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink);
  font: 600 0.9375rem var(--body); cursor: pointer;
}
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--primer); }
.swatch { display: inline-block; width: 1.25rem; height: 0.5rem; border-radius: 0.25rem; background: var(--wire, var(--line)); flex: none; }
.chip-static { cursor: default; min-height: 2rem; font-size: 0.875rem; padding: 0 0.7rem; }
.chip-static:hover { border-color: var(--line); }

.searchbar { display: flex; gap: 0.5rem; margin-top: 1.25rem; }
.searchbar .field { flex: 1; }
.searchbar .btn { align-self: flex-end; }
.searchbar #clear[hidden] { display: none; }

.summary { padding: 0.75rem 0; font: 600 1.125rem var(--display); border-top: 1px solid var(--line); }
.results { list-style: none; margin: 0 0 4rem; padding: 0; display: grid; gap: 0.5rem; }
.row { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row a {
  display: grid; grid-template-columns: 0.5rem 1fr; text-decoration: none;
}
.row a::before { content: ""; background: var(--wire, var(--line)); grid-row: 1; grid-column: 1; }
.row a:hover { background: color-mix(in srgb, var(--ink) 5%, var(--panel)); }
.row-body { grid-column: 2; grid-row: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem; padding: 0.9rem 1rem; }
.row-main { flex: 1 1 18rem; min-width: 0; }
.row-title { display: block; font: 700 1.35rem/1.15 var(--display); overflow-wrap: anywhere; }
.row-facts { display: flex; flex-wrap: wrap; gap: 0.15rem 1.1rem; margin-top: 0.3rem; color: var(--muted); font-size: 0.9375rem; }
.row-snippet { display: block; margin-top: 0.4rem; color: var(--ink); font-size: 0.9375rem; overflow-wrap: anywhere; }
mark { background: color-mix(in srgb, var(--accent) 70%, transparent); color: inherit; border-radius: 2px; padding: 0 0.1em; }

.empty { padding: 2rem 0; display: grid; gap: 1rem; justify-items: start; }
.empty p { max-width: 36rem; }

/* ---------- visualizador ---------- */
body.viewer { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.vbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; padding: 0.5rem 0.75rem;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.vtitle { flex: 1 1 10rem; min-width: 0; font: 700 1.15rem/1.2 var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pager { display: flex; align-items: center; gap: 0.5rem; }
.pagebox { display: flex; align-items: center; gap: 0.4rem; font-weight: 600; white-space: nowrap; }
.pagebox input { width: 4.25rem; text-align: center; padding: 0.4rem; }
.stage { position: relative; flex: 1; min-height: 0; background: var(--canvas); }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#cv:active { cursor: grabbing; }
.zoom { position: absolute; right: 0.75rem; bottom: 0.75rem; display: grid; justify-items: end; gap: 0.4rem; }
.zoom .btn { background: var(--panel); min-width: 3rem; }
.zoom .btn:hover { background: color-mix(in srgb, var(--ink) 9%, var(--panel)); }
.trace {
  position: absolute; left: 0.75rem; bottom: 0.75rem; max-width: min(24rem, calc(100% - 7rem));
  padding: 0.4rem 0.6rem; border-radius: var(--radius); background: color-mix(in srgb, var(--panel) 88%, transparent);
  color: var(--muted); font-size: 0.8125rem; line-height: 1.3; pointer-events: none;
}
.vstatus {
  position: absolute; left: 50%; top: 0.75rem; transform: translateX(-50%); max-width: calc(100% - 1.5rem);
  padding: 0.6rem 1rem; border: 2px solid var(--ink); border-radius: var(--radius); background: var(--panel); font-weight: 600;
}
.progress { position: absolute; left: 0; top: 0; height: 4px; width: 100%; background: var(--accent); transform-origin: left; }
@media (prefers-reduced-motion: no-preference) {
  .progress { animation: slide 1.1s ease-in-out infinite; }
  @keyframes slide { 0% { transform: scaleX(0.05) translateX(0); } 50% { transform: scaleX(0.4) translateX(60%); } 100% { transform: scaleX(0.05) translateX(1900%); } }
}

/* ---------- modo de leitura (texto) ---------- */
#cv[hidden], .zoom[hidden], .trace[hidden] { display: none; }
.modes { display: flex; gap: 0.25rem; }
.modes .btn[aria-pressed="true"] { background: var(--ink); color: var(--panel); }
.reader { position: absolute; inset: 0; overflow-y: auto; background: var(--panel); padding: 1rem 1rem 4rem; }
.reader[hidden] { display: none; }
.reader > * { max-width: 46rem; margin-inline: auto; }
.reader-tools { display: flex; justify-content: flex-end; gap: 0.4rem; margin-bottom: 0.75rem; }
.reader-body { font-size: 1.0625rem; line-height: 1.65; overflow-wrap: anywhere; }
.reader.fs-0 .reader-body { font-size: 0.9375rem; }
.reader.fs-2 .reader-body { font-size: 1.25rem; }
.reader.fs-3 .reader-body { font-size: 1.5rem; }
.reader.fs-4 .reader-body { font-size: 1.85rem; }
.r-head { font: 700 1.2em/1.3 var(--display); margin: 1.6em 0 0.4em; padding-bottom: 0.2em; border-bottom: 2px solid var(--line); }
.r-head:first-child { margin-top: 0; }
.r-par { margin: 0 0 0.9em; }
.r-list { margin: 0 0 0.9em; padding-left: 1.6em; }
.r-list li { margin-bottom: 0.35em; padding-left: 0.2em; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; font-weight: 700;
  padding: 0.05em 0.35em; border-radius: 0.3em; background: color-mix(in srgb, var(--accent) 18%, var(--panel)); }
.reader-note { margin-top: 2rem; font-size: 0.875rem; }

/* ---------- conteúdo do documento e índice do visualizador ---------- */
.doc-head { display: grid; gap: 0.5rem; justify-items: start; padding: 1.5rem 0 1rem; }
.doc-head h1 { font: 700 clamp(1.5rem, 4vw, 2.2rem)/1.15 var(--display); }
.doc-filter { max-width: 24rem; margin: 0.75rem 0; }
.cat { margin: 1.5rem 0; }
.cat-title { display: flex; align-items: center; gap: 0.5rem; font: 700 1.25rem var(--display); padding-bottom: 0.4rem; border-bottom: 2px solid var(--line); }
.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-list a, .toc-item {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; width: 100%;
  padding: 0.55rem 0.5rem; border: 0; background: none; color: inherit; font: inherit; text-align: left;
  text-decoration: none; border-bottom: 1px solid var(--line); cursor: pointer; min-height: 2.75rem;
}
.toc-list a:hover, .toc-item:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.toc-top > a, .toc-top > .toc-item { font-weight: 700; }
.toc-sub > a, .toc-sub > .toc-item { padding-left: 1.5rem; }
.toc-page { color: var(--muted); font-size: 0.875rem; white-space: nowrap; }
.toc-item[aria-current="true"] { background: color-mix(in srgb, var(--accent) 25%, var(--panel)); }
.toc-cat { padding: 0.9rem 0.5rem 0.3rem; font: 700 0.8125rem var(--display); text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.vcrumb { padding: 0.3rem 0.75rem; font-size: 0.875rem; color: var(--muted); background: var(--panel); border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vcrumb[hidden], .toc[hidden] { display: none; }
.toc { position: absolute; z-index: 5; top: 0; bottom: 0; left: 0; width: min(24rem, 100%); overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); }
.toc-bar { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0.75rem; background: var(--panel); border-bottom: 2px solid var(--line); }

/* ---------- admin ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; margin: 1.5rem 0 1.25rem; border-bottom: 1px solid var(--line); }
.tab {
  padding: 0.6rem 0; border: 0; border-bottom: 4px solid transparent; background: none; color: var(--muted);
  font: 700 1.1rem var(--display); cursor: pointer;
}
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.panel { padding-bottom: 4rem; display: grid; gap: 1.5rem; }
.panel > section { display: grid; gap: 0.75rem; }
.form-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 40rem) { .form-grid { grid-template-columns: repeat(2, 1fr); } .span-2 { grid-column: span 2; } }
.uploading { display: grid; gap: 0.35rem; }
progress { width: 100%; height: 0.75rem; accent-color: var(--ink); }
.table-scroll { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
th, td { padding: 0.65rem 0.75rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
th { font: 700 0.9375rem var(--display); color: var(--muted); white-space: nowrap; }
td .muted, .muted { color: var(--muted); }
td .muted { overflow-wrap: anywhere; }
#flash:not(:empty) { margin-bottom: 1rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.status-ok { color: var(--ok); font-weight: 700; }
.status-bad { color: var(--danger); font-weight: 700; }
.status-wait { color: var(--muted); font-weight: 700; }

/* celular: cada linha da tabela vira um cartão, com o nome da coluna ao lado do valor */
@media (max-width: 40rem) {
  .table-scroll table, .table-scroll tbody, .table-scroll tr, .table-scroll td { display: block; }
  .table-scroll thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .table-scroll tr { padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
  .table-scroll tr:last-child { border-bottom: 0; }
  .table-scroll td { padding: 0.3rem 0.75rem; border: 0; overflow-wrap: anywhere; }
  .table-scroll td::before { content: attr(data-label); display: block; color: var(--muted); font-size: 0.8125rem; font-weight: 700; }
}

/* ---------- oficina (CRM) ---------- */
.tab[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
textarea { width: 100%; padding: 0.5rem 0.75rem; border: 2px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); font: inherit; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; }
.stack { list-style: none; margin: 0.75rem 0 1.5rem; padding: 0; display: grid; gap: 0.5rem; }
.card-link { display: grid; gap: 0.2rem; text-decoration: none; color: inherit; }
.card-head { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; justify-content: space-between; margin-bottom: 0.4rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0; }
.form-grid { display: grid; gap: 0.9rem; margin: 1rem 0; }
.form-row { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); }
.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.alert { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: center; justify-content: space-between; border-left-width: 6px; }
.alert.is-overdue { border-left-color: var(--danger); }
.alert.is-soon { border-left-color: var(--accent); }
.alert.is-ok { border-left-color: var(--ok); }
.alert.is-expired { border-left-color: var(--line); }
.tag { display: inline-block; margin-left: 0.5rem; padding: 0.1rem 0.6rem; border: 1px solid var(--line); border-radius: 999px; font-size: 0.8125rem; font-weight: 600; }
.tag.is-overdue { border-color: var(--danger); color: var(--danger); }
.tag.is-ok, .tag.is-active { border-color: var(--ok); }
.item-row { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem; align-items: end; }
.item-row .item-name { grid-column: 1 / -1; }
.mini { display: grid; gap: 0.25rem; font-size: 0.875rem; font-weight: 600; }
.table-wrap { overflow-x: auto; margin-bottom: 4rem; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.table th, .table td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table thead th { font-size: 0.8125rem; color: var(--muted); }
.table tbody th { font-weight: 600; min-width: 11rem; }
.bar { height: 0.4rem; margin-top: 0.3rem; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar .fill { display: block; height: 100%; background: var(--accent); }
.bar .fill.w0 { width: 0%; }
.bar .fill.w1 { width: 10%; }
.bar .fill.w2 { width: 20%; }
.bar .fill.w3 { width: 30%; }
.bar .fill.w4 { width: 40%; }
.bar .fill.w5 { width: 50%; }
.bar .fill.w6 { width: 60%; }
.bar .fill.w7 { width: 70%; }
.bar .fill.w8 { width: 80%; }
.bar .fill.w9 { width: 90%; }
.bar .fill.w10 { width: 100%; }
.report-filter { max-width: 20rem; margin: 0.75rem 0; }
#view .notice { margin: 0.9rem 0; }

/* rodapé de todas as telas */
body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
body > main { flex: 1 0 auto; }
.site-foot { flex: none; padding: 0.9rem 1rem; text-align: center; font-size: 0.8125rem; color: var(--muted); border-top: 1px solid var(--line); }
.site-foot strong { color: var(--ink); font-weight: 600; }
body.viewer .site-foot { padding: 0.3rem 1rem; font-size: 0.75rem; }

/* ---------- telas largas: aproveitam a tela inteira; no celular tudo continua em coluna única ---------- */
.stack.grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); }
.plain.cats { grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); gap: 0.5rem; margin-bottom: 1rem; }
.plain.cats li { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.5rem 0.75rem; }
.cols { display: grid; gap: 0 2rem; align-items: start; }
.card.form-grid > .field:has(textarea), .card.form-grid > .error, .card.form-grid > .actions, .card.form-grid > .item-row,
.card.form-grid > .stack, .card.form-grid > .hint, .card.form-grid > .check, .card.form-grid > .form-row,
.card.form-grid > button { grid-column: 1 / -1; }
.card.form-grid { max-width: 60rem; }
.card-link strong, .alert strong { overflow-wrap: anywhere; }
.table-wrap { -webkit-overflow-scrolling: touch; }

@media (min-width: 64rem) {
  /* consulta: filtros fixos à esquerda, resultados à direita */
  #app > .wrap { display: grid; grid-template-columns: 24rem minmax(0, 1fr); column-gap: 2.5rem; align-items: start; }
  #app .search-head { grid-column: 1; grid-row: 1 / span 4; position: sticky; top: 1rem; padding-top: 1.5rem; max-height: calc(100dvh - 2rem); overflow-y: auto; }
  #app .search-head h1 { font-size: 2rem; margin-bottom: 1rem; }
  #app .filters { grid-template-columns: 1fr; }
  #app .summary, #app .results, #app #empty { grid-column: 2; }
  #app .summary { margin-top: 1.5rem; border-top: 0; padding-top: 0; }
  #app .results { grid-template-columns: repeat(auto-fill, minmax(28rem, 1fr)); }
  /* oficina: retornos/garantias ao lado do histórico */
  .cols { grid-template-columns: minmax(20rem, 26rem) minmax(0, 1fr); }
  .cols .col-main .stack { grid-template-columns: repeat(auto-fill, minmax(26rem, 1fr)); }
  /* conteúdo do documento: categorias em colunas */
  #dlist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 3rem; align-items: start; }
}
@media (min-width: 100rem) { #dlist { grid-template-columns: repeat(3, minmax(0, 1fr)); } #app > .wrap { grid-template-columns: 26rem minmax(0, 1fr); } }
@media (max-width: 40rem) {
  .alert { flex-direction: column; align-items: flex-start; }
  .actions .btn { flex: 1 1 auto; }
  .searchbar { flex-wrap: wrap; }
  .searchbar .field { flex-basis: 100%; }
  .tabs { gap: 0.25rem 1rem; }
  .card-head { align-items: flex-start; }
}
.wrap { width: 100%; box-sizing: border-box; min-width: 0; }
.table-wrap, .table-scroll { max-width: 100%; }

/* ---------- catálogo ---------- */
.cat-filters { margin: 1rem 0; max-width: 40rem; }
@media (min-width: 40rem) { .cat-filters { grid-template-columns: 1fr 1fr; } }
.brand-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); align-items: start; margin-bottom: 4rem; }
.brand-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; }
.brand-card .count { font-size: 0.9rem; font-weight: 400; }
.model-list { list-style: none; margin: 0.6rem 0 0; padding: 0; display: grid; gap: 0.35rem; }
.model-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.4rem; }
.fuel-tag { display: inline-block; padding: 0.05rem 0.55rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; border: 1px solid var(--line); }
.fuel-diesel { --fuel: #b8782a; } .fuel-gasolina { --fuel: #d64545; } .fuel-flex { --fuel: #2e9e5b; }
.fuel-hibrido { --fuel: #8a5cd6; } .fuel-eletrico { --fuel: #2f7fe0; }
.fuel-tag { border-color: var(--fuel); color: var(--fuel); }
.chip[class*="fuel-"] .swatch { background: var(--fuel); }
.actions.tight { margin: 0; }
.card-head .actions { justify-content: flex-end; }

/* ---------- tipo de letra escolhido pela oficina (data-font no <html>) ---------- */
:root[data-font="padrao"] { --display: "Barlow Semi Condensed", "Arial Narrow", system-ui, sans-serif; --body: "Inter", system-ui, sans-serif; }
:root[data-font="moderna"] { --display: "Poppins", system-ui, sans-serif; }
:root[data-font="classica"] { --display: "Playfair Display", Georgia, "Times New Roman", serif; }
:root[data-font="moderna"] h1 { font-size: clamp(1.8rem, 5.5vw, 2.8rem); }
:root[data-font="classica"] h1 { font-size: clamp(1.8rem, 5.5vw, 2.9rem); letter-spacing: 0; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; }
.brand-logo { height: 2.25rem; width: auto; max-width: 9rem; object-fit: contain; border-radius: 4px; background: #000; padding: 2px; }
.font-picker { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
.font-option { display: grid; gap: 0.2rem; padding: 0.8rem 1rem; border: 2px solid var(--line); border-radius: var(--radius); background: var(--panel); cursor: pointer; }
.font-option:has(input:checked) { border-color: var(--accent); }
.font-option input { position: absolute; opacity: 0; pointer-events: none; }
.font-option:has(input:focus-visible) { outline: 3px solid var(--focus, var(--ink)); }
.font-sample { font-size: 1.5rem; line-height: 1.15; font-weight: 700; }
.font-sample.iphone { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, sans-serif; }
.font-sample.padrao { font-family: "Barlow Semi Condensed", sans-serif; }
.font-sample.moderna { font-family: "Poppins", sans-serif; }
.font-sample.classica { font-family: "Playfair Display", serif; }
.logo-box { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.logo-preview { max-height: 5rem; max-width: 14rem; object-fit: contain; background: #000; border: 1px solid var(--line); border-radius: var(--radius); padding: 0.4rem; }
.card.form-grid > .field:has(.font-picker) { grid-column: 1 / -1; }
.font-picker { border: 0; padding: 0; margin: 0; }

/* ---------- menu em botões grandes e logotipo maior ---------- */
.topbar .wrap { min-height: 5rem; padding-top: 0.5rem; padding-bottom: 0.5rem; gap: 0.6rem 0.75rem; }
.topbar .brand { font-size: 1.6rem; gap: 0.9rem; }
.brand-logo { height: 3.75rem; max-width: 16rem; padding: 3px 6px; }
.topbar .btn, .topbar .btn.btn-small {
  min-height: 3rem; padding: 0 1.3rem; font-size: 1.05rem; border: 2px solid var(--line); background: var(--panel);
}
.topbar .btn:hover { border-color: var(--ink); }
.topbar .who { font-size: 0.9375rem; }
.tabs { gap: 0.6rem; margin: 1.25rem 0 1.5rem; border-bottom: 0; }
.tab {
  display: inline-flex; align-items: center; min-height: 3rem; padding: 0 1.4rem; border: 2px solid var(--line);
  border-radius: var(--radius); background: var(--panel); color: var(--ink); font: 700 1.1rem var(--display); text-decoration: none;
}
.tab:hover { border-color: var(--ink); }
.tab[aria-selected="true"], .tab[aria-current="page"] { background: var(--accent); border-color: var(--ink); color: var(--accent-ink); }
@media (max-width: 40rem) {
  .topbar .wrap { min-height: 4.25rem; }
  .brand-logo { height: 3rem; max-width: 10rem; }
  .topbar .brand { font-size: 1.3rem; }
  .topbar .btn, .topbar .btn.btn-small { min-height: 2.75rem; padding: 0 1rem; }
  .tab { flex: 1 1 auto; justify-content: center; padding: 0 1rem; }
}

/* ---------- botão de tema (canto inferior direito) ---------- */
.theme-toggle {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 60; display: inline-flex; align-items: center; gap: 0.5rem;
  min-height: 2.75rem; padding: 0 1rem; border: 2px solid var(--ink); border-radius: 999px; background: var(--panel);
  color: var(--ink); font: 700 0.9375rem var(--display); cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.theme-toggle:hover { background: var(--accent); color: var(--accent-ink); }
.theme-toggle .ico { font-size: 1.15rem; line-height: 1; }
body:not(.viewer) .site-foot { padding-bottom: 4.5rem; }
body.viewer .theme-toggle { right: 0.5rem; bottom: 0.15rem; min-height: 1.6rem; padding: 0 0.7rem; font-size: 0.75rem; box-shadow: none; border-width: 1px; }

/* ---------- tamanho do texto (botões A− / A+; data-size no <html>) ---------- */
:root[data-size="-1"] { font-size: 90%; }
:root[data-size="1"] { font-size: 112.5%; }
:root[data-size="2"] { font-size: 125%; }
:root[data-size="3"] { font-size: 150%; }
h1, h2, h3, .brand { letter-spacing: -0.01em; }

/* ---------- botões flutuantes do canto: tamanho do texto e tema ---------- */
.float-ctl { position: fixed; right: 1rem; bottom: 1rem; z-index: 60; display: flex; gap: 0.4rem; }
.float-ctl .theme-toggle { position: static; }
.size-btn {
  min-width: 2.75rem; min-height: 2.75rem; padding: 0 0.6rem; border: 2px solid var(--ink); border-radius: 999px; background: var(--panel);
  color: var(--ink); font: 700 1rem var(--display); cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.size-btn:hover:not([disabled]) { background: var(--accent); color: var(--accent-ink); }
.size-btn[disabled] { opacity: 0.4; cursor: not-allowed; }
body.viewer .float-ctl { right: 0.5rem; bottom: 0.15rem; gap: 0.25rem; }
body.viewer .size-btn { min-width: 1.8rem; min-height: 1.6rem; padding: 0 0.4rem; font-size: 0.75rem; border-width: 1px; box-shadow: none; }

/* ---------- código de acesso do aparelho ---------- */
.pair-code {
  font: 700 clamp(1.6rem, 8vw, 2.6rem)/1.1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.1em; white-space: nowrap;
  text-align: center; padding: 1.2rem 0.5rem; margin: 1rem 0; background: var(--panel); border: 2px dashed var(--ink);
  border-radius: var(--radius); user-select: all;
}
#login .notice, #login .hint, #login .btn { margin-top: 0.6rem; }
