/* =============================================================
   CREC SAFE LIST — Design System
   Tema: Corporativo Industrial Dark
   Cores base: Azul CREC (#003087) + Branco + Dark Navy
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

/* ── TOKENS ─────────────────────────────────────────────── */
:root {
  /* Brand */
  --crec-blue:        #003087;
  --crec-blue-mid:    #0a4db5;
  --crec-blue-light:  #1a6fe8;
  --crec-cyan:        #0ea5e9;

  /* Backgrounds */
  --bg-base:          #06090f;
  --bg-surface:       #0d1422;
  --bg-card:          #111827;
  --bg-elevated:      #1a2436;
  --bg-hover:         #1f2d44;
  --bg-input:         #0f1a2e;

  /* Borders */
  --border:           rgba(255,255,255,0.07);
  --border-strong:    rgba(255,255,255,0.14);
  --border-blue:      rgba(10,77,181,0.5);

  /* Text */
  --text-primary:     #f0f4ff;
  --text-secondary:   #8da0be;
  --text-muted:       #4a607d;

  /* Status */
  --green:            #10b981;
  --green-bg:         rgba(16,185,129,0.1);
  --red:              #ef4444;
  --red-bg:           rgba(239,68,68,0.1);
  --yellow:           #f59e0b;
  --yellow-bg:        rgba(245,158,11,0.1);
  --critical:         #ff3b3b;
  --critical-bg:      rgba(255,59,59,0.12);

  /* Sizes */
  --sidebar-w:        260px;
  --header-h:         64px;
  --radius-sm:        8px;
  --radius-md:        12px;
  --radius-lg:        18px;
  --radius-xl:        24px;

  /* Fonts */
  --font-body:        'DM Sans', sans-serif;
  --font-display:     'Space Grotesk', sans-serif;

  /* Shadows */
  --shadow-sm:        0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:        0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:        0 12px 40px rgba(0,0,0,0.6);
  --shadow-blue:      0 4px 24px rgba(10,77,181,0.3);
  --shadow-glow:      0 0 0 3px rgba(10,77,181,0.25);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; }

/* ── SCROLLBAR ───────────────────────────────────────────── */
::-webkit-scrollbar          { width: 6px; height: 6px; }
::-webkit-scrollbar-track    { background: transparent; }
::-webkit-scrollbar-thumb    { background: var(--bg-elevated); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ── APP SHELL ───────────────────────────────────────────── */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── SIDEBAR ─────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  transition: transform 0.25s ease;
  z-index: 200;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border);
}

.sidebar__logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 8px;
}

.sidebar__brand-text {
  display: flex;
  flex-direction: column;
}

.sidebar__brand-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.sidebar__brand-sub {
  font-size: 0.65rem;
  color: var(--crec-cyan);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar__nav {
  padding: 12px 10px;
  flex: 1;
}

.sidebar__section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 16px 12px 6px;
}

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

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

.nav-item.active {
  background: rgba(10,77,181,0.2);
  color: var(--crec-blue-light);
  border-left: 3px solid var(--crec-blue-light);
}

.nav-item__icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar__footer {
  padding: 14px;
  border-top: 1px solid var(--border);
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
}

.sidebar__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--crec-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.sidebar__user-info { flex: 1; overflow: hidden; }

.sidebar__user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__user-role {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-logout {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  font-size: 1rem;
  transition: color 0.15s;
}
.btn-logout:hover { color: var(--red); }

/* ── MAIN AREA ───────────────────────────────────────────── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-base);
}

/* ── TOPBAR ──────────────────────────────────────────────── */
#topbar {
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  gap: 16px;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar__title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar__subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.date-picker-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
}

.date-picker-wrap label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input[type="date"] {
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  color-scheme: dark;
}

/* ── PAGE CONTENT ────────────────────────────────────────── */
#page-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

/* ── CARDS ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
}

.card--elevated {
  background: var(--bg-elevated);
  box-shadow: var(--shadow-md);
}

.card--blue-glow {
  border-color: var(--border-blue);
  box-shadow: var(--shadow-blue);
}

/* ── STAT CARDS ──────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}

.stat-card:hover { transform: translateY(-2px); }

.stat-card__label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.stat-card__value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
}

.stat-card__sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 6px;
}

.stat-card__accent {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.stat-card--green  { border-top: 2px solid var(--green); }
.stat-card--red    { border-top: 2px solid var(--red); }
.stat-card--yellow { border-top: 2px solid var(--yellow); }
.stat-card--blue   { border-top: 2px solid var(--crec-blue-light); }
.stat-card--critical { border-top: 2px solid var(--critical); }

/* ── CHECKLIST ───────────────────────────────────────────── */
.checklist-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: border-color 0.15s;
}

