:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172421;
  background: #f4f7f6;
  font-synthesis: none;
  --ink: #172421;
  --muted: #65736f;
  --line: #dce6e2;
  --paper: #ffffff;
  --green: #0b5d57;
  --green-2: #14776d;
  --mint: #e9f5f1;
  --navy: #123044;
  --red: #b33c3c;
  --red-bg: #fff0f0;
  --shadow: 0 18px 50px rgba(31, 66, 57, 0.08);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #f4f7f6; }
button, input { font: inherit; }
a { color: inherit; text-decoration: none; }

.btn { border: 0; border-radius: 12px; padding: 11px 15px; font-weight: 800; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: .16s ease; }
.btn:disabled { opacity: .48; cursor: not-allowed; }
.btn-primary { background: var(--green); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--green-2); transform: translateY(-1px); }
.btn-secondary { background: #eef4f2; color: var(--green); border: 1px solid #d8e7e2; }
.full { width: 100%; }
.button-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.button-row.end { justify-content: flex-end; }

.eyebrow, .brand-overline { color: var(--green); font-size: 11px; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }

.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.08fr .92fr; }
.login-brand-panel { padding: clamp(42px, 8vw, 100px); background: linear-gradient(145deg, #092f31, #0b5d57 58%, #166f62); color: white; display: flex; flex-direction: column; justify-content: center; }
.login-brand-panel .brand-overline { color: #8fdbca; }
.login-brand-panel h1 { font-size: clamp(38px, 5vw, 68px); line-height: 1.02; max-width: 760px; letter-spacing: -.045em; margin: 16px 0 22px; }
.login-brand-panel > p { max-width: 620px; color: #c8dfd8; font-size: 17px; line-height: 1.65; }
.login-feature-grid { display: grid; grid-template-columns: 1fr 1fr; max-width: 620px; gap: 12px; margin-top: 30px; }
.login-feature-grid div { border: 1px solid rgba(255,255,255,.16); border-radius: 14px; padding: 16px; display: flex; gap: 12px; align-items: center; background: rgba(255,255,255,.055); }
.login-feature-grid strong { color: #90dfcd; }
.login-feature-grid span { font-size: 13px; font-weight: 750; }
.login-form-panel { display: grid; place-items: center; padding: 28px; background: #f6f9f8; }
.login-card { width: min(460px, 100%); background: white; border: 1px solid var(--line); border-radius: 24px; padding: clamp(24px, 5vw, 42px); box-shadow: var(--shadow); }
.login-card h2 { font-size: 34px; margin: 13px 0 5px; letter-spacing: -.03em; }
.login-card > p { color: var(--muted); margin-top: 0; }
.logo-mark { width: 40px; height: 40px; display: grid; place-items: center; background: var(--green); color: white; border-radius: 12px; font-weight: 900; letter-spacing: -.04em; }
.logo-mark.large { width: 52px; height: 52px; border-radius: 15px; margin-bottom: 18px; }
.form-stack { display: grid; gap: 14px; margin-top: 24px; }
label { display: grid; gap: 7px; color: #34443f; font-size: 12px; font-weight: 800; }
input { width: 100%; border: 1px solid var(--line); background: #fbfcfc; padding: 12px 13px; border-radius: 10px; outline: none; color: var(--ink); }
input:focus { border-color: #78ab9c; box-shadow: 0 0 0 3px #e2f1ec; }
.demo-box { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.demo-box > span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.build-label { display: block; margin-top: 24px; color: #9ba7a3; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 245px 1fr; }
.sidebar { background: #102e2f; color: white; padding: 22px 15px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.logo-block { display: flex; gap: 11px; align-items: center; padding: 4px 8px 20px; }
.logo-block strong { display: block; font-size: 14px; }
.logo-block span { display: block; color: #9bb8b1; font-size: 10px; margin-top: 2px; }
.nav-list { display: grid; gap: 5px; margin-top: 14px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 11px; border-radius: 11px; color: #bdd1cc; font-size: 13px; font-weight: 750; }
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,.09); color: white; }
.nav-icon { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 8px; background: rgba(255,255,255,.08); font-size: 9px; font-weight: 900; }
.sidebar-bottom { margin-top: auto; display: grid; gap: 12px; padding: 10px 8px 0; }
.sidebar-bottom small { color: #6f9088; }
.user-mini { display: flex; gap: 9px; align-items: center; }
.avatar { width: 35px; height: 35px; border-radius: 50%; background: #1f6b62; display: grid; place-items: center; font-weight: 900; }
.user-mini strong, .user-mini span { display: block; }
.user-mini strong { font-size: 12px; }
.user-mini span { color: #8fb0a8; font-size: 10px; text-transform: capitalize; margin-top: 2px; }
.text-button { padding: 0; border: 0; background: none; color: #d6e4e0; cursor: pointer; text-align: left; font-size: 12px; }
.demo-chip { width: max-content; font-size: 9px; padding: 5px 7px; border-radius: 999px; background: #d9a942; color: #2d230e; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; }
.main-content { padding: 34px clamp(20px, 4vw, 54px) 60px; overflow: hidden; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 25px; }
.page-head h1 { font-size: clamp(30px, 4vw, 46px); letter-spacing: -.04em; margin: 6px 0 7px; line-height: 1; }
.page-head p { color: var(--muted); margin: 0; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card { background: white; border: 1px solid var(--line); border-radius: 17px; padding: 18px; box-shadow: 0 8px 30px rgba(31,66,57,.04); }
.stat-card span, .stat-card small { display: block; color: var(--muted); }
.stat-card span { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.stat-card strong { display: block; font-size: 28px; letter-spacing: -.04em; margin: 9px 0 3px; }
.stat-card small { font-size: 11px; }
.panel { background: white; border: 1px solid var(--line); border-radius: 18px; padding: 20px; margin-top: 16px; box-shadow: 0 7px 28px rgba(31,66,57,.035); }
.panel-head { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.panel-head h2 { margin: 0 0 3px; font-size: 20px; }
.panel-head p { margin: 0; color: var(--muted); font-size: 12px; }
.two-col { display: grid; grid-template-columns: 1.1fr .9fr; gap: 16px; }
.two-col .panel { margin-top: 0; }
.check-list { display: grid; gap: 10px; }
.check-row { display: flex; gap: 11px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.check-row > span { width: 28px; height: 28px; border-radius: 50%; background: #edf3f1; display: grid; place-items: center; color: var(--green); font-weight: 900; }
.check-row.done > span { background: #dff2e9; }
.check-row strong, .check-row small { display: block; }
.check-row strong { font-size: 12px; }
.check-row small { color: var(--muted); margin-top: 3px; }
.architecture-card { display: grid; gap: 8px; }
.architecture-card div { background: #f5f8f7; border-radius: 11px; padding: 12px 13px; display: flex; justify-content: space-between; gap: 14px; }
.architecture-card span { color: var(--muted); font-size: 12px; }
.architecture-card strong { font-size: 12px; }
.test-list { display: grid; gap: 10px; }
.test-row { display: flex; justify-content: space-between; align-items: center; gap: 18px; border: 1px solid var(--line); border-radius: 14px; padding: 15px; }
.test-row h3 { margin: 8px 0 3px; font-size: 15px; }
.test-row p { margin: 0; color: var(--muted); font-size: 11px; }
.status-pill { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 999px; font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; }
.status-pill.published, .status-pill.active { background: #e3f5eb; color: #17643f; }
.status-pill.draft { background: #f1f2f3; color: #66716e; }
.progress-list { display: grid; gap: 16px; }
.progress-title { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 7px; }
.progress-title strong { font-size: 12px; }
.progress-title span { color: var(--muted); font-size: 10px; }
.progress-track { height: 9px; border-radius: 999px; background: #edf2f0; overflow: hidden; }
.progress-track > div { height: 100%; background: linear-gradient(90deg, var(--green), #36a488); border-radius: inherit; }
.table-panel { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 620px; }
th, td { text-align: left; padding: 15px 18px; border-bottom: 1px solid #edf1ef; font-size: 12px; }
th { color: #6d7b77; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; background: #f9fbfa; }
td strong, td small { display: block; }
td small { margin-top: 3px; color: var(--muted); }
.panel-loading { padding: 22px; text-align: center; color: var(--muted); }
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.batch-card { background: white; border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: 0 8px 30px rgba(31,66,57,.04); }
.batch-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 10px; }
.batch-card h3 { margin: 18px 0 30px; font-size: 18px; }
.batch-count { margin-bottom: 16px; }
.batch-count strong { display: block; font-size: 28px; letter-spacing: -.04em; }
.batch-count span { color: var(--muted); font-size: 10px; }
.callout-panel { background: linear-gradient(135deg, #102e2f, #0b5d57); color: white; }
.callout-panel .eyebrow { color: #8fdbca; }
.callout-panel h2 { margin: 8px 0; }
.callout-panel p { color: #cce0da; max-width: 850px; line-height: 1.6; }
.alert { border-radius: 11px; padding: 11px 13px; font-size: 12px; margin: 10px 0; }
.alert.error { color: #8e2f2f; background: var(--red-bg); border: 1px solid #efc7c7; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(10,24,22,.46); display: grid; place-items: center; padding: 18px; z-index: 20; }
.modal { width: min(560px, 100%); background: white; border-radius: 20px; padding: 22px; box-shadow: 0 24px 70px rgba(0,0,0,.2); }
.modal-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 18px; }
.modal h2 { margin: 5px 0 0; }
.icon-button { border: 0; background: #eff4f2; width: 33px; height: 33px; border-radius: 9px; cursor: pointer; font-size: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.span-2 { grid-column: 1 / -1; }
.modal-note { background: #f5f8f7; border-radius: 10px; padding: 11px; color: var(--muted); font-size: 11px; line-height: 1.5; margin: 15px 0; }

.test-page { min-height: 100vh; padding: clamp(18px, 5vw, 60px); background: #edf3f1; display: grid; place-items: start center; }
.test-card { width: min(660px, 100%); background: white; border: 1px solid var(--line); border-radius: 22px; padding: clamp(22px, 4vw, 34px); box-shadow: var(--shadow); }
.test-card.wide { width: min(900px, 100%); }
.test-topbar { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.test-topbar h2 { margin: 5px 0; font-size: 19px; }
.question-counter { color: var(--green); background: #edf7f4; padding: 7px 9px; border-radius: 9px; font-size: 11px; font-weight: 900; }
.test-progress { height: 7px; background: #edf2f0; border-radius: 999px; overflow: hidden; margin: 18px 0 28px; }
.test-progress > div { height: 100%; background: var(--green); }
.test-question { font-size: clamp(20px, 3vw, 27px); line-height: 1.35; letter-spacing: -.02em; margin: 0 0 20px; }
.option-list { display: grid; gap: 10px; }
.test-option { width: 100%; text-align: left; border: 1px solid var(--line); background: white; border-radius: 13px; padding: 13px; display: flex; gap: 11px; align-items: center; cursor: pointer; color: var(--ink); }
.test-option > span { width: 30px; height: 30px; display: grid; place-items: center; background: #eff4f2; border-radius: 8px; color: var(--green); font-weight: 900; }
.test-option.selected { border-color: #5e9a8a; background: #f0f8f5; box-shadow: 0 0 0 2px #dceee8; }
.test-option.selected > span { background: var(--green); color: white; }
.test-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 24px; }
.test-note { margin-top: 12px; color: #97661d; background: #fff7e8; border-radius: 9px; padding: 9px 11px; font-size: 11px; }
.results-page .test-card > h1 { font-size: 64px; margin: 10px 0 0; letter-spacing: -.06em; }
.result-lead { margin-top: 0; color: var(--muted); }
.review-list { display: grid; gap: 10px; margin: 24px 0; }
.review-card { padding: 15px; border-radius: 13px; border: 1px solid var(--line); }
.review-card.correct { background: #f2fbf5; border-color: #cae9d3; }
.review-card.incorrect { background: #fff6f6; border-color: #eccccc; }
.review-card strong { display: block; margin-bottom: 8px; }
.review-card p, .review-card small { display: block; margin: 5px 0; line-height: 1.5; }
.review-card p { font-size: 12px; }
.review-card small { color: var(--muted); }
.correct-answer { color: #17643f; font-weight: 800; }

.crash-page, .loading-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #f3f7f5; }
.crash-card { width: min(620px, 100%); background: white; border: 1px solid var(--line); border-radius: 20px; padding: 30px; box-shadow: var(--shadow); }
.crash-card h1 { font-size: 38px; margin: 8px 0; letter-spacing: -.04em; }
.crash-card p { color: var(--muted); line-height: 1.6; }
.error-code { margin: 18px 0; padding: 12px; border-radius: 10px; background: #fff1f1; color: #8c3434; font-family: ui-monospace, monospace; font-size: 12px; }
.spinner { width: 28px; height: 28px; border: 3px solid #dce7e3; border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
.loading-screen { align-content: center; gap: 10px; color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state { text-align: center; padding: 34px; }
.empty-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin: auto; }

@media (max-width: 1000px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .card-grid { grid-template-columns: 1fr 1fr; }
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .login-page { grid-template-columns: 1fr; }
  .login-brand-panel { display: none; }
  .login-form-panel { min-height: 100vh; }
  .shell { display: block; }
  .sidebar { position: relative; height: auto; padding: 14px; }
  .nav-list { grid-template-columns: repeat(4, 1fr); overflow-x: auto; }
  .nav-item { justify-content: center; padding: 9px; font-size: 11px; }
  .nav-icon { display: none; }
  .sidebar-bottom { display: none; }
  .main-content { padding: 24px 14px 50px; }
  .page-head { flex-direction: column; }
  .page-head > .button-row, .page-head > .btn { width: 100%; }
  .page-head > .button-row .btn { flex: 1; }
  .stats-grid, .card-grid { grid-template-columns: 1fr; }
  .test-row { align-items: flex-start; flex-direction: column; }
  .test-row .btn { width: 100%; }
  .progress-title { align-items: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}

/* v0.2.1 — Custom student fields & real student creation */
select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfcfc;
  padding: 12px 13px;
  border-radius: 10px;
  outline: none;
  color: var(--ink);
  font: inherit;
}
select:focus, textarea:focus { border-color: #78ab9c; box-shadow: 0 0 0 3px #e2f1ec; }
textarea { resize: vertical; min-height: 90px; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--green); }
input[type="file"] { padding: 9px; background: #f8fbfa; }
.alert.success { color: #17643f; background: #eaf8f0; border: 1px solid #bfe4cd; }
.alert.warning { color: #7a5413; background: #fff7e8; border: 1px solid #efd7a9; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.mini-stats > div { background: white; border: 1px solid var(--line); border-radius: 15px; padding: 15px 17px; }
.mini-stats strong { display: block; font-size: 24px; letter-spacing: -.04em; }
.mini-stats span { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; }
.table-actions { display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.btn-small { padding: 7px 10px; border-radius: 9px; font-size: 10px; }
.text-action { border: 0; background: transparent; color: var(--green); font-weight: 800; cursor: pointer; font-size: 10px; padding: 5px; }
.callout-soft { background: #f7faf9; }
.callout-soft strong { font-size: 13px; }
.callout-soft p { color: var(--muted); font-size: 12px; line-height: 1.55; margin: 6px 0 0; }
.modal-large { width: min(720px, 100%); max-height: min(88vh, 900px); overflow-y: auto; }
.modal-xlarge { width: min(860px, 100%); max-height: min(92vh, 980px); overflow-y: auto; }
.modal-subtitle { color: var(--muted); margin: 7px 0 0; font-size: 11px; line-height: 1.45; }
.toggle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check-control { display: flex; grid-template-columns: none; flex-direction: row; align-items: flex-start; gap: 10px; border: 1px solid var(--line); border-radius: 11px; padding: 11px; background: #fbfcfc; cursor: pointer; }
.check-control > input { flex: 0 0 auto; margin-top: 2px; }
.check-control span { display: block; }
.check-control strong, .check-control small { display: block; }
.check-control strong { color: var(--ink); font-size: 11px; }
.check-control small { color: var(--muted); font-size: 9px; margin-top: 3px; line-height: 1.35; font-weight: 500; }
.check-control.compact { min-height: 47px; align-items: center; }
.choice-box { border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; display: grid; gap: 6px; background: #fbfcfc; }
.choice-line { display: flex; grid-template-columns: none; flex-direction: row; align-items: center; gap: 8px; font-size: 11px; font-weight: 600; }
.choice-line input { flex: 0 0 auto; }
.form-section-title { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; padding-bottom: 9px; border-bottom: 1px solid #edf1ef; margin-bottom: 13px; }
.form-section-title strong { font-size: 13px; }
.form-section-title span { color: var(--muted); font-size: 10px; }
.section-gap { margin-top: 24px; }
.label-line { display: inline-flex; align-items: center; gap: 4px; }
.label-line em { color: #b33c3c; font-style: normal; }
.field-help { color: var(--muted); font-size: 9px; font-weight: 500; line-height: 1.35; }
.sticky-actions { position: sticky; bottom: -22px; margin: 22px -22px -22px; padding: 14px 22px; background: rgba(255,255,255,.96); border-top: 1px solid var(--line); backdrop-filter: blur(8px); }

@media (max-width: 760px) {
  .mini-stats { grid-template-columns: 1fr; }
  .toggle-grid { grid-template-columns: 1fr; }
  .form-section-title { align-items: flex-start; flex-direction: column; gap: 3px; }
}
