/* =====================================================================
   Park Seguro — estilos
   Botões: cantos arredondados (não "pílula"), ação principal sempre
   colorida, e uma cor por tipo de ação (verde = confirmar/cobrar,
   vermelho = excluir, âmbar = atenção).
   ===================================================================== */
:root {
  --navy-950: #0b1f2b;
  --navy-900: #0f2a3a;
  --navy-800: #163b52;
  --navy-700: #1f4d69;
  --teal-600: #168577;
  --teal-500: #1f9e8f;
  --teal-400: #2bbca9;
  --blue-600: #2563c9;
  --blue-500: #2f74e0;
  --green-600: #1e8a4c;
  --green-500: #22a35a;
  --amber-600: #c98410;
  --amber-500: #e8a33d;
  --red-600: #c03b3b;
  --red-500: #d94f4f;
  --paper: #f2f5f7;
  --ink: #12242c;
  --ink-soft: #4c6270;
  --border: #d9e2e6;
  --radius: 12px;
  --radius-btn: 10px;
  --sombra: 0 1px 2px rgba(15, 42, 58, 0.06), 0 4px 14px rgba(15, 42, 58, 0.06);
  font-size: 15px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--paper);
  color: var(--ink);
}

a { color: var(--blue-600); }

/* ---------------- Faixas de aviso no topo ---------------- */
.faixa { text-align: center; padding: 9px 14px; font-weight: 600; font-size: 0.86rem; }
.faixa-alerta { background: var(--red-500); color: #fff; }
.faixa-nuvem { background: #e5efff; color: #1b3f7a; border-bottom: 1px solid #c4d7f7; }

/* ---------------- Barra superior ---------------- */
.topbar {
  background: var(--navy-950);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 58px;
  gap: 12px;
}
.topbar-direita { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.12rem; letter-spacing: 0.02em; white-space: nowrap; }
.brand .mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--teal-400), var(--blue-500));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 0.95rem;
}
.brand .sub { font-weight: 400; font-size: 0.7rem; color: #9fb6bf; text-transform: uppercase; letter-spacing: 0.08em; margin-left: 4px; }

.hamburger {
  display: none; background: rgba(255,255,255,0.08); border: none; color: #fff;
  width: 40px; height: 40px; border-radius: 10px; cursor: pointer;
  flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.hamburger span { display: block; width: 20px; height: 2px; background: #fff; border-radius: 2px; }

.unidade-switcher select {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.18); color: #fff;
  padding: 7px 10px; border-radius: 9px; font-size: 0.82rem; font-weight: 600; width: auto;
}
.unidade-switcher select option { color: var(--ink); }
.unidade-label { font-size: 0.82rem; font-weight: 600; color: #cfe3e6; white-space: nowrap; }

.user-pill { font-size: 0.8rem; color: #b8cbd2; white-space: nowrap; }
.papel-badge {
  display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 0.66rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; margin-left: 6px;
}
.papel-badge.admin { background: var(--amber-500); color: #3a2a05; }
.papel-badge.admin_master { background: var(--red-500); color: #fff; }
.papel-badge.manobrista { background: var(--teal-500); color: #fff; }
.topbar .sair {
  color: #fff; text-decoration: none; font-size: 0.82rem; font-weight: 600;
  padding: 7px 12px; border-radius: 9px; background: rgba(255,255,255,0.08);
}
.topbar .sair:hover { background: rgba(255,255,255,0.16); }

.sync-pill {
  font-size: 0.76rem; font-weight: 700; padding: 5px 10px; border-radius: 8px;
  background: rgba(255,255,255,0.1); color: #dbe7ea; white-space: nowrap;
}
.sync-pill.on { background: rgba(34,163,90,0.22); color: #9ff0bf; }
.sync-pill.off { background: rgba(232,163,61,0.25); color: #ffd99a; }

/* ---------------- Menu (segunda linha, agrupado) ---------------- */
.nav {
  background: var(--navy-900);
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  padding: 8px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.nav-grupo { display: flex; flex-wrap: wrap; gap: 4px; }
.nav-grupo + .nav-grupo { padding-left: 18px; border-left: 1px solid rgba(255,255,255,0.12); }
.nav a {
  text-decoration: none; color: #cfe3e6; padding: 7px 13px; border-radius: 9px;
  font-size: 0.87rem; font-weight: 500;
}
.nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav a.active { background: var(--teal-500); color: #fff; font-weight: 700; }
.nav-config a { color: #9fb6bf; }
.so-celular { display: none !important; }
.nav-ajuda { margin-left: auto; }

.container { max-width: 1120px; margin: 0 auto; padding: 26px 24px 60px; }

.page-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.page-header h1 { margin: 0; font-size: 1.5rem; color: var(--navy-950); }
.page-header p { margin: 4px 0 0; color: var(--ink-soft); font-size: 0.9rem; }
.page-header .acoes { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- Botões ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 10px 18px;
  border-radius: var(--radius-btn);
  border: 1px solid transparent;
  font-weight: 700; font-size: 0.88rem; font-family: inherit; line-height: 1.1;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  background: var(--blue-500); color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.15) inset, 0 2px 6px rgba(37, 99, 201, 0.25);
  transition: filter 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid rgba(47, 116, 224, 0.35); outline-offset: 2px; }
.btn.primary { background: var(--blue-500); }
.btn.success { background: var(--green-500); box-shadow: 0 2px 6px rgba(30, 138, 76, 0.28); }
.btn.teal { background: var(--teal-500); box-shadow: 0 2px 6px rgba(22, 133, 119, 0.28); }
.btn.warning { background: var(--amber-500); color: #3a2a05; box-shadow: 0 2px 6px rgba(201, 132, 16, 0.25); }
.btn.danger { background: var(--red-500); box-shadow: 0 2px 6px rgba(192, 59, 59, 0.25); }
.btn.secondary { background: var(--navy-800); box-shadow: 0 2px 6px rgba(15, 42, 58, 0.25); }
.btn.ghost { background: #fff; color: var(--navy-800); border-color: var(--border); box-shadow: none; }
.btn.ghost:hover { background: #f4f8fa; filter: none; }
.btn.small { min-height: 34px; padding: 7px 12px; font-size: 0.78rem; border-radius: 8px; }
.btn.big { min-height: 52px; padding: 14px 26px; font-size: 1rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-linha { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--sombra);
}
.card h3 { color: var(--navy-950); }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--ink-soft); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: none; }

.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}
.tag.pequeno { background: #dff1ee; color: var(--teal-500); }
.tag.grande { background: #e9f0d9; color: #5a7d1f; }
.tag.moto { background: #fdeacb; color: #a56a10; }
.tag.horista { background: #eef1f5; color: var(--ink-soft); }
.tag.diarista { background: #e1eef7; color: #2c6b9c; }
.tag.mensalista { background: #f3e6f7; color: #7a3c9c; }

form.stack { display: flex; flex-direction: column; gap: 14px; max-width: 480px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid .full { grid-column: 1 / -1; }
.grid.grid-4 { grid-template-columns: repeat(4, 1fr); }

label { font-size: 0.82rem; font-weight: 600; color: var(--navy-800); display: block; margin-bottom: 5px; }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.92rem;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 3px solid rgba(47, 116, 224, 0.25);
  outline-offset: 0;
  border-color: var(--blue-500);
}

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 0.88rem; font-weight: 500; }
.flash.erro { background: #fbe4e4; color: #8c2a2a; border: 1px solid #f0b3b3; }
.flash.sucesso { background: #dcf1e6; color: #206942; border: 1px solid #a9dabd; }
.flash.info { background: #e5efff; color: #1b3f7a; border: 1px solid #c4d7f7; }
.flash.aviso { background: #fdf3df; color: #7a5208; border: 1px solid #f2d59b; }

.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 20% 20%, var(--navy-800), var(--navy-950) 70%);
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  width: 340px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.35);
}
.login-card .brand { color: var(--navy-950); margin-bottom: 24px; justify-content: center; }
.login-card .brand .sub { color: var(--ink-soft); }

.value-big { font-size: 2.4rem; font-weight: 800; color: var(--navy-950); }

.stat-row { display: flex; gap: 16px; flex-wrap: wrap; }
.stat-box { flex: 1; min-width: 150px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--sombra); }
.stat-box.destaque { border-left: 4px solid var(--blue-500); }
.stat-box.ok { border-left: 4px solid var(--green-500); }
.stat-box.atencao { border-left: 4px solid var(--amber-500); }
.stat-box.perigo { border-left: 4px solid var(--red-500); }
.stat-box .label { font-size: 0.75rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-box .value { font-size: 1.5rem; font-weight: 700; color: var(--navy-950); margin-top: 4px; }

.muted { color: var(--ink-soft); font-size: 0.85rem; }
.empty-state { text-align: center; padding: 50px 20px; color: var(--ink-soft); }

.result-block { padding: 14px 16px; border-radius: 8px; margin-top: 10px; font-size: 0.88rem; }
.result-block.ok { background: #dcf1e6; color: #206942; }
.result-block.fail { background: #fbe4e4; color: #8c2a2a; }

/* Autocomplete customizado (marca/modelo) */
.autocomplete-wrap { position: relative; }
.autocomplete-lista {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 40;
  display: none;
  box-shadow: 0 12px 20px rgba(0,0,0,0.08);
}
.autocomplete-lista.aberta { display: block; }
.autocomplete-item {
  padding: 9px 12px;
  font-size: 0.88rem;
  cursor: pointer;
}
.autocomplete-item:hover, .autocomplete-item.destacado { background: var(--paper); }

/* ---------------- Tabelas responsivas (viram cards no celular) ---------------- */
.table-responsive { width: 100%; }

@media (max-width: 720px) {
  body { font-size: 0.95rem; }
  .container { padding: 16px 14px 50px; }
  .hamburger { display: flex; }

  .topbar { padding: 0 14px; }
  .brand .sub, .user-pill, .unidade-label, .topbar .sair { display: none; }
  .nav { display: none; flex-direction: column; padding: 10px 14px 16px; }
  .nav.open { display: flex; }
  .nav-grupo { flex-direction: column; }
  .nav-grupo + .nav-grupo { padding-left: 0; border-left: none; border-top: 1px solid rgba(255,255,255,0.12); padding-top: 6px; }
  .nav a { padding: 12px 14px; font-size: 1rem; }
  .nav .so-celular { display: flex !important; }
  .unidade-switcher select { width: 100%; }

  .page-header { align-items: stretch; }
  .page-header .btn, .page-header .acoes { width: 100%; justify-content: center; }
  .busca-rapida .btn { width: auto; }
  .busca-rapida input { min-width: 0; font-size: 0.95rem; }

  .grid, .grid.grid-4 { grid-template-columns: 1fr; }
  form.stack, .grid { max-width: 100%; }

  .btn { width: 100%; justify-content: center; }
  .card .btn.small, td .btn, td form .btn { width: auto; }

  .stat-row { flex-direction: column; }

  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td {
    display: block;
    width: 100%;
  }
  table.responsive tr {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    padding: 6px 12px;
    background: #fff;
  }
  table.responsive td {
    border-bottom: 1px solid var(--border);
    padding: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    text-align: right;
  }
  table.responsive td:last-child { border-bottom: none; }
  table.responsive td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--ink-soft);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: left;
  }
}


/* ---------------- Componentes extras ---------------- */
.busca-rapida { display: flex; gap: 8px; margin-bottom: 18px; }
.busca-rapida input { font-size: 1.05rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.busca-rapida .btn { flex-shrink: 0; }

.cards-pendentes { display: flex; flex-wrap: wrap; gap: 10px; }
.pendente {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  display: flex; align-items: center; gap: 10px; background: #fff;
}
.pendente.horista { background: #fdf6e8; border-color: #f2d59b; }
.pendente.sem-placa { background: #fdecec; border-color: #f0b3b3; }
.pendente.mensalista { background: #eafaf7; border-color: #b6e6dd; }
.pendente strong { font-size: 1.05rem; letter-spacing: 0.03em; }

tr.linha-alerta td { background: #fff6e5; }
.selo { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 0.7rem; font-weight: 700; }
.selo.vermelho { background: #fbe4e4; color: #8c2a2a; }
.selo.ambar { background: #fdf3df; color: #7a5208; }
.selo.verde { background: #dcf1e6; color: #206942; }
.selo.azul { background: #e5efff; color: #1b3f7a; }

.secao-titulo { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.secao-titulo h3 { margin: 0; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.check input { width: auto; }

.foto-veiculo { display: inline-block; width: 56px; height: 42px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); flex-shrink: 0; background: #e8eef1; }
.foto-veiculo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto-veiculo.grande { width: 220px; height: 150px; }
.saida-topo { display: flex; gap: 16px; align-items: stretch; flex-wrap: wrap; margin-bottom: 14px; }
details summary { padding: 6px 0; }

/* ---------------- Manuais ---------------- */
.manual { max-width: 860px; }
.manual h2 { color: var(--navy-950); margin: 30px 0 10px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 1.25rem; }
.manual h2:first-of-type { border-top: none; }
.manual h3 { color: var(--navy-800); margin: 20px 0 6px; font-size: 1.02rem; }
.manual p, .manual li { line-height: 1.6; }
.manual ol li, .manual ul li { margin-bottom: 6px; }
.manual .dica { background: #e5efff; border-left: 4px solid var(--blue-500); padding: 10px 14px; border-radius: 8px; margin: 12px 0; }
.manual .atencao { background: #fdf3df; border-left: 4px solid var(--amber-500); padding: 10px 14px; border-radius: 8px; margin: 12px 0; }
.manual .print { border: 1px solid var(--border); border-radius: 10px; max-width: 100%; box-shadow: var(--sombra); margin: 8px 0 16px; }
.manual code { background: #eef2f4; padding: 1px 6px; border-radius: 5px; font-size: 0.9em; }
.manual .indice { columns: 2; padding-left: 18px; }
.manual kbd { background: #fff; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 0 6px; font-size: 0.85em; }
@media (max-width: 720px) { .manual .indice { columns: 1; } .foto-veiculo.grande { width: 100%; height: 200px; } .nav-ajuda { margin-left: 0; } }
@media print {
  .topbar, .nav, .faixa, .no-print { display: none !important; }
  body { background: #fff; }
  .container { padding: 0; max-width: none; }
  .card { box-shadow: none; border: none; padding: 0; }
  .manual h2 { break-after: avoid; }
  .manual .print { break-inside: avoid; }
}