.checklist-item:hover { border-color: var(--border-strong); }

.checklist-item.is-answered { border-color: rgba(10,77,181,0.3); }

.checklist-item__badge {
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--red);
  background: var(--red-bg);
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 1px;
}

.checklist-item__label {
  flex: 1;
  font-size: 0.875rem;
  color: var(--text-primary);
  line-height: 1.4;
}

.checklist-item__options {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.radio-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.radio-btn:hover { border-color: var(--border-strong); background: var(--bg-hover); }

.radio-btn input[type="radio"] { display: none; }

.radio-btn.selected-conforme     { background: var(--green-bg);   border-color: var(--green);   color: var(--green);  }
.radio-btn.selected-nao_conforme { background: var(--red-bg);     border-color: var(--red);     color: var(--red);    }
.radio-btn.selected-nao_aplicavel{ background: rgba(255,255,255,0.05); border-color: var(--border-strong); color: var(--text-secondary); }

.checklist-obs {
  margin-top: 8px;
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-blue);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.8rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}
.checklist-obs:focus { border-color: var(--crec-blue-light); }

/* ── FORM ELEMENTS ───────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.form-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.form-input {
  padding: 11px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}

.form-input:focus {
  border-color: var(--crec-blue-light);
  box-shadow: var(--shadow-glow);
}

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

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

.search-input-wrap .form-input { padding-left: 38px; }

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn--primary {
  background: var(--crec-blue-mid);
  color: white;
  box-shadow: var(--shadow-blue);
}
.btn--primary:hover { background: var(--crec-blue-light); }
.btn--primary:active { transform: scale(0.98); }

.btn--danger {
  background: var(--red-bg);
  color: var(--red);
  border-color: rgba(239,68,68,0.3);
}
.btn--danger:hover { background: rgba(239,68,68,0.2); }

.btn--ghost {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn--ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn--success {
  background: rgba(16,185,129,0.15);
  color: var(--green);
  border-color: rgba(16,185,129,0.3);
}
.btn--success:hover { background: rgba(16,185,129,0.25); }

.btn--whatsapp {
  background: #25d366;
  color: white;
}
.btn--whatsapp:hover { background: #1ebe5d; }

.btn--excel {
  background: #1d6f42;
  color: white;
}
.btn--excel:hover { background: #25914f; }

.btn--full { width: 100%; }
.btn--lg { padding: 14px 28px; font-size: 1rem; border-radius: var(--radius-md); }
.btn--sm { padding: 7px 14px; font-size: 0.8rem; }
.btn--icon { padding: 9px; border-radius: var(--radius-sm); min-width: 38px; }

.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* ── TABLE ───────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

thead { background: var(--bg-elevated); }

th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

tbody tr { transition: background 0.1s; }
tbody tr:hover { background: var(--bg-hover); }
tbody tr:last-child td { border-bottom: none; }

/* ── BADGES / STATUS ─────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.badge--green    { background: var(--green-bg);    color: var(--green);    }
.badge--red      { background: var(--red-bg);      color: var(--red);      }
.badge--yellow   { background: var(--yellow-bg);   color: var(--yellow);   }
.badge--critical { background: var(--critical-bg); color: var(--critical); }
.badge--gray     { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.badge--blue     { background: rgba(10,77,181,0.2); color: var(--crec-blue-light); }

/* ── MODAL ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

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

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px);
  transition: transform 0.2s;
}

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

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

.modal-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

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

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  min-width: 260px;
  max-width: 380px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.3s, transform 0.3s;
}

.toast.toast--visible { opacity: 1; transform: translateX(0); }

.toast__icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.toast--success .toast__icon { background: var(--green-bg);  color: var(--green);  }
.toast--error   .toast__icon { background: var(--red-bg);    color: var(--red);    }
.toast--warning .toast__icon { background: var(--yellow-bg); color: var(--yellow); }
.toast--info    .toast__icon { background: rgba(10,77,181,0.15); color: var(--crec-blue-light); }

/* ── LOGIN PAGE ──────────────────────────────────────────── */
#login-page {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 900px 700px at 20% 30%, rgba(0,48,135,0.5) 0%, transparent 60%),
    radial-gradient(ellipse 700px 500px at 80% 70%, rgba(10,77,181,0.2) 0%, transparent 60%),
    var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 16px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 16px rgba(10,77,181,0.4));
}

.login-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.login-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.login-divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* ── PAGE HEADER ─────────────────────────────────────────── */
.page-header {
  margin-bottom: 28px;
}

