/* ===========================================================
 * Ferramentaria — Design moderno
 * Tipografia: Inter (Google Fonts)
 * Estética: corporativa, espaçada, sombras suaves
 * =========================================================== */

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

:root {
  --sidebar-w: 280px;

  /* Paleta padrão (sobrescrita por theme.css) */
  --sidebar-bg: #0f172a;
  --sidebar-bg-hover: rgba(255,255,255,0.06);
  --sidebar-active: #6366f1;
  --sidebar-active-bg: rgba(99, 102, 241, 0.15);
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  --sidebar-divider: rgba(255,255,255,0.08);

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --body-bg: #f1f5f9;
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.04);
  --shadow-md: 0 4px 12px -2px rgb(0 0 0 / 0.06), 0 2px 4px -2px rgb(0 0 0 / 0.04);
  --shadow-lg: 0 16px 40px -10px rgb(0 0 0 / 0.15), 0 4px 12px -2px rgb(0 0 0 / 0.05);
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--body-bg);
  color: var(--text-main);
  font-size: 0.9375rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 { font-weight: 700; color: var(--text-main); letter-spacing: -0.02em; }
h2 { font-size: 1.6rem; }
.text-muted { color: var(--text-muted) !important; }

/* ===========================================================
 * LAYOUT
 * =========================================================== */

.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ===========================================================
 * SIDEBAR
 * =========================================================== */

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: 0 0 24px rgba(0,0,0,0.05);
}

.sidebar-brand {
  padding: 24px 22px;
  border-bottom: 1px solid var(--sidebar-divider);
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}
.sidebar-brand i {
  font-size: 1.6rem;
  color: var(--sidebar-active);
  background: var(--sidebar-active-bg);
  padding: 8px;
  border-radius: var(--radius-sm);
}
.sidebar-brand .brand-logo {
  max-height: 40px;
  max-width: 40px;
  object-fit: contain;
}

/* ----- Navegação ----- */
.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.sidebar-nav .nav-link {
  color: var(--sidebar-text);
  padding: 10px 14px;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  position: relative;
}
.sidebar-nav .nav-link:hover {
  background: var(--sidebar-bg-hover);
  color: #fff;
}
.sidebar-nav .nav-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-text-active);
}
.sidebar-nav .nav-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: var(--sidebar-active);
}
.sidebar-nav .nav-link i {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
}

/* ----- Rodapé com perfil ----- */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--sidebar-divider);
}
.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--sidebar-active);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.user-name {
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  color: var(--sidebar-text);
  font-size: 0.75rem;
  line-height: 1.2;
}
.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: rgba(255,255,255,0.06);
  color: var(--sidebar-text);
  border: 1px solid var(--sidebar-divider);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
}
.btn-logout:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

/* ===========================================================
 * CONTEÚDO PRINCIPAL
 * =========================================================== */

.main-content {
  flex: 1;
  min-width: 0;
  padding: 32px 40px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

/* ===========================================================
 * CARDS
 * =========================================================== */

.card {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--card-border);
  padding: 16px 20px;
  font-weight: 600;
  font-size: 0.95rem;
}
.card-body { padding: 20px; }

/* ===========================================================
 * KPI CARDS
 * =========================================================== */

