/* ============================================
   PORTARIA — Sistema de Controle de Acesso
   Modern, clean, touch-friendly UI
   ============================================ */

:root {
  /* ===== EDECONSIL BRAND ===== */
  --brand:        #0D2B55;   /* Azul escuro principal */
  --brand-yellow: #FCC917;   /* Amarelo destaque */

  /* Brand & surfaces */
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e5e9f2;
  --border-strong: #d6dce8;

  /* Text */
  --text: #0f172a;
  --text-muted: #64748b;
  --text-soft: #94a3b8;

  /* Primary = brand azul */
  --primary: #0D2B55;
  --primary-600: #0a2244;
  --primary-700: #081a35;
  --primary-50: #E8F0FA;
  --primary-100: #c5d5ef;

  /* Status */
  --success: #16a34a;
  --success-50: #ecfdf5;
  --success-100: #d1fae5;
  --warning: #f59e0b;
  --warning-50: #fffbeb;
  --warning-100: #fef3c7;
  --danger: #dc2626;
  --danger-50: #fef2f2;
  --danger-100: #fee2e2;
  --violet: #7c3aed;
  --violet-50: #f5f3ff;
  --violet-100: #ede9fe;

  /* Effects */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, .06), 0 2px 4px -2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 10px 25px -3px rgba(15, 23, 42, .10), 0 4px 6px -4px rgba(15, 23, 42, .05);
  --shadow-xl: 0 25px 50px -12px rgba(15, 23, 42, .25);

  --transition: 160ms cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }
.hidden { display: none !important; }

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 22px; }
h3 { font-size: 16px; }

.muted { color: var(--text-muted); font-size: 13px; font-weight: 500; }

/* ===========================================
   LOGIN
   =========================================== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  position: relative;
  background-image: url('../img/login-bg.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.login-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(5, 15, 40, 0.82) 0%, rgba(13, 43, 85, 0.72) 100%);
  pointer-events: none;
  z-index: 0;
}
.login-split {
  display: flex;
  width: 100%;
  max-width: 880px;
  min-height: 540px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  animation: pop .4s cubic-bezier(.34, 1.56, .64, 1);
  position: relative;
  z-index: 1;
}
.login-left {
  flex: 0 0 320px;
  background: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 36px;
  position: relative;
  overflow: hidden;
}
.login-right {
  flex: 1;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
}
.login-right-inner { width: 100%; max-width: 340px; }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.97);} to { opacity: 1; transform: none; } }

.brand-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--brand-yellow);
  color: var(--brand);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 16px -6px rgba(252, 201, 23, .4);
}
.brand-icon svg { width: 26px; height: 26px; }
.brand-icon.sm { width: 36px; height: 36px; border-radius: 10px; }
.brand-icon.sm svg { width: 20px; height: 20px; }

/* ====== LOGO EDECONSIL — Painel esquerdo do login ====== */
.login-left-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}
.login-left-divider {
  width: 48px;
  height: 3px;
  background: var(--brand-yellow);
  border-radius: 2px;
  margin: 20px 0 14px;
}
.login-left-sub {
  color: rgba(255,255,255,.65);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .1em;
  margin: 0 0 28px;
}
.login-left-badges { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.login-left-badge {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.85);
  font-size: 13px;
  font-weight: 500;
}
.login-left-badge svg { color: var(--brand-yellow); flex-shrink: 0; }
.login-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: -.02em;
  margin-bottom: 6px;
}
.login-subtitle { color: var(--text-muted); font-size: 14px; margin: 0 0 28px; }
.login-mobile-logo { display: none; margin-bottom: 24px; text-align: center; }
.login-mobile-logo img { height: 72px; width: auto; }

/* Logo no login — container branco para fundo escuro */
.login-logo-wrap {
  background: #ffffff;
  border-radius: 16px;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}
.edeconsil-logo-login {
  height: 88px;
  width: auto;
  display: block;
}

/* Logo sidebar/topbar — container branco para fundo escuro */
.edeconsil-logo-sidebar-wrap {
  background: #fff;
  border-radius: 8px;
  padding: 4px 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.edeconsil-logo-sidebar-wrap img {
  height: 30px;
  width: auto;
  display: block;
}

.login-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.field input, .field select, .field textarea, .field-inline input, .field-inline select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus, .field-inline input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(13, 43, 85, .10);
}
.form-error {
  margin: 4px 0 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
  min-height: 18px;
}
/* login-hint removido por segurança */

/* ===========================================
   APP LAYOUT
   =========================================== */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* ========== HAMBURGER BUTTON ========== */
.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.hamburger-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.hamburger-btn svg { width: 20px; height: 20px; }

/* ========== SIDEBAR OVERLAY ========== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(2px);
  z-index: 49;
  opacity: 0;
  transition: opacity .25s ease;
}
.sidebar-overlay.visible { opacity: 1; }

/* SIDEBAR */
.sidebar {
  background: var(--brand);
  color: rgba(255,255,255,.75);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width var(--transition);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px 22px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  margin-bottom: 16px;
  overflow: hidden;
}
.sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.2; white-space: nowrap; }
.sidebar-brand-text strong { color: #fff; font-size: 16px; font-weight: 700; }
.sidebar-brand-text span { color: rgba(255,255,255,.55); font-size: 12px; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,.75);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: all var(--transition);
  white-space: nowrap;
  overflow: hidden;
}
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.10); color: #fff; }
.nav-item.active {
  background: var(--brand-yellow);
  color: var(--brand);
  box-shadow: 0 4px 12px -4px rgba(252, 201, 23, .4);
}
.nav-item.active svg { color: var(--brand); }

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,.12);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255,255,255,.06);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--brand-yellow);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.user-info strong { color: #fff; font-size: 13px; font-weight: 600; }
.user-info span { color: rgba(255,255,255,.55); font-size: 11px; display: flex; align-items: center; gap: 6px; }
.user-info span::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--success);
  border-radius: 50%;
  display: inline-block;
}
/* Botão de logout dentro do sidebar escuro */
.sidebar .btn-ghost {
  border-color: rgba(255,255,255,.2);
  color: rgba(255,255,255,.75);
  background: transparent;
}
.sidebar .btn-ghost:hover {
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.35);
  color: #fff;
}

