:root {
  --ink: #20201d;
  --muted: #6d6b64;
  --paper: #f4f2ec;
  --surface: #fffefa;
  --line: #dcd9cf;
  --accent: #5b5bea;
  --accent-dark: #4545c7;
  --mint: #cdebd9;
  --mint-ink: #23694f;
  --amber: #f2d58e;
  --amber-ink: #7c5713;
  --rose: #f2cbc3;
  --rose-ink: #8d3f31;
  --shadow: 0 18px 50px rgba(32, 32, 29, .10);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--paper); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
.noise { position: fixed; inset: 0; pointer-events: none; opacity: .025; z-index: 20; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E"); }
[hidden] { display: none !important; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 21px; font-weight: 850; text-decoration: none; letter-spacing: -.04em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; color: white; background: var(--accent); border-radius: 10px 10px 10px 3px; font-size: 19px; transform: rotate(-3deg); }
.brand--large { position: absolute; top: 42px; left: 48px; font-size: 25px; }
.brand--large .brand-mark { width: 40px; height: 40px; font-size: 22px; }

.login-view { min-height: 100vh; padding: 24px; display: grid; place-items: center; overflow: hidden; }
.login-shell { position: relative; width: min(1180px, 100%); min-height: 690px; display: grid; grid-template-columns: 1.05fr .95fr; align-items: center; gap: 56px; padding: 90px 76px 64px; border: 1px solid rgba(32,32,29,.14); border-radius: 32px; background: #ebe8df; box-shadow: var(--shadow); overflow: hidden; }
.login-shell::before { content: ""; position: absolute; width: 560px; height: 560px; left: -160px; bottom: -270px; border: 110px solid var(--accent); border-radius: 50%; opacity: .92; }
.login-shell::after { content: "✓"; position: absolute; right: 40%; top: 6%; color: rgba(91,91,234,.12); font-size: 230px; font-weight: 900; transform: rotate(-11deg); }
.login-copy { position: relative; z-index: 1; align-self: center; max-width: 520px; }
.eyebrow { margin: 0 0 10px; color: var(--accent-dark); font-size: 12px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.login-copy h1 { margin: 0; font-size: clamp(58px, 7vw, 96px); line-height: .91; letter-spacing: -.075em; }
.login-copy h1 em { color: var(--accent); font-family: Georgia, serif; font-weight: 500; }
.login-copy > p:last-child { max-width: 440px; margin: 30px 0 0; color: var(--muted); font-size: 20px; line-height: 1.5; }
.login-panel { position: relative; z-index: 2; padding: 34px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: 0 26px 70px rgba(32,32,29,.14); }
.login-panel__head { display: flex; justify-content: space-between; align-items: start; gap: 16px; }
.login-panel h2, .modal-card h2 { margin: 0; font-size: 30px; letter-spacing: -.045em; }
.demo-pill { padding: 6px 9px; border: 1px solid #aba9f5; border-radius: 99px; color: var(--accent-dark); background: #eeeeff; font-size: 10px; font-weight: 850; letter-spacing: .09em; }
.user-list { display: grid; gap: 10px; margin-top: 24px; }
.user-card { width: 100%; display: flex; align-items: center; gap: 13px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: white; text-align: left; cursor: pointer; transition: .18s ease; }
.user-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 22px rgba(91,91,234,.12); }
.user-card strong { display: block; font-size: 15px; }
.user-card small { color: var(--muted); }
.user-card__arrow { margin-left: auto; color: var(--accent); font-size: 20px; }
.user-list__students { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.user-list__label { margin: 8px 0 0; color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.login-note { margin: 18px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.skeleton { height: 58px; border-radius: 14px; background: linear-gradient(100deg, #eee 30%, #f8f8f8 50%, #eee 70%); background-size: 300% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -150% 0; } }

.avatar { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; color: white; background: var(--avatar, var(--accent)); font-size: 13px; font-weight: 800; }
.avatar--small { width: 34px; height: 34px; font-size: 11px; }
.topbar { position: sticky; top: 0; z-index: 10; height: 74px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100vw - 1240px)/2)); border-bottom: 1px solid var(--line); background: rgba(244,242,236,.88); backdrop-filter: blur(16px); }
.topbar__actions { display: flex; align-items: center; gap: 10px; }
.profile-button, .icon-button { display: flex; align-items: center; gap: 10px; padding: 6px 9px; border: 1px solid transparent; border-radius: 12px; background: transparent; cursor: pointer; }
.profile-button:hover, .icon-button:hover { border-color: var(--line); background: var(--surface); }
.profile-button__copy { display: grid; text-align: left; }
.profile-button__copy strong { font-size: 13px; }
.profile-button__copy small { color: var(--muted); font-size: 11px; }
.icon-button { padding: 10px 12px; color: var(--muted); font-size: 12px; font-weight: 750; }
.main-content { width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding: 46px 0 80px; }

.page-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.page-head h1 { margin: 0; font-size: clamp(36px, 5vw, 56px); letter-spacing: -.065em; line-height: 1; }
.page-head p:not(.eyebrow) { margin: 12px 0 0; color: var(--muted); }
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 17px; border: 1px solid transparent; border-radius: 12px; font-weight: 750; cursor: pointer; transition: .15s ease; }
.button:hover { transform: translateY(-1px); }
.button--primary { color: white; background: var(--accent); box-shadow: 0 7px 18px rgba(91,91,234,.22); }
.button--primary:hover { background: var(--accent-dark); }
.button--ghost { border-color: var(--line); background: var(--surface); }
.button--small { min-height: 36px; padding: 0 13px; font-size: 12px; }
.button:disabled { opacity: .55; cursor: wait; transform: none; }

.summary-strip { display: grid; grid-template-columns: 1.3fr repeat(3, .7fr); margin-bottom: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.summary-item { min-height: 100px; display: flex; flex-direction: column; justify-content: center; padding: 20px 24px; border-left: 1px solid var(--line); }
.summary-item:first-child { border-left: 0; }
.summary-item small { color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; }
.summary-item strong { margin-top: 5px; font-size: 25px; letter-spacing: -.04em; }
.summary-item--class strong { font-size: 30px; }
.class-meta { display: flex; gap: 8px; margin-top: 8px; }
.tag { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 8px; color: var(--muted); background: #efede7; font-size: 11px; font-weight: 700; }
.workspace { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; box-shadow: 0 12px 34px rgba(32,32,29,.05); }
.workspace-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.workspace-toolbar h2 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 11px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.legend .is-submitted { background: var(--amber-ink); }
.legend .is-graded { background: var(--mint-ink); }

.grid-scroll { overflow-x: auto; }
.submission-grid { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.submission-grid th, .submission-grid td { min-width: 138px; padding: 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); vertical-align: middle; }
.submission-grid th:last-child, .submission-grid td:last-child { border-right: 0; }
.submission-grid tr:last-child td { border-bottom: 0; }
.submission-grid thead th { position: sticky; top: 0; z-index: 2; background: #f9f8f4; text-align: left; font-size: 11px; }
.submission-grid thead th:first-child, .submission-grid tbody td:first-child { position: sticky; left: 0; z-index: 3; min-width: 190px; background: var(--surface); }
.submission-grid thead th:first-child { z-index: 4; background: #f9f8f4; }
.assignment-head { display: grid; gap: 4px; }
.assignment-head strong { font-size: 12px; line-height: 1.25; }
.assignment-head small { color: var(--muted); font-weight: 500; }
.student-cell { display: flex; align-items: center; gap: 9px; font-weight: 700; }
.grid-cell { width: 100%; min-height: 50px; display: grid; place-items: center; gap: 2px; padding: 7px; border: 0; border-radius: 10px; background: #efede7; color: var(--muted); cursor: default; }
.grid-cell small { font-size: 9px; text-transform: uppercase; letter-spacing: .05em; }
button.grid-cell { cursor: pointer; }
button.grid-cell:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.grid-cell--submitted { color: var(--amber-ink); background: var(--amber); }
.grid-cell--graded { color: var(--mint-ink); background: var(--mint); }
.grid-cell--late { color: var(--rose-ink); background: #f5ded9; }
.grid-cell__grade { font-size: 20px; font-weight: 850; }
.empty-state { padding: 60px 24px; text-align: center; }
.empty-state__icon { width: 58px; height: 58px; display: grid; place-items: center; margin: 0 auto 16px; border-radius: 50%; color: var(--accent); background: #ececff; font-size: 25px; }
.empty-state h3 { margin: 0 0 8px; }
.empty-state p { max-width: 420px; margin: 0 auto 20px; color: var(--muted); }

.student-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 22px; align-items: start; }
.assignment-list { display: grid; gap: 13px; }
.assignment-card { display: grid; grid-template-columns: 8px minmax(0,1fr) auto; gap: 18px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 25px rgba(32,32,29,.035); }
.assignment-card__bar { border-radius: 99px; background: var(--accent); }
.assignment-card--graded .assignment-card__bar { background: var(--mint-ink); }
.assignment-card--submitted .assignment-card__bar { background: var(--amber-ink); }
.assignment-card--late .assignment-card__bar { background: var(--rose-ink); }
.assignment-card h2 { margin: 4px 0 8px; font-size: 20px; letter-spacing: -.03em; }
.assignment-card p { margin: 0; color: var(--muted); line-height: 1.45; }
.assignment-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.status { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 8px; font-size: 11px; font-weight: 750; background: #efede7; }
.status--graded { color: var(--mint-ink); background: var(--mint); }
.status--submitted { color: var(--amber-ink); background: var(--amber); }
.status--late { color: var(--rose-ink); background: var(--rose); }
.assignment-card__action { align-self: center; min-width: 120px; }
.grade-note { margin-top: 14px !important; padding: 11px 13px; border-radius: 10px; color: var(--mint-ink) !important; background: #ecf7f0; font-size: 13px; }
.side-card { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #ebe8df; }
.side-card h3 { margin: 0 0 8px; font-size: 16px; }
.side-card p { margin: 0 0 16px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.inline-form { display: grid; gap: 9px; }
.inline-form input { width: 100%; text-transform: uppercase; }

label { display: grid; gap: 7px; color: var(--ink); font-size: 12px; font-weight: 750; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 12px 13px; color: var(--ink); background: white; outline: none; transition: border .15s, box-shadow .15s; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91,91,234,.12); }
.muted { color: var(--muted); line-height: 1.5; }
.field-hint { margin: -4px 0 0; color: var(--muted); font-size: 11px; }

.modal { width: min(620px, calc(100% - 28px)); max-height: calc(100vh - 28px); padding: 0; border: 0; border-radius: 22px; background: transparent; box-shadow: var(--shadow); overflow: visible; }
.modal::backdrop { background: rgba(32,32,29,.48); backdrop-filter: blur(5px); }
.modal-card { position: relative; display: grid; gap: 18px; max-height: calc(100vh - 28px); padding: 32px; border: 1px solid rgba(255,255,255,.4); border-radius: 22px; background: var(--surface); overflow-y: auto; }
.modal-close { position: absolute; right: 18px; top: 17px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: #efede7; color: var(--muted); font-size: 21px; cursor: pointer; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 3px; }
.answer-preview { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: #f5f3ed; line-height: 1.5; }
.answer-preview p { margin: 0 0 8px; white-space: pre-wrap; }
.answer-preview a { color: var(--accent-dark); font-weight: 700; }
.grade-picker { display: flex; gap: 8px; margin: 0; padding: 0; border: 0; }
.grade-picker legend { margin-bottom: 8px; font-size: 12px; font-weight: 750; }
.grade-picker label { flex: 1; }
.grade-picker input { position: absolute; opacity: 0; pointer-events: none; }
.grade-picker span { display: grid; place-items: center; height: 44px; border: 1px solid var(--line); border-radius: 10px; background: white; cursor: pointer; }
.grade-picker input:checked + span { border-color: var(--accent); color: white; background: var(--accent); box-shadow: 0 5px 14px rgba(91,91,234,.2); }
.modal--wide { width: min(760px, calc(100% - 28px)); }
.outbox-list { display: grid; gap: 9px; }
.outbox-message { padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #f7f5ef; }
.outbox-message__head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; font-size: 12px; }
.outbox-message code { color: var(--accent-dark); }
.outbox-message p { margin: 0; color: var(--muted); font-size: 12px; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 24px; max-width: calc(100% - 32px); padding: 12px 17px; border-radius: 12px; color: white; background: var(--ink); box-shadow: var(--shadow); opacity: 0; transform: translate(-50%, 16px); pointer-events: none; transition: .22s ease; font-size: 13px; font-weight: 650; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--rose-ink); }

@media (max-width: 850px) {
  .login-shell { grid-template-columns: 1fr; gap: 34px; min-height: auto; padding: 96px 36px 40px; }
  .brand--large { top: 28px; left: 36px; }
  .login-copy > p:last-child { margin-top: 18px; }
  .login-shell::before { opacity: .18; }
  .login-shell::after { right: -20px; top: 4%; }
  .summary-strip { grid-template-columns: 1fr 1fr; }
  .summary-item:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .summary-item:nth-child(4) { border-top: 1px solid var(--line); }
  .student-layout { grid-template-columns: 1fr; }
  .side-card { order: -1; }
}

@media (max-width: 600px) {
  .login-view { padding: 0; align-items: stretch; }
  .login-shell { min-height: 100vh; padding: 88px 18px 28px; border: 0; border-radius: 0; }
  .brand--large { top: 24px; left: 20px; }
  .login-copy h1 { font-size: 56px; }
  .login-copy > p:last-child { font-size: 16px; }
  .login-panel { padding: 22px; border-radius: 20px; }
  .user-list__students { grid-template-columns: 1fr; }
  .topbar { height: 66px; padding: 0 16px; }
  .desktop-only, .profile-button__copy { display: none; }
  .main-content { width: calc(100% - 28px); padding-top: 28px; }
  .page-head { align-items: start; flex-direction: column; margin-bottom: 22px; }
  .page-head .button { width: 100%; }
  .summary-strip { grid-template-columns: 1fr 1fr; }
  .summary-item { min-height: 82px; padding: 15px; }
  .summary-item--class { grid-column: span 2; border-left: 0; }
  .summary-item:nth-child(2) { border-left: 0; border-top: 1px solid var(--line); }
  .summary-item strong { font-size: 20px; }
  .workspace-toolbar { align-items: start; flex-direction: column; }
  .legend { flex-wrap: wrap; }
  .assignment-card { grid-template-columns: 7px minmax(0,1fr); gap: 13px; padding: 17px; }
  .assignment-card__action { grid-column: 2; width: 100%; }
  .modal-card { padding: 26px 20px 20px; }
  .modal-actions { display: grid; grid-template-columns: 1fr 1fr; }
}
