/* ============================================
   ECO TAMPINHAS — Design System
   ============================================ */

:root {
  /* Brand Colors */
  --green-50: #f0fdf4;
  --green-100: #dcfce7;
  --green-200: #bbf7d0;
  --green-300: #86efac;
  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;
  --green-800: #166534;
  --green-900: #14532d;

  --primary: var(--green-600);
  --primary-hover: var(--green-700);
  --primary-light: var(--green-100);
  --accent: #0ea5e9;

  /* Light Theme */
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.08);
  --header-bg: rgba(255,255,255,0.85);
  --input-bg: #ffffff;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #f59e0b;
  --info: #0ea5e9;
}

body.dark-theme {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-elevated: #334155;
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --border: #334155;
  --border-strong: #475569;
  --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.2);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.4);
  --header-bg: rgba(15,23,42,0.9);
  --input-bg: #1e293b;
  --primary-light: rgba(22,163,74,0.15);
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: 'Poppins', 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
ul { list-style: none; }
input, select, textarea { font-family: inherit; }

/* Loading */
.loading-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.4s, visibility 0.4s;
}
.loading-overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader { position: relative; width: 100px; height: 100px; }
.loader-ring {
  position: absolute; inset: 0;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.loader-logo {
  position: absolute; inset: 15px;
  width: 70px; height: 70px;
  object-fit: contain;
  border-radius: 50%;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Header */
.header {
  position: sticky; top: 0; z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s;
}
.header-container {
  max-width: 1280px; margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex; align-items: center; gap: 1.5rem;
}
.logo-link {
  display: flex; align-items: center; gap: 0.75rem;
  flex-shrink: 0;
}
.logo-img {
  width: 48px; height: 48px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(22,163,74,0.25);
}
.logo-text { display: flex; flex-direction: column; }
.logo-title {
  font-weight: 700; font-size: 1.1rem;
  color: var(--primary); line-height: 1.2;
}
.logo-subtitle {
  font-size: 0.7rem; color: var(--text-muted);
  font-weight: 400;
}
.school-logos {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.75rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--border, rgba(0,0,0,0.08));
}
.school-logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  cursor: default;
}
.school-logo:hover {
  transform: scale(1.12);
  box-shadow: 0 4px 12px rgba(22,163,74,0.25);
}
.nav {
  display: flex; align-items: center; gap: 0.25rem;
  flex: 1; justify-content: center;
}
.nav-link {
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  font-size: 0.875rem; font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s;
}
.nav-link:hover { color: var(--primary); background: var(--primary-light); }
.nav-link.active {
  color: var(--primary); background: var(--primary-light);
  font-weight: 600;
}
.header-actions {
  display: flex; align-items: center; gap: 0.5rem;
  flex-shrink: 0;
}
.theme-btn {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: all 0.2s;
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.theme-btn:hover { color: var(--primary); border-color: var(--primary); }
.theme-btn svg { width: 20px; height: 20px; }
.icon-moon { display: none; }
body.dark-theme .icon-sun { display: none; }
body.dark-theme .icon-moon { display: block; }
.admin-btn {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  font-size: 0.875rem; font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid transparent;
  transition: all 0.2s;
}
.admin-btn:hover { background: var(--primary); color: white; }
.admin-btn svg { width: 18px; height: 18px; }
.admin-btn.logged-in {
  background: var(--primary); color: white;
}
.menu-toggle {
  display: none;
  flex-direction: column; gap: 5px;
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.menu-toggle span {
  width: 20px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: 0.3s;
}

/* Main */
.main { min-height: calc(100vh - 180px); }
.page { display: none; padding: 2rem 1.5rem 4rem; max-width: 1280px; margin: 0 auto; }
.page.active { display: block; animation: fadeIn 0.35s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero */
.hero {
  display: grid; grid-template-columns: 1.2fr 1fr;
  gap: 3rem; align-items: center;
  padding: 2rem 0 3rem;
}
.hero-badge {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 50px;
  font-size: 0.8rem; font-weight: 600;
  margin-bottom: 1rem;
}
.hero-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800; line-height: 1.15;
  margin-bottom: 1rem;
}
.hero-title .highlight {
  color: var(--primary);
  position: relative;
}
.hero-desc {
  font-size: 1.1rem; color: var(--text-secondary);
  margin-bottom: 2rem; max-width: 520px;
}
.hero-stats {
  display: flex; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
  min-width: 140px;
}
.stat-value {
  display: block;
  font-size: 1.75rem; font-weight: 800;
  color: var(--primary); line-height: 1.2;
}
.stat-label {
  font-size: 0.75rem; color: var(--text-muted); font-weight: 500;
}
.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.hero-visual { display: flex; justify-content: center; }
.hero-logo-wrapper {
  position: relative;
  width: 320px; height: 320px;
}
.hero-logo {
  width: 100%; height: 100%;
  object-fit: contain;
  border-radius: 50%;
  position: relative; z-index: 1;
  animation: float 4s ease-in-out infinite;
}
.hero-glow {
  position: absolute; inset: -20px;
  background: radial-gradient(circle, rgba(22,163,74,0.2) 0%, transparent 70%);
  border-radius: 50%;
  animation: pulse 3s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  border-radius: 10px;
  font-size: 0.9rem; font-weight: 600;
  transition: all 0.2s;
  border: 2px solid transparent;
}
.btn-primary {
  background: var(--primary); color: white;
  box-shadow: 0 4px 14px rgba(22,163,74,0.35);
}
.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(22,163,74,0.4);
}
.btn-outline {
  background: transparent; color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:hover {
  background: var(--primary); color: white;
}
.btn-danger {
  background: var(--danger); color: white;
}
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-lg { padding: 0.9rem 2rem; font-size: 1rem; }
.btn-block { width: 100%; }

/* Features */
.features-section { padding: 3rem 0; }
.section-title {
  text-align: center;
  font-size: 1.75rem; font-weight: 700;
  margin-bottom: 2rem;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.feature-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.feature-card h3 {
  font-size: 1.1rem; font-weight: 700;
  margin-bottom: 0.5rem; color: var(--primary);
}
.feature-card p { font-size: 0.9rem; color: var(--text-secondary); }

/* Partners / School logos */
.partners-section {
  padding: 2.5rem 0 1rem;
  text-align: center;
}
.partners-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
.partners-logos {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2.5rem;
  flex-wrap: wrap;
}
.partner-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}
.partner-logo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 3px solid transparent;
}
.partner-item:hover .partner-logo {
  transform: scale(1.08) translateY(-4px);
  box-shadow: 0 8px 24px rgba(22,163,74,0.2);
  border-color: var(--primary);
}
.partner-item span {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* CTA */
.cta-section {
  background: linear-gradient(135deg, var(--green-700), var(--green-600));
  border-radius: 20px;
  padding: 3rem 2rem;
  text-align: center;
  margin-top: 2rem;
  color: white;
}
.cta-content h2 { font-size: 1.75rem; margin-bottom: 0.5rem; }
.cta-content p { opacity: 0.9; margin-bottom: 1.5rem; }
.cta-section .btn-primary {
  background: white; color: var(--green-700);
  box-shadow: none;
}
.cta-section .btn-primary:hover {
  background: var(--green-50);
}

/* Page Header */
.page-header { margin-bottom: 2rem; }
.page-title {
  font-size: 1.85rem; font-weight: 800;
  margin-bottom: 0.35rem;
}
.page-desc { color: var(--text-secondary); font-size: 1rem; }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem; flex-wrap: wrap; gap: 0.75rem;
}
.card-header h3 { font-size: 1.1rem; font-weight: 700; }
.card-actions { display: flex; gap: 0.5rem; }
.mt-4 { margin-top: 1.5rem; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.form-group label {
  font-size: 0.85rem; font-weight: 600;
  color: var(--text-secondary);
}
.form-input, .form-select {
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22,163,74,0.15);
}
.form-select-sm {
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  border-radius: 8px;
}
.form-hint { font-size: 0.8rem; color: var(--text-muted); }

/* Ranking */
.ranking-tabs, .admin-tabs {
  display: flex; gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.tab-btn {
  padding: 0.7rem 1.25rem;
  font-size: 0.9rem; font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  border-radius: 8px 8px 0 0;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.tab-content, .admin-tab-content { display: none; }
.tab-content.active, .admin-tab-content.active { display: block; animation: fadeIn 0.3s; }

.ranking-podium {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
  align-items: end;
}
.podium-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem 1rem;
  text-align: center;
  box-shadow: var(--shadow);
  position: relative;
  transition: transform 0.2s;
}
.podium-item:hover { transform: translateY(-4px); }
.podium-item.gold {
  border-color: #fbbf24;
  background: linear-gradient(180deg, rgba(251,191,36,0.1), var(--bg-card));
  order: 2;
  padding-top: 2rem;
}
.podium-item.silver {
  border-color: #94a3b8;
  order: 1;
}
.podium-item.bronze {
  border-color: #d97706;
  order: 3;
}
.podium-rank {
  font-size: 2rem; font-weight: 800;
  margin-bottom: 0.5rem;
}
.podium-item.gold .podium-rank { color: #f59e0b; }
.podium-item.silver .podium-rank { color: #94a3b8; }
.podium-item.bronze .podium-rank { color: #d97706; }
.podium-name {
  font-weight: 700; font-size: 1rem;
  margin-bottom: 0.25rem;
}
.podium-value {
  font-size: 1.4rem; font-weight: 800;
  color: var(--primary);
}
.podium-sub { font-size: 0.8rem; color: var(--text-muted); }

.filter-bar {
  display: flex; gap: 0.75rem;
  margin-bottom: 1.5rem; flex-wrap: wrap;
}
.filter-bar .form-select, .filter-bar .form-input {
  max-width: 220px;
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.ranking-table, .data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.ranking-table thead, .data-table thead {
  background: var(--primary-light);
}
.ranking-table th, .data-table th {
  padding: 0.85rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--primary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.ranking-table td, .data-table td {
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}
.ranking-table tbody tr:hover, .data-table tbody tr:hover {
  background: var(--primary-light);
}
.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  min-width: 80px;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.5s ease;
}
.rank-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: 8px;
  font-weight: 700; font-size: 0.85rem;
  background: var(--primary-light); color: var(--primary);
}
.rank-badge.top1 { background: #fef3c7; color: #d97706; }
.rank-badge.top2 { background: #f1f5f9; color: #64748b; }
.rank-badge.top3 { background: #ffedd5; color: #c2410c; }
.trend-up { color: var(--success); font-weight: 600; }
.trend-down { color: var(--danger); font-weight: 600; }
.trend-same { color: var(--text-muted); }
.action-btns { display: flex; gap: 0.35rem; }
.btn-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
  transition: 0.2s;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-icon:hover { background: var(--primary-light); color: var(--primary); }
.btn-icon.danger:hover { background: #fef2f2; color: var(--danger); border-color: #fecaca; }

/* Doacoes */
.doacoes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Dashboard */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.dash-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  box-shadow: var(--shadow);
}
.dash-stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
}
.dash-stat-icon.green { background: var(--primary-light); }
.dash-stat-icon.blue { background: rgba(14,165,233,0.15); }
.dash-stat-icon.purple { background: rgba(139,92,246,0.15); }
.dash-stat-icon.orange { background: rgba(245,158,11,0.15); }
.dash-stat-value {
  display: block;
  font-size: 1.5rem; font-weight: 800;
  line-height: 1.2;
}
.dash-stat-label {
  font-size: 0.75rem; color: var(--text-muted); font-weight: 500;
}
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.5rem;
}
.chart-card { min-height: 360px; }
.chart-container {
  position: relative;
  height: 280px;
  width: 100%;
}
.color-picker-group {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.85rem; color: var(--text-secondary);
}
.color-picker-group input[type="color"] {
  width: 32px; height: 32px;
  border: none; border-radius: 6px;
  cursor: pointer;
}

/* Steps */
.steps-container {
  display: flex; flex-direction: column; gap: 1.25rem;
  max-width: 720px;
}
.step-card {
  display: flex; gap: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.step-number {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.2rem;
  flex-shrink: 0;
}
.step-content h3 {
  font-size: 1.1rem; font-weight: 700;
  margin-bottom: 0.4rem;
}
.step-content p {
  color: var(--text-secondary); font-size: 0.95rem;
  margin-bottom: 0.75rem;
}
.step-tags { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.tag {
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  font-size: 0.8rem; font-weight: 600;
}
.tag-success { background: var(--primary-light); color: var(--primary); }
.tag-danger { background: #fef2f2; color: var(--danger); }
body.dark-theme .tag-danger { background: rgba(220,38,38,0.15); }
.collection-points { margin-top: 0.75rem; }
.point {
  background: var(--bg);
  border-radius: 10px;
  padding: 1rem;
  border: 1px solid var(--border);
}
.point strong { display: block; margin-bottom: 0.25rem; }
.point p { margin-bottom: 0.75rem; font-size: 0.9rem; }

/* Sobre */
.sobre-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}
.sobre-content .card h3 {
  color: var(--primary);
  margin-bottom: 0.75rem;
  font-size: 1.15rem;
}
.sobre-content .card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}
.authors-list {
  margin: 0.5rem 0 1rem;
}
.authors-list li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}
.authors-list li:last-child { border-bottom: none; }
.sobre-school-logos {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.sobre-school-logo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 3px 12px rgba(0,0,0,0.1);
  transition: transform 0.25s ease;
}
.sobre-school-logo:hover {
  transform: scale(1.1);
}
.slogan-card {
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  justify-content: center;
}
.sobre-logo {
  width: 120px; height: 120px;
  border-radius: 50%;
  margin-bottom: 1rem;
}
.slogan {
  font-size: 1.15rem; font-weight: 600;
  color: var(--primary);
}
.slogan span {
  display: block;
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 0.25rem;
}

/* Admin */
.admin-login-container {
  display: flex; justify-content: center; align-items: center;
  min-height: 60vh; padding: 2rem 0;
}
.login-card {
  width: 100%; max-width: 400px;
}
.login-header {
  text-align: center; margin-bottom: 1.5rem;
}
.login-logo {
  width: 80px; height: 80px;
  border-radius: 50%;
  margin: 0 auto 1rem;
}
.login-header h2 { font-size: 1.4rem; margin-bottom: 0.25rem; }
.login-header p { color: var(--text-muted); font-size: 0.9rem; }
.login-hint {
  text-align: center; margin-top: 1rem;
  font-size: 0.8rem; color: var(--text-muted);
}
.login-hint code {
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.8rem;
}
.admin-panel.hidden, .hidden { display: none !important; }
.admin-logout-area {
  margin-top: 2rem; text-align: center;
}

/* Footer */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  margin-top: auto;
}
.footer-container {
  max-width: 1280px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  gap: 1.5rem; flex-wrap: wrap;
}
.footer-brand {
  display: flex; align-items: center; gap: 0.75rem;
}
.footer-logo {
  width: 40px; height: 40px;
  border-radius: 50%;
}
.footer-brand strong {
  display: block; color: var(--primary); font-size: 0.95rem;
}
.footer-brand p {
  font-size: 0.75rem; color: var(--text-muted);
}
.footer-info {
  text-align: right;
  font-size: 0.8rem; color: var(--text-muted);
}
.footer-school {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.footer-school-logos {
  display: flex;
  gap: 0.4rem;
}
.footer-school-logo {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.25s ease;
}
.footer-school-logo:hover {
  transform: scale(1.1);
}
.footer-school-text strong {
  display: block;
  font-size: 0.85rem;
  color: var(--text-primary);
}
.footer-school-text p {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 0;
}

/* Toast */
.toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  z-index: 1000;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1.25rem;
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem; font-weight: 500;
  display: flex; align-items: center; gap: 0.6rem;
  animation: slideIn 0.3s ease;
  max-width: 360px;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--info); }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg-card);
  border-radius: 16px;
  width: 100%; max-width: 440px;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.25s;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.1rem; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  font-size: 1.4rem;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-body { padding: 1.5rem; }

/* Responsive */
@media (max-width: 900px) {
  .nav {
    position: fixed; top: 65px; left: 0; right: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-direction: column; padding: 1rem;
    gap: 0.25rem;
    transform: translateY(-120%);
    transition: transform 0.3s;
    z-index: 99;
    box-shadow: var(--shadow-lg);
  }
  .nav.open { transform: translateY(0); }
  .nav-link { width: 100%; text-align: center; padding: 0.75rem; }
  .menu-toggle { display: flex; }
  .hero { grid-template-columns: 1fr; text-align: center; }
  .hero-desc { margin-left: auto; margin-right: auto; }
  .hero-stats { justify-content: center; }
  .hero-actions { justify-content: center; }
  .hero-logo-wrapper { width: 240px; height: 240px; margin: 0 auto; }
  .ranking-podium { grid-template-columns: 1fr; }
  .podium-item.gold, .podium-item.silver, .podium-item.bronze { order: unset; }
  .footer-container { flex-direction: column; text-align: center; }
  .footer-info { text-align: center; }
  .footer-school { justify-content: center; flex-direction: column; gap: 0.5rem; }
  .logo-subtitle { display: none; }
  .school-logos {
    margin-left: 0.4rem;
    padding-left: 0.4rem;
  }
  .school-logo { width: 30px; height: 30px; }
  .partners-logos { gap: 1.5rem; }
  .partner-logo { width: 64px; height: 64px; }
}

@media (max-width: 500px) {
  .header-container { padding: 0.6rem 1rem; }
  .page { padding: 1.5rem 1rem 3rem; }
  .hero-title { font-size: 1.6rem; }
  .stat-card { min-width: 100px; padding: 0.75rem; }
  .stat-value { font-size: 1.3rem; }
  .charts-grid { grid-template-columns: 1fr; }
  .admin-btn span { display: none; }
  .school-logos { display: none; } /* hide in very small to avoid clutter; still in footer/sobre */
  .partners-logos { gap: 1rem; }
  .partner-logo { width: 56px; height: 56px; }
  .partner-item span { font-size: 0.7rem; }
}

/* ========== Assistente IA (Chat) ========== */
.chat-widget {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 900;
}
.chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green-600), var(--green-700));
  color: white;
  font-size: 1.6rem;
  box-shadow: 0 6px 24px rgba(22, 163, 74, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
  border: none;
  cursor: pointer;
}
.chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 28px rgba(22, 163, 74, 0.55);
}
.chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  background: #ef4444;
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}
.chat-badge.hidden { display: none; }

