:root {
  --bg: #f1f5f9;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --accent: #0369a1;
  --border: #e2e8f0;
  --ok: #047857;
  --warn: #b45309;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, #dbeafe 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #e2e8f0 0%, transparent 50%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
  text-decoration: none;
}

.brand-logo img {
  display: block;
  height: 3.6rem;
  width: auto;
}

.brand { font-weight: 800; font-size: 1.15rem; }
.tagline {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}
.lede { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.9rem; }

.top-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.layout {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
  display: grid;
  gap: 1rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.1rem 1.15rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.panel h2 {
  margin: 0 0 0.55rem;
  font-size: 1.05rem;
}

.privacy {
  font-size: 0.8rem;
  color: var(--warn);
  margin: 0;
}

.heatmap, .obstacles, .learners {
  display: grid;
  gap: 0.5rem;
}

.subject-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.75rem;
}

.subject-filter-btn {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: white;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  color: #475569;
}

.subject-filter-btn.is-active {
  background: #0f172a;
  border-color: #0f172a;
  color: #f8fafc;
}

.roster-head {
  display: grid;
  grid-template-columns: 1.1fr 3.2rem minmax(8rem, 1.6fr) 4.2rem minmax(7rem, 1.1fr) minmax(6rem, 1.2fr) auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0 0.65rem 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #64748b;
}

.heat-row, .obs-row, .learner-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  font-size: 0.88rem;
}

.obs-row {
  grid-template-columns: auto 1.5fr 1fr auto;
  cursor: pointer;
}
.obs-row:hover {
  background: #eff6ff;
}
.learner-row {
  grid-template-columns: 1.1fr 3.2rem minmax(8rem, 1.6fr) 4.2rem minmax(7rem, 1.1fr) minmax(6rem, 1.2fr) auto;
}

.subject-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0.18rem 0.4rem;
  border-radius: 6px;
  background: #e2e8f0;
  color: #334155;
}

.subject-badge.subject-ma {
  background: #dbeafe;
  color: #1d4ed8;
}

.subject-badge.subject-en {
  background: #fce7f3;
  color: #9d174d;
}

.subject-badge.subject-none {
  background: #f1f5f9;
  color: #94a3b8;
}

.roster-points {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.roster-notice {
  color: #64748b;
  font-size: 0.82rem;
}

.heat-row strong, .obs-row strong { font-weight: 700; }

button, .ghost {
  font: inherit;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: white;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

button:disabled { opacity: 0.45; cursor: not-allowed; }

#assign-btn {
  background: var(--accent);
  color: white;
  border-color: transparent;
  font-weight: 700;
}

.assign-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.85rem;
  margin: 0.85rem 0 0.35rem;
}
.assign-kind-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink, #131b2e);
}
.assign-intervention {
  font: inherit;
  font-weight: 600;
  padding: 0.4rem 0.7rem;
  border-radius: 0.55rem;
  border: 1px solid #cbd5e1;
  background: #fff;
  min-width: 12rem;
}
.assign-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.75rem;
}

.teacher-login-form {
  display: grid;
  gap: 0.75rem;
  max-width: 28rem;
}

.teacher-login-form label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.teacher-login-form input {
  font: inherit;
  padding: 0.55rem 0.7rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.55rem;
  background: #fff;
}

.lede.tight {
  margin-top: 0.75rem;
  margin-bottom: 0;
}

.status { font-size: 0.85rem; color: var(--ok); }

.loop-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr));
  gap: 0.75rem;
}

.stat {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  min-width: 0;
  display: grid;
  gap: 0.25rem;
  align-content: start;
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--ink, #0f172a);
}

.stat b {
  display: block;
  font-size: 1.55rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat-hint {
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--muted);
}

.stat.stat-ok {
  border-color: #a7f3d0;
  background: #ecfdf5;
}

.stat.stat-bad {
  border-color: #fecdd3;
  background: #fff1f2;
}

.effectiveness { display: grid; gap: 0.5rem; }

.eff-table {
  display: grid;
  gap: 0.35rem;
}

.eff-head, .eff-row {
  display: grid;
  grid-template-columns: 1.4fr 1.1fr 0.9fr 0.9fr 0.9fr 1.4fr auto;
  gap: 0.45rem;
  align-items: start;
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.eff-head {
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid #cbd5e1;
}

.eff-row.verdict-not_helping { background: #fff7ed; }
.eff-row.verdict-helps { background: #ecfdf5; }
.eff-row.verdict-helps_short_term { background: #eff6ff; }
.eff-row.verdict-insufficient_data { opacity: 0.85; }

.eff-verdict { line-height: 1.35; }
.eff-note { margin: 0.35rem 0 0; font-size: 0.8rem; }

.detail {
  white-space: pre-wrap;
  font-size: 0.78rem;
  background: #0f172a;
  color: #e2e8f0;
  padding: 0.85rem;
  border-radius: 10px;
  overflow: auto;
  max-height: 320px;
}

.detail-rich {
  font-size: 0.9rem;
  line-height: 1.45;
}

.detail-rich h3 {
  margin: 1rem 0 0.35rem;
  font-size: 0.95rem;
}

.detail-rich ul {
  margin: 0.25rem 0 0;
  padding-left: 1.15rem;
}

.detail-rich li {
  margin: 0.25rem 0;
}

.detail-rich .muted,
.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.hidden { display: none !important; }

.next-actions {
  display: grid;
  gap: 0.65rem;
}

.next-card {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
}

.next-card p { margin: 0.35rem 0 0; font-size: 0.9rem; color: var(--muted); }
.next-card .muted { margin-top: 0.25rem; }

.next-primary {
  border-color: #7dd3fc;
  background: linear-gradient(180deg, #f0f9ff 0%, #ffffff 100%);
}

.next-card button {
  flex-shrink: 0;
  background: var(--accent);
  color: white;
  border-color: transparent;
  font-weight: 700;
}

.pipeline {
  display: grid;
  gap: 0.45rem;
}

.pipe-row {
  display: grid;
  grid-template-columns: 1.1fr auto 1.4fr;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  font-size: 0.88rem;
}

.pipe-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  white-space: nowrap;
}

.pipe-ok .pipe-badge, .pipe-badge.pipe-ok { background: #d1fae5; color: var(--ok); }
.pipe-bad .pipe-badge, .pipe-badge.pipe-bad { background: #fee2e2; color: #b91c1c; }
.pipe-warn .pipe-badge, .pipe-badge.pipe-warn { background: #ffedd5; color: var(--warn); }
.pipe-active .pipe-badge, .pipe-badge.pipe-active { background: #dbeafe; color: #1d4ed8; }

.live-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  background: #0f172a;
  color: #f8fafc;
  vertical-align: middle;
}

@media (max-width: 720px) {
  .roster-head { display: none; }
  .heat-row, .obs-row, .learner-row, .pipe-row, .next-card, .eff-head, .eff-row {
    grid-template-columns: 1fr;
  }
  .learner-row {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "name name"
      "subj topic"
      "pts status"
      "notice notice"
      "btn btn";
  }
  .learner-row .roster-name { grid-area: name; }
  .learner-row .subject-badge { grid-area: subj; justify-self: start; }
  .learner-row .roster-topic { grid-area: topic; }
  .learner-row .roster-points { grid-area: pts; }
  .learner-row .roster-status { grid-area: status; }
  .learner-row .roster-notice { grid-area: notice; }
  .learner-row button { grid-area: btn; justify-self: start; }
  .eff-head { display: none; }
  .next-card { flex-direction: column; }
}
