/* =============================================
   Carteira de Veículos — Design System
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Reset & Base ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #f0f2f5;
  --surface:      #ffffff;
  --navbar:       #111111;
  --gold:         #c8962a;
  --gold-light:   #e6a820;
  --gold-dark:    #a87820;
  --dark-card:    #1a1a1a;
  --accent:       #f0a500;
  --red:          #e53935;
  --red-soft:     #fdecea;
  --green:        #2e7d32;
  --green-soft:   #e8f5e9;
  --text-primary: #111827;
  --text-secondary:#6b7280;
  --text-muted:   #9ca3af;
  --border:       #e5e7eb;
  --radius-sm:    8px;
  --radius:       12px;
  --radius-lg:    16px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.08);
  --shadow:       0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:    0 8px 32px rgba(0,0,0,.14);
  --transition:   .2s ease;
  --font:         'Inter', sans-serif;
}

html { font-family: var(--font); font-size: 16px; scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text-primary); min-height: 100dvh; overflow-x: hidden; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input, select, textarea { font-family: inherit; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ── App Shell ────────────────────────────── */
#app { display: flex; flex-direction: column; min-height: 100dvh; }

/* ── Navbar ───────────────────────────────── */
.navbar {
  background: #ffffff;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.navbar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 0 8px;
}

.navbar-logo-img {
  height: 36px;
  width: auto;
  max-width: 190px;
  object-fit: contain;
  display: block;
  mix-blend-mode: multiply;
  filter: brightness(1.12) contrast(1.08);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.navbar-action-btn {
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  background: var(--bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.navbar-action-btn:hover {
  background: #e2e8f0;
  color: var(--text-primary);
}

.navbar-action-logout {
  color: var(--red);
  background: var(--red-bg);
  border-color: #fecdd3;
}

.navbar-action-logout:hover {
  background: #ffe4e6;
  color: #be123c;
}

.navbar-tabs {
  display: flex;
  gap: 2px;
  padding-bottom: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.navbar-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  color: var(--text-secondary);
  background: transparent;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: color var(--transition), background var(--transition);
  position: relative;
}

.tab-btn::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2.5px;
  background: #0a2e5c;
  transform: scaleX(0);
  transition: transform var(--transition);
  border-radius: 2px 2px 0 0;
}

.tab-btn:hover { color: var(--text-primary); background: rgba(0,0,0,.03); }
.tab-btn.active { color: #0a2e5c; font-weight: 700; }
.tab-btn.active::after { transform: scaleX(1); }

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

/* ── Page / Views ─────────────────────────── */
.view { display: none; flex-direction: column; flex: 1; }
.view.active { display: flex; }

.page-header {
  padding: 20px 16px 8px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.page-date { font-size: 11px; font-weight: 600; color: var(--text-muted); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 4px; }
.page-title { font-size: 22px; font-weight: 800; color: var(--text-primary); line-height: 1.2; }

/* ── Button Variants ──────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--text-primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: #333; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-primary:active { transform: translateY(0); }

.btn-gold {
  background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
  color: #fff;
  box-shadow: 0 2px 8px rgba(200,150,42,.35);
}
.btn-gold:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(200,150,42,.45); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--text-primary); color: var(--text-primary); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #c62828; }

.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

.btn-link {
  background: none; color: var(--accent);
  font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0;
  transition: color var(--transition);
}
.btn-link:hover { color: var(--gold-dark); }

/* ── Cards ────────────────────────────────── */
.cards-grid {
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover { box-shadow: var(--shadow); }

.card-gold {
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold-dark) 100%);
  color: #fff;
}
.card-dark {
  background: var(--dark-card);
  color: #fff;
}

.card-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 8px;
}

.card-label {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.card-gold .card-label,
.card-dark .card-label { color: rgba(255,255,255,.65); }

.card-icon { opacity: .5; }
.card-gold .card-icon,
.card-dark .card-icon { opacity: .6; }

.card-value {
  font-size: 26px; font-weight: 800;
  line-height: 1;
  margin: 4px 0;
  letter-spacing: -.5px;
}

.card-sub {
  font-size: 12px; color: var(--text-muted); font-weight: 500;
}
.card-gold .card-sub,
.card-dark .card-sub { color: rgba(255,255,255,.6); }

/* ── Chart Section ────────────────────────── */
.chart-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  margin: 0 16px 12px;
  box-shadow: var(--shadow-sm);
}

.chart-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 16px;
}

.chart-title { font-size: 15px; font-weight: 700; }
.chart-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.chart-legend {
  display: flex; gap: 12px; align-items: center;
  font-size: 11px; font-weight: 600;
}

.legend-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; margin-right: 4px;
}

