/* ============================================================
   AvariaTotal — Design System v3
   Dark/Light theme, Mobile-first, Responsive
   ============================================================ */

/* CSS Variables — Dark Theme (default) */
:root {
  --primary: #1a56db;
  --primary-dark: #1341a8;
  --primary-light: #3b82f6;
  --primary-bg: rgba(26,86,219,0.1);
  --primary-border: rgba(26,86,219,0.3);

  --red: #dc2626;
  --red-light: #ef4444;
  --red-bg: rgba(220,38,38,0.1);
  --red-border: rgba(220,38,38,0.3);

  --green: #16a34a;
  --green-light: #22c55e;
  --green-bg: rgba(22,163,74,0.1);

  --yellow: #f59e0b;
  --yellow-bg: rgba(245,158,11,0.1);

  --purple: #7c3aed;
  --purple-bg: rgba(124,58,237,0.1);

  --bg-page: #0d1117;
  --bg-surface: #161b22;
  --bg-elevated: #21262d;
  --bg-hover: rgba(255,255,255,0.04);

  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --text-muted: #656d76;
  --text-inverse: #0d1117;

  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.15);

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.5);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 100px;

  --sidebar-width: 240px;
  --header-height: 64px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Light Theme */
[data-theme="light"] {
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-elevated: #f1f5f9;
  --bg-hover: rgba(0,0,0,0.03);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --border: rgba(0,0,0,0.08);
  --border-strong: rgba(0,0,0,0.15);

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.1);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.15);
}

/* ============ RESET & BASE ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ============ LOADING SCREEN ============ */
.loading-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(135deg, #0d1117 0%, #1a1a2e 100%);
  display: flex; align-items: center; justify-content: center;
}
.loading-content { text-align: center; color: white; }
.loading-logo { font-size: 56px; margin-bottom: 12px; }
.loading-name { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.loading-sub { font-size: 13px; opacity: 0.6; margin-bottom: 24px; }
.loading-spinner { display: flex; justify-content: center; }

/* ============ ANIMATIONS ============ */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }
@keyframes slideUp { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }
@keyframes slideIn { from{opacity:0;transform:translateX(-20px)} to{opacity:1;transform:translateX(0)} }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-8px)} 75%{transform:translateX(8px)} }
@keyframes ping { 0%,100%{box-shadow:0 0 0 0 rgba(220,38,38,0.6)} 70%{box-shadow:0 0 0 10px rgba(220,38,38,0)} }
@keyframes pingBlue { 0%,100%{box-shadow:0 0 0 0 rgba(37,99,235,0.6)} 70%{box-shadow:0 0 0 10px rgba(37,99,235,0)} }

.spin { animation: spin 0.8s linear infinite; display: block; }
.pulse { animation: pulse 2s ease-in-out infinite; }
.animate-slide-up { animation: slideUp 0.4s ease forwards; }
.animate-fade { animation: fadeIn 0.3s ease forwards; }

/* ============ LAYOUT: SIDEBAR + MAIN ============ */
.app-layout {
  display: flex; min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 200;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo {
  width: 40px; height: 40px;
  background: #000;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: white; font-weight: 900;
  flex-shrink: 0; overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.sidebar-logo img { width: 100%; height: 100%; object-fit: contain; }

/* FrotaTotal Logo adaptation: white logo on dark bg, invert on light */
.ft-logo-img {
  width: 100%; height: 100%; object-fit: contain;
  /* Logo is black-on-white, invert to white-on-transparent for dark mode */
  filter: invert(1) brightness(2);
}
[data-theme="light"] .ft-logo-img {
  /* On light mode: show original black logo */
  filter: none;
}
/* For login logo icon specifically (has dark bg always) */
.login-logo-icon .ft-logo-img { filter: invert(1) brightness(2); }
[data-theme="light"] .login-logo-icon .ft-logo-img { filter: invert(1) brightness(2); }
.sidebar-brand-name {
  font-size: 16px; font-weight: 800; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-brand-role {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-muted);
}

.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.sidebar-section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted);
  padding: 8px 10px 4px;
  margin-top: 4px;
}
.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all 0.15s; margin-bottom: 2px;
  position: relative;
}
.sidebar-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-item.active {
  background: var(--primary-bg);
  color: var(--primary-light);
  font-weight: 600;
}
.sidebar-item.active::before {
  content: ''; position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 3px; background: var(--primary); border-radius: 0 3px 3px 0;
}
.sidebar-item-icon { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0; }
.sidebar-item-badge {
  margin-left: auto; background: var(--red);
  color: white; font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: var(--radius-full); min-width: 18px; text-align: center;
}
.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--radius-md);
  cursor: pointer; transition: all 0.15s;
}
.user-card:hover { background: var(--bg-hover); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white;
  flex-shrink: 0; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-card-info { flex: 1; min-width: 0; }
.user-card-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card-role { font-size: 11px; color: var(--text-muted); }

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1; min-height: 100vh;
  display: flex; flex-direction: column;
}

/* Top Header */
.top-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 12px;
}
.top-header-title { font-size: 18px; font-weight: 700; flex: 1; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.btn-icon {
  width: 36px; height: 36px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: transparent;
  color: var(--text-secondary); display: flex; align-items: center;
  justify-content: center; transition: all 0.15s; position: relative;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-strong); }
.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px; background: var(--red);
  border-radius: 50%; border: 2px solid var(--bg-surface);
}
.hamburger-btn {
  display: none; width: 36px; height: 36px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: transparent; color: var(--text-secondary);
  align-items: center; justify-content: center; flex-direction: column; gap: 4px;
}
.hamburger-btn span { width: 16px; height: 2px; background: currentColor; border-radius: 1px; display: block; }

/* Page Content */
.page-content { flex: 1; padding: 24px; max-width: 1400px; width: 100%; }

/* Overlay for mobile sidebar */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 150; backdrop-filter: blur(4px);
}
.sidebar-overlay.open { display: block; }