/* MAIN */
.main {
  padding: 24px 32px 40px;
  overflow-x: hidden;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
  background: var(--surface);
  padding: 16px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.topbar h2 { font-size: 24px; color: var(--brand); }
.topbar p { margin: 4px 0 0; color: var(--text-muted); font-size: 14px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

/* Logo mobile (oculto por padrão, visível apenas no mobile) */
.topbar-logo {
  display: none;
  align-items: center;
  gap: 10px;
}
.topbar-logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.topbar-logo-title { color: #fff; font-size: 15px; font-weight: 700; }
.topbar-logo-sub   { color: rgba(255,255,255,.6); font-size: 11px; }

/* Acesso à conta/logout no mobile (oculto por padrão, visível apenas no mobile).
   Área de toque de 44px (padrão de acessibilidade mobile) mesmo com o círculo
   visível menor — o padding cria a folga sem aumentar o peso visual. */
.topbar-profile-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -4px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: rgba(252, 201, 23, .25);
}
/* Círculo mais sóbrio: contorno âmbar translúcido em vez de amarelo sólido,
   pra sinalizar "toque aqui" sem dominar visualmente o topo navy. */
.topbar-profile-btn .user-avatar {
  width: 36px;
  height: 36px;
  font-size: 14px;
  background: rgba(252, 201, 23, .16);
  color: var(--brand-yellow);
  border: 1.5px solid rgba(252, 201, 23, .55);
}

/* Área de título (visível em tablet/desktop) */
.topbar-title-area { display: flex; align-items: center; gap: 12px; }

/* Saudação mobile */
.mobile-greeting {
  display: none;
  padding: 10px 16px 0;
  font-size: 14px;
  color: var(--text-muted);
}
.mobile-greeting span { color: var(--brand-yellow); font-weight: 700; }
.clock {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.date-pill {
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: capitalize;
}

/* ===========================================
   BUTTONS
   =========================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  font-weight: 600;
  font-size: 14px;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  background: var(--brand-yellow);
  color: var(--brand);
  border-color: transparent;
  font-weight: 700;
}
.btn-primary:hover:not(:disabled) { background: #e6b400; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--brand); border-color: var(--brand); }
.btn-ghost:hover { background: var(--primary-50); border-color: var(--brand); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-lg { padding: 14px 22px; font-size: 15px; }
.btn-block { width: 100%; }

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 32px; height: 32px;
  border-radius: 8px;
  font-size: 22px;
  display: grid;
  place-items: center;
  transition: all var(--transition);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ===========================================
   KPIs
   =========================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 5px;
}
.kpi-blue::before  { background: var(--brand); }
.kpi-amber::before { background: var(--brand-yellow); }
.kpi-green::before { background: linear-gradient(90deg, var(--success), #4ade80); }
.kpi-red::before   { background: linear-gradient(90deg, var(--danger), #f87171); }

.kpi-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 22px;
  flex-shrink: 0;
}
.kpi-blue .kpi-icon  { background: var(--primary-50); color: var(--brand); }
.kpi-amber .kpi-icon { background: #FFF8E0; color: #7A5800; }
.kpi-green .kpi-icon { background: var(--success-50); color: var(--success); }
.kpi-red .kpi-icon { background: var(--danger-50); color: var(--danger); }
.kpi-icon svg { width: 24px; height: 24px; }
.kpi-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 4px;
}
.kpi-value {
  display: block;
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -.02em;
}
.kpi-sub {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-soft);
}

/* ===========================================
   CARDS
   =========================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.card-head h3 { color: var(--brand); }
  flex-wrap: wrap;
}
.card-body { padding: 20px 22px; }

/* Painéis do dashboard — padding lateral aumentado */
#dash-vehicles-list,
#dash-keys-list    { padding: 20px 28px; }

/* Atalhos rápidos — container no card */
.card-body > .shortcuts { padding: 4px 6px; gap: 14px; }
.span-full { grid-column: 1 / -1; }

.dash-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
/* Equalize vehicle and key panels height */
.dash-grid > .card { margin-bottom: 0; }
.dash-grid > .card:not(.span-full) { display: flex; flex-direction: column; }
.dash-grid > .card:not(.span-full) .card-body { flex: 1; min-height: 200px; }

.empty {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ===========================================
   SHORTCUTS
   =========================================== */
.shortcuts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.shortcut {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  padding: 28px 16px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}
.shortcut:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.shortcut > span { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.shortcut strong { display: block; font-size: 13px; color: var(--text); font-weight: 600; line-height: 1.3; }
.shortcut small { color: var(--text-muted); font-size: 11px; }
.shortcut-icon {
  width: 48px; height: 48px;
  min-width: 48px; min-height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  flex-grow: 0;
}
.shortcut-icon svg { width: 26px; height: 26px; }
.shortcut-blue .shortcut-icon   { background: var(--primary-50);       color: var(--brand); }
.shortcut-amber .shortcut-icon  { background: rgba(245, 158, 11, .12); color: #b45309; }
.shortcut-green .shortcut-icon  { background: rgba(22, 163, 74, .12);  color: var(--success); }
.shortcut-violet .shortcut-icon { background: rgba(124, 58, 237, .12); color: var(--violet); }
.shortcut-teal .shortcut-icon   { background: rgba(13, 148, 136, .12); color: #0f766e; }
.import-drop-icon svg { width: 28px; height: 28px; }
.scan-input-icon svg { width: 24px; height: 24px; }

/* ===========================================
   TABS
   =========================================== */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  padding: 6px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}
.tab {
  padding: 10px 18px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  border-radius: 8px;
  font-size: 14px;
  white-space: nowrap;
  transition: all var(--transition);
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab.active {
  background: var(--primary-50);
  color: var(--brand);
  font-weight: 600;
}
.tab-pane { display: none; animation: fadeIn .25s ease; }
.tab-pane.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ===========================================
   FORMS
   =========================================== */
.form-card .card-head h3 { font-size: 18px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 22px;
}
.span-2 { grid-column: span 2; }
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 8px;
}

.search {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  width: 280px;
  max-width: 100%;
  outline: none;
  transition: border-color var(--transition);
}
.search:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37, 99, 235, .12); }

.filters {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.filters.big { padding: 22px; border-bottom: 0; }
.field-inline { display: flex; flex-direction: column; gap: 4px; min-width: 140px; }
.field-inline span { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.field-inline input { padding: 9px 12px; }

/* ===========================================
   TABLES
   =========================================== */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table thead {
  background: var(--surface-2);
}
.table th {
  text-align: left;
  padding: 12px 22px;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .placa {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  background: var(--surface-2);
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 700;
  letter-spacing: .04em;
  display: inline-block;
}

.table-empty { text-align: center; padding: 32px; color: var(--text-muted); }

/* ===========================================
   STATUS BADGES
   =========================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge-success { background: var(--success-100); color: var(--success); }
.badge-danger { background: var(--danger-100); color: var(--danger); }
.badge-warning { background: #FFF8E0; color: #7A5800; }
.badge-info    { background: var(--primary-50); color: var(--brand); }
.badge-muted { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.badge-purple { background: #ede9fe; color: #6d28d9; }

/* Badges de status (No pátio / Saiu) nas tabelas de veículos: padding mais
   compacto que o badge padrão, pra "No pátio" (texto mais longo) não ficar
   desproporcional ao lado de "Saiu" na coluna Status — mesmo ajuste na tela
   e na impressão (ver também @media print mais abaixo, que reduz a fonte). */
#table-vehicles-active .badge,
#table-vehicles-history .badge,
#table-rep-vehicles .badge {
  padding: 2px 8px;
  white-space: nowrap;
}
.badge-amber  { background: var(--warning-100); color: #92400e; }
.badge-muted::before { background: var(--text-soft); }

/* ===========================================
   KEY GRID (Painel)
   =========================================== */
.key-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  padding: 20px;
}
.key-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.key-card.available {
  border-color: var(--success-100);
  background: linear-gradient(180deg, var(--success-50), var(--surface));
}
.key-card.in-use {
  border-color: var(--warning-100);
  background: linear-gradient(180deg, var(--warning-50), var(--surface));
}
.key-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.key-card-name { font-size: 16px; font-weight: 700; color: var(--text); }
.key-card-setor { font-size: 12px; color: var(--text-muted); }
.key-card-info {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
}
.key-card-info strong { color: var(--text); }

/* ===========================================
   RETURN LIST
   =========================================== */
.return-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  gap: 14px;
  flex-wrap: wrap;
  transition: all var(--transition);
}
.return-row:hover { border-color: var(--primary); background: var(--primary-50); }
.return-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.return-info strong { font-size: 15px; color: var(--text); }
.return-info span { font-size: 13px; color: var(--text-muted); }

.dash-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 8px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.dash-row:last-child { border-bottom: 0; }
.dash-row-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.dash-row-info strong { font-size: 14px; color: var(--text); }
.dash-row-info span { font-size: 12px; color: var(--text-muted); }

/* ===========================================
   MODAL
   =========================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(4px);
}
.modal-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: pop .25s cubic-bezier(.34, 1.56, .64, 1);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-body { padding: 24px; }

/* Modal de conta (mobile) */
.profile-modal-user {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.profile-modal-user .user-avatar { width: 48px; height: 48px; font-size: 18px; }
.profile-modal-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.profile-modal-info strong { font-size: 16px; color: var(--text); }
.profile-modal-info .badge { align-self: flex-start; }

.return-summary {
  background: var(--primary-50);
  border: 1px solid var(--primary-100);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.return-summary div { display: flex; flex-direction: column; gap: 2px; }
.return-summary span { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.return-summary strong { font-size: 14px; color: var(--text); }

.obs-note {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(13, 43, 85, .08);
  color: var(--primary);
  cursor: default;
  position: relative;
}
.obs-note svg { width: 14px; height: 14px; flex-shrink: 0; }
.obs-note[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 6px);
  /* Ancorada na borda direita do ícone (não centralizada) e crescendo para a
     esquerda: como essa coluna é sempre a última da tabela, isso garante que
     o balão nunca vaze para fora à direita, sem precisar de JS para detectar
     o espaço disponível. */
  right: 0;
  left: auto;
  background: var(--text);
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
  padding: 8px 10px;
  border-radius: 6px;
  /* width: max-content faz o balão se dimensionar pelo texto (até max-width),
     em vez do shrink-to-fit calculado a partir do ícone de 28px — que era a
     causa da quebra letra a letra. */
  width: max-content;
  min-width: 180px;
  max-width: 280px;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  word-wrap: break-word;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
  z-index: 100;
  pointer-events: none;
}

/* ===========================================
   SIGNATURE PAD
   =========================================== */
.signature-section { display: flex; flex-direction: column; gap: 12px; }
.signature-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.signature-head strong { font-size: 14px; color: var(--text); }
.signature-pad-wrap {
  position: relative;
  background:
    linear-gradient(0deg, transparent 95%, rgba(37, 99, 235, .08) 95%),
    var(--surface-2);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  touch-action: none;
}
#signature-pad {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 240px;
  cursor: crosshair;
  touch-action: none;
}
.signature-line {
  position: absolute;
  bottom: 28px;
  left: 24px;
  right: 24px;
  height: 1px;
  background: var(--border-strong);
  pointer-events: none;
}
.signature-line::before {
  content: '× ___________________________________';
  position: absolute;
  top: -8px;
  left: 0;
  font-size: 11px;
  color: var(--text-soft);
  letter-spacing: 2px;
}
.signature-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ===========================================
   PATRIMÔNIOS — SCAN
   =========================================== */
.scan-card {
  background: linear-gradient(180deg, var(--violet-50), var(--surface));
  border: 1px solid var(--violet-100);
}
.scan-card .card-head h3 { font-size: 18px; }

.scan-form {
  display: flex;
  gap: 12px;
  align-items: stretch;
  flex-wrap: wrap;
}
.scan-input-wrap {
  position: relative;
  flex: 1;
  min-width: 280px;
  display: flex;
  align-items: center;
}
.scan-input-icon {
  position: absolute;
  left: 18px;
  font-size: 24px;
  color: var(--violet);
  pointer-events: none;
  font-weight: 700;
}
.scan-input {
  width: 100%;
  padding: 20px 22px 20px 58px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: .04em;
  border: 2px solid var(--violet-100);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  outline: none;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.scan-input:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, .15);
}
.scan-form .btn-primary {
  background: linear-gradient(135deg, var(--violet), #6d28d9);
  box-shadow: 0 4px 12px -4px rgba(124, 58, 237, .5);
  padding: 0 28px;
  font-size: 15px;
}
.scan-form .btn-primary:hover:not(:disabled) {
  box-shadow: 0 8px 18px -4px rgba(124, 58, 237, .55);
}

.scan-feedback {
  margin-top: 18px;
  padding: 18px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  animation: pop .25s cubic-bezier(.34, 1.56, .64, 1);
}
.scan-feedback.success {
  border-color: var(--success-100);
  background: var(--success-50);
}
.scan-feedback.error {
  border-color: var(--danger-100);
  background: var(--danger-50);
}
.scan-feedback.review {
  border-color: var(--primary-100);
  background: var(--primary-50);
}
/* Plaqueta não encontrada: fluxo normal (cadastro inline), não é um erro —
   mesmo tom âmbar/informativo usado em "Veículo não cadastrado". */
.scan-feedback.notfound {
  border-color: var(--warning-100);
  background: var(--warning-50);
}
.scan-feedback-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}
.scan-inline-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}
.scan-inline-form .btn { width: 100%; }
.scan-feedback-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.scan-feedback-head .badge { font-size: 13px; padding: 6px 14px; }
.scan-feedback-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.scan-feedback-grid div { display: flex; flex-direction: column; gap: 2px; }
.scan-feedback-grid span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.scan-feedback-grid strong { font-size: 15px; color: var(--text); }

.pat-recent-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.pat-recent-row:last-child { border-bottom: 0; }
.pat-recent-main { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; flex: 1; }
.pat-recent-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pat-recent-title { font-size: 14px; color: var(--text); }
.pat-recent-main .pat-plaq {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  background: var(--violet-50);
  color: var(--violet);
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12px;
}
.pat-recent-main span.meta { font-size: 12px; color: var(--text-muted); }
.pat-recent-time {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding-top: 2px;
}

/* Tabela: plaqueta como tag */
.plaq-tag {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  background: var(--violet-50);
  color: var(--violet);
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 700;
  letter-spacing: .02em;
  display: inline-block;
}

/* ===========================================
   PATRIMÔNIOS — IMPORTAR
   =========================================== */
.import-drop {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
  transition: all var(--transition);
}
.import-drop:hover {
  border-color: var(--primary);
  background: var(--primary-50);
}
.import-drop.dragover {
  border-color: var(--primary);
  background: var(--primary-50);
}
.import-drop-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary), var(--primary-600));
  color: #fff;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-size: 26px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 8px 16px -6px rgba(37, 99, 235, .5);
}
.import-drop > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.import-drop strong { font-size: 15px; color: var(--text); }

.import-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.import-summary {
  margin-top: 14px;
  padding: 14px 18px;
  background: var(--success-50);
  border: 1px solid var(--success-100);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.import-summary strong { color: var(--success); font-weight: 700; }
.import-summary.error {
  background: var(--danger-50);
  border-color: var(--danger-100);
}
.import-summary.error strong { color: var(--danger); }

/* ===========================================
   TOAST
   =========================================== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  padding: 14px 20px;
  background: var(--text);
  color: #fff;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  animation: slideIn .25s cubic-bezier(.34, 1.56, .64, 1);
  max-width: 360px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); color: #1f1300; }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: none; }
}

/* ===========================================
   FORM VALIDATION
   =========================================== */
.field--error > input,
.field--error > select,
.field--error > textarea,
.field--error .ve-field-wrap input,
.field--error .ve-placa-input {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .12) !important;
}
.field-error-msg {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--danger);
  animation: fadeIn .2s ease;
}