.legend-receita .legend-dot { background: var(--accent); }
.legend-pendente .legend-dot { background: #3b82f6; }
.legend-despesa .legend-dot { background: var(--red); }

.chart-wrap {
  position: relative;
  height: 150px;
  width: 100%;
}

canvas#chartMain { width: 100% !important; height: 150px !important; }

/* ── A Receber Section ────────────────────── */
.areceber-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  margin: 0 16px 12px;
  box-shadow: var(--shadow-sm);
}

.areceber-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}

.areceber-title { font-size: 15px; font-weight: 700; }

.badge-pendente {
  background: #fef3c7;
  color: #92400e;
  font-size: 10px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 20px;
}

.areceber-value {
  font-size: 26px; font-weight: 800;
  color: var(--red);
  letter-spacing: -.5px;
  margin-bottom: 10px;
}

.areceber-pill {
  background: var(--bg);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ── Vehicle Table Section ────────────────── */
.table-section {
  background: transparent;
  padding: 4px 0 0;
  margin: 0;
}

.table-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 16px;
  margin-bottom: 14px;
}

.table-title { font-size: 15px; font-weight: 700; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  font-size: 10px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 0 8px 10px;
  text-align: left;
}
.data-table td {
  padding: 10px 8px;
  font-size: 13px;
  border-top: 1px solid var(--border);
}

.data-table tr:hover td { background: #fafafa; }

.placa-badge {
  background: var(--navbar);
  color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 4px;
  letter-spacing: .04em; white-space: nowrap;
  font-family: monospace;
}

.veiculo-nome { font-weight: 600; font-size: 13px; }
.veiculo-esc  { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.text-right { text-align: right; }
.font-semibold { font-weight: 600; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-muted { color: var(--text-muted); }

/* ── Status Badge ─────────────────────────── */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 20px;
}
.status-ativo { background: var(--green-soft); color: var(--green); }
.status-liberado { background: var(--border); color: var(--text-muted); }

/* ── Page Content ─────────────────────────── */
.page-content { padding: 12px 16px 24px; display: flex; flex-direction: column; gap: 12px; }

/* ── Filters Bar ──────────────────────────── */
.filters-bar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}

.filter-select {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px; color: var(--text-primary);
  cursor: pointer;
  transition: border-color var(--transition);
  flex: 1; min-width: 120px;
}
.filter-select:focus { border-color: var(--accent); outline: none; }

.search-input {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px; color: var(--text-primary);
  flex: 2; min-width: 160px;
  transition: border-color var(--transition);
}
.search-input:focus { border-color: var(--accent); outline: none; }

/* ── Vehicle Cards (lista) ────────────────── */
.veiculo-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
  cursor: pointer;
}
.veiculo-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

.veiculo-card-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 10px;
}

.veiculo-card-info { flex: 1; }
.veiculo-card-placa {
  display: inline-flex; align-items: center; gap: 4px;
  margin-bottom: 4px;
}

.veiculo-card-name { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.veiculo-card-sub { font-size: 12px; color: var(--text-muted); }

.veiculo-card-stats {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 8px; margin-top: 10px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.stat-item { text-align: center; }
.stat-label { font-size: 10px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 14px; font-weight: 700; margin-top: 2px; }

/* ── Lancamentos List ─────────────────────── */
.lancamento-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 12px;
}

.lancamento-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 18px;
}

.lancamento-icon.rec { background: var(--green-soft); }
.lancamento-icon.desp { background: var(--red-soft); }