/* ============ MOBILE RESPONSIVE ============ */
@media (max-width: 768px) {
  :root { --sidebar-width: 280px; }

  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }

  .main-content { margin-left: 0; }

  .hamburger-btn { display: flex; }

  .page-content { padding: 16px; }

  .top-header { padding: 0 16px; }
}

@media (max-width: 480px) {
  .page-content { padding: 12px; }
  .top-header-title { font-size: 16px; }
}

/* ============ LOGIN PAGE ============ */
.login-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #0d1117 0%, #1a1a2e 50%, #0f1729 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  position: relative; overflow: hidden;
}
.login-bg::before {
  content: ''; position: absolute; top: -30%; left: -20%;
  width: 600px; height: 600px; border-radius: 50%;
  background: radial-gradient(circle, rgba(26,86,219,0.12) 0%, transparent 70%);
}
.login-bg::after {
  content: ''; position: absolute; bottom: -20%; right: -10%;
  width: 500px; height: 500px; border-radius: 50%;
  background: radial-gradient(circle, rgba(220,38,38,0.08) 0%, transparent 70%);
}
[data-theme="light"] .login-bg {
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 50%, #f0f9ff 100%);
}
.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg);
  position: relative; z-index: 1;
  animation: slideUp 0.5s ease;
}
.login-logo {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 28px;
}
.login-logo-icon {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, #1a56db, #dc2626);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: white; font-weight: 900;
  overflow: hidden;
}
.login-logo-icon img { width: 100%; height: 100%; object-fit: contain; }
.login-title { font-size: 22px; font-weight: 800; color: var(--text-primary); }
.login-subtitle { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.login-back {
  font-size: 12px; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 20px; cursor: pointer;
  transition: color 0.15s;
}
.login-back:hover { color: var(--primary-light); }

/* ============ FORMS ============ */
.form-group { margin-bottom: 16px; }
.form-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-control {
  width: 100%; padding: 11px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px; font-family: var(--font);
  transition: all 0.15s; outline: none;
  appearance: none; -webkit-appearance: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.15);
  background: var(--bg-surface);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:invalid.touched { border-color: var(--red); }
.form-error { font-size: 12px; color: var(--red-light); margin-top: 4px; display: flex; align-items: center; gap: 4px; }

.input-group { position: relative; }
.input-group .form-control { padding-right: 44px; }
.btn-eye {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: 44px; background: none; border: none;
  color: var(--text-muted); display: flex; align-items: center; justify-content: center;
  transition: color 0.15s;
}
.btn-eye:hover { color: var(--text-primary); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media(max-width:480px) { .form-row { grid-template-columns: 1fr; } }

/* Textarea */
textarea.form-control {
  resize: vertical; min-height: 100px;
}

/* Select */
select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Checkbox & Radio */
.form-check {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.15s;
  font-size: 14px;
}
.form-check:hover { border-color: var(--primary); background: var(--primary-bg); }
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 16px; height: 16px;
  accent-color: var(--primary);
  cursor: pointer; flex-shrink: 0;
}
.form-check-label { font-size: 13px; font-weight: 500; cursor: pointer; flex: 1; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 10px 18px;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
  border: none; cursor: pointer; font-family: var(--font);
  transition: all 0.15s; white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(26,86,219,0.3);
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(26,86,219,0.4); }
.btn-primary:active { transform: translateY(0); }

.btn-danger {
  background: var(--red);
  color: white;
  box-shadow: 0 4px 12px rgba(220,38,38,0.3);
}
.btn-danger:hover { background: #b91c1c; transform: translateY(-1px); }

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

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

.btn-ghost {
  background: transparent; border: none;
  color: var(--text-secondary); padding: 8px 12px;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn-lg { padding: 14px 24px; font-size: 16px; }
.btn-full { width: 100%; }

/* Login submit */
.btn-login {
  width: 100%; padding: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white; border: none; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 700; font-family: var(--font);
  cursor: pointer; transition: all 0.2s;
  box-shadow: 0 8px 24px rgba(26,86,219,0.35);
  margin-top: 8px;
}
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(26,86,219,0.45); }
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Mobile large buttons (Uber-style) */
@media(max-width:768px) {
  .btn-lg-mobile {
    padding: 16px 20px !important;
    font-size: 16px !important;
    border-radius: var(--radius-md) !important;
  }
}

/* ============ RECDAPTCHA ============ */
.recaptcha-box {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px; margin-bottom: 16px;
  cursor: pointer; transition: all 0.15s;
  user-select: none;
}
.recaptcha-box:hover { border-color: var(--border-strong); }
.recaptcha-box.verified { border-color: var(--green); background: var(--green-bg); }
.recaptcha-check {
  width: 24px; height: 24px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.recaptcha-square {
  width: 24px; height: 24px; border: 2px solid var(--border-strong);
  border-radius: 4px; transition: all 0.15s;
}
.recaptcha-text { flex: 1; font-size: 14px; font-weight: 500; color: var(--text-secondary); }
.recaptcha-logo {
  width: 40px; display: flex; flex-direction: column; align-items: center; gap: 2px;
}

/* ============ ALERT ============ */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 13px; display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 12px;
}
.alert-info { background: var(--primary-bg); border: 1px solid var(--primary-border); color: var(--primary-light); }
.alert-danger { background: var(--red-bg); border: 1px solid var(--red-border); color: #f87171; }
.alert-success { background: var(--green-bg); border: 1px solid rgba(22,163,74,0.3); color: #4ade80; }
.alert-warning { background: var(--yellow-bg); border: 1px solid rgba(245,158,11,0.3); color: #fbbf24; }
[data-theme="light"] .alert-info { color: var(--primary-dark); }
[data-theme="light"] .alert-danger { color: var(--red); }
[data-theme="light"] .alert-success { color: var(--green); }
[data-theme="light"] .alert-warning { color: #92400e; }

/* ============ CARDS ============ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.card-title { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}

/* Stat Cards */
.stats-grid {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all 0.2s;
}
.stat-card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.stat-card-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.stat-card-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 16px; }
.stat-card-value { font-size: 28px; font-weight: 800; line-height: 1; letter-spacing: -0.02em; margin-bottom: 6px; }
.stat-card-trend { font-size: 12px; color: var(--text-muted); }
.stat-card-trend .up { color: var(--green-light); }
.stat-card-trend .down { color: var(--red-light); }

@media(max-width:1024px) { .stats-grid { grid-template-columns: repeat(2,1fr); } }
@media(max-width:480px) { .stats-grid { grid-template-columns: repeat(2,1fr); gap: 12px; } }

/* ============ TABLES ============ */
.table-container { overflow-x: auto; }
table {
  width: 100%; border-collapse: collapse;
  font-size: 14px;
}
thead th {
  text-align: left; padding: 10px 14px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }
tbody td { padding: 12px 14px; vertical-align: middle; }

/* ============ BADGES ============ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.badge-ativa { background: var(--red-bg); color: #f87171; border: 1px solid var(--red-border); }
.badge-aprovada { background: var(--yellow-bg); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.badge-confirmada { background: var(--primary-bg); color: var(--primary-light); border: 1px solid var(--primary-border); }
.badge-rascunho { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border); }
.badge-leve { background: var(--green-bg); color: #4ade80; border: 1px solid rgba(22,163,74,0.3); }
.badge-media { background: var(--yellow-bg); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.badge-grave { background: var(--red-bg); color: #f87171; border: 1px solid var(--red-border); }
.badge-adm { background: var(--purple-bg); color: #a78bfa; border: 1px solid rgba(124,58,237,0.3); }
.badge-lider { background: rgba(14,165,233,0.1); color: #38bdf8; border: 1px solid rgba(14,165,233,0.3); }
.badge-cco { background: var(--primary-bg); color: var(--primary-light); border: 1px solid var(--primary-border); }
.badge-motorista { background: var(--green-bg); color: #4ade80; border: 1px solid rgba(22,163,74,0.3); }

[data-theme="light"] .badge-ativa { color: var(--red); }
[data-theme="light"] .badge-aprovada { color: #92400e; }
[data-theme="light"] .badge-confirmada { color: var(--primary-dark); }
[data-theme="light"] .badge-leve { color: var(--green); }
[data-theme="light"] .badge-media { color: #92400e; }
[data-theme="light"] .badge-grave { color: var(--red); }

/* ============ CHARTS ============ */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.chart-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.chart-card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.chart-card-title { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.chart-card-body { padding: 16px; }
.chart-wrapper { position: relative; height: 220px; }
@media(max-width:768px) { .charts-grid { grid-template-columns: 1fr; } }

/* ============ DAMAGE MAP ============ */
.damage-map-container {
  position: relative;
  border-radius: var(--radius-md); overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  cursor: crosshair;
}
.damage-map-container.locked { cursor: default; }
.damage-map-img { width: 100%; display: block; }
.damage-marker {
  position: absolute; transform: translate(-50%,-50%);
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2.5px solid white;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 900; color: white;
  cursor: pointer; z-index: 10;
  transition: transform 0.15s;
  box-shadow: var(--shadow-sm);
}
.damage-marker:hover { transform: translate(-50%,-50%) scale(1.2); z-index: 11; }
.damage-marker.ativa {
  background: var(--red);
  animation: ping 2s ease-in-out infinite;
}
.damage-marker.resolvida {
  background: var(--primary);
  animation: pingBlue 2s ease-in-out infinite;
}

/* Fullscreen map */
.map-fullscreen {
  position: fixed; inset: 0; z-index: 9990;
  background: rgba(0,0,0,0.95);
  display: flex; flex-direction: column;
  animation: fadeIn 0.2s ease;
}
.map-fullscreen-header {
  padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.map-fullscreen-title { color: white; font-size: 16px; font-weight: 700; }
.map-fullscreen-body {
  flex: 1; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.map-fullscreen-inner {
  position: relative; max-width: 900px; width: 100%;
  touch-action: none;
}
.map-fullscreen-img { width: 100%; border-radius: var(--radius-md); display: block; }
.map-fullscreen-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.map-legend { display: flex; gap: 16px; }
.map-legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: rgba(255,255,255,0.6); }
.map-legend-dot { width: 10px; height: 10px; border-radius: 50%; }

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 9995;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%; max-width: 460px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}
.modal-lg { max-width: 600px; }
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: var(--bg-surface); z-index: 1;
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: transparent; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px; transition: all 0.15s;
}
.modal-close:hover { background: var(--red-bg); color: var(--red-light); border-color: var(--red-border); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
  position: sticky; bottom: 0; background: var(--bg-surface); z-index: 1;
}

/* Marker type selector */
.type-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; }
.type-option {
  padding: 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; text-align: center;
  transition: all 0.15s; background: var(--bg-elevated);
}
.type-option:hover { border-color: var(--primary); background: var(--primary-bg); }
.type-option.selected { border-color: var(--primary); background: var(--primary-bg); color: var(--primary-light); font-weight: 600; }
.type-option-icon { font-size: 24px; margin-bottom: 6px; }
.type-option-label { font-size: 12px; font-weight: 600; }

/* ============ UPLOAD MEDIA ============ */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer; transition: all 0.2s;
  background: var(--bg-elevated);
  position: relative;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-bg);
}
.upload-zone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}
.upload-icon { font-size: 36px; margin-bottom: 12px; }
.upload-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.upload-sub { font-size: 13px; color: var(--text-muted); }
.upload-hint { font-size: 11px; color: var(--text-muted); margin-top: 8px; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px,1fr)); gap: 10px; margin-top: 14px; }
.media-item {
  position: relative; border-radius: var(--radius-sm); overflow: hidden;
  background: var(--bg-elevated); border: 1px solid var(--border);
  aspect-ratio: 1;
}
.media-item img, .media-item video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.media-item-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.media-item:hover .media-item-overlay { background: rgba(0,0,0,0.6); }
.media-item-del {
  width: 28px; height: 28px; background: var(--red);
  border-radius: 50%; color: white; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; transition: opacity 0.15s;
  border: none;
}
.media-item:hover .media-item-del { opacity: 1; }
.media-item-name {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.7); padding: 4px 6px;
  font-size: 9px; color: white; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.media-progress {
  height: 4px; background: var(--bg-elevated);
  border-radius: 2px; overflow: hidden; margin-top: 4px;
}
.media-progress-bar {
  height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 2px; transition: width 0.3s ease;
}
.media-type-icon {
  position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px; background: rgba(0,0,0,0.7);
  border-radius: 4px; display: flex; align-items: center; justify-content: center;
  font-size: 11px;
}