/* ===========================================
   RESPONSIVE
   =========================================== */

/* --- 1024px: small desktop / large tablet ---- */
@media (max-width: 1024px) {
  .main { padding: 20px 24px 32px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

/* --- 768px: tablet — hamburger activated ------- */
@media (max-width: 768px) {
  /* Layout */
  .app { grid-template-columns: 1fr; }

  /* Hamburger button visible */
  .hamburger-btn { display: flex; }

  /* Sidebar becomes a fixed drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    height: 100vh;
    width: 260px;
    z-index: 50;
    padding: 20px 16px;
    flex-direction: column;
    transition: left .28s cubic-bezier(.4, 0, .2, 1);
    box-shadow: none;
    overflow-y: auto;
  }
  .sidebar.sidebar-open {
    left: 0;
    box-shadow: var(--shadow-xl);
  }

  /* Overlay */
  .sidebar-overlay { display: block; }

  /* Topbar */
  .topbar { margin-bottom: 16px; }
  .topbar h2 { font-size: 19px; }
  .topbar p { font-size: 13px; }
  .clock { font-size: 19px; }
  .date-pill { font-size: 12px; padding: 5px 10px; }

  /* Main padding */
  .main { padding: 16px 16px 32px; }

  /* KPI */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }

  /* Dashboard grid */
  .dash-grid { grid-template-columns: 1fr; }

  /* Forms */
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }

  /* Shortcuts */
  .shortcuts { grid-template-columns: repeat(2, 1fr); }

  /* Tables: ensure horizontal scroll never breaks layout */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { min-width: 540px; }
  .table th, .table td { white-space: nowrap; }

  /* Filters wrap nicely */
  .filters { flex-wrap: wrap; gap: 10px; }
  .field-inline { min-width: 120px; }

  /* Modal */
  .modal-card { max-width: 100%; margin: 0 8px; }
  .modal-body { padding: 16px; }

  /* Scan */
  .scan-form { flex-direction: column; }
  .scan-input-wrap { min-width: 0; }

  /* Toast */
  .toast { left: 16px; right: 16px; bottom: 16px; max-width: none; }
}

