/* =====================================================
   SIMULADOS MARANGUAPE - Design System
   Inspirado em Apple, Stripe, Notion
   ===================================================== */

/* ---- CSS Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Colors */
  --white: #ffffff;
  --black: #000000;
  --bg: #f8f9fb;
  --bg-card: #ffffff;
  --bg-subtle: #f1f3f9;
  --bg-muted: #e8ecf4;
  
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  --text-inverse: #ffffff;
  
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --ring: rgba(59,130,246,.35);

  --blue-50: #eff6ff; --blue-100: #dbeafe; --blue-200: #bfdbfe;
  --blue-500: #3b82f6; --blue-600: #2563eb; --blue-700: #1d4ed8;
  
  --green-50: #f0fdf4; --green-500: #22c55e; --green-600: #16a34a;
  --red-50: #fef2f2; --red-500: #ef4444; --red-600: #dc2626;
  --amber-50: #fffbeb; --amber-500: #f59e0b; --amber-600: #d97706;
  --purple-50: #faf5ff; --purple-500: #a855f7; --purple-600: #9333ea;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-ring: rgba(37,99,235,.25);

  /* Spacing */
  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem;
  --space-4: 1rem; --space-5: 1.25rem; --space-6: 1.5rem;
  --space-8: 2rem; --space-10: 2.5rem; --space-12: 3rem;

  /* Radius */
  --radius-sm: 6px; --radius: 10px; --radius-lg: 14px; --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 12px rgba(0,0,0,.06);
  --shadow-md: 0 8px 24px rgba(0,0,0,.08);
  --shadow-lg: 0 20px 48px rgba(0,0,0,.1);
  --shadow-card: 0 1px 3px rgba(0,0,0,.04), 0 0 0 1px rgba(0,0,0,.03);

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', monospace;
  
  /* Transitions */
  --ease: cubic-bezier(.4,0,.2,1);
  --duration: 200ms;

  /* Layout */
  --sidebar-w: 260px;
  --header-h: 64px;
  --content-max: 1200px;
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { font-family: var(--font); color: var(--text-primary); background: var(--bg); line-height: 1.6; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 1rem; }
h1,h2,h3,h4,h5 { line-height: 1.3; font-weight: 600; }
h1 { font-size: 1.75rem; letter-spacing: -0.025em; }
h2 { font-size: 1.375rem; letter-spacing: -0.02em; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }

/* ---- Utilities ---- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2,1fr); }
.grid-3 { grid-template-columns: repeat(3,1fr); }
.grid-4 { grid-template-columns: repeat(4,1fr); }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.625rem 1.25rem; font-size: 0.875rem; font-weight: 500;
  border-radius: var(--radius); border: 1px solid transparent;
  transition: all var(--duration) var(--ease); line-height: 1.4;
  white-space: nowrap; text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.btn-primary {
  background: var(--primary); color: var(--text-inverse); border-color: var(--primary);
  box-shadow: 0 1px 2px rgba(37,99,235,.3);
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
  background: var(--white); color: var(--text-primary); border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--bg-subtle); }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-subtle); color: var(--text-primary); }

.btn-danger { background: var(--red-600); color: white; border-color: var(--red-600); }
.btn-danger:hover { background: var(--red-500); }

.btn-success { background: var(--green-600); color: white; border-color: var(--green-600); }
.btn-success:hover { background: var(--green-500); }

.btn-sm { padding: 0.4rem 0.875rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 0.5rem; width: 36px; height: 36px; }

.btn .material-icons { font-size: 1.125rem; }

/* ---- Forms ---- */
.form-group { display: flex; flex-direction: column; gap: 0.375rem; margin-bottom: var(--space-5); }
.form-label { font-size: 0.875rem; font-weight: 500; color: var(--text-primary); }
.form-hint { font-size: 0.75rem; color: var(--text-muted); }