/* ============ NOTIFICATIONS ============ */
.notif-panel {
  position: fixed; top: var(--header-height); right: 0;
  width: 340px; max-height: calc(100vh - var(--header-height));
  background: var(--bg-surface); border: 1px solid var(--border);
  border-top: none; border-right: none;
  box-shadow: var(--shadow-lg);
  overflow-y: auto; z-index: 300;
  animation: slideIn 0.2s ease;
}
.notif-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: var(--bg-surface);
}
.notif-title { font-size: 15px; font-weight: 700; }
.notif-item {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.1s;
  display: flex; gap: 12px; align-items: flex-start;
}
.notif-item:hover { background: var(--bg-hover); }
.notif-item.unread { background: var(--primary-bg); }
.notif-item.unread:hover { background: rgba(26,86,219,0.15); }
.notif-dot-indicator {
  width: 8px; height: 8px; border-radius: 50%; background: var(--primary);
  margin-top: 5px; flex-shrink: 0;
}
.notif-content { flex: 1; }
.notif-msg { font-size: 13px; line-height: 1.5; margin-bottom: 3px; }
.notif-time { font-size: 11px; color: var(--text-muted); }

/* ============ CHECKLIST ============ */
.checklist { display: flex; flex-direction: column; gap: 8px; }
.checklist-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  gap: 12px;
}
.checklist-item-label { font-size: 13px; font-weight: 500; flex: 1; }
.toggle-group { display: flex; gap: 4px; }
.toggle-btn {
  padding: 5px 12px; font-size: 12px; font-weight: 600;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: transparent; color: var(--text-muted); cursor: pointer;
  transition: all 0.15s;
}
.toggle-btn.active-sim { background: var(--green-bg); color: #4ade80; border-color: rgba(22,163,74,0.4); }
.toggle-btn.active-nao { background: var(--red-bg); color: #f87171; border-color: var(--red-border); }
[data-theme="light"] .toggle-btn.active-sim { color: var(--green); }
[data-theme="light"] .toggle-btn.active-nao { color: var(--red); }

/* ============ PROFILE / ADM ============ */
.profile-avatar-upload {
  position: relative; width: 80px; height: 80px; cursor: pointer;
}
.profile-avatar-upload .avatar { width: 80px; height: 80px; font-size: 24px; border-radius: 50%; }
.profile-avatar-overlay {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.2s; color: white; font-size: 18px;
}
.profile-avatar-upload:hover .profile-avatar-overlay { opacity: 1; }
.profile-avatar-upload input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; border-radius: 50%;
}

/* ============ PAGINATION ============ */
.pagination { display: flex; align-items: center; gap: 4px; }
.page-btn {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: transparent;
  color: var(--text-secondary); font-size: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.page-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============ FILTERS ============ */
.filters-bar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 16px;
}
.filter-select {
  padding: 8px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-elevated);
  color: var(--text-secondary); font-size: 13px; font-family: var(--font);
  cursor: pointer; outline: none;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
  padding-right: 28px;
}
.filter-select:focus { border-color: var(--primary); color: var(--text-primary); }
.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px;
  flex: 1; min-width: 180px;
}
.search-bar input {
  flex: 1; background: none; border: none; outline: none;
  font-size: 13px; color: var(--text-primary); font-family: var(--font);
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-bar:focus-within { border-color: var(--primary); }

/* ============ EMPTY STATE ============ */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state-title { font-size: 16px; font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state-desc { font-size: 14px; }

/* ============ APPROVAL FLOW ============ */
.flow-steps {
  display: flex; align-items: center; gap: 0;
  overflow-x: auto; padding-bottom: 4px;
}
.flow-step {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-width: 100px; position: relative;
}
.flow-step:not(:last-child)::after {
  content: ''; position: absolute; top: 16px; left: 50%; width: 100%;
  height: 2px; background: var(--border);
}
.flow-step.done:not(:last-child)::after { background: var(--primary); }
.flow-step-circle {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; z-index: 1;
  border: 2px solid var(--border); background: var(--bg-elevated);
  color: var(--text-muted);
}
.flow-step.done .flow-step-circle {
  background: var(--primary); border-color: var(--primary); color: white;
}
.flow-step.current .flow-step-circle {
  background: var(--yellow); border-color: var(--yellow); color: white;
  animation: pulse 2s infinite;
}
.flow-step-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-align: center; }
.flow-step.done .flow-step-label, .flow-step.current .flow-step-label { color: var(--text-secondary); }

/* ============ VEHICLE CARDS ============ */
.vehicle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 16px; }
.vehicle-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  transition: all 0.2s; cursor: pointer;
}
.vehicle-card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.vehicle-card-header { padding: 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.vehicle-number { width: 44px; height: 44px; border-radius: var(--radius-sm); background: var(--primary-bg); color: var(--primary-light); font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.vehicle-card-body { padding: 16px; }
.vehicle-info-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.vehicle-info-label { color: var(--text-muted); }
.vehicle-info-val { font-weight: 600; }

/* ============ SCROLL STYLE ============ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============ RESPONSIVE TABLES ============ */
@media(max-width:640px) {
  .hide-mobile { display: none !important; }
  .table-mobile-card tbody tr {
    display: block; padding: 12px; border-bottom: 1px solid var(--border);
    border-radius: 0;
  }
  .table-mobile-card tbody td {
    display: flex; justify-content: space-between; align-items: center;
    padding: 4px 0; font-size: 13px;
  }
  .table-mobile-card tbody td::before {
    content: attr(data-label);
    font-weight: 600; color: var(--text-muted); font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.05em;
  }
  .table-mobile-card thead { display: none; }
}

/* ============ SECTION HEADERS ============ */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 20px;
}
.section-title-main { font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.section-desc { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ============ DIVIDER ============ */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ============ INFO ROW ============ */
.info-row { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 16px; }
.info-item { }
.info-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 3px; }
.info-value { font-size: 14px; font-weight: 600; }

/* ============ TABS ============ */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab {
  padding: 10px 18px; font-size: 14px; font-weight: 600;
  color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent;
  white-space: nowrap; transition: all 0.15s;
  background: none; border-top: none; border-left: none; border-right: none;
  font-family: var(--font);
}
.tab:hover { color: var(--text-secondary); }
.tab.active { color: var(--primary-light); border-bottom-color: var(--primary); }
[data-theme="light"] .tab.active { color: var(--primary); }

/* ============ STEP PROGRESS ============ */
.step-bar {
  display: flex; gap: 0; margin-bottom: 24px; overflow-x: auto;
}
.step-bar-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  position: relative; min-width: 80px;
}
.step-bar-item:not(:last-child)::after {
  content: ''; position: absolute; top: 14px; left: 50%; width: 100%;
  height: 2px; background: var(--border); z-index: 0;
}
.step-bar-item.completed:not(:last-child)::after { background: var(--primary); }
.step-bar-circle {
  width: 28px; height: 28px; border-radius: 50%; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  background: var(--bg-elevated); border: 2px solid var(--border); color: var(--text-muted);
}
.step-bar-item.completed .step-bar-circle {
  background: var(--primary); border-color: var(--primary); color: white;
}
.step-bar-item.active .step-bar-circle {
  background: var(--primary-bg); border-color: var(--primary); color: var(--primary-light);
}
.step-bar-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-align: center; }
.step-bar-item.completed .step-bar-label, .step-bar-item.active .step-bar-label { color: var(--text-secondary); }

