:root {
  color-scheme: light;
  --navy-950: #07152f;
  --navy-900: #0a1f43;
  --navy-800: #123465;
  --navy-700: #1d4c84;
  --ink: #15233b;
  --muted: #66758d;
  --line: #dfe6ee;
  --surface: #ffffff;
  --canvas: #f4f6f9;
  --ten: #f4a340;
  --ten-dark: #bc6517;
  --ten-soft: #fff4e6;
  --eleven: #ec6b62;
  --eleven-dark: #b43c43;
  --eleven-soft: #fff0ef;
  --success: #1d8b6a;
  --success-soft: #e8f7f1;
  --warning: #a66108;
  --danger: #b52d3a;
  --danger-soft: #fdecee;
  --shadow: 0 16px 42px rgba(12, 36, 72, .09);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { min-height: 100vh; margin: 0; color: var(--ink); background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(52, 112, 196, .28);
  outline-offset: 2px;
}

.is-hidden { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.stack { display: grid; gap: 14px; }
.row { display: flex; align-items: center; gap: 12px; }
.row--spread { justify-content: space-between; }
.text-right { text-align: right; }

.brand-lockup { display: flex; align-items: center; gap: 11px; min-width: max-content; }
.brand-lockup strong { display: block; font-size: 18px; letter-spacing: -.02em; }
.brand-lockup small { display: block; margin-top: 1px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.brand-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; background: var(--navy-900); overflow: hidden; }
.brand-mark img { width: 42px; height: 42px; object-fit: contain; }
.brand-mark--ten { background: var(--ten); }
.brand-mark--eleven { background: var(--eleven); }
.brand-mark--split { background: linear-gradient(135deg, var(--ten) 0 50%, var(--eleven) 50%); }

.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 17px; border: 0; border-radius: 12px; background: var(--navy-900); color: white; font-weight: 750; text-decoration: none; cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s; }
.button:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(10,31,67,.16); }
.button:disabled { opacity: .58; cursor: wait; transform: none; box-shadow: none; }
.button--small { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.button--ten { background: var(--ten); color: #3b260f; }
.button--eleven { background: var(--eleven); }
.button--quiet { background: #eef2f7; color: var(--ink); }
.button--ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.button--danger { background: var(--danger-soft); color: var(--danger); }
.icon-button { width: 38px; height: 38px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); cursor: pointer; font-size: 21px; }
.icon-button:hover { background: #eef2f7; color: var(--ink); }

.pill { display: inline-flex; align-items: center; gap: 6px; width: max-content; padding: 5px 9px; border-radius: 999px; background: #eef2f7; color: var(--muted); font-size: 12px; font-weight: 700; }
.pill--success { background: var(--success-soft); color: var(--success); }
.pill--warning { background: #fff4dc; color: var(--warning); }
.pill--danger { background: var(--danger-soft); color: var(--danger); }
.pill--ten { background: var(--ten-soft); color: var(--ten-dark); }
.pill--eleven { background: var(--eleven-soft); color: var(--eleven-dark); }

.field { display: grid; gap: 7px; }
.field > span, .field > label { color: var(--muted); font-size: 13px; font-weight: 700; }
.input, .field input, .field select, .field textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--ink); }
.field textarea { min-height: 110px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }

.empty-state { padding: 42px 20px; border: 1px dashed #cbd5e1; border-radius: var(--radius-lg); text-align: center; color: var(--muted); }
.empty-state strong { display: block; margin-bottom: 5px; color: var(--ink); }
.skeleton { border-radius: 12px; background: linear-gradient(90deg, #edf1f5, #f8fafc, #edf1f5); background-size: 200% 100%; animation: shimmer 1.25s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.landing-page { display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, #fff5e7 0, transparent 30%), radial-gradient(circle at 80% 90%, #ffefee 0, transparent 30%), var(--canvas); }
.landing-card { width: min(100%, 540px); padding: 38px; border: 1px solid rgba(255,255,255,.8); border-radius: var(--radius-xl); background: rgba(255,255,255,.9); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.landing-card h1 { margin: 36px 0 10px; font-size: clamp(32px, 8vw, 52px); line-height: 1; letter-spacing: -.055em; }
.landing-card p { color: var(--muted); line-height: 1.65; }
.landing-actions { display: grid; gap: 10px; margin-top: 28px; }

.toast-host { position: fixed; z-index: 1000; right: 18px; bottom: 18px; display: grid; gap: 8px; width: min(380px, calc(100vw - 36px)); }
.toast { transform: translateY(12px); opacity: 0; padding: 13px 15px; border-radius: 13px; background: var(--navy-950); color: white; box-shadow: var(--shadow); transition: .2s ease; }
.toast.is-visible { transform: none; opacity: 1; }
.toast--success { background: #11644e; }
.toast--error { background: #8f2330; }
.toast--warning { background: #80510f; }

.modal-backdrop { position: fixed; z-index: 900; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(5,18,39,.46); opacity: 0; transition: opacity .18s; }
.modal-backdrop.is-open { opacity: 1; }
.modal { width: min(520px, 100%); max-height: calc(100vh - 36px); display: grid; grid-template-rows: auto minmax(0,1fr) auto; border-radius: 22px; background: white; box-shadow: 0 30px 90px rgba(5,18,39,.32); overflow: hidden; }
.modal--wide { width: min(820px, 100%); }
.modal__header, .modal__actions { display: flex; align-items: center; gap: 10px; padding: 18px 20px; }
.modal__header { justify-content: space-between; border-bottom: 1px solid var(--line); }
.modal__header h2 { margin: 0; font-size: 20px; }
.modal__body { padding: 20px; overflow: auto; }
.modal__actions { justify-content: flex-end; border-top: 1px solid var(--line); }

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .landing-card { padding: 26px; }
  .button { min-height: 46px; }
}

/* Teacher workspace */
.teacher-page { min-width: 320px; }
.teacher-login { min-height: 100vh; display: grid; grid-template-columns: minmax(340px,.95fr) minmax(440px,1.05fr); }
.teacher-login__brand { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; padding: clamp(40px,8vw,110px); background: var(--navy-950); color: white; }
.teacher-login__brand::before, .teacher-login__brand::after { content: ""; position: absolute; border-radius: 50%; filter: blur(2px); }
.teacher-login__brand::before { width: 360px; height: 360px; right: -130px; top: -100px; background: var(--ten); }
.teacher-login__brand::after { width: 310px; height: 310px; left: -140px; bottom: -120px; background: var(--eleven); }
.teacher-login__brand > * { position: relative; z-index: 1; }
.teacher-login__brand .brand-lockup small { color: #acbdd6; }
.teacher-login__brand h1 { max-width: 560px; margin: 80px 0 16px; font-size: clamp(48px,7vw,84px); line-height: .94; letter-spacing: -.065em; }
.teacher-login__brand > p { max-width: 540px; margin: 0; color: #c6d3e5; font-size: 17px; line-height: 1.65; }
.login-feature-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 48px; }
.login-feature-list span { display: flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid rgba(255,255,255,.13); border-radius: 999px; background: rgba(255,255,255,.07); color: #d8e1ed; font-size: 12px; }
.login-feature-list b { display: grid; place-items: center; min-width: 22px; height: 22px; border-radius: 7px; background: rgba(255,255,255,.14); color: white; }
.teacher-login__form { display: grid; place-items: center; padding: 30px; background: radial-gradient(circle at 80% 20%, var(--eleven-soft), transparent 28%), radial-gradient(circle at 20% 90%, var(--ten-soft), transparent 28%), var(--canvas); }
.login-card { width: min(100%, 470px); padding: 34px; border: 1px solid rgba(255,255,255,.8); border-radius: var(--radius-xl); background: rgba(255,255,255,.94); box-shadow: var(--shadow); }
.login-card h2 { margin: 22px 0 8px; font-size: 31px; letter-spacing: -.04em; }
.login-card > p { margin: 0 0 22px; color: var(--muted); line-height: 1.55; }
.login-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 20px; padding: 4px; border-radius: 13px; background: #edf1f5; }
.login-tabs button { padding: 10px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 750; }
.login-tabs button.is-active { background: white; color: var(--ink); box-shadow: 0 3px 10px rgba(12,36,72,.08); }
.telegram-login-panel { display: grid; place-items: center; gap: 14px; padding: 18px 0; text-align: center; }
.telegram-login-panel p { margin: 0; color: var(--muted); line-height: 1.5; }
.telegram-orbit { width: 68px; height: 68px; display: grid; place-items: center; border-radius: 24px; background: #e7f3ff; color: #2584c6; font-size: 30px; }

.teacher-app { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0,1fr); }
.teacher-sidebar { position: fixed; z-index: 100; inset: 0 auto 0 0; width: 250px; display: flex; flex-direction: column; padding: 22px 16px; background: var(--navy-950); color: white; }
.teacher-sidebar .brand-lockup { padding: 0 7px; }
.teacher-sidebar .brand-lockup small { color: #8fa5c5; }
.teacher-nav { display: grid; gap: 5px; margin-top: 38px; }
.teacher-nav button { position: relative; width: 100%; display: grid; grid-template-columns: 28px minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 11px 12px; border: 0; border-radius: 12px; background: transparent; color: #9fb1cb; text-align: left; cursor: pointer; font-size: 13px; font-weight: 700; }
.teacher-nav button > span { color: #7e97ba; font-size: 19px; text-align: center; }
.teacher-nav button:hover { background: rgba(255,255,255,.06); color: white; }
.teacher-nav button.is-active { background: rgba(255,255,255,.12); color: white; }
.teacher-nav button.is-active::before { content: ""; position: absolute; left: -16px; width: 3px; height: 24px; border-radius: 0 5px 5px 0; background: var(--ten); }
.nav-count { min-width: 21px; height: 21px; display: grid; place-items: center; border-radius: 7px; background: var(--eleven); color: white; font-size: 10px; }
.teacher-account { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 10px; margin-top: auto; padding: 12px 7px 0; border-top: 1px solid rgba(255,255,255,.1); }
.teacher-account > span { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 12px; background: var(--ten); color: #3b260f; font-weight: 900; }
.teacher-account strong, .teacher-account small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.teacher-account strong { font-size: 12px; }
.teacher-account small { margin-top: 3px; color: #8fa5c5; font-size: 10px; }
.teacher-account .icon-button { color: #8fa5c5; }
.teacher-main { grid-column: 2; min-width: 0; }
.teacher-topbar { position: sticky; z-index: 80; top: 0; height: 78px; display: flex; align-items: center; gap: 14px; padding: 0 30px; border-bottom: 1px solid var(--line); background: rgba(244,246,249,.9); backdrop-filter: blur(17px); }
.teacher-topbar p { margin: 0 0 2px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.teacher-topbar h1 { margin: 0; font-size: 20px; letter-spacing: -.025em; }
.topbar-actions { display: flex; gap: 8px; margin-left: auto; }
.sidebar-toggle { display: none; }
.teacher-content { width: min(100%, 1540px); margin: 0 auto; padding: 26px 30px 50px; }
.teacher-view { display: grid; gap: 20px; }
.view-title { margin: 4px 0 0; font-size: 26px; letter-spacing: -.04em; }
.view-toolbar, .course-toolbar { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.toolbar-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.eyebrow { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: white; box-shadow: 0 6px 24px rgba(12,36,72,.035); }
.panel__header { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.panel__header h2 { margin: 4px 0 0; font-size: 18px; letter-spacing: -.025em; }
.welcome-panel { position: relative; overflow: hidden; min-height: 180px; display: flex; align-items: center; justify-content: space-between; padding: 32px; border-radius: var(--radius-xl); background: var(--navy-950); color: white; box-shadow: var(--shadow); }
.welcome-panel::after { content: ""; position: absolute; width: 260px; height: 260px; right: -60px; bottom: -120px; border-radius: 50%; background: linear-gradient(135deg, var(--ten), var(--eleven)); }
.welcome-panel > * { position: relative; z-index: 1; }
.welcome-panel h2 { margin: 22px 0 7px; font-size: 34px; letter-spacing: -.045em; }
.welcome-panel p { margin: 0; color: #bdcbe0; }
.welcome-date { min-width: 105px; text-align: center; }
.welcome-date strong { display: block; font-size: 54px; line-height: 1; }
.welcome-date span { color: #c9d5e6; font-size: 12px; text-transform: uppercase; }
.metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; }
.metric-grid--three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.metric-card { position: relative; overflow: hidden; min-height: 126px; display: grid; align-content: space-between; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: white; }
.metric-card::after { content: ""; position: absolute; width: 80px; height: 80px; right: -20px; bottom: -30px; border-radius: 50%; background: var(--metric-color,#e9eef5); opacity: .8; }
.metric-card > * { position: relative; z-index: 1; }
.metric-card span { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-card strong { font-size: 32px; letter-spacing: -.04em; }
.metric-card small { color: var(--muted); }
.dashboard-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 20px; }
.timeline-list { padding: 4px 20px 18px; }
.timeline-item { display: grid; grid-template-columns: 56px minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid #edf1f5; }
.timeline-item:last-child { border-bottom: 0; }
.timeline-item__date { display: grid; place-items: center; height: 48px; border-radius: 13px; background: #edf1f5; text-align: center; }
.timeline-item__date strong { font-size: 17px; line-height: 1; }
.timeline-item__date small { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.timeline-item__body { display: grid; gap: 3px; }
.timeline-item__body small { color: var(--muted); }
.quick-actions { display: grid; gap: 7px; padding: 12px; }
.quick-actions button { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 11px; padding: 11px; border: 0; border-radius: 13px; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.quick-actions button:hover { background: #f3f6f9; }
.quick-actions b { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 12px; background: var(--ten-soft); color: var(--ten-dark); font-size: 20px; }
.quick-actions span { display: grid; gap: 3px; }
.quick-actions small { color: var(--muted); }
.course-status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 18px; }
.course-status-card { display: grid; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 17px; }
.course-status-card__top { display: flex; align-items: center; gap: 12px; }
.course-status-card__top .brand-mark { width: 44px; height: 44px; border-radius: 14px; }
.course-status-card__top .brand-mark img { width: 38px; height: 38px; }
.course-status-card__top div { display: grid; gap: 3px; }
.course-status-card__top small { color: var(--muted); }
.course-status-card__stats { display: flex; gap: 20px; color: var(--muted); font-size: 12px; }
.course-status-card__stats b { color: var(--ink); }

.segmented-control { display: grid; grid-auto-flow: column; gap: 3px; width: max-content; padding: 4px; border-radius: 13px; background: #e8edf3; }
.segmented-control button { min-width: 110px; padding: 9px 13px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 750; }
.segmented-control button.is-active { background: white; color: var(--ink); box-shadow: 0 3px 12px rgba(12,36,72,.09); }
.editor-layout { display: grid; grid-template-columns: minmax(440px,1.1fr) minmax(340px,.9fr); gap: 20px; align-items: start; }
.course-tree-panel { min-height: 650px; }
.editor-help { display: flex; align-items: center; gap: 9px; margin: 14px 18px 0; padding: 10px 12px; border-radius: 11px; background: #f0f5fb; color: var(--muted); font-size: 12px; }
.editor-help span { color: var(--navy-700); font-size: 18px; }
.course-tree { display: grid; gap: 7px; padding: 16px 18px 22px; }
.tree-node { --depth: 0; position: relative; margin-left: calc(var(--depth) * 22px); }
.tree-node__row { min-height: 54px; display: grid; grid-template-columns: auto auto minmax(0,1fr) auto; align-items: center; gap: 9px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 13px; background: white; cursor: pointer; transition: .12s; }
.tree-node__row:hover, .tree-node.is-selected .tree-node__row { border-color: #a9bdd5; box-shadow: 0 5px 18px rgba(12,36,72,.07); }
.tree-node.is-dragging { opacity: .42; }
.tree-node.is-drop-target .tree-node__row { outline: 3px solid rgba(52,112,196,.22); }
.tree-node__handle { padding: 6px; color: #a2b0c2; cursor: grab; }
.tree-node__toggle { width: 26px; height: 26px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.tree-node__title { min-width: 0; display: grid; gap: 2px; }
.tree-node__title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.tree-node__title small { color: var(--muted); font-size: 10px; }
.tree-node__actions { display: flex; }
.tree-node__actions button { width: 30px; height: 30px; font-size: 17px; }
.tree-node[data-node-type="section"] > .tree-node__row { background: var(--navy-950); color: white; border-color: var(--navy-950); }
.tree-node[data-node-type="section"] > .tree-node__row small, .tree-node[data-node-type="section"] > .tree-node__row .tree-node__handle { color: #9eb2d0; }
.tree-node.is-archived .tree-node__row { opacity: .55; border-style: dashed; }
.tree-node.is-needs-approval .tree-node__row::after { content: "Требует решения"; position: absolute; right: 48px; padding: 4px 7px; border-radius: 7px; background: #fff4dc; color: var(--warning); font-size: 9px; font-weight: 800; }
.node-inspector { position: sticky; top: 98px; max-height: calc(100vh - 122px); overflow: auto; }
.inspector-form { display: grid; gap: 16px; padding: 20px; }
.inspector-header { display: flex; justify-content: space-between; gap: 12px; padding: 20px; border-bottom: 1px solid var(--line); }
.inspector-header h2 { margin: 5px 0 0; font-size: 20px; }
.revision-list { display: grid; gap: 8px; }
.revision-item { padding: 11px; border-radius: 11px; background: #f5f7fa; color: var(--muted); font-size: 11px; }

.approval-list { display: grid; gap: 8px; padding: 14px 18px 18px; }
.approval-item { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; }
.person-avatar { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 13px; background: var(--ten-soft); color: var(--ten-dark); font-weight: 900; }
.approval-item__body { display: grid; gap: 2px; }
.approval-item__body small { color: var(--muted); }
.approval-item__actions { display: flex; gap: 6px; }
.search-field { min-height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid var(--line); border-radius: 11px; background: white; }
.search-field span { color: var(--muted); }
.search-field input { width: 190px; border: 0; outline: 0; color: var(--ink); background: transparent; }
.table-wrap { overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th { padding: 12px 18px; background: #f7f9fb; color: var(--muted); text-align: left; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.data-table td { padding: 13px 18px; border-top: 1px solid #edf1f5; vertical-align: middle; }
.person-cell { display: flex; align-items: center; gap: 10px; }
.person-cell span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: #edf1f5; font-weight: 800; }
.person-cell div { display: grid; gap: 2px; }
.person-cell small { color: var(--muted); }

.review-layout { display: grid; grid-template-columns: minmax(300px,.72fr) minmax(470px,1.28fr); gap: 20px; align-items: start; }
.review-queue-panel, .review-workspace { min-height: 650px; }
.review-workspace { position: sticky; top: 98px; max-height: calc(100vh - 122px); overflow: auto; }
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
.filter-row .input { min-height: 38px; padding: 7px 9px; }
.review-queue { display: grid; gap: 5px; padding: 9px; }
.review-queue-item { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 10px; padding: 12px; border: 1px solid transparent; border-radius: 13px; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.review-queue-item:hover, .review-queue-item.is-active { border-color: var(--line); background: #f6f8fa; }
.review-queue-item__score { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: #edf1f5; color: var(--muted); font-weight: 900; }
.review-queue-item__body { min-width: 0; display: grid; gap: 3px; }
.review-queue-item__body strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.review-queue-item__body small { color: var(--muted); }
.review-answer { padding: 22px; }
.review-answer__meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.review-answer__prompt { padding: 15px; border-radius: 13px; background: #f5f7fa; color: var(--muted); line-height: 1.55; }
.review-answer__text { margin: 20px 0; font-family: Georgia, serif; font-size: 16px; line-height: 1.7; }
.rubric-grid { display: grid; gap: 8px; }
.rubric-row { display: grid; grid-template-columns: minmax(0,1fr) 90px; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
.rubric-row input { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 9px; }
.review-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 18px 22px; border-top: 1px solid var(--line); }

.gradebook-wrap { overflow: auto; }
.gradebook-table { min-width: 880px; border-collapse: separate; border-spacing: 0; font-size: 11px; }
.gradebook-table th, .gradebook-table td { min-width: 86px; padding: 10px; border-right: 1px solid #edf1f5; border-bottom: 1px solid #edf1f5; text-align: center; }
.gradebook-table th { position: sticky; top: 0; z-index: 2; background: #f7f9fb; color: var(--muted); font-size: 9px; }
.gradebook-table th:first-child, .gradebook-table td:first-child { position: sticky; left: 0; z-index: 3; min-width: 190px; background: white; text-align: left; }
.gradebook-table th:first-child { background: #f7f9fb; z-index: 4; }
.grade-cell { display: grid; gap: 2px; }
.grade-cell strong { font-size: 16px; }
.grade-cell small { color: var(--muted); }
.grade-cell.is-pending strong { color: var(--warning); }

.source-filters { display: grid; grid-template-columns: minmax(220px,1fr) 180px 190px; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); }
.source-filters .search-field input { width: 100%; }
.source-list { display: grid; }
.source-item { display: grid; grid-template-columns: auto minmax(0,1fr) auto auto; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid #edf1f5; }
.source-item:last-child { border-bottom: 0; }
.source-icon { width: 40px; height: 44px; display: grid; place-items: center; border-radius: 10px; background: #edf1f5; color: var(--navy-700); font-size: 10px; font-weight: 900; }
.source-item__body { min-width: 0; display: grid; gap: 3px; }
.source-item__body strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-item__body small { color: var(--muted); }

.settings-layout { display: grid; grid-template-columns: 210px minmax(0,1fr); gap: 20px; align-items: start; }
.settings-nav { display: grid; gap: 4px; padding: 7px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.settings-nav button { padding: 11px 12px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); text-align: left; cursor: pointer; font-size: 12px; font-weight: 750; }
.settings-nav button.is-active { background: var(--navy-950); color: white; }
.settings-content { min-height: 560px; padding: 24px; }
.settings-content h2 { margin: 0 0 6px; font-size: 23px; }
.settings-content > p { margin: 0 0 24px; color: var(--muted); }
.threshold-editor { display: grid; gap: 10px; max-width: 620px; }
.threshold-row { display: grid; grid-template-columns: 70px 1fr 90px; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; }
.threshold-row > b { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: #edf1f5; font-size: 20px; }
.threshold-row input { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 9px; }
.audit-list { display: grid; gap: 8px; }
.audit-item { display: grid; grid-template-columns: 120px minmax(0,1fr) auto; gap: 12px; padding: 12px; border-bottom: 1px solid #edf1f5; font-size: 12px; }
.audit-item time, .audit-item small { color: var(--muted); }
.sidebar-backdrop { display: none; }
.invite-dialog { display: grid; justify-items: center; gap: 15px; text-align: center; }
.invite-dialog img, .qr-placeholder { width: min(260px,80vw); aspect-ratio: 1; border: 10px solid white; border-radius: 18px; box-shadow: 0 8px 30px rgba(12,36,72,.12); }
.qr-placeholder { display: grid; place-items: center; background: repeating-conic-gradient(var(--navy-950) 0 25%,white 0 50%) 0/24px 24px; color: transparent; }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dashboard-grid, .editor-layout, .review-layout { grid-template-columns: 1fr; }
  .node-inspector, .review-workspace { position: static; max-height: none; }
}

@media (max-width: 820px) {
  .teacher-login { grid-template-columns: 1fr; }
  .teacher-login__brand { min-height: 330px; padding: 38px; }
  .teacher-login__brand h1 { margin-top: 45px; font-size: 52px; }
  .teacher-login__form { padding: 20px; }
  .teacher-app { grid-template-columns: 1fr; }
  .teacher-sidebar { transform: translateX(-105%); transition: transform .2s; }
  .teacher-app.sidebar-open .teacher-sidebar { transform: none; }
  .teacher-main { grid-column: 1; }
  .sidebar-toggle { display: inline-grid; place-items: center; }
  .sidebar-backdrop { position: fixed; z-index: 90; inset: 0; background: rgba(7,21,47,.42); }
  .teacher-app.sidebar-open .sidebar-backdrop { display: block; }
  .teacher-content { padding: 20px 16px 40px; }
  .teacher-topbar { padding: 0 16px; }
  .topbar-actions #global-preview-button { display: none; }
  .source-filters { grid-template-columns: 1fr; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { grid-auto-flow: column; overflow-x: auto; }
  .settings-nav button { white-space: nowrap; }
}

@media (max-width: 580px) {
  .teacher-login__brand { min-height: 260px; }
  .teacher-login__brand h1 { margin-top: 34px; font-size: 42px; }
  .teacher-login__brand > p, .login-feature-list { display: none; }
  .login-card { padding: 24px; }
  .welcome-panel { padding: 24px; }
  .welcome-date { display: none; }
  .metric-grid, .metric-grid--three, .course-status-grid { grid-template-columns: 1fr; }
  .view-toolbar, .course-toolbar { align-items: flex-start; flex-direction: column; }
  .toolbar-actions { width: 100%; }
  .toolbar-actions .button { flex: 1; }
  .segmented-control { width: 100%; }
  .segmented-control button { min-width: 0; width: 100%; }
  .source-item { grid-template-columns: auto minmax(0,1fr); }
  .source-item > .pill, .source-item > .button { display: none; }
}


/* Student application */
.student-page { --accent: var(--ten); --accent-dark: var(--ten-dark); --accent-soft: var(--ten-soft); padding-bottom: 92px; }
html[data-grade="11"] .student-page { --accent: var(--eleven); --accent-dark: var(--eleven-dark); --accent-soft: var(--eleven-soft); }
.student-header { position: sticky; z-index: 50; top: 0; display: flex; align-items: center; justify-content: space-between; padding: calc(12px + env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 12px max(18px, env(safe-area-inset-left)); background: rgba(244,246,249,.88); border-bottom: 1px solid rgba(223,230,238,.72); backdrop-filter: blur(16px); }
.student-header .brand-mark { width: 42px; height: 42px; border-radius: 14px; }
.student-header .brand-mark img { width: 36px; height: 36px; }
.student-avatar { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--navy-900); color: white; font-weight: 800; cursor: pointer; }
.student-shell { width: min(100%, 760px); margin: 0 auto; padding: 22px 18px 36px; }
.student-loading { display: grid; gap: 16px; }
.student-hero { position: relative; overflow: hidden; min-height: 230px; padding: 28px; border-radius: var(--radius-xl); background: var(--navy-950); color: white; box-shadow: var(--shadow); }
.student-hero::after { content: ""; position: absolute; right: -80px; bottom: -120px; width: 310px; height: 310px; border-radius: 50%; background: var(--accent); opacity: .95; }
.student-hero > * { position: relative; z-index: 1; }
.student-hero h1 { max-width: 440px; margin: 36px 0 10px; font-size: clamp(34px, 9vw, 54px); line-height: .98; letter-spacing: -.055em; }
.student-hero p { max-width: 480px; margin: 0; color: #c8d5e8; line-height: 1.55; }
.student-hero--compact { min-height: 190px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.student-hero--compact h1 { margin: 22px 0 7px; font-size: clamp(28px, 7vw, 42px); }
.student-hero--compact .score-orbit { flex: 0 0 auto; }
.score-orbit { position: relative; z-index: 1; width: 106px; height: 106px; display: grid; place-content: center; text-align: center; border: 10px solid rgba(255,255,255,.18); border-top-color: var(--accent); border-radius: 50%; background: rgba(255,255,255,.07); }
.score-orbit strong { font-size: 29px; line-height: 1; }
.score-orbit small { color: #c8d5e8; font-size: 11px; }
.auth-card { display: grid; gap: 12px; margin-top: 18px; padding: 24px; border-radius: var(--radius-lg); background: white; box-shadow: var(--shadow); }
.auth-card h2 { margin: 0; font-size: 21px; }
.auth-card p { margin: 0 0 6px; color: var(--muted); line-height: 1.55; }
.student-pending { min-height: 60vh; display: grid; place-items: center; align-content: center; gap: 15px; text-align: center; }
.student-pending h1 { margin: 0; font-size: 34px; letter-spacing: -.04em; }
.student-pending p { max-width: 480px; margin: 0 0 8px; color: var(--muted); line-height: 1.6; }
.status-illustration { width: 84px; height: 84px; display: grid; place-items: center; border-radius: 28px; background: var(--accent); color: white; font-size: 40px; font-weight: 900; transform: rotate(-4deg); }
.student-section { margin-top: 30px; scroll-margin-top: 88px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 13px; }
.section-heading h2 { margin: 0; font-size: 21px; letter-spacing: -.02em; }
.link-button { padding: 7px; border: 0; background: transparent; color: var(--navy-700); font-weight: 750; cursor: pointer; }
.assignment-list { display: grid; gap: 10px; }
.assignment-card { width: 100%; display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: white; color: inherit; text-align: left; cursor: pointer; box-shadow: 0 5px 20px rgba(12,36,72,.04); transition: .15s ease; }
.assignment-card:hover { transform: translateY(-1px); border-color: #cbd6e3; box-shadow: 0 10px 28px rgba(12,36,72,.08); }
.assignment-card__icon { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 15px; background: var(--success-soft); color: var(--success); font-size: 23px; font-weight: 900; }
.assignment-card__icon--ten { background: var(--ten-soft); color: var(--ten-dark); }
.assignment-card__icon--eleven { background: var(--eleven-soft); color: var(--eleven-dark); }
.assignment-card__icon--danger { background: var(--danger-soft); color: var(--danger); }
.assignment-card__body { min-width: 0; display: grid; gap: 3px; }
.assignment-card__body small { color: var(--muted); font-size: 11px; font-weight: 700; }
.assignment-card__body strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.assignment-card__body span { color: var(--muted); font-size: 12px; }
.assignment-card__arrow { color: #9cabbf; font-size: 28px; }
.course-progress-card { display: grid; gap: 13px; padding: 20px; border-radius: var(--radius-lg); background: white; border: 1px solid var(--line); }
.course-progress-card strong { display: block; margin-top: 4px; }
.course-progress-card b { color: var(--accent-dark); font-size: 24px; }
.course-progress-card small { color: var(--muted); }
.meter { height: 8px; overflow: hidden; border-radius: 99px; background: #edf1f5; }
.meter span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.course-outline { display: grid; gap: 8px; margin-top: 10px; }
.course-outline details { border: 1px solid var(--line); border-radius: 14px; background: white; overflow: hidden; }
.course-outline summary { display: flex; justify-content: space-between; gap: 12px; padding: 15px; cursor: pointer; font-weight: 750; }
.course-outline summary small { color: var(--muted); }
.course-outline details > div { display: grid; gap: 0; padding: 0 15px 11px; }
.course-outline p { display: flex; gap: 9px; margin: 0; padding: 9px 0; border-top: 1px solid #edf1f5; color: var(--muted); font-size: 13px; }
.course-outline p.is-complete { color: var(--success); }
.result-strip { display: grid; grid-template-columns: repeat(4, minmax(120px,1fr)); gap: 10px; overflow-x: auto; scrollbar-width: none; }
.result-strip::-webkit-scrollbar { display: none; }
.result-strip > button { min-width: 140px; display: grid; gap: 5px; padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: white; color: inherit; text-align: left; cursor: pointer; }
.result-strip strong { margin-top: 6px; font-size: 13px; }
.result-strip small { color: var(--muted); }
.grade-badge { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: #edf1f5; color: var(--muted); font-weight: 900; }
.grade-badge--5 { background: var(--success-soft); color: var(--success); }
.grade-badge--4 { background: #e8f1ff; color: #2863a8; }
.grade-badge--3 { background: #fff4dc; color: var(--warning); }
.grade-badge--2 { background: var(--danger-soft); color: var(--danger); }
.student-nav { position: fixed; z-index: 60; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(480px, calc(100% - 30px)); display: grid; grid-template-columns: repeat(3,1fr); padding: 7px; border: 1px solid rgba(255,255,255,.4); border-radius: 20px; background: rgba(7,21,47,.94); box-shadow: 0 15px 45px rgba(7,21,47,.3); backdrop-filter: blur(16px); }
.student-nav button { display: grid; place-items: center; gap: 2px; padding: 7px; border: 0; border-radius: 14px; background: transparent; color: #aebbd0; font-size: 10px; cursor: pointer; }
.student-nav button span { font-size: 19px; }
.student-nav button.is-active { background: rgba(255,255,255,.12); color: white; }
.offline-banner { position: fixed; z-index: 100; top: 0; left: 0; right: 0; padding: 8px; background: #80510f; color: white; text-align: center; font-size: 12px; }

.attempt-active { padding-bottom: 0; user-select: none; }
.attempt-active .student-header { display: none; }
.attempt-screen { width: min(100%, 820px); margin: -22px auto 0; }
.attempt-header { position: sticky; z-index: 30; top: 0; display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 12px; padding: calc(12px + env(safe-area-inset-top)) 0 12px; background: rgba(244,246,249,.94); backdrop-filter: blur(16px); }
.attempt-heading { min-width: 0; display: grid; }
.attempt-heading strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attempt-heading span { color: var(--muted); font-size: 12px; }
.attempt-timer { padding: 7px 10px; border-radius: 10px; background: #edf1f5; color: var(--muted); font-size: 13px; font-weight: 800; }
.attempt-timer.is-urgent { background: var(--danger-soft); color: var(--danger); }
.progress-bar { height: 4px; margin-bottom: 18px; border-radius: 99px; background: #dfe6ee; overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.question-card { position: relative; overflow: hidden; min-height: 55vh; padding: clamp(20px,5vw,36px); border: 1px solid var(--line); border-radius: var(--radius-xl); background: white; box-shadow: var(--shadow); }
.question-card::before { content: attr(data-watermark) "  ·  " attr(data-watermark) "  ·  " attr(data-watermark); position: absolute; inset: 0; display: grid; place-items: center; color: var(--navy-900); opacity: .035; font-size: 19px; font-weight: 900; line-height: 7; letter-spacing: .06em; transform: rotate(-22deg) scale(1.4); pointer-events: none; white-space: pre-wrap; }
.question-card > * { position: relative; z-index: 1; }
.question-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.question-prompt { margin: 28px 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(19px,4vw,24px); line-height: 1.55; }
.question-prompt img { max-width: 100%; border-radius: 12px; }
.choice-list { display: grid; gap: 10px; }
.choice { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: start; gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; transition: .15s; }
.choice:hover { border-color: #b7c6d8; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice__marker { width: 21px; height: 21px; border: 2px solid #a8b5c6; border-radius: 50%; }
.choice input[type="checkbox"] + .choice__marker { border-radius: 6px; }
.choice input:checked + .choice__marker { border: 6px solid var(--accent); }
.long-answer { display: grid; gap: 6px; }
.long-answer textarea { width: 100%; min-height: 220px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.92); color: var(--ink); resize: vertical; line-height: 1.6; user-select: text; }
.long-answer small { color: var(--muted); text-align: right; }
.autosave-caption { display: flex; align-items: center; gap: 8px; margin: 22px 0 0; color: var(--muted); font-size: 12px; }
.save-indicator { width: 8px; height: 8px; border-radius: 50%; background: #a8b5c6; }
.save-indicator.is-pending { background: var(--warning); animation: pulse 1s infinite; }
.save-indicator.is-saved { background: var(--success); }
.save-indicator.is-error { background: var(--danger); }
@keyframes pulse { 50% { opacity: .35; } }
.attempt-actions { position: sticky; z-index: 20; bottom: 0; display: grid; grid-template-columns: 1fr 1.7fr; gap: 10px; padding: 16px 0 calc(16px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--canvas) 25%); }
.notice { padding: 12px; border-radius: 12px; background: #edf1f5; }
.notice--warning { background: #fff4dc; color: #754a0a; }
.submit-result { display: grid; justify-items: center; gap: 18px; text-align: center; }
.submit-result .score-orbit { color: white; background: var(--navy-900); }

@media (max-width: 640px) {
  .student-shell { padding-left: 14px; padding-right: 14px; }
  .student-hero { padding: 22px; }
  .student-hero--compact { align-items: center; }
  .student-hero--compact .score-orbit { width: 90px; height: 90px; border-width: 8px; }
  .result-strip { grid-template-columns: repeat(4, 140px); }
  .question-card { border-radius: 20px; }
}