.form-control {
  width: 100%; padding: 0.625rem 0.875rem; font-size: 0.9375rem;
  background: var(--white); border: 1px solid var(--border-strong);
  border-radius: var(--radius); color: var(--text-primary);
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.form-control:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:disabled { background: var(--bg-subtle); color: var(--text-muted); cursor: not-allowed; }

select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8.825L.35 3.175l.7-.7L6 7.425l4.95-4.95.7.7z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.875rem center; padding-right: 2.5rem; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

textarea.form-control { min-height: 100px; resize: vertical; }

.form-check { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; cursor: pointer; }
.form-check input[type="checkbox"],
.form-check input[type="radio"] { width: 1rem; height: 1rem; accent-color: var(--primary); }

/* ---- Cards ---- */
.card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  border: 1px solid var(--border); box-shadow: var(--shadow-card);
}

/* ---- Responsive Tables ---- */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 #e2e8f0;
}
.table-responsive::-webkit-scrollbar { height: 8px; }
.table-responsive::-webkit-scrollbar-track { background: #e2e8f0; border-radius: 4px; }
.table-responsive::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 4px; min-width: 40px; }
.table-responsive::-webkit-scrollbar-thumb:hover { background: #64748b; }
.card-header {
  padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; }
.card-header h3 .material-icons { font-size: 1.25rem; color: var(--text-muted); }
.card-body { padding: var(--space-6); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.card-body::-webkit-scrollbar { height: 6px; }
.card-body::-webkit-scrollbar-track { background: transparent; }
.card-body::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-full); }
.card-footer { padding: var(--space-4) var(--space-6); border-top: 1px solid var(--border); background: var(--bg-subtle); }