.page-header__title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.page-header__sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ── FILTER TABS ─────────────────────────────────────────── */
.filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-tab {
  padding: 8px 16px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-tab:hover { border-color: var(--border-strong); color: var(--text-primary); }
.filter-tab.active { background: var(--crec-blue-mid); color: white; border-color: var(--crec-blue-mid); }

/* ── VEHICLE SELECT ──────────────────────────────────────── */
.vehicle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
}

.vehicle-chip {
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}

.vehicle-chip:hover { border-color: var(--crec-blue-light); color: var(--crec-blue-light); }
.vehicle-chip.selected { background: rgba(10,77,181,0.2); border-color: var(--crec-blue-light); color: var(--crec-blue-light); }
.vehicle-chip.inspected { border-color: rgba(16,185,129,0.4); color: var(--green); background: var(--green-bg); }
.vehicle-chip.critical  { border-color: rgba(239,68,68,0.4);  color: var(--red);   background: var(--red-bg);   }

/* ── PHOTO UPLOAD ────────────────────────────────────────── */
.photo-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.photo-upload-area:hover {
  border-color: var(--crec-blue-light);
  background: rgba(10,77,181,0.04);
}

.photo-upload-area.has-photo {
  border-style: solid;
  border-color: var(--crec-blue-light);
  padding: 8px;
}

.photo-preview {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

/* ── LOADING OVERLAY ─────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6,9,15,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  backdrop-filter: blur(2px);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--crec-blue-light);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state__icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state__title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.empty-state__text { font-size: 0.85rem; }

/* ── SECTION DIVIDER ─────────────────────────────────────── */
.section-title {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 14px;
  margin-top: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── SHIFT BADGE ─────────────────────────────────────────── */
.shift-a { background: rgba(245,158,11,0.15); color: var(--yellow); }
.shift-b { background: rgba(99,102,241,0.15); color: #818cf8; }

/* ── ACTIONS ROW ─────────────────────────────────────────── */
.actions-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  align-items: center;
}

/* ── HAMBURGER (MOBILE) ──────────────────────────────────── */
.btn-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 6px;
}

/* ── RESPONSIVE ──────────────────────────────────────────── */

/* Garante que nada extrapola a largura da tela */
*, *::before, *::after { max-width: 100%; }
html, body { overflow-x: hidden; max-width: 100vw; }
#app { overflow-x: hidden; max-width: 100vw; }
#main { overflow-x: hidden; min-width: 0; }
#page-content { overflow-x: hidden; min-width: 0; }

@media (max-width: 900px) {
  :root { --sidebar-w: 100%; }

  #sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    width: 260px;
    box-shadow: var(--shadow-lg);
    z-index: 300;
  }

  #sidebar.open { transform: translateX(0); }

  #page-content { padding: 14px; }

  .btn-hamburger { display: flex; }

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

  .vehicle-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }

  #topbar { padding: 0 14px; }

  /* Topbar data picker menor no mobile */
  .date-picker-wrap { padding: 6px 10px; }
  input[type="date"] { font-size: 0.8rem; }
  .topbar__title { font-size: 0.9rem; }

  /* Tabelas: scroll horizontal contido */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }

  /* Cards não extrapolam */
  .card { overflow: hidden; }

  /* Checklist mais compacto */
  .checklist-item { padding: 12px 12px; }
  .radio-btn { padding: 5px 10px; font-size: 0.75rem; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }

  .stat-card { padding: 14px; }
  .stat-card__value { font-size: 1.6rem; }

  .login-card { padding: 24px 18px; }

  .modal-box { padding: 18px; border-radius: var(--radius-lg); }

  .actions-row { flex-direction: column; align-items: stretch; }

  /* Topbar compacto */
  #topbar { height: auto; padding: 10px 14px; flex-wrap: wrap; gap: 8px; }
  .topbar__title { font-size: 0.85rem; }
  .date-picker-wrap { padding: 5px 10px; }

  /* Página de conteúdo */
  #page-content { padding: 12px; }

  /* Botões full no mobile */
  .btn--lg { padding: 13px 20px; font-size: 0.95rem; }

  /* Gráfico não overflow */
  canvas { max-width: 100% !important; }

  /* Filter tabs com scroll */
  .filter-tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .filter-tab { flex-shrink: 0; }

  /* Vehicle grid menor */
  .vehicle-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 6px; }
  .vehicle-chip { padding: 8px 4px; font-size: 0.72rem; }

  /* Page header */
  .page-header__title { font-size: 1.1rem; }
}

/* ── UTILITY ─────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-yellow { color: var(--yellow); }
.text-blue   { color: var(--crec-blue-light); }
.text-muted  { color: var(--text-muted); }
.text-bold   { font-weight: 700; }
.text-center { text-align: center; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.gap-8  { gap: 8px; }
.flex   { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }