:root {
  --color-bg: #ffffff;
  --color-text: #1a1a1a;
  --color-muted: #666666;
  --color-accent: #2f6f4f;
  --color-accent-dark: #234f38;
  --color-border: #e0e0e0;
  --color-error-bg: #fdecea;
  --color-error-text: #8a1f11;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
}

a {
  color: var(--color-accent);
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* -------------------------------------------------------------- nav/footer */

header.site-header {
  border-bottom: 1px solid var(--color-border);
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  max-width: 900px;
  margin: 0 auto;
}

.site-nav .wordmark {
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: none;
  color: var(--color-text);
}

.site-nav .links {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.site-nav .links a {
  text-decoration: none;
  color: var(--color-text);
}

.site-nav .links a.button,
.button {
  background: var(--color-accent);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}

.button:hover {
  background: var(--color-accent-dark);
}

.button.secondary {
  background: transparent;
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
}

footer.site-footer {
  border-top: 1px solid var(--color-border);
  margin-top: 3rem;
  padding: 1.5rem;
  text-align: center;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.site-footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.25rem;
  margin-bottom: 0.75rem;
}

.site-footer .footer-links a {
  color: var(--color-muted);
  text-decoration: none;
}

.site-footer .footer-links a:hover {
  text-decoration: underline;
}

/* ------------------------------------------------------------------- hero */

.hero {
  padding: 4rem 1.5rem;
  text-align: center;
}

.hero h1 {
  font-size: 2.25rem;
  margin-bottom: 0.75rem;
}

.hero p {
  color: var(--color-muted);
  font-size: 1.1rem;
  max-width: 640px;
  margin: 0 auto 1.5rem;
}

/* ------------------------------------------------------------------ forms */

form.stack {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-width: 360px;
}

/* The `hidden` attribute is browser-default display:none, but any author
   rule that sets `display` on the same element overrides it regardless of
   specificity — form.stack's `display: flex` above was doing exactly that,
   so every sign-in mode's form stayed visible at once. Restate it here
   with higher specificity than form.stack so hidden actually hides. */
form.stack[hidden] {
  display: none;
}

label {
  font-size: 0.9rem;
  font-weight: 600;
}

input[type="email"],
input[type="password"],
input[type="text"] {
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 1rem;
  width: 100%;
}

.form-error {
  background: var(--color-error-bg);
  color: var(--color-error-text);
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.form-success {
  background: #eaf6ee;
  color: var(--color-accent-dark);
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.form-link {
  background: none;
  border: none;
  color: var(--color-accent);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  text-align: left;
}

/* -------------------------------------------------------------- dashboard */

.card {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.card h2 {
  margin-top: 0;
}

.stat-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.stat {
  flex: 1;
  min-width: 140px;
}

.stat .value {
  font-size: 1.75rem;
  font-weight: 700;
}

.stat .label {
  color: var(--color-muted);
  font-size: 0.85rem;
}

.bar-row {
  display: grid;
  grid-template-columns: 90px 1fr 3rem;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}

.bar-track {
  background: var(--color-border);
  border-radius: 4px;
  height: 14px;
  overflow: hidden;
}

.bar-fill {
  background: var(--color-accent);
  height: 100%;
}

table.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.report-table th,
table.report-table td {
  text-align: left;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border);
}

.list-row:last-child {
  border-bottom: none;
}

.code-display {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.75rem;
  letter-spacing: 0.15em;
  background: #f5f5f5;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  display: inline-block;
  margin: 0.75rem 0;
}

.placeholder-note {
  color: var(--color-muted);
  font-size: 0.85rem;
  font-style: italic;
}

/* --------------------------------------------------------- role show/hide */

/* Sections are hidden by default; the dashboard sets data-role on <body>
   once GET /v1/me resolves, and only the matching sections appear. */
.student-only,
.viewer-only {
  display: none;
}

body[data-role="student"] .student-only {
  display: block;
}

body[data-role="parent"] .viewer-only,
body[data-role="slp"] .viewer-only {
  display: block;
}

.role-picker {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 420px;
}