/* ---- Alerts ---- */
.alert {
  display: flex; align-items: flex-start; gap: 0.75rem;
  padding: var(--space-4) var(--space-5); border-radius: var(--radius);
  font-size: 0.875rem; margin-bottom: var(--space-5);
  border: 1px solid transparent;
}
.alert .material-icons { font-size: 1.25rem; margin-top: 1px; }
.alert-success { background: var(--green-50); color: #15803d; border-color: #bbf7d0; }
.alert-danger, .alert-error { background: var(--red-50); color: #b91c1c; border-color: #fecaca; }
.alert-warning { background: var(--amber-50); color: #92400e; border-color: #fde68a; }
.alert-info { background: var(--blue-50); color: #1e40af; border-color: var(--blue-200); }

/* ---- Badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.125rem 0.625rem; font-size: 0.75rem; font-weight: 500;
  border-radius: var(--radius-full); background: var(--bg-subtle); color: var(--text-secondary);
}
.badge-primary { background: var(--blue-100); color: var(--blue-700); }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-warning { background: #fef3c7; color: #92400e; }

/* ---- Tables ---- */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
table.table { min-width: 700px; }
thead { background: var(--bg-subtle); }
th { padding: 0.75rem 1rem; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); text-align: left; white-space: nowrap; }
td { padding: 0.875rem 1rem; font-size: 0.875rem; border-top: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: var(--bg-subtle); }

/* ---- Stat Cards ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-4); }
.stat-card {
  display: flex; align-items: flex-start; gap: var(--space-4);
  padding: var(--space-6); background: var(--bg-card);
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  transition: all 200ms cubic-bezier(.4,0,.2,1);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
.stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon .material-icons { font-size: 1.375rem; }
.stat-icon.blue { background: var(--blue-50); color: var(--blue-600); }
.stat-icon.green { background: var(--green-50); color: var(--green-600); }
.stat-icon.amber { background: var(--amber-50); color: var(--amber-600); }
.stat-icon.purple { background: var(--purple-50); color: var(--purple-600); }
.stat-icon.red { background: var(--red-50); color: var(--red-600); }
.stat-content { min-width: 0; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.stat-label { font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.125rem; }

/* ---- Empty State ---- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--space-12) var(--space-6); text-align: center;
}
.empty-state .material-icons { font-size: 48px; color: var(--border-strong); margin-bottom: var(--space-4); }
.empty-state h3 { font-size: 1.125rem; color: var(--text-primary); margin-bottom: var(--space-2); }
.empty-state p { font-size: 0.9375rem; color: var(--text-muted); max-width: 400px; margin-bottom: var(--space-6); }

/* ---- Dropdown ---- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 50;
  min-width: 180px; background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  padding: 0.25rem; display: none;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.75rem; font-size: 0.875rem; color: var(--text-secondary);
  border-radius: var(--radius-sm); transition: background var(--duration);
  border: none; background: none; width: 100%; text-align: left; cursor: pointer;
}
.dropdown-item:hover { background: var(--bg-subtle); color: var(--text-primary); }
.dropdown-item .material-icons { font-size: 1.125rem; }
.dropdown-divider { height: 1px; background: var(--border); margin: 0.25rem 0; }

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-4); opacity: 0; visibility: hidden;
  transition: opacity 300ms var(--ease), visibility 300ms;
}
.modal-backdrop.show { opacity: 1; visibility: visible; }
.modal {
  background: var(--white); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(10px); transition: transform 300ms var(--ease);
}
.modal-backdrop.show .modal { transform: translateY(0); }
.modal-header {
  padding: var(--space-6); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h2 { font-size: 1.125rem; }
.modal-body { padding: var(--space-6); }
.modal-footer { padding: var(--space-4) var(--space-6); border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: var(--space-3); }

/* ---- Pagination ---- */
.pagination { display: flex; align-items: center; gap: 0.25rem; }
.pagination a, .pagination span {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; font-size: 0.875rem; border-radius: var(--radius);
  color: var(--text-secondary); transition: all var(--duration);
}
.pagination a:hover { background: var(--bg-subtle); }
.pagination .active { background: var(--primary); color: white; font-weight: 600; }

/* ---- Progress ---- */
.progress { width: 100%; height: 6px; background: var(--bg-muted); border-radius: var(--radius-full); overflow: hidden; }
.progress-bar { height: 100%; border-radius: var(--radius-full); transition: width 500ms var(--ease); background: var(--primary); }
.progress-bar.green { background: var(--green-500); }
.progress-bar.amber { background: var(--amber-500); }
.progress-bar.red { background: var(--red-500); }

/* ---- Avatar ---- */
.avatar {
  width: 40px; height: 40px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.875rem; flex-shrink: 0;
  background: var(--primary-light); color: var(--primary);
}
.avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.125rem; }

/* =====================================================
   APP LAYOUT - Sidebar + Content
   ===================================================== */
.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w); background: var(--white);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 40;
  transition: transform 300ms var(--ease);
}

.sidebar-brand {
  padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: var(--space-3);
}
.sidebar-brand-icon {
  width: 36px; height: 36px; background: var(--primary); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; color: white;
}
.sidebar-brand-icon .material-icons { font-size: 1.25rem; }
.sidebar-brand-text { font-size: 0.9375rem; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.sidebar-brand-text small { display: block; font-size: 0.6875rem; font-weight: 400; color: var(--text-muted); }

.sidebar-nav { flex: 1; padding: var(--space-3); overflow-y: auto; }
.sidebar-section { margin-bottom: var(--space-2); }
.sidebar-section-title {
  padding: var(--space-2) var(--space-3); font-size: 0.6875rem;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted);
}

.nav-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 0.5rem var(--space-3); border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 450; color: var(--text-secondary);
  transition: all var(--duration) var(--ease); text-decoration: none;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg-subtle); color: var(--text-primary); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-item .material-icons { font-size: 1.25rem; opacity: .7; }
.nav-item.active .material-icons { opacity: 1; }
.nav-badge {
  margin-left: auto; font-size: 0.6875rem; font-weight: 600;
  background: var(--primary); color: white; padding: 0.125rem 0.5rem;
  border-radius: var(--radius-full);
}

.sidebar-footer {
  padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex; align-items: center; gap: var(--space-3);
}
.sidebar-user-info { min-width: 0; flex: 1; }
.sidebar-user-name { font-size: 0.875rem; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 0.75rem; color: var(--text-muted); }

/* Main content */
.main { flex: 1; margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; min-width: 0; overflow-x: hidden; }

.top-bar {
  height: var(--header-h); background: var(--white); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--space-6); position: sticky; top: 0; z-index: 30;
}
.top-bar-left { display: flex; align-items: center; gap: var(--space-4); }
.top-bar-right { display: flex; align-items: center; gap: var(--space-3); }

.menu-toggle { display: none; background: none; border: none; color: var(--text-secondary); padding: 0.25rem; border-radius: var(--radius); }
.menu-toggle:hover { background: var(--bg-subtle); }

.page-content { flex: 1; padding: var(--space-8) var(--space-6); max-width: var(--content-max); width: 100%; margin: 0 auto; min-width: 0; overflow-x: hidden; }

/* Page Header */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-8); }
.page-header h1 { margin-bottom: 0.25rem; }
.page-header p { color: var(--text-muted); font-size: 0.9375rem; margin: 0; }
.page-header-actions { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-4); }

/* Escola selector */
.escola-selector {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 0.375rem 0.75rem; background: var(--bg-subtle);
  border-radius: var(--radius); font-size: 0.8125rem;
  color: var(--text-secondary); cursor: pointer;
  border: 1px solid transparent; transition: all var(--duration);
}
.escola-selector:hover { border-color: var(--border-strong); background: var(--white); }
.escola-selector .material-icons { font-size: 1rem; }

/* Mobile brand in top-bar */
.top-bar-brand {
  display: none;
  align-items: center; gap: 6px;
}
@media (max-width: 1024px) {
  .top-bar-brand { display: flex; }
}

/* Sidebar close button (mobile only) */
.sidebar-close {
  display: none; position: absolute; top: 12px; right: 12px;
  background: none; border: none; color: var(--text-muted);
  padding: 4px; border-radius: var(--radius); cursor: pointer;
  z-index: 2; transition: all var(--duration);
}
.sidebar-close:hover { background: var(--bg-subtle); color: var(--text-primary); }

/* Sidebar logout link (mobile) */
.sidebar-logout {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 0.5rem var(--space-3); border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 450; color: var(--text-secondary);
  text-decoration: none; transition: all var(--duration) var(--ease);
  margin-top: var(--space-2);
}
.sidebar-logout:hover { background: var(--bg-subtle); color: var(--danger); }
.sidebar-logout .material-icons { font-size: 1.25rem; opacity: .7; }

/* Mobile: hidden horizontal nav (not used anymore) */
.mobile-nav { display: none !important; }

/* Mobile Drawer */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 39;
  background: rgba(0,0,0,.35); opacity: 0; transition: opacity 300ms ease;
  pointer-events: none;
}
.sidebar-overlay.active {
  opacity: 1; pointer-events: auto;
}

