/* ===================================================
   style.css — Design System RoberCar
   Paleta: Navy #0f1923 + Amber #f59e0b + Dark cards
   =================================================== */

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

/* ===== CSS VARIABLES — TEMA ESCURO (Padrão) ===== */
:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #121212;
  --bg-tertiary: #1a1a1a;
  --bg-card: #141414;
  --bg-card-hover: #1c1c1c;
  --border: #262626;
  --border-light: #333333;

  --text-primary: #f0f0f0;
  --text-secondary: #a3a3a3;
  --text-muted: #737373;

  --primary: #e60000;
  --primary-dark: #b30000;
  --primary-light: #ff3333;
  --primary-glow: rgba(230, 0, 0, 0.15);

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.12);
  --purple: #8b5cf6;

  --sidebar-width: 260px;
  --header-height: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  --shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.6);
  --shadow-primary: 0 4px 20px rgba(230, 0, 0, 0.25);

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== TEMA CLARO MODERNO & REFINADO ===== */
html.light-mode {
  /* Fundo da página: Slate 50 (limpo, moderno, suave, sem cansar a vista) */
  --bg-primary: #f8fafc;
  /* Sidebar, Topbar e painéis estruturais em branco puro com bordas nítidas */
  --bg-secondary: #ffffff;
  /* Fundo de campos, tags, botões secundários e destaque sutil: Slate 100 */
  --bg-tertiary: #f1f5f9;
  /* Fundo dos cartões e modais: Branco puro */
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  /* Bordas elegantes e sutis: Slate 200 */
  --border: #e2e8f0;
  --border-light: #f1f5f9;

  /* Tipografia nítida e contrastante (Slate 900 / 600 / 400) */
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;

  /* Vermelho RS CAR refinado e calibrado para fundo claro */
  --primary: #dc2626;
  --primary-dark: #b91c1c;
  --primary-light: #ef4444;
  --primary-glow: rgba(220, 38, 38, 0.08);

  /* Status e cores temáticas vibrantes e confortáveis */
  --success: #16a34a;
  --success-bg: #ecfdf5;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --info: #2563eb;
  --info-bg: #eff6ff;
  --purple: #7c3aed;

  /* Sombras naturais e leves com profundidade moderna */
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.06), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-primary: 0 4px 14px rgba(220, 38, 38, 0.16);
}

html.light-mode ::-webkit-scrollbar-track { background: #f8fafc; }
html.light-mode ::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
html.light-mode ::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Componentes Estruturais no Modo Claro */
html.light-mode #sidebar {
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  box-shadow: 1px 0 10px rgba(0, 0, 0, 0.02);
}
html.light-mode .sidebar-logo { border-bottom: 1px solid #e2e8f0; }
html.light-mode .nav-section { color: #94a3b8; font-weight: 700; letter-spacing: 1px; }
html.light-mode .nav-item { color: #475569; font-weight: 500; }
html.light-mode .nav-item i { color: #64748b; }
html.light-mode .nav-item:hover { background: #f8fafc; color: #0f172a; }
html.light-mode .nav-item:hover i { color: #dc2626; }
html.light-mode .nav-item.active {
  background: #fef2f2;
  color: #dc2626;
  border-left: 3px solid #dc2626;
  font-weight: 600;
}
html.light-mode .nav-item.active i { color: #dc2626; }
html.light-mode .sidebar-footer { border-top: 1px solid #e2e8f0; }
html.light-mode .btn-config { color: #475569; }
html.light-mode .btn-config:hover { background: #f1f5f9; color: #0f172a; }

/* Topbar no Modo Claro */
html.light-mode #topbar {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}
html.light-mode .breadcrumb { color: #64748b; }
html.light-mode #breadcrumb-current { color: #0f172a; font-weight: 700; }
html.light-mode .topbar-date { color: #64748b; }
html.light-mode .topbar-badge {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  font-weight: 600;
}
html.light-mode .theme-toggle {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}
html.light-mode .theme-toggle:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Containers, Tabelas e Caixas no Modo Claro */
html.light-mode .table-container,
html.light-mode .rel-chart-box,
html.light-mode .rel-rank-box,
html.light-mode .stat-card,
html.light-mode .os-card,
html.light-mode .card,
html.light-mode .search-bar {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
html.light-mode .data-table th {
  background: #f8fafc;
  color: #475569;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 700;
}
html.light-mode .data-table td {
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}
html.light-mode .data-table tbody tr:hover td {
  background: #f8fafc;
}

/* Formulários, Inputs e Filtros no Modo Claro */
html.light-mode .form-control,
html.light-mode input[type="text"],
html.light-mode input[type="date"],
html.light-mode input[type="number"],
html.light-mode input[type="password"],
html.light-mode select,
html.light-mode textarea {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #0f172a;
}
html.light-mode .form-control:focus,
html.light-mode input[type="text"]:focus,
html.light-mode input[type="date"]:focus,
html.light-mode input[type="number"]:focus,
html.light-mode select:focus,
html.light-mode textarea:focus {
  background: #ffffff;
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}
html.light-mode input::placeholder,
html.light-mode textarea::placeholder {
  color: #94a3b8;
}
html.light-mode select option {
  background: #ffffff;
  color: #0f172a;
}

/* Modais no Modo Claro */
html.light-mode .modal-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.15);
}
html.light-mode .modal-header {
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
}
html.light-mode .modal-footer {
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

/* Botões do Período em Relatórios no Modo Claro */
html.light-mode .rel-filter-bar {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 12px 18px;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}
html.light-mode .rel-period-btn {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-weight: 600;
}
html.light-mode .rel-period-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}
html.light-mode .rel-period-btn.active {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.25);
}

/* Cards de KPI em Relatórios no Modo Claro */
html.light-mode .rel-kpi-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: transform 0.2s, box-shadow 0.2s;
}
html.light-mode .rel-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}
html.light-mode .rel-kpi-label { color: #64748b; font-weight: 700; }
html.light-mode .rel-kpi-value { color: #0f172a; font-weight: 800; }
html.light-mode .rel-kpi-sub { color: #64748b; }
html.light-mode .kpi-grad-green .rel-kpi-icon { background: #ecfdf5; color: #059669; }
html.light-mode .kpi-grad-red .rel-kpi-icon { background: #fef2f2; color: #dc2626; }
html.light-mode .kpi-grad-emerald .rel-kpi-icon { background: #ecfdf5; color: #047857; }
html.light-mode .kpi-grad-blue .rel-kpi-icon { background: #eff6ff; color: #2563eb; }
html.light-mode .kpi-grad-purple .rel-kpi-icon { background: #f5f3ff; color: #7c3aed; }

/* Botões no Modo Claro */
html.light-mode .btn-ghost {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
}
html.light-mode .btn-ghost:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}
html.light-mode .btn-secondary {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
}
html.light-mode .btn-secondary:hover {
  background: #e2e8f0;
  color: #0f172a;
}
html.light-mode .btn-primary {
  background: #dc2626;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.2);
}
html.light-mode .btn-primary:hover {
  background: #b91c1c;
}

/* Badges e Status no Modo Claro */
html.light-mode .badge-success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
html.light-mode .badge-danger { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
html.light-mode .badge-warning { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
html.light-mode .badge-primary { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
html.light-mode .badge-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
html.light-mode .badge-ghost { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }

/* Abas de Filtro de Status no Modo Claro */
html.light-mode .filter-tab {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
}
html.light-mode .filter-tab:hover {
  background: #f8fafc;
  color: #0f172a;
  border-color: #94a3b8;
}
html.light-mode .filter-tab.active {
  background: #fef2f2;
  border-color: #dc2626;
  color: #dc2626;
  font-weight: 600;
}

/* Gráficos e Rankings no Modo Claro */
html.light-mode .rel-chart-header,
html.light-mode .rel-rank-header {
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
}
html.light-mode .rel-chart-header h3,
html.light-mode .rel-rank-header h4 {
  color: #0f172a;
}
html.light-mode .rel-rank-item {
  border-bottom: 1px solid #f1f5f9;
}
html.light-mode .ranking-bar-bg {
  background: #e2e8f0;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ===== LOADER ===== */
#app-loader {
  position: fixed; inset: 0;
  background: var(--bg-primary);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 9999; gap: 20px;
}
#app-loader img { width: 140px; border-radius: 16px; }
#app-loader p { color: var(--text-muted); font-size: 14px; }

/* ===== SIDEBAR ===== */
#sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  z-index: 200;
  transition: var(--transition);
  overflow: hidden;
}

.sidebar-logo {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo img {
  width: 44px; height: 44px;
  border-radius: 10px;
  object-fit: contain;
  background: #ffffff;
  padding: 3px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  flex-shrink: 0;
}

.sidebar-logo-text h2 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.3px;
  line-height: 1.2;
}

.sidebar-logo-text p {
  font-size: 11px;
  color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}

.nav-section {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 16px 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  margin-bottom: 2px;
}

.nav-item i { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.8; }

.nav-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--primary-glow);
  color: var(--primary);
  border-left: 3px solid var(--primary);
  padding-left: 11px;
}

.nav-item.active i { opacity: 1; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.btn-config {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  padding: 8px;
  border-radius: var(--radius-sm);
  width: 100%;
  transition: var(--transition);
}
.btn-config:hover { background: var(--bg-card); color: var(--text-primary); }

/* ===== MAIN LAYOUT ===== */
#app-shell {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== TOPBAR ===== */
#topbar {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

#menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-muted);
}

.breadcrumb-sep { color: var(--border-light); }
#breadcrumb-current { color: var(--text-primary); font-weight: 600; }

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.topbar-badge {
  background: var(--primary-glow);
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 600;
}

/* ===== USER DROPDOWN ===== */
.user-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 400;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.user-dropdown-item {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  transition: background 0.15s;
}

.user-dropdown-item:hover {
  background: var(--bg-tertiary);
}

.user-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.user-dropdown-danger {
  color: var(--danger);
}

.user-dropdown-danger:hover {
  background: var(--danger-bg);
}

/* ===== MAIN CONTENT ===== */
#main-content {
  flex: 1;
  padding: 24px;
  width: 100%;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn i { width: 16px; height: 16px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-xs { padding: 4px 8px; font-size: 12px; }

.btn-primary {
  background: var(--primary);
  color: #0f1923;
  font-weight: 600;
  box-shadow: var(--shadow-primary);
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }

.btn-secondary {
  background: var(--info);
  color: white;
}
.btn-secondary:hover { background: #2563eb; transform: translateY(-1px); }

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover { background: #059669; transform: translateY(-1px); }

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover { background: var(--danger); color: white; }

.btn-ghost {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.btn-icon { padding: 7px; border-radius: var(--radius-sm); }
.btn-icon i { width: 14px; height: 14px; }

/* ===== MODULE HEADER ===== */
.module-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.module-title {
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
}

.module-title i { color: var(--primary); width: 24px; height: 24px; }
.module-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== TABLES ===== */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-secondary);
  transition: background 0.15s;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--bg-card-hover); color: var(--text-primary); }

.loading-row, .empty-row {
  text-align: center;
  padding: 48px !important;
  color: var(--text-muted);
}

.tfoot-summary td { padding: 10px 16px; background: var(--bg-tertiary); font-size: 13px; border-top: 1px solid var(--border); }
.tfoot-total td { padding: 12px 16px; background: var(--bg-secondary); font-size: 15px; font-weight: 700; border-top: 2px solid var(--primary); }

/* ===== SEARCH BAR ===== */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  margin-bottom: 16px;
}

.search-bar i { color: var(--text-muted); width: 18px; height: 18px; flex-shrink: 0; }

.search-bar input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  width: 100%;
}

.search-bar input::placeholder { color: var(--text-muted); }

/* ===== FORMS ===== */
.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-span-2 { grid-column: span 2; }
.form-span-3 { grid-column: span 3; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea,
.form-control {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 14px;
  transition: var(--transition);
  outline: none;
  width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-group input::placeholder { color: var(--text-muted); }
.form-group select option { background: var(--bg-secondary); }
.form-group textarea { resize: vertical; min-height: 60px; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-primary { background: rgba(245, 158, 11, 0.15); color: var(--primary); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-info { background: var(--info-bg); color: var(--info); border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-ghost { background: rgba(255,255,255,0.07); color: var(--text-muted); border: 1px solid var(--border); }

/* ===== MODALS ===== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal.active { display: flex; }

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-box {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}

.modal-lg { max-width: 760px; }
.modal-xl { max-width: 960px; }

@keyframes modalIn {
  from { transform: translateY(20px) scale(0.97); opacity: 0; }
  to { transform: none; opacity: 1; }
}

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

.modal-header h3 { font-size: 17px; font-weight: 700; color: var(--text-primary); }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.modal-close:hover { background: var(--danger-bg); color: var(--danger); }

.modal-body { padding: 24px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
}

/* ===== SPINNER ===== */
.spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

.spinner-lg { width: 40px; height: 40px; border-width: 3px; }

@keyframes spin { to { transform: rotate(360deg); } }

.loading-page {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 300px; gap: 16px;
  color: var(--text-muted);
}

/* ===== TOAST NOTIFICATIONS ===== */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 14px;
  color: var(--text-primary);
  max-width: 360px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.3s ease;
}

.toast.show { opacity: 1; transform: none; }

/* ===== DASHBOARD ===== */
.dashboard-welcome {
  display: flex;
  align-items: center;
  gap: 20px;
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-tertiary) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.dashboard-welcome::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  pointer-events: none;
}

.dashboard-logo {
  width: 72px; height: 72px;
  border-radius: 14px;
  object-fit: contain;
  background: #ffffff;
  padding: 5px;
  box-shadow: var(--shadow-primary);
  flex-shrink: 0;
}

.dashboard-welcome h2 { font-size: 20px; font-weight: 700; }
.dashboard-welcome p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.dash-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: var(--transition);
}

.dash-kpi-card.clickable { cursor: pointer; }
.dash-kpi-card.clickable:hover { background: var(--bg-card-hover); border-color: var(--border-light); transform: translateY(-2px); box-shadow: var(--shadow); }

.dash-kpi-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.icon-primary { background: var(--primary-glow); color: var(--primary); }
.icon-green { background: var(--success-bg); color: var(--success); }
.icon-red { background: var(--danger-bg); color: var(--danger); }
.icon-blue { background: var(--info-bg); color: var(--info); }
.icon-orange { background: rgba(249, 115, 22, 0.12); color: #f97316; }
.icon-purple { background: rgba(139, 92, 246, 0.12); color: var(--purple); }

.dash-kpi-card p { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.dash-kpi-card h3 { font-size: 20px; font-weight: 700; }

.dash-section { margin-bottom: 28px; }
.dash-section-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; color: var(--text-primary); }
.dash-section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
}

.quick-action-btn i { width: 28px; height: 28px; color: var(--primary); }
.quick-action-btn:hover { background: var(--primary-glow); border-color: var(--primary); color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-primary); }

.estoque-alertas-grid { display: flex; flex-wrap: wrap; gap: 10px; }

.alerta-peca-card {
  background: var(--warning-bg);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

/* ===== OS MODULE ===== */
.os-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  transition: var(--transition);
}

.filter-tab:hover { border-color: var(--border-light); color: var(--text-primary); }

.filter-tab.active {
  background: var(--primary-glow);
  border-color: var(--primary);
  color: var(--primary);
}

/* Drag & Drop Feedback para Abas de Status */
.filter-tab {
  transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1), background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.filter-tab.drop-target-ready {
  border: 1.5px dashed rgba(204, 0, 0, 0.5) !important;
  background: rgba(204, 0, 0, 0.08);
  transform: translateY(-2px);
}
.filter-tab.drop-hover {
  background: var(--primary) !important;
  border: 2px solid #ffffff !important;
  color: #ffffff !important;
  transform: scale(1.12) translateY(-4px) !important;
  box-shadow: 0 8px 24px rgba(204, 0, 0, 0.6) !important;
  z-index: 10;
}
.filter-tab.drop-hover .dot {
  background: #ffffff !important;
}

.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-warning { background: var(--warning); }
.dot-primary { background: var(--primary); }
.dot-success { background: var(--success); }
.dot-ghost { background: var(--text-muted); }

.os-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.os-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: grab;
  user-select: none;
  transition: var(--transition);
}

.os-card:active {
  cursor: grabbing;
}

.os-card.is-dragging-card {
  opacity: 0.35 !important;
  transform: scale(0.96) !important;
  border: 2px dashed var(--primary) !important;
  box-shadow: none !important;
}

.os-card:hover:not(.is-dragging-card) { border-color: var(--border-light); transform: translateY(-2px); box-shadow: var(--shadow); }

.os-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}

.os-num { font-weight: 700; font-size: 15px; color: var(--primary); }

.os-card-body { padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; }

.os-info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.os-info-row i { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }

.os-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border);
}

.os-total { font-weight: 700; font-size: 15px; color: var(--success); }

/* OS Form */
.os-section {
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-title i { width: 14px; height: 14px; }

.add-item-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
}

.add-item-row input, .add-item-row select {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  padding: 8px 12px;
  outline: none;
  flex: 1;
  min-width: 120px;
}

.add-item-row input:focus, .add-item-row select:focus { border-color: var(--primary); }

.item-os-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 13px;
}

.item-desc { flex: 1; color: var(--text-primary); }
.item-qty { color: var(--text-muted); min-width: 30px; }
.item-valor { color: var(--success); font-weight: 600; min-width: 80px; text-align: right; }

.os-total-bar {
  display: flex;
  justify-content: flex-end;
  gap: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: 16px;
}

.total-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 16px;
  border-right: 1px solid var(--border);
  font-size: 12px;
  gap: 4px;
}

.total-item span { color: var(--text-muted); }
.total-item strong { font-size: 14px; }
.total-item:last-child { border-right: none; }

.total-final {
  background: var(--primary-glow);
  padding: 12px 20px;
}

.total-final span { color: var(--primary); }
.total-final strong { font-size: 18px; color: var(--primary); }

/* ===== CAIXA ===== */
.caixa-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: var(--transition);
}

.summary-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}

.summary-entrada { border-left: 3px solid var(--success); }
.summary-entrada .summary-icon { background: var(--success-bg); color: var(--success); }

.summary-saida { border-left: 3px solid var(--danger); }
.summary-saida .summary-icon { background: var(--danger-bg); color: var(--danger); }

.summary-saldo { border-left: 3px solid var(--primary); }
.summary-saldo .summary-icon { background: var(--primary-glow); color: var(--primary); }

.summary-mes { border-left: 3px solid var(--info); }
.summary-mes .summary-icon { background: var(--info-bg); color: var(--info); }

.summary-card p { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.summary-card h3 { font-size: 18px; font-weight: 700; }
.summary-label { font-size: 12px; color: var(--text-muted); }

.caixa-date-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-muted);
}

.caixa-date-filter input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  padding: 7px 12px;
  font-size: 13px;
  outline: none;
}

.caixa-date-filter input:focus { border-color: var(--primary); }

/* ===== ESTOQUE ===== */
.alertas-container { margin-bottom: 16px; }

.alerta-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--warning-bg);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  flex-wrap: wrap;
}

.alerta-banner i { color: var(--warning); width: 18px; height: 18px; flex-shrink: 0; }

/* ===== CLIENTES ===== */
.veiculo-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
  transition: var(--transition);
}

.veiculo-card:hover { border-color: var(--border-light); }

.veiculo-icon {
  width: 40px; height: 40px;
  background: var(--primary-glow);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.veiculo-info { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.veiculo-info strong { font-size: 14px; }
.veiculo-info small { font-size: 12px; color: var(--text-muted); }

/* ===== MECÂNICOS ===== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.mecanico-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: var(--transition);
}

.mecanico-card:hover { border-color: var(--border-light); box-shadow: var(--shadow); }

.mecanico-avatar {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: #0f1923;
}

.mecanico-info h3 { font-size: 16px; font-weight: 700; }
.mecanico-info p { font-size: 12px; margin-top: 4px; display: flex; align-items: center; gap: 4px; }

.mecanico-stats {
  display: flex;
  gap: 0;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.stat-mini {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 8px;
  border-right: 1px solid var(--border);
  gap: 2px;
}

.stat-mini:last-child { border-right: none; }
.stat-value { font-size: 14px; font-weight: 700; }
.stat-label { font-size: 10px; color: var(--text-muted); }

/* ===== RELATÓRIOS ===== */
.relatorio-filtros {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-muted);
}

.relatorio-filtros input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  padding: 7px 12px;
  font-size: 13px;
  outline: none;
}

.relatorio-filtros input:focus { border-color: var(--primary); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: var(--transition);
}

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

.kpi-green { background: var(--success-bg); color: var(--success); }
.kpi-red { background: var(--danger-bg); color: var(--danger); }
.kpi-primary { background: var(--primary-glow); color: var(--primary); }
.kpi-blue { background: var(--info-bg); color: var(--info); }
.kpi-purple { background: rgba(139, 92, 246, 0.12); color: var(--purple); }

.kpi-label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.kpi-value { font-size: 18px; font-weight: 700; }

.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.chart-wide { grid-column: 1; }
.chart-title { font-size: 14px; font-weight: 600; margin-bottom: 16px; display: flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.chart-title i { width: 16px; height: 16px; color: var(--primary); }

.relatorio-tables {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.relatorio-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.relatorio-table-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 6px; color: var(--text-secondary); }

.rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.rank-row:last-child { border-bottom: none; }
.rank-num { color: var(--primary); font-weight: 700; min-width: 24px; }
.rank-name { flex: 1; color: var(--text-secondary); }
.rank-value { color: var(--text-primary); font-weight: 600; }

/* ===== UTIL CLASSES ===== */
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--text-primary); }
.font-bold { font-weight: 700; }
.mb-16 { margin-bottom: 16px; }

code {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--primary);
}

.info-banner {
  background: var(--info-bg);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--info);
}

.action-btns { display: flex; gap: 4px; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  text-align: center;
  gap: 12px;
  width: 100%;
}

.empty-state i { width: 48px; height: 48px; opacity: 0.4; }
.error-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px; gap: 12px; color: var(--text-muted); text-align: center; }
.error-state i { width: 48px; height: 48px; color: var(--danger); }

/* ===== SIDEBAR OVERLAY (mobile) ===== */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 150;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  #sidebar {
    transform: translateX(-100%);
  }

  #sidebar.open {
    transform: none;
  }

  #sidebar-overlay.show { display: block; }

  #app-shell { margin-left: 0; }

  #menu-toggle { display: flex; }

  .charts-grid { grid-template-columns: 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
  .form-span-2, .form-span-3 { grid-column: span 1; }

  .os-total-bar { flex-wrap: wrap; }

  #main-content { padding: 16px; }
}

@media (max-width: 600px) {
  .dash-kpi-grid { grid-template-columns: 1fr 1fr; }
  .quick-actions-grid { grid-template-columns: repeat(3, 1fr); }
  .form-grid-3 { grid-template-columns: 1fr; }
  .caixa-summary-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== META DE FATURAMENTO ===== */
.meta-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.meta-info {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}
.meta-progress-bar {
  width: 100%;
  height: 12px;
  background: var(--bg-card);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.meta-progress-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
  transition: width 0.6s ease, background 0.3s;
}



/* ===== META CHART ===== */
.meta-chart-wrapper { display: flex; align-items: center; gap: 24px; }
.meta-chart { width: 120px; height: 120px; border-radius: 50%; background: conic-gradient(var(--primary) var(--pct, 0%), var(--bg-secondary) 0); display: flex; align-items: center; justify-content: center; position: relative; flex-shrink: 0; box-shadow: inset 0 0 10px rgba(0,0,0,0.5); }
.meta-chart::before { content: ''; position: absolute; inset: 12px; background: var(--bg-card); border-radius: 50%; box-shadow: 0 2px 10px rgba(0,0,0,0.5); }
.meta-chart-content { position: relative; z-index: 1; text-align: center; }
.meta-chart-content span { display: block; font-size: 20px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.meta-chart-content small { font-size: 11px; color: var(--text-muted); }
.meta-details { flex: 1; }
.meta-details h4 { font-size: 24px; margin-bottom: 4px; color: var(--text-primary); }
.meta-details p { color: var(--text-muted); font-size: 14px; margin-bottom: 12px; }
.meta-input-group { display: flex; gap: 8px; margin-top: 12px; }
.meta-input-group input { width: 140px; }

/* ===== PREMIUM DASHBOARD CHARTS ===== */
.chart-card {
  position: relative;
  width: 100%;
  height: 320px;
  background: var(--bg-card);
  padding: 20px;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
}

.dash-meta-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  transition: transform 0.2s;
}
.dash-meta-card:hover { transform: translateY(-2px); }
.dash-meta-card p {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 8px;
}
.dash-meta-card h3 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
}