.kpi-card {
  border-radius: var(--radius-md);
  border: 0;
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  background: var(--card-bg);
  box-shadow: var(--shadow-md);
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.kpi-card .card-body { padding: 0; }
.kpi-card .kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 14px;
  float: none;
  opacity: 1;
}
.kpi-card .kpi-value {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--text-main);
}
.kpi-card .kpi-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Variantes coloridas */
.kpi-card.kpi-success .kpi-icon { background: #d1fae5; color: #059669; }
.kpi-card.kpi-warning .kpi-icon { background: #fef3c7; color: #d97706; }
.kpi-card.kpi-primary .kpi-icon { background: #ddd6fe; color: #6d28d9; }
.kpi-card.kpi-info    .kpi-icon { background: #dbeafe; color: #2563eb; }
.kpi-card.kpi-secondary .kpi-icon { background: #e2e8f0; color: #475569; }

/* ===========================================================
 * DASHBOARD — BANNER DE SAUDAÇÃO
 * =========================================================== */

.dash-greeting {
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(167,139,250,0.06));
  border: 1px solid rgba(99,102,241,0.15);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.dash-greeting h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
}
.dash-greeting-meta {
  color: var(--text-muted);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: capitalize;
}

/* ===========================================================
 * DASHBOARD — AÇÕES RÁPIDAS
 * =========================================================== */

.quick-action {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-main);
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}
.quick-action:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  color: var(--text-main);
  border-color: var(--primary);
}
.quick-action .qa-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: rgba(99,102,241,0.1);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.quick-action .qa-title {
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.quick-action .qa-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.quick-action .qa-badge {
  background: #ef4444;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.quick-action-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.quick-action-primary:hover { color: #fff; }
.quick-action-primary .qa-icon { background: rgba(255,255,255,0.2); color: #fff; }
.quick-action-primary .qa-sub { color: rgba(255,255,255,0.85); }
.quick-action-warning {
  background: #fef3c7;
  border-color: #fbbf24;
}
.quick-action-warning .qa-icon { background: #fbbf24; color: #fff; }

/* ===========================================================
 * DASHBOARD — CARDS DE ALERTA
 * =========================================================== */

.alert-card {
  display: block;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: all 0.15s ease;
  border-left: 4px solid;
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
}
.alert-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.alert-card .ac-icon {
  font-size: 1.4rem;
  margin-bottom: 8px;
}
.alert-card .ac-value {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}
.alert-card .ac-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-top: 4px;
}
.alert-card-danger  { border-left-color: #ef4444; }
.alert-card-danger  .ac-icon { color: #ef4444; }
.alert-card-warning { border-left-color: #f59e0b; }
.alert-card-warning .ac-icon { color: #f59e0b; }
.alert-card-info    { border-left-color: #3b82f6; }
.alert-card-info    .ac-icon { color: #3b82f6; }
.alert-card-dark    { border-left-color: #1f2937; }
.alert-card-dark    .ac-icon { color: #1f2937; }

/* ===========================================================
 * DASHBOARD — RANKING (Top 5)
 * =========================================================== */

.rank-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}
.rank-row:last-child { border-bottom: 0; }
.rank-pos {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f1f5f9;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.rank-row:nth-child(1) .rank-pos { background: #fef3c7; color: #b45309; }
.rank-row:nth-child(2) .rank-pos { background: #e2e8f0; color: #475569; }
.rank-row:nth-child(3) .rank-pos { background: #fed7aa; color: #9a3412; }
.rank-info { flex: 1; min-width: 0; }
.rank-name {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rank-bar {
  height: 6px;
  background: #f1f5f9;
  border-radius: 3px;
  overflow: hidden;
}
.rank-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--sidebar-active));
  border-radius: 3px;
  transition: width 0.6s ease;
}
.rank-value {
  text-align: right;
  min-width: 70px;
}
.rank-value strong { font-size: 1.05rem; }

/* ===========================================================
 * DASHBOARD — LEGENDA DO DONUT
 * =========================================================== */

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
}
.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
}
.donut-legend-item .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ===========================================================
 * BOTÕES
 * =========================================================== */

.btn {
  border-radius: var(--radius-sm);
  font-weight: 500;
  padding: 8px 16px;
  font-size: 0.9rem;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -2px rgba(79, 70, 229, 0.4);
}
.btn-outline-primary {
  border-color: var(--primary);
  color: var(--primary);
}
.btn-outline-primary:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-outline-secondary {
  color: var(--text-muted);
  border-color: var(--card-border);
  background: #fff;
}
.btn-outline-secondary:hover {
  background: #f8fafc;
  color: var(--text-main);
  border-color: var(--card-border);
}
.btn-sm { padding: 5px 11px; font-size: 0.82rem; }
.btn-lg { padding: 11px 20px; font-size: 1rem; }
.btn i { font-size: 1.05em; }

/* ===========================================================
 * FORMULÁRIOS
 * =========================================================== */

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.form-control, .form-select {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 0.92rem;
  transition: all 0.15s ease;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}
.form-text { font-size: 0.8rem; }
.form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}
.form-switch .form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

/* ===========================================================
 * TABELAS
 * =========================================================== */

.table {
  margin-bottom: 0;
  --bs-table-bg: transparent;
}
.table > :not(caption) > * > * { padding: 14px 16px; }
.table > thead {
  background: #f8fafc;
}
.table > thead th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
}
.table > tbody tr { transition: background 0.1s; }
.table > tbody tr:hover { background: #f8fafc; }
.table > tbody td {
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.table > tbody tr:last-child td { border-bottom: 0; }
.table-light { --bs-table-bg: #f8fafc; }

/* ===========================================================
 * BADGES
 * =========================================================== */

.badge {
  font-weight: 600;
  font-size: 0.72rem;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.02em;
}
.badge.bg-success      { background: #d1fae5 !important; color: #047857 !important; }
.badge.bg-primary      { background: #e0e7ff !important; color: #4338ca !important; }
.badge.bg-warning      { background: #fef3c7 !important; color: #b45309 !important; }
.badge.bg-secondary    { background: #e2e8f0 !important; color: #475569 !important; }
.badge.bg-info         { background: #dbeafe !important; color: #1e40af !important; }
.badge.bg-dark         { background: #1f2937 !important; color: #fff !important; }
.badge.text-dark       { color: inherit !important; }

/* ===========================================================
 * ALERTS
 * =========================================================== */

.alert {
  border-radius: var(--radius-md);
  border: 0;
  padding: 14px 18px;
  font-size: 0.9rem;
}
.alert-success { background: #d1fae5; color: #047857; }
.alert-danger  { background: #fee2e2; color: #b91c1c; }
.alert-warning { background: #fef3c7; color: #b45309; }
.alert-info    { background: #dbeafe; color: #1e40af; }

/* ===========================================================
 * THUMBS
 * =========================================================== */

.thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
  border: 1px solid var(--card-border);
}
.thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
  font-size: 1.4rem;
}

/* ===========================================================
 * LOGIN
 * =========================================================== */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 30%, rgba(99, 102, 241, 0.2) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
    linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  padding: 24px;
  font-family: 'Inter', sans-serif;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M0 0h100v100H0z' fill='none' stroke='%23ffffff' stroke-opacity='0.04' stroke-width='0.5'/%3E%3C/svg%3E");
  background-size: 60px 60px;
  pointer-events: none;
}
.login-card {
  background: rgba(255,255,255,0.98);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-lg);
  padding: 44px 38px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 70px -15px rgba(0,0,0,0.4);
  position: relative;
  z-index: 1;
  animation: fadeUp 0.5s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.login-brand {
  text-align: center;
  margin-bottom: 32px;
}
.login-brand i {
  font-size: 2.8rem;
  color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.login-brand .login-logo-img {
  max-height: 90px;
  max-width: 240px;
  object-fit: contain;
}
.login-brand h1 {
  font-size: 1.7rem;
  font-weight: 800;
  margin: 16px 0 4px;
  letter-spacing: -0.02em;
}
.login-brand p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
}
.login-card .btn-primary {
  padding: 11px;
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 4px;
}

/* ===========================================================
 * SELECT2 (consistência com Bootstrap)
 * =========================================================== */

.select2-container--bootstrap-5 .select2-selection {
  min-height: 40px;
  border-color: var(--card-border);
  border-radius: var(--radius-sm);
}
.select2-container--bootstrap-5 .select2-selection:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

/* ===========================================================
 * MODAL
 * =========================================================== */

.modal-content {
  border: 0;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}
.modal-header {
  border-bottom: 1px solid var(--card-border);
  padding: 18px 24px;
}
.modal-body { padding: 24px; }
.modal-footer {
  border-top: 1px solid var(--card-border);
  padding: 16px 24px;
}
.modal-title { font-weight: 700; }

/* ===========================================================
 * DEFINITION LIST (página detalhe)
 * =========================================================== */

dl dt {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
}
dl dd {
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 12px;
}

/* ===========================================================
 * MOBILE: TOPBAR + OFFCANVAS
 * =========================================================== */

.mobile-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 1030;
  background: var(--sidebar-bg);
  color: #fff;
  padding: 10px 12px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.mobile-topbar .topbar-btn {
  background: transparent;
  border: 0;
  color: var(--sidebar-text-active);
  font-size: 1.5rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: background 0.15s;
}
.mobile-topbar .topbar-btn:hover,
.mobile-topbar .topbar-btn:active {
  background: rgba(255,255,255,0.1);
  color: #fff;
}
.mobile-topbar .topbar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  flex: 1;
  justify-content: center;
  overflow: hidden;
}
.mobile-topbar .topbar-title i {
  color: var(--sidebar-active);
}
.mobile-topbar .topbar-title span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mobile-topbar .topbar-logo {
  max-height: 28px;
  max-width: 28px;
  object-fit: contain;
}

.sidebar-offcanvas {
  background: var(--sidebar-bg) !important;
  color: var(--sidebar-text);
  width: 280px !important;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.sidebar-offcanvas .sidebar-brand {
  padding: 18px 18px;
}
.sidebar-offcanvas .btn-close-light {
  background: transparent;
  border: 0;
  color: var(--sidebar-text);
  font-size: 1.2rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  margin-left: auto;
}
.sidebar-offcanvas .btn-close-light:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}
.sidebar-offcanvas .sidebar-nav {
  flex: 1;
  overflow-y: auto;
}

/* ===========================================================
 * RESPONSIVO — ajustes por breakpoint
 * =========================================================== */

@media (max-width: 992px) {
  .main-content { padding: 16px; }
}

@media (max-width: 768px) {
  .mobile-topbar { display: flex; }

  body { padding-bottom: env(safe-area-inset-bottom); }

  .main-content { padding: 14px 12px; }

  .page-header {
    margin-bottom: 18px;
    gap: 8px;
  }
  .page-header h2 { font-size: 1.2rem; }
  .page-header p { font-size: 0.85rem; }

  /* Cards mais compactos no mobile */
  .card-body { padding: 14px; }
  .card-header { padding: 12px 14px; font-size: 0.88rem; }

  /* KPIs menores */
  .kpi-card { padding: 14px; }
  .kpi-card .kpi-value { font-size: 1.55rem; }
  .kpi-card .kpi-icon {
    width: 38px; height: 38px;
    font-size: 1.1rem;
    margin-bottom: 10px;
  }
  .kpi-card .kpi-label { font-size: 0.7rem; }

  /* Banner de saudação compacto */
  .dash-greeting {
    padding: 14px 16px;
    flex-direction: column;
    align-items: flex-start;
  }
  .dash-greeting h2 { font-size: 1.1rem; }
  .dash-greeting-meta { font-size: 0.78rem; }

  /* Quick actions empilhados */
  .quick-action { padding: 14px; gap: 12px; }
  .quick-action .qa-icon { width: 40px; height: 40px; font-size: 1.15rem; }
  .quick-action .qa-title { font-size: 0.9rem; }
  .quick-action .qa-sub { font-size: 0.75rem; }

  /* Alert cards menores */
  .alert-card { padding: 14px; }
  .alert-card .ac-value { font-size: 1.4rem; }
  .alert-card .ac-label { font-size: 0.7rem; }

  /* Botões adaptáveis */
  .btn { padding: 8px 12px; font-size: 0.85rem; }
  .btn-sm { padding: 5px 9px; font-size: 0.76rem; }
  .btn-lg { padding: 10px 16px; font-size: 0.92rem; }

  /* Tabela: padding menor + fonte menor */
  .table > :not(caption) > * > * { padding: 10px 10px; }
  .table { font-size: 0.85rem; }

  /* Formulários */
  .form-label { font-size: 0.75rem; }
  .form-control, .form-select { padding: 8px 10px; font-size: 0.9rem; }

  /* Login adapta */
  .login-card { padding: 28px 22px; }
  .login-brand h1 { font-size: 1.4rem; }
  .login-brand i { font-size: 2.2rem; width: 64px; height: 64px; }

  /* Cabeçalhos em flex apertados — quebra melhor */
  .d-flex.justify-content-between { flex-wrap: wrap; gap: 8px; }

  /* Modais ocupam mais espaço */
  .modal-dialog { margin: 8px; }

  /* Ranking compacto */
  .rank-row { padding: 8px 0; gap: 10px; }
  .rank-pos { width: 26px; height: 26px; font-size: 0.78rem; }
  .rank-name { font-size: 0.82rem; }
  .rank-value strong { font-size: 0.9rem; }
}

/* Telas muito pequenas (≤ 480px) */
@media (max-width: 480px) {
  .main-content { padding: 12px 10px; }
  .page-header h2 { font-size: 1.05rem; }
  .kpi-card .kpi-value { font-size: 1.3rem; }
  .btn i + span,
  .btn span + i { display: inline; }
  /* Esconde texto de botão quando há ícone (mantém só ícone) */
  .btn-icon-only-mobile span { display: none; }
}