@media (max-width: 1024px) {
  .sidebar {
    position: fixed; top: 0; left: 0; right: 0;
    width: 100%; height: auto; max-height: 90vh;
    z-index: 40;
    transform: translateY(-100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    box-shadow: none;
    overflow-y: auto;
  }
  .sidebar.open {
    transform: translateY(0);
    box-shadow: 0 4px 24px rgba(0,0,0,.12);
  }
  .sidebar-close { display: block; }
  .sidebar-overlay { display: block; }
  .main { margin-left: 0; }
  .menu-toggle { display: flex; }
  .page-content { padding: var(--space-6) var(--space-4); }
  .top-bar { padding: 0 var(--space-4); }
}

@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  h1 { font-size: 1.5rem; }
  .page-header { flex-direction: column; align-items: flex-start; gap: var(--space-3); }
  .page-header .btn { width: 100%; justify-content: center; }
  .page-content { padding: var(--space-4) var(--space-3); }
  /* Table responsive */
  th { padding: 0.5rem 0.625rem; font-size: 0.6875rem; }
  td { padding: 0.625rem; font-size: 0.8125rem; white-space: nowrap; }
  .badge { padding: 0.125rem 0.5rem; font-size: 0.6875rem; }
  /* Filter forms */
  .card-body form[style*="display:flex"],
  .card-body form[style*="display: flex"] { flex-direction: column !important; align-items: stretch !important; }
  .card-body form .form-group { min-width: 100% !important; width: 100%; }
  .card-body form .btn { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-content { padding: var(--space-3) var(--space-2); }
  table { min-width: 500px; }
  th { padding: 0.375rem 0.5rem; font-size: 0.625rem; }
  td { padding: 0.5rem; font-size: 0.75rem; }
}

/* ---- Auth Pages (Login/Cadastro) ---- */
.auth-page {
  min-height: 100vh; display: flex;
  background: var(--bg);
}
.auth-left {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--space-8);
}
.auth-right {
  flex: 1; background: linear-gradient(135deg, #0d4a2e 0%, #1a6b3c 40%, #2e8b57 70%, #c8a415 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--space-8); color: white; position: relative; overflow: hidden;
}
.auth-right::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.auth-right-content { position: relative; z-index: 1; text-align: center; max-width: 400px; }
.auth-right-content h2 { font-size: 2rem; margin-bottom: var(--space-4); font-weight: 700; }
.auth-right-content p { font-size: 1.125rem; opacity: .85; line-height: 1.7; }

.auth-card {
  width: 100%; max-width: 420px;
}
.auth-logo {
  display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-10);
}
.auth-logo-icon {
  width: 44px; height: 44px; background: var(--primary); border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center; color: white;
}
.auth-logo-icon .material-icons { font-size: 1.5rem; }
.auth-logo-text { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }

.auth-title { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.375rem; }
.auth-subtitle { color: var(--text-muted); font-size: 1rem; margin-bottom: var(--space-8); }

.auth-divider {
  display: flex; align-items: center; gap: var(--space-4);
  margin: var(--space-6) 0; color: var(--text-muted); font-size: 0.8125rem;
}
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.auth-footer { text-align: center; margin-top: var(--space-6); font-size: 0.875rem; color: var(--text-muted); }
.auth-footer a { color: var(--primary); font-weight: 500; }
.auth-footer a:hover { text-decoration: underline; }

@media (max-width: 900px) {
  .auth-right { display: none; }
  .auth-left { padding: var(--space-6); }
}

/* ---- Tabs ---- */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: var(--space-6); }
.tab {
  padding: var(--space-3) var(--space-5); font-size: 0.875rem; font-weight: 500;
  color: var(--text-muted); border-bottom: 2px solid transparent;
  transition: all var(--duration); cursor: pointer; background: none; border-top: none; border-left: none; border-right: none;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---- Tooltip ---- */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip); position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%); padding: 0.375rem 0.625rem; font-size: 0.75rem;
  background: var(--text-primary); color: white; border-radius: var(--radius-sm);
  white-space: nowrap; z-index: 50;
}

/* ---- Skeleton Loading ---- */
.skeleton { background: linear-gradient(90deg, var(--bg-muted) 25%, var(--bg-subtle) 50%, var(--bg-muted) 75%); background-size: 200% 100%; animation: skeleton 1.5s ease infinite; border-radius: var(--radius); }
@keyframes skeleton { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---- Animations ---- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 300ms var(--ease); }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- Toast ---- */
.toast-container { position: fixed; top: var(--space-6); right: var(--space-6); z-index: 999; display: flex; flex-direction: column; gap: var(--space-3); }
.toast {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-4) var(--space-5); background: var(--white);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  border: 1px solid var(--border); font-size: 0.875rem;
  animation: fadeIn 300ms var(--ease);
}
.toast-success { border-left: 3px solid var(--green-500); }
.toast-error { border-left: 3px solid var(--red-500); }
.toast .material-icons { font-size: 1.25rem; }
.toast-success .material-icons { color: var(--green-500); }
.toast-error .material-icons { color: var(--red-500); }