.meta-progress-bar {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 4px;
}
.meta-progress-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--primary);
  transition: width 0.8s cubic-bezier(.4,0,.2,1), background 0.4s;
  box-shadow: 0 0 10px rgba(230,0,0,0.35);
}

/* ===== TAB FILTER ===== */
.tab-filter {
  padding: 7px 16px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.tab-filter:hover { color: var(--text-primary); background: var(--bg-card); }
.tab-filter.active { background: var(--bg-card); color: var(--text-primary); box-shadow: 0 1px 4px rgba(0,0,0,0.2); }

/* ===== HISTORICO DE CAIXA ===== */
.historico-grupo {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 16px;
  overflow: hidden;
}
.historico-grupo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}
.historico-data-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: capitalize;
}
.historico-itens { padding: 8px 0; }
.historico-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.historico-item:last-child { border-bottom: none; }
.historico-item:hover { background: rgba(255,255,255,0.02); }
.historico-item-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.historico-item-icon i { width: 18px; height: 18px; }
.icon-entrada { background: rgba(16,185,129,0.12); color: var(--success); }
.icon-saida { background: rgba(239,68,68,0.12); color: var(--danger); }
.historico-item-info { flex: 1; min-width: 0; }
.historico-item-info strong { font-size: 14px; color: var(--text-primary); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.historico-item-valor {
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
  flex-shrink: 0;
}
.historico-item-valor.entrada { color: var(--success); }
.historico-item-valor.saida { color: var(--danger); }
.historico-item-acoes { display: flex; gap: 4px; flex-shrink: 0; }
.hist-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 500;
}
.btn-xs { padding: 4px 6px !important; font-size: 12px !important; }

/* ===== BUSCA GLOBAL ===== */
.topbar-right { display: flex; align-items: center; gap: 12px; position: relative; }
.global-search-wrapper { position: relative; display: flex; align-items: center; }
.btn-search-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: var(--transition);
}
.btn-search-toggle:hover { color: var(--text-primary); border-color: var(--primary); }
.global-search-box {
  position: absolute;
  right: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--primary);
  border-radius: 10px;
  padding: 6px 12px;
  width: 340px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  z-index: 200;
}
.global-search-box .search-icon { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.global-search-box input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
}
.global-search-box input::placeholder { color: var(--text-muted); }
.global-search-box button { background: none; border: none; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; }
.global-search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 300;
  max-height: 400px;
  overflow-y: auto;
  padding: 6px;
}
.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.search-result-item:hover { background: var(--bg-tertiary); }
.search-result-icon { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.search-result-text { display: flex; flex-direction: column; }
.search-result-label { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.search-result-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.search-no-result { padding: 20px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ===== RANKING MECANICOS ===== */
.ranking-list { display: flex; flex-direction: column; gap: 10px; }
.ranking-item { display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: var(--bg-tertiary); border-radius: 12px; border: 1px solid var(--border); }
.ranking-pos { font-size: 22px; flex-shrink: 0; width: 36px; text-align: center; }
.ranking-info { flex: 1; }
.ranking-bar-bg { height: 6px; background: rgba(255,255,255,0.08); border-radius: 99px; overflow: hidden; }
.ranking-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #ff6b6b); border-radius: 99px; transition: width 0.8s ease; }

/* ===== FOTO DO VEICULO ===== */
.foto-upload-area {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-tertiary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100px;
}
.foto-upload-area:hover { border-color: var(--primary); background: rgba(230,0,0,0.04); }

/* ===== RELATÓRIOS MODULE ===== */
.rel-filter-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 16px 20px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 14px; margin-bottom: 24px;
}
.rel-filter-group { display: flex; flex-direction: column; gap: 4px; }
.rel-filter-group label { font-size: 10px; text-transform: uppercase; font-weight: 700; color: var(--text-muted); letter-spacing: 0.5px; }
.rel-filter-group input { width: 160px; }
.rel-filter-sep { color: var(--text-muted); font-size: 16px; margin-top: 14px; }
.rel-filter-btns { display: flex; gap: 6px; margin-left: auto; margin-top: 14px; }
.rel-period-btn {
  background: var(--bg-tertiary); border: 1px solid var(--border); color: var(--text-secondary);
  padding: 6px 14px; border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: var(--transition);
}
.rel-period-btn:hover { border-color: var(--primary); color: var(--text-primary); }
.rel-period-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* KPI Cards */
.rel-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.rel-kpi-card {
  display: flex; align-items: center; gap: 14px; padding: 18px 20px;
  border-radius: 14px; border: 1px solid var(--border);
  background: var(--bg-card); position: relative; overflow: hidden;
}
.rel-kpi-card::before {
  content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 3px;
}
.kpi-grad-green::before { background: linear-gradient(90deg, #10b981, #34d399); }
.kpi-grad-red::before { background: linear-gradient(90deg, #ef4444, #f87171); }
.kpi-grad-emerald::before { background: linear-gradient(90deg, #059669, #10b981); }
.kpi-grad-blue::before { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.kpi-grad-purple::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.rel-kpi-icon {
  width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.kpi-grad-green .rel-kpi-icon { background: rgba(16,185,129,0.15); color: #10b981; }
.kpi-grad-red .rel-kpi-icon { background: rgba(239,68,68,0.15); color: #ef4444; }
.kpi-grad-emerald .rel-kpi-icon { background: rgba(5,150,105,0.15); color: #059669; }
.kpi-grad-blue .rel-kpi-icon { background: rgba(59,130,246,0.15); color: #3b82f6; }
.kpi-grad-purple .rel-kpi-icon { background: rgba(139,92,246,0.15); color: #8b5cf6; }
.rel-kpi-content { display: flex; flex-direction: column; }
.rel-kpi-label { font-size: 11px; text-transform: uppercase; font-weight: 700; color: var(--text-muted); letter-spacing: 0.3px; }
.rel-kpi-value { font-size: 20px; font-weight: 800; color: var(--text-primary); line-height: 1.2; }
.rel-kpi-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Charts */
.rel-charts-row { margin-bottom: 20px; }
.rel-charts-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.rel-chart-box {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden;
}
.rel-chart-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.rel-chart-header h3 {
  font-size: 14px; font-weight: 700; color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}
.rel-chart-body { padding: 16px 20px; position: relative; }

/* Rankings */
.rel-rankings-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; margin-top: 20px; }
.rel-rank-box {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden;
}
.rel-rank-header {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.rel-rank-header h4 { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.rel-rank-body { padding: 12px 16px; }
.rel-rank-item {
  display: flex; align-items: center; gap: 12px; padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.rel-rank-item:last-child { border-bottom: none; }
.rel-rank-pos { font-size: 18px; width: 28px; text-align: center; flex-shrink: 0; }
.rel-rank-info { flex: 1; }
.rel-rank-row { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 12px; }
.rel-rank-row strong { color: var(--text-primary); }
.rel-rank-row span { color: var(--text-muted); font-weight: 600; }

@media (max-width: 768px) {
  .rel-charts-2col { grid-template-columns: 1fr; }
  .rel-rankings-row { grid-template-columns: 1fr; }
  .rel-kpi-grid { grid-template-columns: 1fr 1fr; }
  .rel-filter-bar { flex-direction: column; align-items: stretch; }
}

/* ===== LOGIN SCREEN ===== */
#login-screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-primary);
  background-image: radial-gradient(circle at center, #1a1a1a 0%, var(--bg-primary) 100%);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 40px;
  border-radius: 12px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
  animation: slideUpFade 0.5s ease-out forwards;
}

.login-logo {
  width: 150px;
  height: 150px;
  border-radius: 14px;
  margin-bottom: 24px;
  object-fit: contain;
  background: #ffffff;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 16px rgba(2, 132, 199, 0.25);
  border: 2px solid rgba(2, 132, 199, 0.45);
}

.input-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon i {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.input-icon input {
  padding-left: 42px;
}

/* ===== CUSTOM DATE PICKERS (CALENDÁRIOS) ===== */
input[type="date"] {
  position: relative;
  background-color: var(--bg-card) !important;
  color: var(--info) !important; 
  font-weight: 700 !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  padding: 8px 12px !important;
  padding-left: 38px !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 13px !important;
  cursor: pointer;
  outline: none !important;
  transition: var(--transition);
  min-height: 42px;
  width: 145px !important; /* Fixa o tamanho para não esticar */
  max-width: 100%;
}

input[type="date"]:hover, input[type="date"]:focus {
  border-color: var(--border-light) !important;
  background-color: var(--bg-card-hover) !important;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  filter: invert(0.6) sepia(0) saturate(1) hue-rotate(0deg); 
  opacity: 0.8;
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
}


/* =================================================== CHAT DE SUPORTE IA =================================================== */
