:root {
  --ink: #1d2738;
  --muted: #647084;
  --line: #dce3ee;
  --paper: #ffffff;
  --canvas: #f4f7fb;
  --brand: #5b3fd4;
  --brand-dark: #4027af;
  --cyan: #12a6b5;
  --success: #14845f;
  --success-bg: #e8f7f1;
  --warning: #a25b07;
  --warning-bg: #fff3dc;
  --danger: #b33a43;
  --danger-bg: #fff0f1;
  --shadow: 0 12px 32px rgba(36, 49, 75, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; line-height: 1.55; }
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(2rem, 5vw, 3.35rem); line-height: 1.06; letter-spacing: -.04em; margin-bottom: .7rem; }
h2 { line-height: 1.2; letter-spacing: -.02em; }
small, .muted { color: var(--muted); }
code, pre, textarea { font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace; }

.site-header { min-height: 68px; padding: 0 max(1.25rem, calc((100vw - 1180px)/2)); display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: #17142a; color: white; }
.site-header a { color: white; }
.brand { font-size: 1.2rem; letter-spacing: -.02em; }
.site-header nav { display: flex; align-items: center; gap: 1rem; }
.user-chip { padding: .32rem .7rem; border-radius: 999px; background: rgba(255,255,255,.12); font-size: .85rem; }
.inline-form { display: inline; margin: 0; }
.link-button { border: 0; padding: 0; background: transparent; color: white; font: inherit; cursor: pointer; }
.link-button:hover { text-decoration: underline; }

.container { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: 3rem 0 5rem; min-height: calc(100vh - 135px); }
footer { min-height: 67px; padding: 1.25rem; text-align: center; color: var(--muted); border-top: 1px solid var(--line); font-size: .86rem; }
.eyebrow { margin-bottom: .55rem; color: var(--brand); text-transform: uppercase; letter-spacing: .12em; font-weight: 800; font-size: .76rem; }
.page-heading { margin-bottom: 2rem; max-width: 800px; }
.page-heading p:last-child { color: var(--muted); font-size: 1.05rem; }
.split-heading { display: flex; max-width: none; align-items: flex-end; justify-content: space-between; gap: 2rem; }
.back-link { display: inline-block; margin-bottom: 1.35rem; font-weight: 700; }

.login-card { width: min(520px, 100%); margin: 5vh auto; background: var(--paper); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: clamp(1.5rem, 5vw, 3rem); }
.stack { display: grid; gap: 1rem; }
label { display: grid; gap: .38rem; color: #354157; font-weight: 700; font-size: .93rem; }
input, textarea { width: 100%; border: 1px solid #bdc8d8; border-radius: 10px; padding: .78rem .88rem; font: inherit; color: var(--ink); background: white; }
textarea { font-family: "Cascadia Code", Consolas, monospace; line-height: 1.55; resize: vertical; tab-size: 4; }
input:focus, textarea:focus { outline: 3px solid rgba(91, 63, 212, .17); border-color: var(--brand); }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: .62rem 1rem; border: 1px solid #b7c2d3; border-radius: 9px; background: white; color: var(--ink); font: inherit; font-weight: 800; cursor: pointer; text-decoration: none; }
.button:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.button.primary { background: var(--brand); border-color: var(--brand); color: white; }
.button.primary:hover { background: var(--brand-dark); }
.button.small { min-height: 34px; padding: .35rem .65rem; font-size: .82rem; }
.button.danger { color: var(--danger); border-color: #e7b7bb; }
.wide { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }
.form-help { color: var(--muted); font-size: .85rem; }

.alert { padding: .85rem 1rem; border-radius: 10px; margin-bottom: 1.25rem; border: 1px solid var(--line); background: white; }
.alert-error { background: var(--danger-bg); border-color: #efc4c7; color: #862a31; }
.alert-success { background: var(--success-bg); border-color: #b7dfcf; color: #0d6649; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.card, .panel { background: var(--paper); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); }
.card { padding: 1.35rem; display: flex; flex-direction: column; min-height: 250px; }
.card h2 { margin: 1rem 0 .65rem; }
.card-topline, .card-footer, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.card-footer { margin-top: auto; padding-top: 1rem; color: var(--muted); font-size: .9rem; }
.clamp { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tag, .status { display: inline-flex; width: fit-content; padding: .27rem .58rem; border-radius: 999px; font-size: .76rem; font-weight: 800; }
.tag, .status.neutral { background: #eef1f6; color: #586478; }
.status.success { background: var(--success-bg); color: var(--success); }
.status.warning { background: var(--warning-bg); color: var(--warning); }
.success-text { color: var(--success); }
.empty-state, .message-card { padding: 3rem; text-align: center; border: 2px dashed #cbd4e2; border-radius: 15px; color: var(--muted); }

.two-column { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(260px, .75fr); gap: 1.3rem; align-items: start; }
.statement { white-space: pre-wrap; font-size: 1.05rem; margin: 1.4rem 0; }
.notice { padding: 1rem 1.1rem; border-left: 4px solid var(--cyan); background: #e9f8fa; border-radius: 0 10px 10px 0; margin: 1.5rem 0; }
.notice p { margin: .25rem 0 0; }
.file-input { padding: 1rem; border: 1px dashed #aab7ca; border-radius: 10px; background: white; }
.file-input input { padding: .55rem 0 0; border: 0; }
.panel { padding: 1.25rem; margin-bottom: 1.25rem; }
.panel h2 { font-size: 1.2rem; }
.sticky { position: sticky; top: 1rem; }
.history-list { margin: 0; padding-left: 1.35rem; }
.history-list li { padding: .55rem 0; border-bottom: 1px solid var(--line); }
.history-list li:last-child { border-bottom: 0; }
.history-list a { display: flex; justify-content: space-between; gap: .6rem; }

.result-hero { padding: clamp(1.5rem, 5vw, 3rem); border-radius: 18px; margin-bottom: 1.25rem; }
.result-pass { background: linear-gradient(135deg, #e2f7ed, #e8f9fa); border: 1px solid #b7dfcf; }
.result-progress { background: linear-gradient(135deg, #fff3dc, #fff8e9); border: 1px solid #f0d59e; }
.score { font-size: 1.5rem; font-weight: 900; }
.check-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .65rem; }
.check-list li { display: flex; gap: .8rem; align-items: flex-start; padding: .8rem; border-radius: 10px; }
.check-list p { margin: .18rem 0 0; color: var(--muted); }
.check-pass { background: var(--success-bg); }
.check-fail { background: var(--danger-bg); }
.check-icon { flex: 0 0 28px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; color: white; font-weight: 900; }
.check-pass .check-icon { background: var(--success); }
.check-fail .check-icon { background: var(--danger); }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
.metric { padding: 1.15rem; border: 1px solid var(--line); border-radius: 13px; background: white; }
.metric span { display: block; color: var(--muted); font-size: .85rem; }
.metric strong { display: block; font-size: 2rem; line-height: 1.2; margin-top: .4rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .91rem; }
th, td { padding: .76rem .65rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:hover { background: #fafbfe; }

.teacher-detail { grid-template-columns: minmax(0, 1fr) minmax(320px, 1fr); }
.code-block { max-height: 70vh; overflow: auto; margin: 0; padding: 1rem; border-radius: 9px; background: #171a26; color: #eef2ff; white-space: pre-wrap; word-break: break-word; }
.test-details { display: grid; gap: .6rem; }
details { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
summary { padding: .75rem; cursor: pointer; font-weight: 800; }
.test-ok summary { background: var(--success-bg); color: var(--success); }
.test-bad summary { background: var(--danger-bg); color: var(--danger); }
details dl { padding: 0 .8rem .8rem; }
details dt { font-weight: 800; margin-top: .6rem; }
details dd { margin: .15rem 0; }
details pre { margin: 0; padding: .55rem; background: #f4f6fa; border-radius: 7px; white-space: pre-wrap; word-break: break-word; }

.users-layout { grid-template-columns: minmax(280px, .7fr) minmax(0, 1.3fr); }
.user-list { display: grid; gap: .75rem; }
.user-row { padding: .9rem; border: 1px solid var(--line); border-radius: 10px; display: grid; gap: .7rem; }
.user-row.inactive { opacity: .58; }
.user-row span { display: block; color: var(--muted); font-size: .85rem; }
.user-actions, .compact-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.compact-form { flex: 1; }
.compact-form input { min-width: 130px; flex: 1; padding: .45rem .6rem; }
.separator { margin: 1.6rem 0; border: 0; border-top: 1px solid var(--line); }

@media (max-width: 820px) {
  .container { padding-top: 2rem; }
  .two-column, .teacher-detail, .users-layout { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .split-heading { align-items: flex-start; flex-direction: column; }
  .sticky { position: static; }
  .user-chip { display: none; }
}

@media (max-width: 560px) {
  .site-header { align-items: flex-start; padding-top: .9rem; padding-bottom: .9rem; }
  .site-header nav { flex-wrap: wrap; justify-content: flex-end; font-size: .86rem; gap: .55rem .8rem; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .card-footer { align-items: flex-start; flex-direction: column; }
  .card-footer .button { width: 100%; }
  .panel { padding: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