.chat-panel {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 360px;
  max-width: calc(100vw - 2rem);
  height: 480px;
  max-height: calc(100vh - 120px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeIn 0.25s ease;
}
.chat-panel.hidden { display: none; }

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1rem;
  background: linear-gradient(135deg, var(--green-600), var(--green-700));
  color: white;
}
.chat-header-info {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: white;
  object-fit: cover;
}
.chat-header-info strong {
  display: block;
  font-size: 0.95rem;
  line-height: 1.2;
}
.chat-status {
  font-size: 0.7rem;
  opacity: 0.9;
}
.chat-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: white;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.15);
  border: none;
  cursor: pointer;
}
.chat-close:hover { background: rgba(255,255,255,0.3); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--bg);
}
.chat-msg {
  max-width: 88%;
  padding: 0.7rem 0.95rem;
  border-radius: 14px;
  font-size: 0.875rem;
  line-height: 1.45;
  animation: fadeIn 0.2s ease;
}
.chat-msg.bot {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.chat-msg.user {
  align-self: flex-end;
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}
.chat-msg .msg-time {
  display: block;
  font-size: 0.65rem;
  opacity: 0.7;
  margin-top: 0.3rem;
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.chip {
  padding: 0.35rem 0.7rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid transparent;
  cursor: pointer;
  transition: 0.15s;
}
.chip:hover {
  background: var(--primary);
  color: white;
}

.chat-form {
  display: flex;
  gap: 0.4rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.chat-input {
  flex: 1;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: 24px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.875rem;
  outline: none;
}
.chat-input:focus {
  border-color: var(--primary);
}
.chat-send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: 0.2s;
}
.chat-send:hover { background: var(--primary-hover); }

/* Tipo de registro na tabela */
.badge-add {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary);
}
.badge-remove {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #fef2f2;
  color: var(--danger);
}
body.dark-theme .badge-remove {
  background: rgba(220, 38, 38, 0.2);
}

@media (max-width: 500px) {
  .chat-panel {
    width: calc(100vw - 1.5rem);
    right: -0.25rem;
    height: 70vh;
  }
  .chat-widget {
    bottom: 1rem;
    right: 1rem;
  }
}

/* ========== Comprovante ========== */
.modal-comprovante {
  max-width: 520px;
}
.comprovante-actions {
  display: flex;
  gap: 0.75rem;
  padding: 0 1.5rem 1.5rem;
  justify-content: flex-end;
}
.comprovante-doc {
  padding: 0.5rem 0;
}
.comp-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.comp-logo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
}
.comp-header h2 {
  margin: 0;
  color: var(--primary);
  font-size: 1.25rem;
}
.comp-header p {
  margin: 0.15rem 0 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.comp-codigo {
  font-size: 0.75rem !important;
  color: var(--text-muted) !important;
  font-family: monospace;
}
.comp-hr {
  border: none;
  border-top: 2px solid var(--primary);
  margin: 1rem 0;
}
.comp-info p {
  margin: 0.4rem 0;
  font-size: 0.9rem;
}
.comp-qtd {
  color: var(--primary);
  font-weight: 700;
  font-size: 1.15rem;
}
.comp-footer {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

@media print {
  body * { visibility: hidden; }
  #comprovante-print-area, #comprovante-print-area * { visibility: visible; }
  #comprovante-print-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }
  .no-print { display: none !important; }
}

/* ========== Meta Progress ========== */
.meta-progress-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0 1.5rem;
  box-shadow: var(--shadow);
  max-width: 480px;
}
.meta-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.meta-label { font-weight: 600; font-size: 0.9rem; color: var(--text-secondary); }
.meta-numbers { font-size: 0.95rem; }
.meta-numbers strong { color: var(--primary); font-size: 1.15rem; }
.meta-bar {
  height: 12px;
  background: var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.meta-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green-500), var(--green-600));
  border-radius: 8px;
  transition: width 0.6s ease;
  min-width: 0;
}
.meta-progress-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ========== Lock banner ========== */
.lock-banner {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--text);
}
.lock-banner.hidden { display: none; }

