:root {
    --ink: #27283a;
    --muted: #73717a;
    --paper: #f8f6f1;
    --card: #fffefa;
    --line: #dedbd3;
    --accent: #5b4f8a;
    --accent-dark: #44386f;
    --accent-soft: #eeeaf8;
    --success: #39704a;
    --danger: #9b3f3f;
    --serif: 'EB Garamond', Georgia, serif;
    --sans: Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--sans); }
.hidden { display: none !important; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.workspace-header {
    position: sticky; top: 0; z-index: 20; min-height: 68px; padding: 0 5vw;
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 2rem;
    background: rgba(248, 246, 241, 0.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px);
}
.workspace-brand { display: inline-flex; align-items: center; gap: .65rem; color: var(--ink); text-decoration: none; font: 600 1.12rem var(--serif); }
.workspace-brand img { width: 32px; height: 32px; object-fit: contain; }
.workspace-nav { display: flex; align-items: center; gap: .25rem; padding: .25rem; background: #eeece6; border-radius: 999px; }
.workspace-nav a { padding: .45rem .9rem; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: .82rem; font-weight: 500; }
.workspace-nav a.active { color: var(--ink); background: var(--card); box-shadow: 0 1px 5px rgba(39,40,58,.1); }
.workspace-account { justify-self: end; display: flex; align-items: center; gap: .7rem; color: var(--muted); font-size: .78rem; }

.teacher-shell { width: min(1180px, 90vw); margin: 0 auto; padding: 3.4rem 0 7rem; }
.center-state { min-height: 65vh; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.center-state h1 { max-width: 650px; margin: .15rem 0 .65rem; font: 500 clamp(2rem, 5vw, 3.5rem)/1.05 var(--serif); }
.center-state p:not(.eyebrow) { max-width: 560px; color: var(--muted); line-height: 1.6; }
.spinner { width: 28px; height: 28px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.teacher-heading { display: flex; justify-content: space-between; align-items: end; gap: 2rem; margin-bottom: 2.3rem; }
.teacher-heading h1 { margin: .1rem 0 .25rem; font: 500 clamp(2.4rem, 5vw, 4rem)/1 var(--serif); }
.teacher-heading p { margin: 0; color: var(--muted); }
.teacher-heading-actions { display: flex; align-items: end; gap: .75rem; }
.eyebrow, .card-label { margin: 0 0 .25rem; color: var(--accent); font-size: .69rem; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; }
.select-label { display: grid; gap: .25rem; color: var(--muted); font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
select, input { min-height: 42px; padding: .65rem .75rem; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 8px; }
select:focus, input:focus { outline: 2px solid rgba(91,79,138,.2); border-color: var(--accent); }

.section-nav { position: sticky; top: 68px; z-index: 10; display: flex; gap: 1.6rem; padding: .85rem 0; background: var(--paper); border-bottom: 1px solid var(--line); }
.section-nav a { color: var(--muted); text-decoration: none; font-size: .78rem; font-weight: 500; }
.section-nav a:hover { color: var(--accent); }
.teacher-section { padding: 3.3rem 0 1rem; scroll-margin-top: 105px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 1.5rem; margin-bottom: 1.25rem; }
.section-heading h2 { margin: .1rem 0; font: 500 2rem var(--serif); }
.section-description { margin: 0; color: var(--muted); font-size: .88rem; }
.status-pill { padding: .35rem .65rem; color: var(--success); background: #e8f2e9; border-radius: 999px; font-size: .7rem; font-weight: 600; }

.overview-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 1rem; }
.summary-card, .table-card, .empty-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 24px rgba(50,44,32,.035); }
.summary-card { min-height: 180px; padding: 1.3rem; }
.summary-card strong:not(.metric) { display: block; margin-top: .7rem; font: 500 1.45rem var(--serif); }
.summary-card p { color: var(--muted); font-size: .8rem; line-height: 1.45; }
.metric-card { display: flex; flex-direction: column; justify-content: center; }
.metric { font: 500 3.2rem/1 var(--serif); }
.copy-row { display: flex; gap: .5rem; margin: 1rem 0 .7rem; }
.copy-row input { width: 100%; font-size: .76rem; }

.primary-button, .secondary-button, .text-button { border: 0; border-radius: 8px; cursor: pointer; text-decoration: none; font-weight: 600; }
.primary-button { display: inline-flex; justify-content: center; padding: .72rem 1rem; color: white; background: var(--accent); }
.primary-button:hover { background: var(--accent-dark); }
.primary-button.compact { padding: .58rem .75rem; font-size: .76rem; }
.secondary-button { padding: .68rem .9rem; color: var(--accent-dark); background: var(--accent-soft); }
.secondary-button:hover { background: #e2dcf2; }
.text-button { padding: .5rem; color: var(--muted); background: transparent; }
button:disabled { opacity: .58; cursor: wait; }

.onboarding-card { min-height: 310px; padding: clamp(2rem, 6vw, 4rem); display: flex; justify-content: space-between; align-items: center; gap: 3rem; background: linear-gradient(135deg,#fffefa,#f0ecf8); border: 1px solid var(--line); border-radius: 18px; }
.onboarding-card h2 { margin: .2rem 0 .6rem; font: 500 2.5rem var(--serif); }
.onboarding-card p:not(.eyebrow) { max-width: 610px; color: var(--muted); line-height: 1.55; }

.table-card { overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .9rem 1rem; text-align: left; border-bottom: 1px solid var(--line); font-size: .8rem; }
th { color: var(--muted); background: #f3f1ec; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
.student-name { display: block; font-weight: 600; }
.student-email { color: var(--muted); font-size: .72rem; }
.empty-row, .empty-card { padding: 2rem; color: var(--muted); text-align: center; font-size: .85rem; }

.assignment-list { display: grid; gap: .65rem; }
.assignment-card { padding: 1rem 1.1rem; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 1rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.assignment-card h3 { margin: 0 0 .25rem; font: 500 1.2rem var(--serif); }
.assignment-meta { display: flex; flex-wrap: wrap; gap: .45rem .8rem; color: var(--muted); font-size: .73rem; }
.assignment-status { padding: .25rem .55rem; border-radius: 999px; background: #efede7; font-size: .65rem; font-weight: 600; text-transform: capitalize; }
.assignment-status.published { color: var(--success); background: #e8f2e9; }

.feature-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: .7rem; }
.feature-control { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.1rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.feature-control span { display: grid; gap: .2rem; }
.feature-control strong { font: 500 1.05rem var(--serif); }
.feature-control small { color: var(--muted); font-size: .7rem; }
.feature-control input { position: absolute; opacity: 0; pointer-events: none; }
.feature-control i { position: relative; width: 40px; height: 23px; flex: 0 0 40px; background: #cbc8c1; border-radius: 999px; transition: .2s; }
.feature-control i::after { content: ''; position: absolute; width: 17px; height: 17px; top: 3px; left: 3px; background: white; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: .2s; }
.feature-control input:checked + i { background: var(--accent); }
.feature-control input:checked + i::after { transform: translateX(17px); }
.feature-control:focus-within { outline: 2px solid rgba(91,79,138,.25); }
.save-status { color: var(--success); font-size: .75rem; }

.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 1rem; }
.modal-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(28,27,34,.52); backdrop-filter: blur(3px); }
.modal-card { position: relative; width: min(520px,96vw); max-height: 92vh; overflow-y: auto; padding: 1.5rem; background: var(--card); border-radius: 16px; box-shadow: 0 24px 80px rgba(0,0,0,.22); }
.modal-card.wide { width: min(680px,96vw); }
.modal-heading { display: flex; justify-content: space-between; margin-bottom: 1.2rem; }
.modal-heading h2 { margin: .1rem 0; font: 500 1.8rem var(--serif); }
.close-button { border: 0; background: transparent; color: var(--muted); font-size: 1.6rem; cursor: pointer; }
.modal-card label { min-width: 0; display: grid; gap: .3rem; margin-bottom: .9rem; color: var(--ink); font-size: .76rem; font-weight: 600; }
.modal-card label span { color: var(--muted); font-weight: 400; }
.modal-card input:not([type="checkbox"]), .modal-card select { width: 100%; min-width: 0; max-width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 .8rem; }
.check-label { grid-template-columns: auto 1fr !important; align-items: center; justify-content: start; padding-top: 1.35rem; }
.check-label input { min-height: 0; }
.modal-actions { display: flex; justify-content: flex-end; align-items: center; gap: .6rem; margin-top: 1rem; }
.form-error { color: var(--danger); font-size: .76rem; }
.form-help { margin: .35rem 0 0; font-size: .78rem; line-height: 1.45; color: var(--muted); }
.toast { position: fixed; z-index: 60; right: 1.2rem; bottom: 1.2rem; max-width: 360px; padding: .8rem 1rem; color: white; background: var(--ink); border-radius: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.2); font-size: .8rem; }

@media (max-width: 760px) {
    .workspace-header { grid-template-columns: 1fr auto; padding: .6rem 4vw; }
    .workspace-brand span, .workspace-account { display: none; }
    .workspace-nav { justify-self: end; }
    .teacher-shell { width: 92vw; padding-top: 2rem; }
    .teacher-heading, .section-heading, .onboarding-card { align-items: stretch; flex-direction: column; }
    .teacher-heading-actions { align-items: stretch; }
    .teacher-heading-actions .secondary-button { align-self: end; }
    .overview-grid, .feature-grid { grid-template-columns: 1fr; }
    .section-nav { overflow-x: auto; gap: 1rem; }
    .form-grid { grid-template-columns: minmax(0,1fr); }
    .assignment-card { grid-template-columns: 1fr; }
    .assignment-card .secondary-button { justify-self: start; }
}
