/* Calvin's School — clean, linear, easy to scan. No tiles, no gamification.
   Layout principle (James 2026-08-14): single column, lists and tables with
   hairline separators, one obvious action per row. Boxed panels only for rare
   focal moments (login, check-in, celebration). */

:root {
  --bg: #fbfcfe;
  --panel: #ffffff;
  --text: #1e2637;
  --muted: #64708a;
  --border: #e4e8f0;
  --accent: #2f6fdf;
  --accent-soft: #e8f0fd;
  --good: #178a44;
  --good-soft: #e6f5ec;
  --wait: #b26a05;
  --wait-soft: #fdf3e0;
  --danger: #c22f2f;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151c;
    --panel: #191e27;
    --text: #e8edf6;
    --muted: #94a0b8;
    --border: #2a3342;
    --accent: #6aa2f8;
    --accent-soft: #1c2f4e;
    --good: #43c377;
    --good-soft: #16341f;
    --wait: #e3a94e;
    --wait-soft: #3a2d13;
    --danger: #f07575;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
}

/* ---- header / nav ---- */
header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  max-width: 760px;
  margin: 0 auto;
  padding: 1rem 1.2rem 0.4rem;
}
.brand { font-weight: 700; font-size: 1.05rem; text-decoration: none; color: var(--text); }
nav { display: flex; align-items: baseline; gap: 1.2rem; }
nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}
nav a:hover { color: var(--accent); }
nav a.active { color: var(--text); border-bottom-color: var(--accent); }

main { max-width: 760px; margin: 0 auto; padding: 0.4rem 1.2rem 3rem; }

h1 { font-size: 1.5rem; margin: 0.8rem 0 0.1rem; }
h2 {
  font-size: 1.05rem;
  margin: 2rem 0 0.3rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}
a { color: var(--accent); }
.muted { color: var(--muted); margin: 0.2rem 0; }
.small { font-size: 0.85rem; }
.error { color: var(--danger); font-weight: 600; }

/* ---- row lists (tasks, approvals, courses) ---- */
.rows { margin: 0.4rem 0; }
.row {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: none; }

.status-dot {
  flex: 0 0 1.6rem;
  height: 1.6rem;
  margin-top: 0.1rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  border: 2px solid var(--border);
  color: var(--muted);
}
.status-dot.verified { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.status-dot.pending_approval { background: var(--wait-soft); border-color: var(--wait); color: var(--wait); }
.status-dot.todo { border-color: var(--accent); }

.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; }
.row-sub { color: var(--muted); font-size: 0.88rem; margin-top: 0.1rem; }
.row-actions { display: flex; gap: 0.5rem; align-items: center; flex-shrink: 0; flex-wrap: wrap; }
.row-actions form { margin: 0; }

.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0 0.5rem;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  vertical-align: middle;
}
.tag.plain { background: var(--border); color: var(--muted); }

.note {
  display: inline-block;
  background: var(--wait-soft);
  color: var(--text);
  border-radius: 6px;
  padding: 0.15rem 0.55rem;
  margin-top: 0.3rem;
  font-size: 0.88rem;
}

/* ---- buttons ---- */
.btn {
  display: inline-block;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  padding: 0.4rem 0.9rem;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.big { font-size: 1.05rem; padding: 0.65rem 1.3rem; }
.linklike {
  background: none; border: none; color: var(--muted);
  font: inherit; font-weight: 600; cursor: pointer; padding: 0;
}
.linklike:hover { color: var(--accent); }

/* ---- focal panels (login, check-in, celebration only) ---- */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.4rem 1.6rem;
  margin: 1.2rem 0;
}
.panel.center { text-align: center; padding: 2.2rem 1.6rem; }
.panel.center h2 { border: none; margin: 0 0 0.4rem; font-size: 1.4rem; }
.done-list { list-style: none; padding: 0; text-align: left; max-width: 460px; margin: 1rem auto 0; }
.done-list li { padding: 0.15rem 0; }
.login-panel { max-width: 380px; margin: 3rem auto; }