/* ========== FAQ ========== */
.faq-list {
  max-width: 760px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.faq-item summary {
  padding: 1rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  font-size: 1.2rem;
  color: var(--primary);
  font-weight: 700;
}
.faq-item[open] summary::after { content: '−'; }
.faq-item p {
  padding: 0 1.25rem 1.15rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.55;
  margin: 0;
  border-top: 1px solid var(--border);
  padding-top: 0.85rem;
  margin-top: 0;
}

/* ========== Relatório ========== */
.relatorio-box {
  margin-top: 0.5rem;
}
.relatorio-doc {
  padding: 1.5rem;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.relatorio-doc h2 {
  color: var(--primary);
  margin-bottom: 0.25rem;
}
.relatorio-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0;
}
.relatorio-meta .stat-mini {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  text-align: center;
}
.relatorio-meta .stat-mini strong {
  display: block;
  font-size: 1.35rem;
  color: var(--primary);
}
.relatorio-meta .stat-mini span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ========== Confirm modal ========== */
.modal-confirm { max-width: 440px; }
.confirm-details {
  margin: 0.75rem 0 0;
  padding-left: 1.25rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.confirm-details li { margin: 0.25rem 0; }

/* ========== Login lock ========== */
.login-lock-msg {
  margin-top: 0.75rem;
  padding: 0.6rem 0.8rem;
  background: #fef2f2;
  color: #b91c1c;
  border-radius: 8px;
  font-size: 0.85rem;
  text-align: center;
}
body.dark-theme .login-lock-msg {
  background: rgba(220, 38, 38, 0.15);
  color: #fca5a5;
}
.login-lock-msg.hidden { display: none; }

/* ========== PWA banner ========== */
.pwa-banner {
  position: fixed;
  bottom: 5.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 850;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.85rem 1.1rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 92vw;
  font-size: 0.875rem;
}
.pwa-banner.hidden { display: none; }
.pwa-banner > div { display: flex; gap: 0.4rem; flex-shrink: 0; }

/* ========== Filters row ========== */
.filtros-avancados {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.form-input-sm {
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  border-radius: 8px;
  max-width: 150px;
}

/* ========== Design polish ========== */
.header {
  box-shadow: 0 1px 0 var(--border);
}
.hero-title .highlight {
  background: linear-gradient(120deg, var(--green-600), var(--green-400));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.feature-card {
  border-top: 3px solid var(--primary);
}
.page-title {
  letter-spacing: -0.02em;
}
.btn-primary {
  letter-spacing: 0.01em;
}
.ranking-podium .podium-item.gold {
  transform: scale(1.02);
}
.dash-stat {
  transition: transform 0.2s;
}
.dash-stat:hover {
  transform: translateY(-2px);
}

@media (max-width: 600px) {
  .pwa-banner {
    flex-direction: column;
    text-align: center;
    bottom: 5rem;
  }
  .meta-progress-card { max-width: 100%; }
}


/* ========== Public prefs panel ========== */
.prefs-wrap { position: relative; }
.prefs-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 290px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 1rem;
  z-index: 200;
  animation: fadeIn 0.2s ease;
}
.prefs-panel.hidden { display: none; }
.prefs-title { font-weight: 700; font-size: 0.95rem; margin: 0; }
.prefs-sub { font-size: 0.75rem; color: var(--text-muted); margin: 0.15rem 0 0.85rem; line-height: 1.35; }
.prefs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  font-size: 0.85rem;
}
.prefs-seg {
  display: flex;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.prefs-seg-btn {
  padding: 0.35rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: 0.15s;
}
.prefs-seg-btn.active {
  background: var(--primary);
  color: white;
}

/* Global table theming */
.ranking-table thead,
.data-table thead {
  background: var(--table-head-bg, var(--primary-light)) !important;
}
.ranking-table th,
.data-table th {
  color: var(--table-head-color, var(--primary)) !important;
}

body.density-compact .card { padding: 1.1rem; }
body.density-compact .page { padding-top: 1.25rem; }
body.font-large { font-size: 17.5px; }
body.font-large .page-title { font-size: 2rem; }

body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

.reveal-on-scroll {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}
body.reduce-motion .reveal-on-scroll {
  opacity: 1;
  transform: none;
}

.stat-value.pulse,
.dash-stat-value.pulse {
  animation: numPulse 0.45s ease;
}
@keyframes numPulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.meta-bar-fill { position: relative; overflow: hidden; }
.meta-bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  transform: translateX(-100%);
  animation: shine 2.5s ease-in-out infinite;
}
body.reduce-motion .meta-bar-fill::after { display: none; }
@keyframes shine {
  0%, 40% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
}
.card:hover {
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
}

.meta-encouragement {
  margin-top: 0.55rem;
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 600;
  min-height: 1.2em;
}
