:root {
  /* Casa do Motoca: laranja da marca + preto */
  --bg: #f5f3f0; --card: #ffffff; --ink: #141414; --muted: #6b6b6b; --line: #e6e2dd;
  --brand: #fd6205; --brand-2: #d14f00; --ok: #15803d; --bad: #b91c1c; --warn: #a16207;
  --side: #0d0d0d; --radius: 10px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
aside { background: var(--side); color: #e9e7e3; padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.layout { background: linear-gradient(to right, var(--side) 220px, transparent 220px); }
aside .logo { display: block; margin: 0 auto 22px; text-align: center; }
aside .logo img { width: 150px; max-width: 100%; filter: drop-shadow(0 0 1px rgba(255,255,255,.35)); }
aside nav a { display: block; color: #d6d3ce; padding: 9px 10px; border-radius: 8px; margin-bottom: 2px; }
aside nav a:hover { background: #1f1f1f; color: #fff; text-decoration: none; }
aside nav a.on { background: #1f1f1f; color: #fff; box-shadow: inset 3px 0 0 var(--brand); text-decoration: none; }
aside .user { position: absolute; bottom: 18px; left: 22px; right: 14px; font-size: 12px; color: #9b9892; }
aside .user a { color: var(--brand); }
main { padding: 26px 32px 60px; max-width: 1300px; }
h1 { font-size: 22px; margin: 0 0 18px; font-weight: 800; letter-spacing: -.2px; }
.top h1::before { content: ""; display: inline-block; width: 6px; height: 20px; background: var(--brand);
  transform: skewX(-15deg); margin-right: 10px; vertical-align: -2px; border-radius: 1px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.top h1 { margin: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.kpi { border-top: 3px solid var(--brand); }
.kpi .v { font-size: 22px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .s { color: var(--muted); font-size: 12px; margin-top: 2px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; background: #faf9f7; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:hover td { background: #fbfaf8; }
.pos { color: var(--ok); } .neg { color: var(--bad); } .mut { color: var(--muted); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; background: #eee; }
.tag.ok { background: #dcfce7; color: #166534; } .tag.est { background: #ffedd5; color: #9a3412; }
.tag.pend { background: #fef9c3; color: #854d0e; } .tag.ign { background: #e5e7eb; color: #4b5563; }
.btn { display: inline-block; background: var(--brand); color: #fff; letter-spacing: .2px; border: 0; border-radius: 8px; padding: 8px 14px;
       font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--brand-2); text-decoration: none; }
.btn.sec { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.sec:hover { background: #f3f2ef; }
.btn.peq { padding: 4px 10px; font-size: 12px; }
.btn.perigo { background: #fff; color: var(--bad); border: 1px solid #f1c7c7; }
form.inline { display: inline; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 16px; }
.form .full { grid-column: 1 / -1; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid #d6d2cb; border-radius: 8px; font: inherit; background: #fff; }
input[type=checkbox] { width: auto; }
textarea { min-height: 70px; }
.acoes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.flash { background: #fff7ed; border: 1px solid #fed7aa; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.erro { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.avisos li { margin-bottom: 4px; }
.filtros { display: flex; gap: 6px; flex-wrap: wrap; }
.filtros a { padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 13px; }
.filtros a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
body.tela-login { background: radial-gradient(circle at 50% 20%, #2a1405 0%, #0d0d0d 55%); min-height: 100vh; }
.login { max-width: 380px; margin: 0 auto; }
.login-logo { display: block; width: 230px; margin: 7vh auto 18px; filter: drop-shadow(0 6px 18px rgba(253,98,5,.25)); }
.login h1 { text-align: center; font-size: 15px; color: var(--muted); font-weight: 600; letter-spacing: .3px; }
.rodape-login { text-align: center; color: #8a8a8a; font-size: 12px; margin-top: 16px; }
.rodape-login a { color: var(--brand); }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.split { display: flex; justify-content: space-between; gap: 10px; }
.scroll { overflow-x: auto; }
.barra-movel, .fundo-menu, .lista-movel, .so-movel { display: none; }
.cartao-veiculo { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 10px; color: var(--ink); }
.cartao-veiculo:hover { text-decoration: none; border-color: var(--brand); }
.cartao-veiculo > div { margin-top: 2px; font-size: 14px; }
@media (max-width: 860px) {
  /* menu vira gaveta lateral, aberta pelo botão ☰ */
  .barra-movel { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 60;
                 background: var(--side); padding: 8px 12px; }
  .em-testes .barra-movel { top: 33px; }
  .botao-menu { background: none; border: 0; padding: 8px 6px; cursor: pointer; display: flex; flex-direction: column; gap: 5px; }
  .botao-menu span { display: block; width: 24px; height: 2px; background: #fff; border-radius: 2px; }
  .logo-movel img { height: 40px; display: block; }
  .layout { grid-template-columns: 1fr; background: none; }
  aside { position: fixed; top: 0; left: 0; bottom: 0; width: 250px; height: 100vh; z-index: 80;
          transform: translateX(-100%); transition: transform .2s ease; }
  .em-testes aside { top: 0; height: 100vh; }
  .menu-aberto aside { transform: none; box-shadow: 4px 0 24px rgba(0,0,0,.4); }
  .menu-aberto .fundo-menu { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 70; }
  aside nav a { padding: 11px 10px; font-size: 15px; }
  aside .user { position: static; margin-top: 18px; }
  main { padding: 14px 12px 40px; max-width: 100%; overflow-x: hidden; }
  .g2 { grid-template-columns: 1fr; }
  .card { padding: 14px; overflow-x: auto; }
  .top { gap: 10px; }
  .top h1 { font-size: 19px; }
  h2 { font-size: 15px; }
  table { font-size: 13px; }
  th, td { padding: 7px 8px; }
  td.n { white-space: nowrap; }
  input, select, textarea { font-size: 16px; } /* evita zoom automático no iPhone */
  table input, table select { min-width: 110px; }
  .kpi { padding: 12px; }
  .kpi .v { font-size: 19px; }
  .col-opc { display: none; }
  .lista-movel, .so-movel { display: block; }
  .so-desktop { display: none; }
  .acoes .btn { padding: 9px 12px; }
}
@media (max-width: 520px) {
  .g4 { grid-template-columns: 1fr 1fr; }
  .kpi .s { font-size: 11px; }
  .kpi .v { font-size: 17px; }
  .top .acoes { width: 100%; }
  .filtros { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .filtros a { white-space: nowrap; }
  .form { grid-template-columns: 1fr; }
}
/* perfil somente consulta: esconde controles de edição (o servidor também bloqueia) */
.perfil-consulta form[method=post]:not(.livre),
.perfil-consulta a[href*="/novo"], .perfil-consulta a[href*="/editar"],
.perfil-consulta .so-edicao { display: none !important; }
.tabela-usuarios td { vertical-align: middle; }
.tabela-usuarios form { display: inline-flex; gap: 6px; align-items: center; }
.tabela-usuarios select, .tabela-usuarios input { width: auto; padding: 5px 8px; font-size: 12px; }
details summary { cursor: pointer; color: var(--brand-2); font-size: 13px; }
td.acoes { display: table-cell; }
td.acoes > * { display: inline-block; vertical-align: middle; margin: 2px 6px 2px 0; }

/* ambiente de testes: faixa fixa no topo, impossível confundir com produção */
.faixa-testes { position: sticky; top: 0; z-index: 50; background: repeating-linear-gradient(-45deg, #7c3aed 0 18px, #6d28d9 18px 36px);
  color: #fff; text-align: center; font-weight: 800; letter-spacing: .6px; font-size: 13px; padding: 7px 10px; text-transform: uppercase; }
.em-testes aside { top: 33px; height: calc(100vh - 33px); }
.em-testes aside nav a.on { box-shadow: inset 3px 0 0 #7c3aed; }
