/**
 * Sophia STARS Parent Portal — single stylesheet, built directly from the
 * main app's design tokens (roadmap §3.1: "do not import the 32-file
 * stack; this pilots the Phase 1 approach"). Mobile-first single column.
 */

:root {
  --navy-900: #001c38;
  --navy-800: #003057;
  --navy-700: #004173;
  --gold-500: #a8761a;
  --gold-400: #c9942c;
  --blue-500: #0078d4;

  --ok-500: #10b981;
  --warn-500: #f59e0b;
  --err-500: #ef4444;

  --house-solis: #f59e0b;
  --house-aqua: #3b82f6;
  --house-luna: #94a3b8;
  --house-ignis: #f97316;

  --n-0: #ffffff;
  --n-50: #f8fafc;
  --n-100: #f1f5f9;
  --n-200: #e2e8f0;
  --n-500: #64748b;
  --n-900: #0f172a;

  --bg: var(--n-50);
  --surface: var(--n-0);
  --surface-2: var(--n-100);
  --border: var(--n-200);
  --text: var(--n-900);
  --text-2: var(--n-500);

  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;

  --r-md: 10px;
  --r-lg: 16px;
  --r-full: 999px;
  --sh-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
  --sh-md: 0 4px 12px rgba(15, 23, 42, 0.1);

  --font: "Inter", "Segoe UI", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --surface: #111a2c;
    --surface-2: #182338;
    --border: rgba(255, 255, 255, 0.09);
    --text: #e2e8f0;
    --text-2: #94a3b8;
  }
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a {
  color: var(--blue-500);
}
:focus-visible {
  outline: 3px solid var(--blue-500);
  outline-offset: 2px;
}

.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-4);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}
.brand img {
  width: 44px;
  height: 44px;
}
.brand h1 {
  font-size: 1.25rem;
  margin: 0;
  color: var(--navy-800);
}
.brand p {
  margin: 0;
  color: var(--text-2);
  font-size: 0.85rem;
}

.card-title {
  margin-top: 0;
  font-size: 1.05rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: var(--sp-2);
  color: var(--text);
}
input[type="email"],
input[type="text"] {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 1rem;
  background: var(--surface);
  color: var(--text);
  margin-bottom: var(--sp-4);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--r-md);
  font-weight: 700;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  background: var(--navy-800);
  color: #fff;
}
.btn:hover {
  background: var(--navy-700);
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.error-text {
  background: color-mix(in srgb, var(--err-500) 12%, transparent);
  color: var(--err-500);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  font-size: 0.9rem;
  margin-bottom: var(--sp-4);
  display: none;
}
.error-text.visible {
  display: block;
}

.help-link {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-2);
  margin-top: var(--sp-4);
}

/* ── Dashboard ── */
.sibling-switcher {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  padding-bottom: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.sibling-chip {
  flex: 0 0 auto;
  padding: 0.5rem 1rem;
  border-radius: var(--r-full);
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.sibling-chip.active {
  border-color: var(--house-color, var(--navy-800));
  background: color-mix(in srgb, var(--house-color, var(--navy-800)) 12%, transparent);
}

.hero-card {
  border-left: 6px solid var(--house-color, var(--navy-800));
}
.hero-card h2 {
  margin: 0 0 var(--sp-2);
}
.hero-meta {
  color: var(--text-2);
  font-size: 0.9rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
}
.stat-tile {
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  text-align: center;
}
.stat-tile .num {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy-800);
}
.stat-tile .label {
  font-size: 0.75rem;
  color: var(--text-2);
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 100px;
  margin: var(--sp-4) 0;
}
.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.bar-rec {
  width: 100%;
  background: var(--ok-500);
  border-radius: 3px 3px 0 0;
}
.bar-fric {
  width: 100%;
  background: var(--n-200);
  border-radius: 0 0 3px 3px;
}

.section-title {
  font-weight: 700;
  margin: var(--sp-5) 0 var(--sp-2);
}
/* Every .section-title in this app is the first thing in its .card. */
.card > .section-title:first-child {
  margin-top: 0;
}
.hidden {
  display: none;
}
.list-row {
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.list-row:last-child {
  border-bottom: none;
}
.list-row .meta {
  color: var(--text-2);
  font-size: 0.8rem;
}

.empty {
  color: var(--text-2);
  font-size: 0.9rem;
  padding: var(--sp-3) 0;
}

.logout-link {
  display: block;
  text-align: center;
  margin-top: var(--sp-5);
  color: var(--text-2);
  font-size: 0.85rem;
  cursor: pointer;
  background: none;
  border: none;
  text-decoration: underline;
}