/* --- 560px: mobile -------------------------------- */
@media (max-width: 560px) {
  /* KPIs: grade 2×2 no mobile */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi { padding: 12px; gap: 10px; }
  .kpi-icon { width: 36px; height: 36px; border-radius: 10px; }
  .kpi-icon svg { width: 18px; height: 18px; }
  .kpi-value { font-size: 22px; }
  .kpi-label { font-size: 10px; }
  .kpi-sub { font-size: 10px; }

  /* Shortcuts: grade 3×2 — cabe tudo sem corte */
  .shortcuts,
  .card-body > .shortcuts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 4px 0;
  }
  .shortcut {
    flex: unset;
    background: transparent;
    border: none;
    padding: 10px 6px;
    gap: 6px;
  }
  .shortcut:hover { transform: none; box-shadow: none; }
  .shortcut-icon { width: 44px; height: 44px; min-width: 44px; min-height: 44px; border-radius: 12px; }
  .shortcut-icon svg { width: 20px; height: 20px; }
  .shortcut strong { font-size: 10px; line-height: 1.3; }
  .shortcut small { display: none; }

  /* Veículos no pátio: compacto no mobile */
  #dash-vehicles-list,
  #dash-keys-list { padding: 12px 16px; }
  .dash-row { padding: 8px 4px; }
  .dash-row-info strong { font-size: 13px; }
  .dash-row-info span { font-size: 11px; }

  .form-grid { padding: 16px; gap: 12px; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }

  .card-head { padding: 14px 16px; }
  .card-body { padding: 14px 16px; }
  .table th, .table td { padding: 10px 14px; }

  .topbar h2 { font-size: 17px; }
  .clock { font-size: 17px; }
  .topbar-right { gap: 8px; }
  .date-pill { display: none; }

  .tabs { padding: 4px; gap: 2px; }
  .tab { padding: 9px 12px; font-size: 13px; }

  .signature-actions { flex-direction: column-reverse; }
  .signature-actions .btn { width: 100%; }

  .btn-lg { padding: 12px 18px; font-size: 14px; }
}

/* --- 640px: form single-column ---- */
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
}

/* ============================================================
   LOGIN — MOBILE + TABLET (≤1024px): foto de fundo cobrindo toda
   a viewport, bloco do logo translúcido e card branco sólido,
   ambos centralizados verticalmente com espaço entre si (a foto
   aparece atrás de tudo, inclusive no vão entre os blocos)
   ============================================================ */
@media (max-width: 1024px) {
  .login-screen {
    min-height: 100vh;
    padding: 24px 16px;
    align-items: center;
    justify-content: center;
  }
  /* Overlay mais leve no mobile — a foto precisa aparecer no vão entre os blocos */
  .login-screen::before { background: rgba(13, 43, 85, .32); }

  .login-split {
    flex-direction: column;
    width: 100%;
    max-width: 420px;
    min-height: 0;
    border-radius: 0;
    gap: 28px;
    box-shadow: none;
    background: transparent;
  }
  .login-left {
    display: flex;
    flex: 0 0 auto;
    /* Soma com o overlay acima (~32%) para ~54% de escurecimento total no bloco — dentro de 40-55% */
    background: rgba(13, 43, 85, .32);
    padding: 28px 24px;
    min-height: 0;
    border-radius: var(--radius-lg);
  }
  .login-left-content { align-items: center; text-align: center; width: 100%; }
  .login-logo-wrap { padding: 10px 14px; }
  .edeconsil-logo-login { height: 52px; }
  .login-left-divider { margin: 14px 0 10px; }
  .login-left-sub {
    font-size: 11px;
    margin: 0;
    color: rgba(255,255,255,.9);
    text-shadow: 0 1px 4px rgba(0,0,0,.45);
  }
  .login-left-badges { display: none; }
  .login-right {
    flex: 0 0 auto;
    background: var(--surface);
    padding: 28px 24px 32px;
    min-height: 0;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
  }
  .login-mobile-logo { display: none; }
}

/* ===========================================
   PORTEIROS — estilos específicos
   =========================================== */
