:root {
  --bg: #f4fbf7;
  --bg-alt: #f4fbf7;
  --card: #ffffff;
  --card-elevated: rgba(255, 255, 255, 0.92);
  --border-subtle: rgba(15, 42, 28, 0.12);

  --accent: #1f9d5a;
  --accent-soft: rgba(31, 157, 90, 0.12);
  --accent-strong: #17844c;

  --text: #0f2a1c;
  --text-muted: rgba(15, 42, 28, 0.62);

  --danger: #d93a3a;

  --radius-lg: 18px;
  --shadow-soft: 0 18px 45px rgba(15, 42, 28, 0.10);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(31, 157, 90, 0.18), transparent 55%),
    radial-gradient(circle at bottom right, rgba(31, 157, 90, 0.10), transparent 55%),
    #f4fbf7;
  color: var(--text);
  min-height: 100vh;
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3.5rem;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.8rem;
  flex-wrap: wrap;
}

.header-left {
  flex: 1 1 auto;
  min-width: 260px;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.6rem;
}

.page-header h1 {
  font-size: 1.9rem;
  letter-spacing: -0.03em;
  margin: 0 0 0.35rem;
}

.subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 480px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(15, 42, 28, 0.12);
  background: rgba(255, 255, 255, 0.86);
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.badge .dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(31, 157, 90, 0.35);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.8rem;
  text-decoration: none;
  border: 1px solid rgba(15, 42, 28, 0.18);
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.nav-btn:hover {
  background: rgba(31, 157, 90, 0.10);
  border-color: rgba(31, 157, 90, 0.35);
  transform: translateY(-1px);
}

.nav-btn-primary {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.nav-btn-primary:hover {
  background: rgba(31, 157, 90, 0.18);
  border-color: var(--accent-strong);
}

.controls-card {
  background:
    radial-gradient(circle at top left, rgba(31, 157, 90, 0.10), transparent 55%),
    rgba(255, 255, 255, 0.92);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: 1rem 1.2rem 0.8rem;
  box-shadow: var(--shadow-soft);
  margin-bottom: 1.8rem;
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.control {
  min-width: 240px;
}

.control label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

#school-filter {
  width: 100%;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(15, 42, 28, 0.18);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(15, 42, 28, 0.55) 50%),
    linear-gradient(135deg, rgba(15, 42, 28, 0.55) 50%, transparent 50%);
  background-position: calc(100% - 14px) calc(50% - 2px),
    calc(100% - 9px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

#school-filter:focus {
  border-color: rgba(31, 157, 90, 0.55);
  box-shadow: 0 0 0 4px rgba(31, 157, 90, 0.12);
}

.status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Loader */

#loader {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(15, 42, 28, 0.22);
  border-top-color: var(--accent);
  animation: spin 0.6s linear infinite;
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.last-update {
  margin: 0.6rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.1rem;
}

.card {
  background: rgba(255, 255, 255, 0.92);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: 1.15rem 1.2rem 1.1rem;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(circle at top right, rgba(31, 157, 90, 0.10), transparent 55%);
  transition: opacity 0.2s ease-out;
  pointer-events: none;
}

.card:hover::before {
  opacity: 1;
}

.card h2 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.card-value {
  margin: 0.2rem 0 0.25rem;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--accent);
}

.card-label {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.card-total {
  background:
    radial-gradient(circle at top left, rgba(31, 157, 90, 0.12), transparent 60%),
    rgba(255, 255, 255, 0.94);
  border-color: rgba(31, 157, 90, 0.35);
}

.card-total .card-value {
  font-size: 2.2rem;
}

.card-total::after {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 999px;
  border: 1px solid rgba(31, 157, 90, 0.35);
  opacity: 0.18;
  right: -35px;
  bottom: -35px;
}
@media (max-width: 960px) {
  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .page {
    padding-top: 1.8rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-right {
    align-items: flex-start;
  }

  .cards-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .controls-card {
    padding: 0.9rem 0.9rem 0.75rem;
  }
}