/* ============ LIGHT MODE CONTRAST FIXES ============ */
/* Ensure all text is visible in light mode */
[data-theme="light"] .sidebar-item { color: #374151; }
[data-theme="light"] .sidebar-item:hover { color: #111827; background: rgba(0,0,0,0.04); }
[data-theme="light"] .sidebar-item.active { color: var(--primary); background: var(--primary-bg); }
[data-theme="light"] .sidebar-brand-name { color: #111827; }
[data-theme="light"] .sidebar-brand-role { color: #6b7280; }
[data-theme="light"] .user-card-name { color: #111827; }
[data-theme="light"] .user-card-role { color: #6b7280; }
[data-theme="light"] .top-header { background: #ffffff; border-bottom: 1px solid rgba(0,0,0,0.08); }
[data-theme="light"] .top-header-title { color: #111827; }
[data-theme="light"] .section-title-main { color: #111827; }
[data-theme="light"] .card-title { color: #111827; }
[data-theme="light"] .modal-title { color: #111827; }
[data-theme="light"] .form-label { color: #374151; }
[data-theme="light"] .form-control { background: #ffffff; color: #111827; border-color: rgba(0,0,0,0.15); }
[data-theme="light"] .form-control:focus { border-color: var(--primary); color: #111827; }
[data-theme="light"] .form-control::placeholder { color: #94a3b8; }
[data-theme="light"] select.form-control option { background: #ffffff; color: #111827; }
[data-theme="light"] .filter-select { background: #ffffff; color: #374151; border-color: rgba(0,0,0,0.12); }
[data-theme="light"] .filter-select:focus { color: #111827; }
[data-theme="light"] .search-bar { background: #ffffff; border-color: rgba(0,0,0,0.12); }
[data-theme="light"] .search-bar input { color: #111827; }
[data-theme="light"] .btn-ghost { color: #374151; }
[data-theme="light"] .btn-ghost:hover { background: rgba(0,0,0,0.05); color: #111827; }
[data-theme="light"] .btn-outline { color: #374151; border-color: rgba(0,0,0,0.2); }
[data-theme="light"] .btn-outline:hover { background: rgba(0,0,0,0.04); color: #111827; }
[data-theme="light"] .btn-icon { color: #374151; }
[data-theme="light"] .btn-icon:hover { background: rgba(0,0,0,0.05); }
[data-theme="light"] table th { color: #374151; background: #f8fafc; }
[data-theme="light"] table td { color: #374151; }
[data-theme="light"] .checklist-item { background: #f8fafc; }
[data-theme="light"] .checklist-item-label { color: #374151; }
[data-theme="light"] .toggle-btn { color: #6b7280; border-color: rgba(0,0,0,0.15); background: #fff; }
[data-theme="light"] .type-option { background: #f8fafc; color: #374151; border-color: rgba(0,0,0,0.1); }
[data-theme="light"] .type-option-label { color: #374151; }
[data-theme="light"] .type-option:hover { background: var(--primary-bg); color: var(--primary); }
[data-theme="light"] .type-option.selected { color: var(--primary); }
[data-theme="light"] .notif-panel { background: #ffffff; }
[data-theme="light"] .notif-header { background: #ffffff; }
[data-theme="light"] .vehicle-card { background: #ffffff; }
[data-theme="light"] .empty-state-title { color: #374151; }
[data-theme="light"] .info-value { color: #111827; }
[data-theme="light"] .flow-step-label { color: #6b7280; }
[data-theme="light"] .flow-step.done .flow-step-label { color: #374151; }
[data-theme="light"] .step-bar-label { color: #6b7280; }
[data-theme="light"] .step-bar-item.active .step-bar-label { color: #374151; }

/* Landing page "Voltar ao site" and hero text in light mode */
[data-theme="light"] .hero-badge,
[data-theme="light"] .hero-title,
[data-theme="light"] .hero-subtitle,
[data-theme="light"] .hero-cta,
[data-theme="light"] .nav-links a,
[data-theme="light"] .landing-nav a { color: inherit; }

/* ============ RESPONSIVE GRID UTILITIES ============ */
.responsive-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media(max-width:768px) {
  .responsive-grid-2 { grid-template-columns: 1fr; }
}

/* ============ MOBILE IMPROVEMENTS ============ */
@media(max-width:768px) {
  /* Main content area */
  .main-content { padding-top: 0; }
  .page-content { padding: 12px; }

  /* Header */
  .top-header { padding: 0 12px; height: 56px; }
  .top-header-title { font-size: 16px; }
  #sessionTimer { display: none; } /* hide timer on mobile to save space */

  /* Sidebar */
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4);
    z-index: 199; display: none;
  }
  .sidebar-overlay.open { display: block; }
  #hamburgerBtn { display: flex !important; }

  /* Cards: full width */
  .card { border-radius: var(--radius-md); }
  .card-body { padding: 14px; }
  .card-header { padding: 12px 14px; }

  /* Buttons */
  .btn-lg-mobile { width: 100%; justify-content: center; }

  /* Section header */
  .section-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .section-header > div:last-child { width: 100%; }
  .section-header > div:last-child .btn { width: 100%; justify-content: center; }

  /* Forms */
  .form-row { flex-direction: column; gap: 0; }

  /* Filters */
  .filters-bar { flex-direction: column; }
  .filters-bar .search-bar,
  .filters-bar .filter-select { width: 100%; min-width: unset; }

  /* Flow steps */
  .flow-steps { gap: 2px; }
  .flow-step { min-width: 70px; }
  .flow-step-label { font-size: 10px; }

  /* Modal */
  .modal { border-radius: var(--radius-lg); max-height: 95vh; margin: 0 8px; }
  .modal-overlay { padding: 10px; align-items: flex-end; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 16px; }

  /* Avaria grid */
  .damage-map-container { max-width: 100%; }

  /* Stats grid */
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  @media(max-width:420px) {
    .stats-grid { grid-template-columns: 1fr; }
  }

  /* Notifications panel */
  .notif-panel { width: 100%; left: 0; right: 0; border-left: none; }

  /* Nova avaria step 2: map + list stacked */
  #step2 .card-body > div[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

@media(max-width:480px) {
  .top-header-title { font-size: 14px; }
  .page-content { padding: 10px; }
  .card-body { padding: 12px; }
}

/* ============ BADGE EXTRAS ============ */
.badge-encaminhada {
  background: rgba(249,115,22,0.15);
  color: #fb923c;
  border: 1px solid rgba(249,115,22,0.3);
}
.badge-resolvida {
  background: rgba(22,163,74,0.15);
  color: #4ade80;
  border: 1px solid rgba(22,163,74,0.3);
}
[data-theme="light"] .badge-encaminhada { color: #ea580c; }
[data-theme="light"] .badge-resolvida { color: var(--green); }

/* btn-warning */
.btn-warning {
  background: var(--yellow); color: #fff;
  border: 1px solid var(--yellow); font-weight: 600;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; transition: all .15s;
}
.btn-warning:hover { background: #d97706; border-color: #d97706; }
.btn-warning.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ADM_GERAL / ADM_EMPRESA badge colors */
.badge-adm_geral { background: rgba(124,58,237,0.15); color: #a78bfa; border: 1px solid rgba(124,58,237,0.3); }
.badge-adm_empresa { background: rgba(14,165,233,0.15); color: #38bdf8; border: 1px solid rgba(14,165,233,0.3); }
[data-theme="light"] .badge-adm_geral { color: #7c3aed; }
[data-theme="light"] .badge-adm_empresa { color: #0369a1; }

/* ============ LOGIN BACK BUTTON (both modes) ============ */
.login-back-btn {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.10); border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px; padding: 7px 12px; font-size: 12px; font-weight: 600;
  color: rgba(255,255,255,0.85); text-decoration: none; transition: all .15s;
}
.login-back-btn:hover { color: #fff; background: rgba(255,255,255,0.18); }
[data-theme="light"] .login-back-btn {
  background: rgba(255,255,255,0.75); border: 1px solid rgba(0,0,0,0.15);
  color: #374151;
}
[data-theme="light"] .login-back-btn:hover { color: #111827; background: rgba(255,255,255,0.95); }

.login-theme-btn {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.10); border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px; cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center; transition: all .15s;
  color: white;
}
.login-theme-btn:hover { background: rgba(255,255,255,0.18); }
[data-theme="light"] .login-theme-btn {
  background: rgba(255,255,255,0.75); border: 1px solid rgba(0,0,0,0.15);
}

/* ============ MEDIA GRID ============ */
.midia-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.midia-item {
  border-radius: var(--radius-md); overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}
.midia-thumb {
  aspect-ratio: 4/3; position: relative;
  overflow: hidden; cursor: pointer; background: var(--bg-elevated);
}
.midia-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.midia-thumb:hover img { transform: scale(1.04); }
.video-thumb { cursor: default; }
.video-thumb video { width: 100%; height: 100%; object-fit: cover; }
.midia-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.7));
  color: #fff; font-size: 10px; padding: 16px 6px 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.midia-actions {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 8px; background: var(--bg-elevated);
  border-top: 1px solid var(--border);
}
.btn-xs {
  padding: 3px 8px; font-size: 11px; border-radius: 5px;
  display: inline-flex; align-items: center; gap: 4px;
}

/* ============ PROFILE RESPONSIVE GRID ============ */
.responsive-grid-perfil { display: grid; grid-template-columns: 300px 1fr; gap: 20px; }
@media(max-width: 768px) {
  .responsive-grid-perfil { grid-template-columns: 1fr; }
}

/* ============ ENHANCED MOBILE (additional) ============ */
@media(max-width: 768px) {
  /* Login page */
  .login-card { padding: 24px 18px !important; margin: 0 8px; }
  .login-logo { gap: 12px; }
  .login-logo-icon { width: 48px !important; height: 48px !important; }
  .login-title { font-size: 18px !important; }
  .login-subtitle { font-size: 12px !important; }

  /* Empresa badge in header - hide on very small */
  .hide-mobile { display: none !important; }

  /* Avaria detail sections stack */
  .responsive-grid-2 { grid-template-columns: 1fr !important; }

  /* Media grid smaller on mobile */
  .midia-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }

  /* Action buttons wrap */
  .btn-group-mobile { flex-wrap: wrap; }

  /* Section header on mobile */
  .section-header { gap: 8px; }
  .section-title-main { font-size: 18px; }

  /* Notification panel full width */
  .notif-panel { width: calc(100vw - 24px) !important; right: 12px !important; left: 12px !important; }

  /* Filters better spacing */
  .filters-bar { gap: 8px; }
}

@media(max-width: 420px) {
  .midia-grid { grid-template-columns: repeat(2, 1fr); }
  .section-title-main { font-size: 16px; }
  .btn { font-size: 12px; padding: 7px 12px; }
  .btn-sm { padding: 5px 10px; font-size: 11px; }
}

/* ============ BTN EXTRAS ============ */
.btn-success {
  background: var(--green); color: #fff;
  border: 1px solid var(--green); font-weight: 600;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; transition: all .15s;
}
.btn-success:hover { background: #15803d; border-color: #15803d; }
.btn-success.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-danger {
  background: var(--red); color: #fff;
  border: 1px solid var(--red); font-weight: 600;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; transition: all .15s;
}
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-danger.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ============================================================
 * FrotaTotal v4 — Extended UI: Camera, GPS, Banners, Mobile
 * ============================================================ */

/* ---- Top Message Banners (green/yellow/red) ---- */
.top-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 99997;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; font-size: 13px; font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,.15);
  animation: slideDown .3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes slideDown { from { transform: translateY(-100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.top-banner.banner-success { background: #16a34a; color: #fff; }
.top-banner.banner-warning { background: #d97706; color: #fff; }
.top-banner.banner-error   { background: #dc2626; color: #fff; }
.top-banner.banner-info    { background: #1a56db; color: #fff; }
.top-banner-close { background: none; border: none; color: inherit; cursor: pointer; font-size: 18px; line-height: 1; opacity: .8; }
.top-banner-close:hover { opacity: 1; }

/* ---- Camera Capture Buttons ---- */
.media-capture-row {
  display: flex; gap: 10px; margin: 12px 0; flex-wrap: wrap;
}
.btn-capture {
  flex: 1; min-width: 130px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 16px; background: var(--bg-elevated);
  border: 1px dashed var(--border); border-radius: var(--radius-md);
  cursor: pointer; font-size: 14px; font-weight: 600;
  color: var(--text-secondary); transition: all .15s;
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.btn-capture:hover, .btn-capture:active {
  border-color: var(--primary); color: var(--primary);
  background: var(--primary-bg); transform: scale(.98);
}
.btn-capture input[type="file"] { display: none; }
.btn-capture-icon { font-size: 22px; }

/* ---- GPS indicator ---- */
.gps-indicator {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 600;
}
.gps-indicator.gps-ok    { background: var(--green-bg); color: var(--green-light); border: 1px solid rgba(22,163,74,.3); }
.gps-indicator.gps-error { background: var(--red-bg);   color: var(--red-light);   border: 1px solid var(--red-border); }
.gps-indicator.gps-wait  { background: var(--primary-bg); color: var(--primary-light); border: 1px solid var(--primary-border); }
.gps-dot { width: 8px; height: 8px; border-radius: 50%; animation: gpsPulse 1.2s infinite; }
.gps-dot.ok    { background: var(--green-light); }
.gps-dot.error { background: var(--red-light); animation: none; }
@keyframes gpsPulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .5; transform: scale(.8); } }

/* ---- Map Modal (GPS/address selection) ---- */
.map-select-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.75);
  z-index: 10000; display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.map-select-box {
  background: var(--bg-surface); border-radius: var(--radius-xl);
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  border: 1px solid var(--border); box-shadow: 0 24px 80px rgba(0,0,0,.4);
}
.map-select-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.map-select-body { padding: 16px 20px; }
.map-preview-iframe {
  width: 100%; height: 250px; border: none;
  border-radius: var(--radius-md); margin-top: 12px;
  background: var(--bg-elevated);
}

/* ---- Media item improvements ---- */
.media-item {
  position: relative; border-radius: var(--radius-md);
  overflow: hidden; background: var(--bg-elevated);
  border: 1px solid var(--border); aspect-ratio: 1;
}
.media-item img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: pointer; }
.media-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-item-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0);
  transition: background .2s; display: flex; align-items: flex-start; justify-content: flex-end; padding: 6px;
}
.media-item:hover .media-item-overlay { background: rgba(0,0,0,.35); }
.media-item-del {
  background: rgba(220,38,38,.9); color: #fff; border: none;
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
  font-size: 13px; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .2s;
}
.media-item:hover .media-item-del { opacity: 1; }
.media-item-name {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,.6); color: #fff; font-size: 10px;
  padding: 4px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.media-type-icon {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  font-size: 28px; pointer-events: none;
}
.media-progress { position: absolute; bottom: 22px; left: 0; right: 0; height: 3px; background: rgba(255,255,255,.2); }
.media-progress-bar { height: 100%; background: var(--primary-light); transition: width .1s; }

/* ---- Mobile upload zone ---- */
@media (max-width: 768px) {
  .upload-zone { padding: 20px 12px; }
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(90px,1fr)); gap: 8px; }
  .media-capture-row { gap: 8px; }
  .btn-capture { min-width: 110px; padding: 12px 10px; font-size: 13px; }
}

/* ---- Damage Map — Responsive ---- */
@media (max-width: 640px) {
  .damage-map-step-grid { grid-template-columns: 1fr !important; }
  .damage-map-container { min-height: 180px; }
  .map-fullscreen-header { flex-direction: column; gap: 8px; padding: 10px 12px; }
  .map-fullscreen-footer { flex-direction: column; gap: 8px; padding: 10px 12px; }
}

/* ---- Modern Loading Indicator ---- */
.ft-loader {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.ft-loader-ring {
  width: 48px; height: 48px; border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--primary); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Avaria status: all values ---- */
.badge-ativa     { background: rgba(220,38,38,.15); color: #f87171; border: 1px solid rgba(220,38,38,.3); }
.badge-rascunho  { background: rgba(107,114,128,.15); color: #9ca3af; border: 1px solid rgba(107,114,128,.3); }
.badge-aprovada  { background: rgba(245,158,11,.15); color: #fbbf24; border: 1px solid rgba(245,158,11,.3); }
.badge-confirmada{ background: rgba(37,99,235,.15); color: #60a5fa; border: 1px solid rgba(37,99,235,.3); }
[data-theme="light"] .badge-ativa      { color: #dc2626; }
[data-theme="light"] .badge-aprovada   { color: #d97706; }
[data-theme="light"] .badge-confirmada { color: #1d4ed8; }
[data-theme="light"] .badge-rascunho   { color: #6b7280; }

/* ---- Relatorio cards ---- */
.relatorio-card {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 14px 16px;
  margin-bottom: 10px;
}
.relatorio-card-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-muted); margin-bottom: 8px;
}
.relatorio-stat {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--border);
}
.relatorio-stat:last-child { border-bottom: none; }
.relatorio-stat-label { color: var(--text-secondary); }
.relatorio-stat-value { font-weight: 700; color: var(--text-primary); }

/* ---- Vehicle list (all roles) ---- */
.vehicle-list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  margin-bottom: 8px; transition: border-color .15s;
}
.vehicle-list-item:hover { border-color: var(--primary-border); }
.vehicle-list-icon {
  width: 44px; height: 44px; border-radius: var(--radius-md);
  background: var(--primary-bg); display: flex; align-items: center;
  justify-content: center; font-size: 22px; flex-shrink: 0;
}
.vehicle-list-info { flex: 1; min-width: 0; }
.vehicle-list-numero { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.vehicle-list-detail { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.vehicle-list-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600; flex-shrink: 0;
}

/* ---- Full mobile responsive improvements ---- */
@media (max-width: 768px) {
  /* Step bar mobile */
  .step-bar { gap: 4px; }
  .step-bar-item { min-width: 60px; }
  .step-bar-label { font-size: 9px; }
  .step-bar-circle { width: 24px; height: 24px; font-size: 11px; }

  /* Form improvements */
  .form-row { grid-template-columns: 1fr; gap: 8px; }
  .form-check { font-size: 13px; }

  /* Card header on mobile */
  .card-header { flex-wrap: wrap; gap: 8px; }
  .card-title { font-size: 13px; }

  /* Section header */
  .section-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .section-title-main { font-size: 16px; }

  /* Table improvements */
  table { font-size: 12px; }
  th, td { padding: 8px 10px; }

  /* Buttons */
  .btn { font-size: 13px; padding: 9px 14px; }
  .btn-lg-mobile { width: 100%; padding: 14px; font-size: 15px; font-weight: 700; border-radius: 10px; }

  /* Filters bar */
  .filters-bar { flex-direction: column; gap: 8px; }
  .filters-bar .search-bar { width: 100%; }
  .filters-bar .filter-select { width: 100%; }
  .filters-bar input[type="date"] { width: 100%; }

  /* Modal */
  .modal { margin: 0 8px; max-height: 92vh; }
  .modal-body { padding: 14px 16px; }

  /* Avaria detalhe */
  .info-row { flex-direction: column; gap: 8px; }
  .info-item { flex: 1 1 100%; }

  /* Dashboard stats */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  /* Hamburger visible */
  #hamburgerBtn { display: flex !important; }

  /* Notification panel full width */
  .notif-panel { left: 0 !important; right: 0 !important; width: 100% !important; border-radius: 0 !important; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .top-header { padding: 0 12px; }
  .page-content { padding: 12px; }
  .card-body { padding: 12px; }
  .btn { font-size: 12px; padding: 8px 12px; }
  .section-title-main { font-size: 15px; }

  /* Vehicle cards */
  .vehicle-grid { grid-template-columns: 1fr; }

  /* Avaria list */
  .hide-mobile { display: none !important; }
}

/* ---- Smooth page transitions ---- */
.animate-slide-up {
  animation: slideUp .25s cubic-bezier(.4,0,.2,1) both;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Active/focus improvements for mobile ---- */
@media (hover: none) {
  .btn:hover { transform: none; }
  .sidebar-item:hover { background: transparent; }
}

/* ---- Permission info banner ---- */
.perm-info-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-md); margin-bottom: 14px;
  font-size: 13px; font-weight: 500;
}
.perm-info-banner.info   { background: var(--primary-bg); color: var(--primary-light); border: 1px solid var(--primary-border); }
.perm-info-banner.warning{ background: rgba(245,158,11,.1); color: #fbbf24; border: 1px solid rgba(245,158,11,.3); }
.perm-info-banner.danger { background: var(--red-bg); color: var(--red-light); border: 1px solid var(--red-border); }
[data-theme="light"] .perm-info-banner.info    { color: var(--primary); }
[data-theme="light"] .perm-info-banner.warning { color: #d97706; }
[data-theme="light"] .perm-info-banner.danger  { color: var(--red); }

/* ---- All-drivers avaria view ---- */
.motorista-view-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: var(--radius-full);
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  background: rgba(22,163,74,.1); color: #4ade80;
  border: 1px solid rgba(22,163,74,.2);
}
[data-theme="light"] .motorista-view-badge { color: #16a34a; }

/* ---- Damage map in avaria detail responsive ---- */
.damage-map-detail { max-width: 100%; overflow: hidden; }
.damage-map-detail img { max-width: 100%; height: auto; }

/* ---- Hidden admin link ---- */
.hidden-admin-link {
  position: fixed; bottom: 8px; right: 8px; opacity: 0;
  font-size: 8px; color: transparent; cursor: default;
  user-select: none; z-index: 1;
}
.hidden-admin-link:hover { opacity: 0.01; }

/* ---- Fix: logo in light mode ---- */
[data-theme="light"] .loading-logo img { filter: none; }
[data-theme="light"] .sidebar-logo img { filter: none; }

/* ---- Performance: will-change for animations ---- */
.sidebar { will-change: transform; }
.modal-overlay { will-change: opacity; }
.at-toast { will-change: transform, opacity; }