/* check-out stats screen */
.stat-grid {
  display: flex;
  justify-content: center;
  gap: 1.6rem;
  flex-wrap: wrap;
  margin: 1.4rem 0 0.6rem;
}
.stat { min-width: 84px; }
.stat-num { font-size: 2rem; font-weight: 700; color: var(--accent); line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 0.85rem; }
.subjects-row { display: flex; justify-content: center; gap: 0.5rem; flex-wrap: wrap; margin: 0.8rem 0; }
.subject-chip {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.2rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
}

/* ---- tables ---- */
.table { width: 100%; border-collapse: collapse; margin: 0.4rem 0; }
.table th {
  text-align: left;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.4rem 0.6rem 0.4rem 0;
  border-bottom: 1px solid var(--border);
}
.table td { padding: 0.55rem 0.6rem 0.55rem 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: none; }

.bar {
  display: inline-block;
  width: 110px;
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  vertical-align: middle;
  margin-right: 0.5rem;
}
.fill { display: block; height: 100%; background: var(--good); border-radius: 999px; }

/* ---- forms & inline editors ---- */
form label { display: block; margin: 0.55rem 0 0.15rem; font-weight: 600; font-size: 0.88rem; }
form label.inline { display: inline-flex; align-items: center; gap: 0.35rem; margin-right: 1rem; font-weight: 500; }
input:not([type="checkbox"]), select {
  width: 100%;
  max-width: 420px;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.weekday-picks { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 0.4rem 0; }
.wd { display: inline-flex !important; align-items: center; gap: 0.25rem; font-weight: 500 !important; margin: 0 !important; }

/* week grid on the requirements page */
.week-scroll { overflow-x: auto; }
.week-grid { border-collapse: collapse; width: 100%; min-width: 460px; margin: 0.6rem 0; }
.week-grid th, .week-grid td { border-bottom: 1px solid var(--border); padding: 0.5rem 0.4rem; text-align: center; }
.week-grid thead th {
  font-size: 0.8rem; color: var(--muted); border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.week-grid th.corner, .week-grid td.track-cell {
  text-align: left; white-space: nowrap; position: sticky; left: 0;
  background: var(--bg); z-index: 1;
}
.week-grid td.track-cell { font-weight: 500; padding-right: 1rem; }
.week-grid td.track-cell.done { text-decoration: line-through; color: var(--muted); text-decoration-thickness: 1px; }
.tag.pct-green  { background: var(--good-soft); color: var(--good); text-decoration: none; display: inline-block; }
.tag.pct-yellow { background: var(--wait-soft); color: var(--wait); text-decoration: none; display: inline-block; }
.tag.pct-red    { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); text-decoration: none; display: inline-block; }
.week-grid .daycount {
  display: inline-block; margin-left: 0.35rem; min-width: 1.3rem;
  font-weight: 700; color: var(--accent); background: var(--accent-soft);
  border-radius: 999px; padding: 0 0.35rem;
}
.week-grid th.weekend, .week-grid td.weekend { background: color-mix(in srgb, var(--muted) 8%, transparent); }
.week-grid tr.off { opacity: 0.5; }
.mark { font-size: 1.05rem; line-height: 1; }
.mark.req { color: var(--good); }
.mark.opt { color: var(--muted); }
.legend { margin-top: 0.2rem; }

/* status pills (parent Today table) */
.status-pill {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}
.status-verified { background: var(--good-soft); color: var(--good); }
.status-todo { background: var(--wait-soft); color: var(--wait); }
.status-pending { background: color-mix(in srgb, var(--wait) 22%, transparent); color: var(--wait); }

/* live check-in clock (parent dashboard) */
#school-clock { font-weight: 700; }
#school-clock.clock-red { color: var(--danger); }
#school-clock.clock-yellow { color: var(--wait); }
#school-clock.clock-green { color: var(--good); }

details.editor { margin-top: 0.3rem; }
details.editor > summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.88rem;
  list-style: none;
}
details.editor > summary::before { content: "▸ "; }
details.editor[open] > summary::before { content: "▾ "; }
details.editor > .editor-body {
  border-left: 3px solid var(--border);
  padding: 0.2rem 0 0.6rem 1rem;
  margin: 0.4rem 0 0.2rem;
}
.editor-body form { margin-bottom: 0.8rem; }
.editor-body button { margin-top: 0.5rem; }