.lancamento-info { flex: 1; min-width: 0; }
.lancamento-desc { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lancamento-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.lancamento-valor { font-size: 16px; font-weight: 800; }
.lancamento-rec .lancamento-valor { color: var(--green); }
.lancamento-desp .lancamento-valor { color: var(--red); }

.btn-delete-item {
  background: none; color: var(--text-muted); padding: 4px;
  border-radius: 4px; transition: color var(--transition), background var(--transition);
}
.btn-delete-item:hover { color: var(--red); background: var(--red-soft); }

/* ── Empty State ──────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px;
  padding: 48px 24px; text-align: center;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 42px; opacity: .4; }
.empty-state p { font-size: 14px; }

/* ── Modal ────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 24px 20px 32px;
  width: 100%; max-width: 540px;
  max-height: 92dvh;
  overflow-y: auto;
  transform: translateY(40px);
  transition: transform .28s cubic-bezier(.34,1.56,.64,1);
  box-shadow: 0 -8px 40px rgba(0,0,0,.2);
}

.modal-lg { max-width: 640px; }

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

.modal-handle {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 20px;
}

.modal-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  gap: 16px;
}

.modal-title { font-size: 20px; font-weight: 800; margin-bottom: 4px; line-height: 1.2; }
.modal-subtitle { font-size: 13px; color: var(--text-muted); line-height: 1.4; }

.modal-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: all var(--transition);
}
.modal-close-btn:hover { background: var(--border); color: var(--text-primary); }

/* ── Form Section Card ────────────────────── */
.form-section-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 4px;
}

.form-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.form-section-card .form-input,
.form-section-card .form-select {
  background: var(--surface);
}

/* ── Form Actions Right ───────────────────── */
.form-actions-right {
  justify-content: flex-end;
}
.form-actions-right .btn {
  flex: unset;
}


/* ── Form ─────────────────────────────────── */
.form-grid { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }

.form-input, .form-select, .form-textarea {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 14px; color: var(--text-primary);
  transition: border-color var(--transition), background var(--transition);
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  background: #fff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(240,165,0,.12);
}
.form-textarea { resize: vertical; min-height: 80px; }

.novo-item-box {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.novo-item-box .form-input {
  padding: 11px 13px;
  font-size: 14px;
  flex: 1;
}
.novo-item-box .btn-sm {
  padding: 0 12px;
  white-space: nowrap;
}

.form-actions { display: flex; gap: 10px; margin-top: 6px; }
.form-actions .btn { flex: 1; justify-content: center; padding: 13px; }

/* ── Toast ────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--navbar);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(10px);
  transition: all .3s ease;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-left: 3px solid #4caf50; }
.toast.error { border-left: 3px solid var(--red); }

/* ── Loading ──────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, #f0f0f0 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px; height: 20px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Scrollbar ────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ── Utils ────────────────────────────────── */
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.w-full { width: 100%; }
.text-center { text-align: center; }

/* ── Responsive ───────────────────────────── */
@media (min-width: 540px) {
  .cards-grid { display: grid; grid-template-columns: 1fr 1fr; }
  .cards-grid .card-dark { grid-column: 1 / -1; }
  .modal { border-radius: var(--radius-lg); margin: auto; }
  .modal-overlay { align-items: center; }
}

/* ── Veículos View ────────────────────────── */
.vv-header {
  padding: 20px 16px 0;
}

.vv-count {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.vv-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.15;
}

.vv-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
  line-height: 1.5;
}

.vv-btn-novo {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 20px;
  font-size: 14px;
  border-radius: 10px;
  margin-bottom: 20px;
}