.field-check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}
.field-check span { flex: 1; }
.field-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}
.badge-admin   { background: #ede9fe; color: #6d28d9; }
.badge-porteiro { background: #dbeafe; color: #1d4ed8; }

/* ===========================================
   PRINT
   =========================================== */
.print-only { display: none; }

@page { margin: 15mm; }

@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

  .print-only { display: block !important; }

  /* Oculta chrome da UI */
  .sidebar, .sidebar-overlay, .hamburger-btn, .bottom-nav,
  .topbar, .tabs, .filters, .btn, .form-actions, .mobile-greeting,
  .dash-chart-card, #dash-chart-container { display: none !important; }

  /* Layout de impressão */
  .app { display: block; }
  .main { padding: 0; }
  body { background: #fff; font-size: 11px; color: #111; }

  /* --------------------------------------------------
     Cabeçalho: logo | título centralizado | URL
     -------------------------------------------------- */
  .print-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    margin-bottom: 16px;
    border-bottom: 2.5px solid #0D2B55;
    break-after: avoid;
  }
  .print-logo {
    width: 120px;
    height: auto;
    display: block;
    flex-shrink: 0;
  }
  .print-header-center {
    flex: 1;
    text-align: center;
  }
  .print-title {
    font-size: 14px;
    font-weight: 700;
    color: #0D2B55;
    margin: 0 0 3px;
    letter-spacing: -.01em;
  }
  .print-period { font-size: 10px; color: #64748b; margin: 0; }
  .print-header-right {
    text-align: right;
    font-size: 9px;
    color: #94a3b8;
    flex-shrink: 0;
    line-height: 1.5;
  }

  /* --------------------------------------------------
     Cards
     -------------------------------------------------- */
  .card {
    box-shadow: none;
    border: 1px solid #e2e8f0;
    margin-bottom: 10px;
    break-inside: avoid;
  }
  .card-head {
    padding: 7px 12px;
    border-bottom: 1px solid #e2e8f0;
    break-after: avoid;
  }
  .card-head h3 { font-size: 11px; font-weight: 700; color: #0D2B55; text-transform: uppercase; letter-spacing: .05em; }

  .rep-section-head {
    padding: 7px 12px;
    border-bottom: 1px solid #e2e8f0;
    break-after: avoid;
  }
  .rep-section-head h3 { font-size: 11px; font-weight: 700; color: #0D2B55; text-transform: uppercase; letter-spacing: .05em; }
  .rep-section-icon { display: none !important; }

  /* --------------------------------------------------
     KPIs — 3 colunas, sem ícone
     -------------------------------------------------- */
  .kpi-grid, .rep-kpi-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px;
    margin-bottom: 12px;
  }
  .kpi {
    padding: 10px 12px;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    gap: 3px;
  }
  .kpi::before { height: 3px; }
  .kpi-icon { display: none !important; }
  .kpi-label { font-size: 9px; color: #64748b; font-weight: 500; }
  .kpi-value { font-size: 24px; font-weight: 800; color: #0D2B55; line-height: 1; }

  /* --------------------------------------------------
     Tabelas — 11px, bordas, cabeçalho repetido
     -------------------------------------------------- */
  .table {
    font-size: 11px;
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
  }
  .table th {
    padding: 5px 8px;
    font-size: 9px;
    font-weight: 700;
    background: #f1f5f9 !important;
    text-transform: uppercase;
    letter-spacing: .04em;
    border: 1px solid #cbd5e1;
    white-space: nowrap;
  }
  .table td {
    padding: 5px 8px;
    border: 1px solid #e2e8f0;
    vertical-align: top;
    word-break: break-word;
  }
  .table td:has(.placa), .table td:has(.plaq-tag) { white-space: nowrap; }
  .table-wrap { overflow: visible; }
  .table thead { display: table-header-group; }
  tr { break-inside: avoid; }

  /* --------------------------------------------------
     Rodapé: data à esquerda · página à direita
     -------------------------------------------------- */
  .print-footer {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
    font-size: 9px;
    color: #94a3b8;
  }
  .print-page-counter::before {
    content: "Página " counter(page) " de " counter(pages);
  }
}

/* ============================================================
   CONSULTA DE PLACA — status badge e campos auto-preenchidos
   ============================================================ */
.placa-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.placa-input-wrap input {
  flex: 1;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}
.placa-status {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: .02em;
  /* sem conteúdo = invisível sem ocupar espaço */
  min-width: 0;
  transition: opacity .15s;
}
.placa-status:empty { opacity: 0; pointer-events: none; }
.placa-status.loading {
  background: var(--primary-50);
  color: var(--primary);
  border: 1px solid var(--primary-100);
}
.placa-status.found {
  background: var(--success-50);
  color: var(--success);
  border: 1px solid var(--success-100);
}
.placa-status.recorrente {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.placa-status.not-found {
  background: var(--warning-50);
  color: var(--warning);
  border: 1px solid var(--warning-100);
}
.placa-status.manual {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ============================================================
   SCAN MODE TOGGLE — saída / entrada
   ============================================================ */
.scan-mode-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  width: fit-content;
}
.scan-mode-btn {
  padding: 9px 22px;
  font-size: 14px;
  font-weight: 600;
  background: var(--surface);
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.scan-mode-btn:first-child { border-right: 1px solid var(--border); }
.scan-mode-btn:hover { background: var(--surface-2); }
.scan-mode-btn.active {
  background: var(--primary);
  color: #fff;
}
.scan-mode-btn[data-mode="entrada"].active {
  background: #0891b2;  /* cyan para diferenciar visualmente de saída */
}

/* ============================================================
   SCAN FEEDBACK — estado cooldown (bloqueio 15s)
   ============================================================ */
.scan-feedback.cooldown {
  background: var(--warning-50);
  border-color: var(--warning-100);
  color: var(--text);
}
#scan-countdown {
  font-weight: 700;
  color: var(--warning);
}

/* ============================================================
   RESPONSIVIDADE — melhorias adicionais
   ============================================================ */
/* Evita zoom automático no iOS ao focar inputs */
@media (max-width: 768px) {
  input, select, textarea, .scan-input {
    font-size: 16px !important;
  }
  /* Touch targets mínimos (44px) */
  .btn { min-height: 44px; }
  .nav-item { min-height: 44px; }
  .tab { min-height: 44px; }
  /* Toggle de modo ocupa largura total no mobile */
  .scan-mode-toggle { width: 100%; }
  .scan-mode-btn { flex: 1; text-align: center; }
  /* Placa status empilha abaixo do input no mobile */
  .placa-input-wrap { flex-wrap: wrap; }
  .placa-status { width: 100%; text-align: center; }
  /* Card head empilha no mobile */
  .card-head { flex-wrap: wrap; gap: 8px; }
  .card-head .search { width: 100%; min-width: 0; }
  /* Import drop mais compacto */
  .import-drop { padding: 20px 12px; }
  /* Filtros de data empilham */
  .filters { flex-direction: column; align-items: stretch; }
  .field-inline { min-width: 0; }
}

@media (max-width: 560px) {
  /* Tab labels menores para caber mais tabs */
  .tab { padding: 8px 10px; font-size: 12px; }
  /* Topbar compacta */
  .topbar { gap: 8px; }
  /* Pat recent row empilha */
  .pat-recent-row { flex-direction: column; gap: 4px; align-items: flex-start; }
  .pat-recent-time { font-size: 12px; }
  /* Scan input botão full-width */
  .scan-form { gap: 10px; }
}

/* ============================================================
   BOTÕES — variantes warning e info
   ============================================================ */
.btn-warning {
  background: var(--warning);
  color: #fff;
  border: 1px solid var(--warning);
}
.btn-warning:hover { background: #d97706; border-color: #d97706; }
.btn-warning:active { background: #b45309; }

.btn-info {
  background: #0891b2;
  color: #fff;
  border: 1px solid #0891b2;
}
.btn-info:hover { background: #0e7490; border-color: #0e7490; }
.btn-info:active { background: #155e75; }

/* ============================================================
   TABS PATRIMÔNIO — cores distintas saída/entrada
   ============================================================ */
.page[data-page="patrimonios"] .tab[data-tab="saida-pat"].active {
  background: var(--warning);
  color: #fff;
  border-color: transparent;
}
.page[data-page="patrimonios"] .tab[data-tab="entrada-pat"].active {
  background: #0891b2;
  color: #fff;
  border-color: transparent;
}

/* ============================================================
   PAT TYPE TOGGLE — "Com plaqueta" / "Item pessoal"
   ============================================================ */
.pat-type-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  width: fit-content;
}
.pat-type-btn {
  padding: 9px 22px;
  font-size: 14px;
  font-weight: 600;
  background: var(--surface);
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.pat-type-btn:first-child { border-right: 1px solid var(--border); }
.pat-type-btn:hover { background: var(--surface-2); }
.pat-type-btn.active {
  background: var(--primary);
  color: #fff;
}
.page[data-page="patrimonios"] .tab-pane[data-pane="entrada-pat"] .pat-type-btn.active {
  background: #0891b2;
}
@media (max-width: 768px) {
  .pat-type-toggle { width: 100%; }
  .pat-type-btn { flex: 1; }
}

/* ============================================================
   MENU LATERAL — badges de alerta
   ============================================================ */
.nav-item { position: relative; }
.nav-badge {
  position: absolute;
  top: 5px; right: 8px;
  background: #E24B4A;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  border-radius: 9px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
}
.nav-badge.hidden { display: none; }

/* ============================================================
   VEÍCULOS — coluna "Por" com ícone de usuário
   ============================================================ */
.by-user {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
  font-size: 13px;
}
.by-user svg { flex-shrink: 0; color: var(--text-soft); }

/* ============================================================
   PATRIMÔNIO — link "Ver histórico completo"
   ============================================================ */
.pat-recent-link {
  padding: 10px 0 4px;
  text-align: center;
}
.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.link-btn:hover { background: var(--primary-50); }

/* ============================================================
   TOPBAR — estilos por breakpoint
   ============================================================ */

/* Desktop (>1024px): topbar simples, sem logo mobile */
.topbar-logo    { display: none; }
.mobile-greeting { display: none; }

/* ============================================================
   TABLET (769px – 1024px): sidebar icon-only
   ============================================================ */
@media (min-width: 769px) and (max-width: 1024px) {
  .app { grid-template-columns: 64px 1fr; }

  .sidebar { padding: 16px 8px; width: 64px; overflow: hidden; }
  .sidebar-brand { padding: 6px 4px 18px; justify-content: center; }
  .sidebar-brand-text { display: none; }
  .brand-icon.sm { margin: 0 auto; }
  .edeconsil-logo-sidebar-wrap { margin: 0 auto; }

  .nav-item { padding: 12px; justify-content: center; gap: 0; }
  .nav-item > span:not(.nav-badge) { display: none; }
  .nav-item svg { width: 22px; height: 22px; }
  .nav-item.active { box-shadow: none; }
  .nav-badge { top: 4px; right: 4px; }

  .user-chip { padding: 8px; justify-content: center; }
  .user-info { display: none; }
  .sidebar .btn-ghost span { display: none; }
  .sidebar .btn-ghost { justify-content: center; padding: 10px; }
  .sidebar-footer .btn-block { width: auto; }
}

/* ============================================================
   MOBILE (≤768px): bottom nav, topbar Edeconsil, sem sidebar
   ============================================================ */
@media (max-width: 768px) {
  /* Esconde sidebar no mobile */
  .sidebar { display: none; }
  .sidebar-overlay { display: none !important; }

  /* App sem coluna lateral */
  .app { grid-template-columns: 1fr; }

  /* Topbar mobile: fundo brand, 2 linhas — 1ª: logo + avatar; 2ª: relógio + data.
     Evita os três blocos brigando por espaço numa linha só. */
  .topbar {
    background: var(--brand);
    padding: 10px 16px 12px;
    margin-bottom: 0;
    border-radius: 0;
    border: none;
    box-shadow: none;
    position: sticky;
    top: 0;
    z-index: 40;
    row-gap: 6px;
  }
  .topbar-logo   { display: flex; order: 1; }
  .topbar-title-area { display: none; }
  .topbar-profile-btn { display: flex; order: 2; margin-left: auto; }

  /* Relógio + data vão para a 2ª linha, alinhados à esquerda sob o logo */
  .topbar-right {
    order: 3;
    flex-basis: 100%;
    justify-content: flex-start;
    gap: 10px;
  }
  .clock { font-size: 16px; color: #fff; }
  .date-pill {
    background: rgba(255,255,255,.12);
    border-color: transparent;
    color: rgba(255,255,255,.75);
    font-size: 11px;
    padding: 4px 10px;
  }

  /* Saudação mobile */
  .mobile-greeting { display: block; padding: 12px 16px 0; }

  /* Main padding inferior = altura do bottom nav (62px) + respiro (16px) + safe-area
     do aparelho, para nenhum conteúdo ficar escondido atrás da barra fixa */
  .main { padding: 16px 16px calc(62px + 16px + env(safe-area-inset-bottom)); }

  /* Hamburger não utilizado no mobile (substituído pelo bottom nav) */
  .hamburger-btn { display: none; }
}

/* ============================================================
   BOTTOM NAV — base (oculto em tablet/desktop)
   ============================================================ */
.bottom-nav { display: none; }

@media (max-width: 768px) {
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 50;
    background: #fff;
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(13, 43, 85, .08);
    height: calc(62px + env(safe-area-inset-bottom));
    padding: 0 0 env(safe-area-inset-bottom);
  }
  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    padding: 6px 4px;
    cursor: pointer;
    position: relative;
    transition: color var(--transition);
    min-height: 44px;
  }
  .bottom-nav-item svg { width: 22px; height: 22px; flex-shrink: 0; }
  .bottom-nav-item span:not(.bottom-badge) { line-height: 1; }
  .bottom-nav-item:hover { color: var(--brand); }
  .bottom-nav-item.active {
    color: var(--brand);
    font-weight: 700;
  }
  .bottom-nav-item.active svg { stroke-width: 2.5; }

  /* Badge no bottom nav */
  .bottom-badge {
    position: absolute;
    top: 4px; right: calc(50% - 14px);
    background: #E24B4A;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    min-width: 15px;
    height: 15px;
    border-radius: 8px;
    padding: 0 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }
  .bottom-badge.hidden { display: none; }
}

/* ============================================================
   NOVA ENTRADA — campo de placa em destaque
   ============================================================ */
.ve-placa-section { margin-bottom: 4px; }

.ve-placa-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.ve-placa-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  width: 20px; height: 20px;
  pointer-events: none;
  flex-shrink: 0;
}
.ve-placa-spinner {
  position: absolute;
  right: 14px;
  width: 18px; height: 18px;
  border: 2.5px solid var(--border-strong);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: ve-spin .7s linear infinite;
}
@keyframes ve-spin { to { transform: rotate(360deg); } }

.ve-placa-input {
  width: 100%;
  padding: 14px 44px 14px 46px !important;
  font-size: 20px !important;
  font-family: 'JetBrains Mono', 'Courier New', monospace !important;
  font-weight: 700 !important;
  letter-spacing: .06em !important;
  text-transform: uppercase !important;
  border-width: 2px !important;
  border-radius: var(--radius-sm) !important;
  transition: border-color var(--transition), box-shadow var(--transition) !important;
}
.ve-placa-input:focus {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 4px rgba(13, 43, 85, .12) !important;
}

/* ============================================================
   NOVA ENTRADA — card de reconhecimento
   ============================================================ */
.ve-lookup-card {
  margin-top: 10px;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  animation: fadeIn .2s ease;
}
.ve-lookup-card.frota     { background: #ecfdf5; border: 1px solid #d1fae5; border-left: 4px solid #16a34a; }
.ve-lookup-card.recorrente{ background: var(--primary-50); border: 1px solid var(--primary-100); border-left: 4px solid var(--brand); }
.ve-lookup-card.unknown   { background: var(--warning-50); border: 1px solid var(--warning-100); border-left: 4px solid var(--warning); }

.ve-lookup-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}
.ve-lookup-icon { width: 17px; height: 17px; flex-shrink: 0; }
.frota      .ve-lookup-icon { color: #16a34a; }
.recorrente .ve-lookup-icon { color: var(--brand); }
.unknown    .ve-lookup-icon { color: var(--warning); }

.ve-lookup-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.frota      .ve-lookup-badge { background: #d1fae5; color: #166534; }
.recorrente .ve-lookup-badge { background: var(--primary-100); color: var(--brand); }
.unknown    .ve-lookup-badge { background: var(--warning-100); color: #92400e; }

.ve-lookup-title { font-size: 15px; font-weight: 700; color: var(--text); }
.ve-lookup-sub   { font-size: 13px; color: var(--text-muted); }
.ve-lookup-footer{ font-size: 12px; font-weight: 500; margin-top: 3px; }
.frota      .ve-lookup-footer { color: #16a34a; }
.recorrente .ve-lookup-footer { color: var(--brand); }
.unknown    .ve-lookup-footer { color: #92400e; }

/* ============================================================
   NOVA ENTRADA — campos preenchidos automaticamente
   ============================================================ */
.ve-field-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.ve-field-wrap input { width: 100%; padding-right: 32px; }
.ve-lock-icon {
  position: absolute;
  right: 10px;
  width: 13px; height: 13px;
  color: var(--text-soft);
  pointer-events: none;
  flex-shrink: 0;
}
.field--auto-frota      .ve-field-wrap input { background: #f8fafc; border-color: #16a34a; }
.field--auto-recorrente .ve-field-wrap input { background: #f8fafc; border-color: var(--brand); }
.field--auto-frota      .ve-lock-icon { color: #16a34a; }
.field--auto-recorrente .ve-lock-icon { color: var(--brand); }

/* ============================================================
   NOVA ENTRADA — modelo + cor sempre lado a lado
   ============================================================ */
.ve-modelo-cor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ============================================================
   NOVA ENTRADA — botões
   ============================================================ */
.ve-btn-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
}
.ve-btn-clear:hover { color: var(--text); }

/* ============================================================
   NOVA ENTRADA — mobile: botão fixo acima do bottom nav
   ============================================================ */
.ve-mobile-btn { display: none; }

@media (max-width: 768px) {
  .ve-placa-input { font-size: 24px !important; }

  .tab-pane[data-pane="entrada"] { padding-bottom: 80px; }

  .ve-mobile-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 62px;
    left: 0; right: 0;
    height: 52px;
    background: var(--brand-yellow);
    color: var(--brand);
    border: none;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    z-index: 39;
    box-shadow: 0 -2px 12px rgba(13, 43, 85, .12);
    cursor: pointer;
    letter-spacing: .01em;
  }
  .ve-mobile-btn:active { background: #e6b400; }

  .ve-form-actions .ve-btn-submit { display: none; }
  .ve-form-actions { justify-content: center; padding-top: 4px; }
}

/* ============================================================
   VEÍCULOS NO PÁTIO — estado vazio com ícone
   ============================================================ */
.patio-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}
.patio-empty svg {
  opacity: .35;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.patio-empty strong {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.patio-empty span { font-size: 13px; }

/* ============================================================
   DASHBOARD — gráfico de movimentações
   ============================================================ */
.dash-chart-empty {
  text-align: center;
  padding: 20px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ============================================================
   TOPBAR — relógio + última atualização empilhados
   ============================================================ */
.topbar-clock-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}
.last-update {
  font-size: 11px;
  color: var(--text-soft);
  font-weight: 500;
  white-space: nowrap;
}
@media (max-width: 768px) {
  .last-update { color: rgba(255,255,255,.5); font-size: 10px; }
}

/* ============================================================
   PATRIMÔNIOS — scan input: pulse no foco + flash sucesso/erro
   ============================================================ */

/* Ícone pulsa enquanto o campo está em foco */
@keyframes scan-icon-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.25); opacity: 0.6; }
}
.scan-input-wrap:focus-within .scan-input-icon {
  animation: scan-icon-pulse 1.1s ease-in-out infinite;
}
/* Ícone entrada usa cor ciano */
.scan-input-wrap--ent:focus-within .scan-input-icon { color: #0891b2; }

/* Botão de saída usa cor primária (amarelo) */
.page[data-page="patrimonios"] .tab-pane[data-pane="saida-pat"] .btn-primary {
  background: var(--brand-yellow);
  color: var(--brand);
  font-weight: 700;
}

/* ============================================================
   PATRIMÔNIOS — botão fixo mobile
   ============================================================ */
.pat-mobile-btn { display: none; }

@media (max-width: 768px) {
  /* Campo de leitura maior no mobile */
  .scan-input { height: 64px !important; font-size: 20px !important; padding: 0 22px 0 58px !important; }

  /* Espaço para o botão fixo */
  .tab-pane[data-pane="saida-pat"],
  .tab-pane[data-pane="entrada-pat"] { padding-bottom: 80px; }

  /* Botão fixo acima do bottom nav */
  .pat-mobile-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 62px;
    left: 0; right: 0;
    height: 52px;
    border: none;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    z-index: 39;
    cursor: pointer;
    letter-spacing: .01em;
  }
  .pat-mobile-btn--saida {
    background: var(--brand-yellow);
    color: var(--brand);
    box-shadow: 0 -2px 12px rgba(252,201,23,.25);
  }
  .pat-mobile-btn--ent {
    background: #0891b2;
    color: #fff;
    box-shadow: 0 -2px 12px rgba(8,145,178,.25);
  }
  .pat-mobile-btn--saida:active { background: #e6b400; }
  .pat-mobile-btn--ent:active   { background: #0e7490; }

  /* Ocultar botão desktop nos forms de patrimônio no mobile */
  .pat-submit-desktop { display: none; }

  /* Últimos registros como cards no mobile */
  #pat-recent-list .pat-recent-row,
  #pat-ent-recent-list .pat-recent-row {
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 12px 14px;
  }
  #pat-recent-list .pat-recent-row:last-child,
  #pat-ent-recent-list .pat-recent-row:last-child { border-bottom: 1px solid var(--border) !important; }
  .pat-recent-time { font-size: 11px; }
}

/* ============================================================
   USUÁRIOS — avatar na listagem
   ============================================================ */
.user-list-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.avatar-admin    { background: var(--brand); color: #fff; }
.avatar-porteiro { background: var(--primary-50); color: var(--brand); }

/* ============================================================
   VEÍCULOS NO PÁTIO — botão de saída desktop
   ============================================================ */
.btn-saida-desktop {
  white-space: nowrap;
  font-weight: 700;
}

/* ============================================================
   VEÍCULOS NO PÁTIO — cards mobile
   ============================================================ */
.vehicles-active-cards { display: none; }

.vehicle-active-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.vehicle-active-card:last-child { border-bottom: 0; }

.vehicle-active-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.vehicle-active-placa {
  font-size: 18px;
  font-weight: 700;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  background: var(--surface-2);
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: .04em;
}
.vehicle-active-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
  color: var(--text);
}
.vehicle-active-modelo {
  font-weight: 600;
}
.vehicle-active-card-meta {
  font-size: 12px;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .vehicles-active-table-wrap { display: none; }
  .vehicles-active-cards { display: block; }
}

/* ============================================================
   RELATÓRIOS — painel de filtros
   ============================================================ */
.rep-filters-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.rep-filters-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 16px;
}
.rep-filters-head svg { color: var(--brand); flex-shrink: 0; }

.rep-filters-dates {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.rep-filters-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* ============================================================
   RELATÓRIOS — atalhos de período (segmented control)
   ============================================================ */
.rep-shortcuts-bar {
  display: flex;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  gap: 3px;
  width: fit-content;
  margin-bottom: 14px;
}

.rep-shortcut {
  padding: 8px 20px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
  line-height: 1;
}
.rep-shortcut:hover:not(.active) {
  background: rgba(13, 43, 85, .06);
  color: var(--text);
}
.rep-shortcut.active {
  background: var(--surface);
  color: var(--brand);
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .12), 0 0 0 1px var(--border);
}

/* ============================================================
   RELATÓRIOS — campo de busca geral
   ============================================================ */
.rep-search-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rep-search-label {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 500;
}

.rep-search-wrap {
  position: relative;
}

.rep-search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: #0D2B55;
  pointer-events: none;
}

.rep-search-input {
  width: 100%;
  height: 44px;
  padding: 0 36px 0 44px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
  transition: border-color .15s, box-shadow .15s;
}
.rep-search-input::placeholder { color: #94a3b8; }
.rep-search-input:focus {
  outline: none;
  border-color: #0D2B55;
  box-shadow: 0 0 0 3px rgba(13, 43, 85, .10);
}

.rep-search-clear {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
}
.rep-search-clear:hover { color: var(--text); }

.rep-search-count {
  font-size: 12px;
  color: var(--text-muted);
  padding-left: 2px;
}

/* ============================================================
   RELATÓRIOS — KPI grid (3 colunas, ícone à direita)
   ============================================================ */
.rep-kpi-grid {
  grid-template-columns: repeat(3, 1fr);
}

.rep-kpi-grid .kpi {
  min-height: 90px;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
}

.rep-kpi-grid .kpi-value { font-size: 32px; }

.rep-kpi-grid .kpi-label {
  font-size: 10px;
  letter-spacing: .06em;
}

.rep-kpi-grid .kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Variante para abas com poucos indicadores (1-2 cards) — não estica para a largura toda */
.rep-kpi-grid--sub {
  grid-template-columns: repeat(auto-fit, minmax(220px, 300px));
}

/* ============================================================
   RELATÓRIOS — filtro extra por aba (Status / Setor / Tipo)
   ============================================================ */
.rep-subfilter {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 20px;
}
.rep-subfilter .field-inline { min-width: 180px; }

/* ============================================================
   RELATÓRIOS — cabeçalho de seção
   ============================================================ */
.rep-section-card {
  margin-bottom: 24px;
}

.rep-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.rep-section-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rep-section-title h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.rep-section-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.rep-icon-blue  { background: var(--primary-50); color: var(--brand); }
.rep-icon-amber { background: #FFF8E0; color: #7A5800; }
.rep-icon-cyan  { background: #e0f4f7; color: #0097a7; }

.rep-section-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  background: var(--primary-50);
  padding: 3px 12px;
  border-radius: 20px;
}

/* ============================================================
   RELATÓRIOS — estado vazio grande (fora da tabela)
   ============================================================ */
.rep-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 52px 24px;
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}
.rep-empty-state svg { opacity: .18; }
.rep-empty-state p { max-width: 300px; margin: 0; line-height: 1.5; }

/* ============================================================
   RELATÓRIOS — tabelas: cabeçalho uppercase, linhas alt/hover
   ============================================================ */
.rep-section-card .table thead th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #64748b;
  background: #f8fafc;
}

.rep-section-card .table tbody tr:nth-child(even) td {
  background: #fafafa;
}

.rep-section-card .table tbody tr:hover td {
  background: #f1f5f9;
}

.rep-section-card .table tbody td {
  border-bottom: 1px solid #f0f0f0;
}

/* ============================================================
   RELATÓRIOS — responsivo mobile
   ============================================================ */
@media (max-width: 768px) {
  .rep-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .rep-shortcuts-bar { width: 100%; border-radius: 10px; }
  .rep-shortcut { flex: 1; text-align: center; padding: 9px 6px; font-size: 12px; }
  .rep-filters-actions { margin-left: 0; }
}

/* ============================================================
   RELATÓRIOS — impressão
   ============================================================ */
@media print {
  /* Oculta painel de filtros e sub-filtro por aba */
  .rep-filters-panel { display: none !important; }
  .rep-subfilter { display: none !important; }

  /* Imprime só a aba ativa no momento (data/pane .active já é o que a tela mostra) —
     as outras 3 abas permanecem com o display:none padrão, sem duplicar cards/tabelas */

  /* Cabeçalho de seção: oculta badge de contagem */
  .rep-section-count { display: none !important; }

  /* Seções de relatório fluem naturalmente entre páginas — sem quebra forçada
     por seção e sem impedir que uma tabela longa continue na página seguinte.
     overflow:visible evita que o recorte de bordas arredondadas da tela "vaze"
     ou sobreponha conteúdo quando o card é fragmentado entre páginas. */
  .card, .rep-section-card { overflow: visible; break-inside: auto; }

  /* Grid de indicadores: abas com só 1-2 cards (Veículos/Chaves) não ficam
     esticadas em 3 colunas fixas — Patrimônios (3) e Visão Geral (6) mantêm 3 colunas */
  .rep-kpi-grid--sub { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important; }

  /* Tabelas de Veículos, Chaves e Patrimônios: colunas proporcionais (somam
     100% da largura útil da página) + quebra de linha, para caber sem cortar.
     Quando uma dessas abas é a impressa, o botão "Imprimir" muda a página
     para paisagem (ver #rep-print-page-style), dando bem mais largura útil
     do que o retrato usado pela Visão Geral. */
  #table-rep-vehicles,
  #table-rep-keys,
  #table-rep-pat {
    font-size: 10px;
    table-layout: fixed;
  }
  #table-rep-vehicles td,
  #table-rep-keys td,
  #table-rep-pat td {
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  /* Veículos: Placa, TAG, Veículo, Motorista, Empresa, Entrada, Saída, Status, Registrado por */
  #table-rep-vehicles th:nth-child(1), #table-rep-vehicles td:nth-child(1) { width: 8%; }
  #table-rep-vehicles th:nth-child(2), #table-rep-vehicles td:nth-child(2) { width: 8%; }
  #table-rep-vehicles th:nth-child(3), #table-rep-vehicles td:nth-child(3) { width: 12%; }
  #table-rep-vehicles th:nth-child(4), #table-rep-vehicles td:nth-child(4) { width: 12%; }
  #table-rep-vehicles th:nth-child(5), #table-rep-vehicles td:nth-child(5) { width: 12%; }
  #table-rep-vehicles th:nth-child(6), #table-rep-vehicles td:nth-child(6) { width: 10%; }
  #table-rep-vehicles th:nth-child(7), #table-rep-vehicles td:nth-child(7) { width: 10%; }
  #table-rep-vehicles th:nth-child(8), #table-rep-vehicles td:nth-child(8) { width: 11%; }
  #table-rep-vehicles th:nth-child(9), #table-rep-vehicles td:nth-child(9) { width: 17%; }
  /* Placa, TAG e Status são curtos — não precisam quebrar linha */
  #table-rep-vehicles td:nth-child(1),
  #table-rep-vehicles td:nth-child(2),
  #table-rep-vehicles td:nth-child(8) { white-space: nowrap; }
  /* Badge de status: fonte proporcional ao resto da tabela impressa (10px) —
     sem isso, "No pátio" (texto mais longo) fica visualmente maior que "Saiu". */
  #table-rep-vehicles .badge { font-size: 9px; padding: 2px 7px; }

  /* Chaves: Chave, Status, Pessoa, Setor, Retirada, Devolução, Porteiro */
  #table-rep-keys th:nth-child(1), #table-rep-keys td:nth-child(1) { width: 14%; }
  #table-rep-keys th:nth-child(2), #table-rep-keys td:nth-child(2) { width: 10%; }
  #table-rep-keys th:nth-child(3), #table-rep-keys td:nth-child(3) { width: 16%; }
  #table-rep-keys th:nth-child(4), #table-rep-keys td:nth-child(4) { width: 14%; }
  #table-rep-keys th:nth-child(5), #table-rep-keys td:nth-child(5) { width: 14%; }
  #table-rep-keys th:nth-child(6), #table-rep-keys td:nth-child(6) { width: 14%; }
  #table-rep-keys th:nth-child(7), #table-rep-keys td:nth-child(7) { width: 18%; }
  #table-rep-keys td:nth-child(2) { white-space: nowrap; }

  /* Patrimônios: Plaqueta, Descrição, Setor, Portador, Categoria, Tipo, Data/Hora, Porteiro */
  #table-rep-pat th:nth-child(1), #table-rep-pat td:nth-child(1) { width: 8%; }
  #table-rep-pat th:nth-child(2), #table-rep-pat td:nth-child(2) { width: 20%; }
  #table-rep-pat th:nth-child(3), #table-rep-pat td:nth-child(3) { width: 14%; }
  #table-rep-pat th:nth-child(4), #table-rep-pat td:nth-child(4) { width: 14%; }
  #table-rep-pat th:nth-child(5), #table-rep-pat td:nth-child(5) { width: 11%; }
  #table-rep-pat th:nth-child(6), #table-rep-pat td:nth-child(6) { width: 9%; }
  #table-rep-pat th:nth-child(7), #table-rep-pat td:nth-child(7) { width: 14%; }
  #table-rep-pat th:nth-child(8), #table-rep-pat td:nth-child(8) { width: 10%; }
  /* Plaqueta (código curto), Categoria e Tipo (badges) não precisam quebrar linha */
  #table-rep-pat td:nth-child(1),
  #table-rep-pat td:nth-child(5),
  #table-rep-pat td:nth-child(6) { white-space: nowrap; }
}

/* ============================================================
   AJUDA — busca
   ============================================================ */
.help-search-wrap {
  position: relative;
  margin-bottom: 20px;
}

.help-search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--brand);
  pointer-events: none;
}

.help-search-input {
  width: 100%;
  height: 46px;
  padding: 0 16px 0 44px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}
.help-search-input::placeholder { color: var(--text-soft); }
.help-search-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(13, 43, 85, .10);
}

.help-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 24px 0;
}

/* ============================================================
   AJUDA — seções por módulo
   ============================================================ */
.help-section { margin-bottom: 24px; }

.help-section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.help-section-head h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.help-section-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.help-icon-blue   { background: var(--primary-50); color: var(--brand); }
.help-icon-amber  { background: #FFF8E0; color: #7A5800; }
.help-icon-teal   { background: #ccfbf1; color: #0f766e; }
.help-icon-green  { background: var(--success-100); color: var(--success); }
.help-icon-purple { background: var(--violet-100); color: var(--violet); }

/* ============================================================
   AJUDA — acordeão
   ============================================================ */
.help-accordion {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

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

.help-item-q {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  background: none;
  border: none;
  text-align: left;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
}
.help-item-q:hover { background: var(--surface-2); }

.help-item-chevron {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform var(--transition);
}
.help-item.open .help-item-chevron { transform: rotate(180deg); }

.help-item-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition);
}
.help-item.open .help-item-a { max-height: 600px; }

.help-item-a-inner {
  padding: 0 20px 18px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
}
.help-item-a-inner p { margin: 0 0 8px; }
.help-item-a-inner p:last-child { margin-bottom: 0; }
.help-item-a-inner ol,
.help-item-a-inner ul {
  margin: 0 0 8px;
  padding-left: 20px;
}
.help-item-a-inner li { margin-bottom: 4px; }
.help-item-a-inner strong { color: var(--text); }

.help-tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--warning-50);
  border: 1px solid var(--warning-100);
  border-radius: var(--radius-sm);
  color: #7A5800;
}
.help-tip svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--warning);
}

@media (max-width: 768px) {
  .help-item-q { padding: 14px 16px; }
  .help-item-a-inner { padding: 0 16px 16px; }
}
}