/* ── Pills ────────────────────────────────── */
.vv-pills-wrap {
  padding: 0 16px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.vv-pills-wrap::-webkit-scrollbar { display: none; }

.vv-pills {
  display: inline-flex;
  gap: 4px;
  background: #e5e7eb;
  padding: 4px;
  border-radius: 10px;
  white-space: nowrap;
}

.vv-pill {
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all .18s ease;
  position: relative;
}

.vv-pill:hover { color: var(--text-primary); background: rgba(255,255,255,.6); }

.vv-pill.active {
  background: var(--surface);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}

.vv-pill-green { color: #16a34a; }
.vv-pill-green:hover { color: #15803d; }
.vv-pill-green.active { color: #16a34a; }

.vv-pill-red { color: var(--red); }
.vv-pill-red:hover { color: #c62828; }
.vv-pill-red.active { color: var(--red); }

/* ── Search ───────────────────────────────── */
.vv-search-wrap {
  padding: 0 16px 12px;
}

.vv-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.vv-search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(240,165,0,.10);
}

.vv-search-icon { color: var(--text-muted); flex-shrink: 0; }

.vv-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
}
.vv-search-input::placeholder { color: var(--text-muted); }

/* ── Vehicle List ─────────────────────────── */
.vv-list {
  padding: 0 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vv-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 12px 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition);
}
.vv-item:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

.vv-item-left {
  flex: 0 0 110px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.vv-item-placa {
  background: var(--navbar);
  color: #fff;
  font-family: monospace;
  font-size: 13px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 7px;
  letter-spacing: .06em;
  white-space: nowrap;
  margin-bottom: 6px;
}

.vv-item-nome {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-primary);
  text-transform: uppercase;
  line-height: 1.25;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vv-item-cor {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vv-item-center {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.vv-item-esc {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vv-item-oj {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vv-item-oj strong {
  color: var(--text-primary);
  font-weight: 800;
}

.vv-item-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.vv-rastreador-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.vv-r-letter {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.vv-r-circle {
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--navbar);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

@media (max-width: 400px) {
  .vv-item {
    padding: 12px 10px 12px 12px;
    gap: 8px;
  }
  .vv-item-left {
    flex: 0 0 96px;
  }
  .vv-item-placa {
    font-size: 12px;
    padding: 4px 9px;
  }
  .vv-item-esc {
    font-size: 12px;
  }
  .vv-item-oj {
    font-size: 11px;
  }
  .vv-r-letter {
    font-size: 18px;
  }
  .vv-r-circle {
    min-width: 24px;
    height: 24px;
    font-size: 11px;
  }
}

/* ── Status Badges (new) ──────────────────── */
.badge-v {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1.5px solid;
  white-space: nowrap;
}

.badge-v-apreendido {
  color: #1d4ed8;
  border-color: #93c5fd;
  background: #eff6ff;
}

.badge-v-pendente {
  color: #b45309;
  border-color: #fcd34d;
  background: #fffbeb;
}

.badge-v-recebido {
  color: #16a34a;
  border-color: #86efac;
  background: #f0fdf4;
}

.badge-v-perdido {
  color: #dc2626;
  border-color: #fca5a5;
  background: #fef2f2;
}

/* ── Dots Menu ────────────────────────────── */
.btn-dots {
  background: transparent;
  color: var(--text-muted);
  padding: 6px;
  border-radius: 6px;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  transition: background var(--transition), color var(--transition);
}
.btn-dots:hover { background: var(--bg); color: var(--text-primary); }

.dots-menu-wrap { position: relative; }

.dots-menu {
  position: absolute;
  right: 0; top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  min-width: 140px;
  overflow: hidden;
  display: none;
}
.dots-menu.open { display: block; }

.dots-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-primary);
  background: transparent;
  text-align: left;
  transition: background var(--transition);
}
.dots-menu button:hover { background: var(--bg); }
.dots-menu button.danger { color: var(--red); }
.dots-menu button.danger:hover { background: var(--red-soft); }

/* ── Rastreador Battery / Days & MDD Tag ──── */
.vv-rastreador-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.vv-bateria-pill {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 6px;
  line-height: 1.3;
  white-space: nowrap;
}
.vv-bat-ok   { background: #dcfce7; color: #15803d; }
.vv-bat-warn { background: #fef3c7; color: #b45309; }
.vv-bat-crit { background: #fee2e2; color: #b91c1c; }

.vv-mdd-line {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  flex-wrap: nowrap;
  overflow: hidden;
}

.vv-mdd-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vv-mdd-aguardando_mdd      { background: #f3f4f6; color: #4b5563; }
.vv-mdd-mdd_expedido        { background: #dbeafe; color: #1d4ed8; }
.vv-mdd-com_oj              { background: #ede9fe; color: #6d28d9; }
.vv-mdd-diligencia_agendada { background: #fef3c7; color: #b45309; }
.vv-mdd-cumprido            { background: #dcfce7; color: #15803d; }

/* ── Agenda Section ───────────────────────── */
.agenda-section {
  margin: 0 0 8px;
}

.agenda-badge-count {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}

.agenda-date-pill {
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 5px;
  text-transform: uppercase;
  white-space: nowrap;
}
.agenda-hoje   { background: #fee2e2; color: #b91c1c; }
.agenda-amanha { background: #fef3c7; color: #b45309; }
.agenda-futura { background: #e0f2fe; color: #0369a1; }

/* ── Quick Actions Bar (Modal) ────────────── */
.quick-actions-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: var(--bg);
  padding: 8px;
  border-radius: var(--radius);
}

.qa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 6px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  transition: transform var(--transition), box-shadow var(--transition);
}
.qa-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.qa-whats { background: #dcfce7; color: #15803d; }
.qa-maps  { background: #dbeafe; color: #1d4ed8; }
.qa-waze  { background: #e0f2fe; color: #0369a1; }
.qa-copy  { background: #fef3c7; color: #92400e; }

/* ── Fotos Upload & Grid ──────────────────── */
.fotos-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.fotos-upload-btn {
  cursor: pointer;
  background: var(--surface);
}

.fotos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.fotos-grid:empty { margin-top: 0; }

.foto-thumb-wrap {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
}

.foto-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

.foto-remove-btn {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,.7);
  color: #fff;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.88);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.lightbox-overlay.open { display: flex; }
.lightbox-overlay img {
  max-width: 100%;
  max-height: 90dvh;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
}

/* ── Cobrança por Escritório ──────────────── */
.cobranca-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.cobranca-header {
  margin-bottom: 12px;
}
.cobranca-title { font-size: 15px; font-weight: 700; }
.cobranca-sub   { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.cobranca-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cobranca-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg);
}

.cobranca-item > div:first-child {
  flex: 1;
  min-width: 0;
}

.cobranca-esc-nome {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}
.cobranca-esc-qtd {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.cobranca-esc-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}
.cobranca-esc-val {
  font-size: 15px;
  font-weight: 800;
  color: #b45309;
  line-height: 1.1;
}
.cobranca-esc-right .btn-sm {
  background: var(--surface);
  padding: 6px 10px;
  font-size: 11px;
  white-space: nowrap;
}

/* ── Modal WhatsApp OJ Options ────────────── */
.whats-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.whats-opt-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 12px;
  border-radius: 10px;
  background: var(--bg);
  border: 2px solid transparent;
  text-align: left;
  transition: all var(--transition);
}

.whats-opt-btn.active {
  background: #f0fdf4;
  border-color: #16a34a;
}

.whats-opt-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
}

.whats-opt-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

.btn-whats-send {
  background: #16a34a;
  color: #fff;
}
.btn-whats-send:hover {
  background: #15803d;
}

.whats-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.btn-edit-tpl {
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 6px;
}

.whats-tpl-editor {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.whats-tpl-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-primary);
}

.whats-tpl-vars {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
}

.tpl-var-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 700;
  font-family: monospace;
  color: var(--text-primary);
}

.whats-tpl-editor .form-textarea {
  background: var(--surface);
  font-size: 13px;
}

.whats-tpl-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Auth / Login Screen ──────────────────────────── */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: linear-gradient(145deg, #f8fafc 0%, #e2e8f0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.auth-overlay.hidden {
  display: none !important;
}

.auth-card {
  width: 100%;
  max-width: 390px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 22px 24px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.12);
}

.auth-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}

.auth-logo-img {
  height: 44px;
  width: auto;
  max-width: 230px;
  object-fit: contain;
  mix-blend-mode: multiply;
  filter: brightness(1.12) contrast(1.08);
}

.auth-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 4px;
}

.auth-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 18px;
  line-height: 1.4;
}

.auth-submit-btn {
  width: 100%;
  justify-content: center;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  background: #0a2e5c;
  color: #ffffff;
  margin-top: 6px;
}

.auth-submit-btn:hover {
  background: #0f3d7a;
}

.auth-footer {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.auth-link-btn {
  background: none;
  border: none;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
}

.auth-link-btn:hover {
  text-decoration: underline;
}

/* ── Mobile Native App Layout (Bottom Tab Bar & No Top Nav) ── */
@media (max-width: 640px) {
  #app {
    padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  }

  .navbar {
    padding: 0 12px;
  }

  .navbar-top {
    padding: 10px 0;
  }

  .navbar-logo-img {
    height: 30px;
    max-width: 140px;
  }

  .navbar-actions {
    gap: 4px;
  }

  .navbar-action-btn {
    padding: 5px 8px;
    font-size: 11px;
  }

  /* Move as abas de navegação para a parte inferior como aplicativo nativo */
  .navbar-tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 180;
    background: #ffffff;
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px));
    overflow: visible;
  }

  .tab-btn {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3px;
    padding: 7px 2px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
  }

  .tab-btn svg {
    width: 19px;
    height: 19px;
  }

  .tab-btn::after {
    top: 0;
    bottom: auto;
    left: 22%;
    right: 22%;
    height: 3px;
    border-radius: 0 0 3px 3px;
  }

  .toast-container {
    bottom: calc(74px + env(safe-area-inset-bottom, 0px));
  }
}

/* Ocultar botão Tela Cheia caso já esteja rodando instalado como PWA standalone */
@media (display-mode: standalone), (display-mode: fullscreen) {
  #btn-fullscreen {
    display: none !important;
  }
}




