/* «Контрольные»: тетрадная тема — синие чернила, красная ручка, зелёная галочка. Шрифт Golos Text (локально). */
@font-face { font-family: 'Golos Text'; font-weight: 400 700; font-display: swap; src: url('../fonts/golos-cyrillic-ext.woff2') format('woff2'); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: 'Golos Text'; font-weight: 400 700; font-display: swap; src: url('../fonts/golos-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Golos Text'; font-weight: 400 700; font-display: swap; src: url('../fonts/golos-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Golos Text'; font-weight: 400 700; font-display: swap; src: url('../fonts/golos-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #F3F5F8; --surface: #FFFFFF; --ink: #141B2D; --muted: #566178; --line: #DDE2EA;
  --accent: #2447C9; --accent-soft: #E8EDFC; --on-accent: #FFFFFF;
  --pen: #B3261E; --pen-soft: #FBE8E6; --ok: #17704A; --ok-soft: #E2F3EA;
  --shadow: 0 1px 2px rgba(20, 27, 45, .06), 0 6px 18px rgba(20, 27, 45, .05);
  /* прежние имена — их читает JS диаграмм и часть шаблонов */
  --fg: var(--ink); --card: var(--surface); --err: var(--pen); --err-bg: var(--pen-soft);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1320; --surface: #161D2E; --ink: #E8ECF5; --muted: #9AA5BD; --line: #28324A;
    --accent: #8BA4FF; --accent-soft: #1F2A55; --on-accent: #0B1020;
    --pen: #FF9087; --pen-soft: #3B1D21; --ok: #62D49C; --ok-soft: #143426; --shadow: none;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 'Golos Text', system-ui, sans-serif; font-variant-numeric: tabular-nums; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 28px; line-height: 1.15; letter-spacing: -.02em; font-weight: 700; margin: 4px 0 6px; }
h2 { font-size: 18px; font-weight: 650; letter-spacing: -.005em; margin: 28px 0 12px; }
h3 { font-size: 14px; font-weight: 600; margin: 14px 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sp { flex: 1; }
.low { color: var(--pen); } .high { color: var(--ok); } .mid { color: var(--accent); }
.weak { color: var(--pen); font-weight: 600; }

/* шапка */
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 32px; min-height: 60px; padding: 0 32px; background: var(--surface); border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; color: var(--ink); }
.logo:hover { text-decoration: none; }
.logo i { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 6px; }
.logo i b { background: var(--on-accent); border-radius: 1.5px; }
.logo i b:nth-child(2), .logo i b:nth-child(3) { opacity: .45; }
.nav { display: flex; flex-wrap: wrap; gap: 0 4px; flex: 1; align-self: stretch; }
.nav a { display: flex; align-items: center; min-height: 60px; padding: 0 12px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav a.on { color: var(--ink); border-color: var(--accent); }
.user { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.user form { margin: 0; }
.access { position: relative; }
.access summary { list-style: none; cursor: pointer; padding: 5px 12px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); font-weight: 500; }
.access summary::-webkit-details-marker { display: none; }
.access[open] summary { box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--accent); }
.access-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 320px; max-width: 90vw; max-height: 70vh; overflow: auto; padding: 4px 16px 14px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 28px rgba(0, 0, 0, .18); }
.access-pop h4 { margin: 12px 0 4px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.access-pop p, .access-pop ul { margin: 0; font-size: 14px; }
.access-pop ul { padding-left: 0; list-style: none; }
.access-pop li { margin: 4px 0; }
.access-pop .cl { display: inline-block; margin: 0 2px 2px 4px; padding: 1px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 13px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; display: grid; place-items: center; font-size: 13px; }

main { max-width: 1280px; margin: 0 auto; padding: 28px 32px; }
main.wide { max-width: none; }
.head-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 4px; }
.head-row h1 { margin-bottom: 2px; }
.head-row form { display: flex; gap: 10px; align-items: center; margin: 0; }
.crumb { display: flex; gap: 8px; color: var(--muted); font-size: 13px; }
.subnav { display: flex; gap: 4px; margin: -8px 0 16px; border-bottom: 1px solid var(--line); }
.subnav a { padding: 8px 14px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav a:hover { color: var(--ink); text-decoration: none; }
.subnav a.on { color: var(--ink); border-color: var(--accent); }

/* карточки и поля */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; box-shadow: var(--shadow); }
.card.narrow { max-width: 380px; margin: 56px auto; display: grid; gap: 14px; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.stack { display: grid; gap: 12px; max-width: 520px; grid-template-columns: minmax(0, 1fr); }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.checks { display: flex; gap: 16px; flex-wrap: wrap; }
.checks[hidden], .dep-field[hidden] { display: none; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); min-width: 0; }
label:has(> input[type=checkbox]) { display: flex; gap: 8px; align-items: center; color: var(--ink); font-size: 15px; }
input, select, textarea { height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font: inherit; max-width: 100%; }
textarea { height: auto; padding: 10px 14px; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); padding: 0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select { padding-right: 10px; }
input:disabled, button:disabled { opacity: .5; cursor: not-allowed; }
.stack select, .stack textarea { width: 100%; }
.stack > button { justify-self: start; }
.card.narrow > button { justify-self: stretch; }

button, .btn { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 18px; border: 0; border-radius: 9px; background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { text-decoration: none; }
/* окошко подтверждения (confirm.js) */
.dlg { border: 0; border-radius: 14px; padding: 22px 24px; width: min(440px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(10, 16, 32, .35); }
.dlg::backdrop { background: rgba(10, 16, 32, .5); }
.dlg-title { margin: 0 0 8px; font-size: 18px; }
.dlg-text { margin: 0 0 20px; line-height: 1.45; color: var(--muted); white-space: pre-line; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; }
.dlg-foot button.danger { background: var(--pen); color: var(--surface); }
.btn.sm { white-space: nowrap; height: 32px; padding: 0 12px; font-size: 14px; gap: 6px; }
.works-list td:first-child { width: 100%; }
.works-list td + td { white-space: nowrap; }
.works-list .btn.secondary.bad { color: var(--pen); box-shadow: inset 0 0 0 1.5px var(--pen); height: auto; min-height: 32px; padding-top: 3px; padding-bottom: 3px; }
.btn.bad span { display: grid; line-height: 1.15; }
.btn.bad small { font-size: 12px; font-weight: 500; }
.btn-row { flex-wrap: nowrap; }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; }
button.secondary, .btn.secondary, .btn.ghost { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
button.link { background: none; color: var(--accent); padding: 0; height: auto; font-weight: 500; }
/* Опасное действие в углу строки: маленький крестик, красный только при наведении */
.x-col { width: 1%; padding-left: 28px; text-align: right; white-space: nowrap; }
button.x-btn { background: none; color: var(--muted, #8a8f99); width: 28px; height: 28px; padding: 0; line-height: 1; font-size: 14px; border-radius: 6px; }
button.x-btn:hover, button.x-btn:focus-visible { background: color-mix(in srgb, var(--err, #c0392b) 14%, transparent); color: var(--err, #c0392b); }
.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.flash { padding: 10px 14px; border-radius: 9px; margin-bottom: 14px; background: var(--accent-soft); color: var(--accent); }
.flash.error { background: var(--pen-soft); color: var(--pen); }
.pill, .badge { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 99px; background: var(--bg); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); font-size: 13px; font-weight: 600; }
.badge.ok, .pill.ok { background: var(--ok-soft); color: var(--ok); box-shadow: none; }
.pill.pen { background: var(--pen-soft); color: var(--pen); box-shadow: none; }
.err { color: var(--pen); }
/* статус работы: зелёный прямоугольник с галочкой — «Опубликована», серый — «Черновик» */
.status { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 8px; background: var(--bg); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; font-size: 14px; white-space: nowrap; }
.status.ok { background: var(--ok-soft); color: var(--ok); box-shadow: inset 0 0 0 1.5px var(--ok); }
.status .i { width: 20px; height: 20px; stroke-width: 2.6; }
td .status { height: 30px; font-size: 13px; padding: 0 10px; }
td .status .i { width: 16px; height: 16px; }

/* таблицы */
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 16px; }
th { text-align: left; padding: 10px 14px; color: var(--muted); font-weight: 500; font-size: 13px; border-bottom: 1px solid var(--line); }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
tr.off td { color: var(--muted); text-decoration: line-through; }
details.add-students { margin-bottom: 16px; }
details.add-students > summary { cursor: pointer; display: inline-block; padding: 7px 16px; border-radius: 9px; font-weight: 600; color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); list-style: none; margin-bottom: 10px; }
details.add-students > summary::-webkit-details-marker { display: none; }
details.add-students > summary::before { content: "+ "; }
details.add-students[open] > summary::before { content: "− "; }
table.students td { padding: 3px 14px; font-size: 14px; }
table.students td:first-child { width: 36px; }
table.students input { height: 26px; padding: 0 8px; font-size: 14px; border-radius: 6px; width: 220px; }
table.students form.inline { gap: 8px; }
table.students input[readonly] { border-color: transparent; background: transparent; cursor: default; }
form.inline { display: flex; gap: 10px; align-items: center; margin: 0; }

/* показатели, колонки, диаграммы */
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-bottom: 8px; }
.kpis { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.kpi { display: grid; gap: 4px; min-width: 170px; padding: 18px 22px; }
.kpi b { font-size: 34px; line-height: 1.1; letter-spacing: -.02em; }
.chart-box { position: relative; max-width: 620px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 14px; margin-bottom: 16px; }
.pills { list-style: none; padding: 0; margin: 4px 0 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.pills li { display: inline-flex; gap: 6px; padding: 5px 12px; border-radius: 99px; font-size: 14px; font-weight: 500; background: var(--pen-soft); color: var(--pen); }
.pills li b { font-weight: 700; }
.pills li.ok { background: var(--ok-soft); color: var(--ok); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: -6px 0 16px; align-items: center; }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; }
.legend .dot.dark { background: var(--ink); }
.legend .dot.hl { width: 14px; height: 14px; background: #FFE600; box-shadow: 0 0 0 1.5px var(--ink); vertical-align: -2px; }
.legend .rule { display: inline-block; width: 26px; border-top: 1.5px solid var(--ink); margin-right: 8px; vertical-align: middle; }
.mini { display: inline-block; width: 70px; height: 6px; margin-right: 8px; border-radius: 3px; background: var(--line); overflow: hidden; vertical-align: middle; }
.mini i { display: block; height: 100%; background: var(--accent); }
.mini.full i { background: var(--ok); }
.ok-text { color: var(--ok); font-weight: 600; }
/* статус работы в списке «Мои классы»: красный «!» — не заполнена, зелёная «✓» — заполнена */
.st-col { width: 34px; padding-right: 0 !important; }
.st { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: 14px; font-weight: 800; line-height: 1; vertical-align: middle; }
.st.bad { background: var(--pen-soft); color: var(--pen); box-shadow: inset 0 0 0 1.5px var(--pen); }
.st.ok { background: var(--ok-soft); color: var(--ok); box-shadow: inset 0 0 0 1.5px var(--ok); }
.meter { display: flex; align-items: center; gap: 10px; justify-content: flex-start; padding-left: 4px; }
.meter span { display: block; width: 52px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter span i { display: block; height: 100%; background: var(--accent); }
.meter.low span i { background: var(--pen); } .meter.high span i { background: var(--ok); }
.meter b { font-weight: 600; min-width: 38px; }
.meter.low b { color: var(--pen); } .meter.high b { color: var(--ok); } .meter b { color: var(--accent); }

/* рейтинг классов (методист) */
.rk-head, .rk { display: grid; grid-template-columns: 30px 70px minmax(120px, 1fr) 64px 120px 90px; gap: 16px; align-items: center; }
.rk-head { height: 34px; color: var(--muted); font-size: 13px; }
.rk { height: 50px; border-top: 1px solid var(--line); }
.rk .track { position: relative; height: 16px; border-radius: 8px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); }
.rk .track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 8px; background: var(--accent); }
.rk .track::after { content: ""; position: absolute; left: 50%; top: -4px; bottom: -4px; border-left: 1.5px dashed var(--pen); opacity: .75; }
.rk.low .track i { background: var(--pen); } .rk.high .track i { background: var(--ok); }
.rk b { font-weight: 650; }
.place { width: 28px; height: 28px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--muted); }
.place.first { background: var(--accent); color: var(--on-accent); box-shadow: none; }

.st-head, .st-row { grid-template-columns: 30px 70px minmax(120px, 1fr) 64px 120px 90px; }

/* ученик: разбор выбранной контрольной */
.focus { margin: 4px 0 24px; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.focus .kpi { min-width: 120px; padding: 12px 16px; box-shadow: none; }
.focus .kpi b { font-size: 26px; }
table.focus-tasks { margin: 14px 0 8px; }
tr.sel td { background: var(--accent-soft); }

/* ученик: все контрольные с разбором по заданиям */
.subj-head { margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--line); }
.wd summary { cursor: pointer; font-weight: 500; color: var(--accent); }
.wd[open] summary { margin-bottom: 8px; }
table.task-mini { margin: 4px 0 6px; font-size: 14px; border-radius: 8px; }
table.task-mini th, table.task-mini td { padding: 6px 10px; }
.tnote { margin-top: 2px; padding: 3px 8px; font-size: 13px; color: var(--muted); border-left: 3px solid var(--accent); background: var(--bg); border-radius: 0 6px 6px 0; white-space: pre-line; }

/* тепловая карта */
.grid-wrap { overflow: auto; max-height: 75vh; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.heat { max-height: none; padding: 12px; }
.heat table { margin: 0; border: 0; width: auto; min-width: 0; border-collapse: separate; border-spacing: 6px; background: transparent; }
.heat th { text-align: center; }
.heat th:first-child { text-align: left; }
.heat td { border: 0; padding: 0; }
.heat td.topic { text-align: left; min-width: 210px; padding-right: 10px; }
.heat td.h { text-align: center; min-width: 58px; height: 42px; border-radius: 8px; font-weight: 600; }
.heat td.h.low { background: var(--pen-soft); color: var(--pen); }
.heat td.h.mid { background: var(--accent-soft); color: var(--accent); }
.heat td.h.high { background: var(--ok-soft); color: var(--ok); }

/* дерево «класс → предмет → работы» */
.tree { display: grid; gap: 12px; }
.tree details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.tree summary { display: flex; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer; list-style: none; }
.tree summary::-webkit-details-marker { display: none; }
.tree summary::before { content: ""; width: 8px; height: 8px; flex: none; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; }
.tree details[open] > summary::before { transform: rotate(45deg); }
.tree summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 12px; }
.tree .name { font-weight: 700; font-size: 18px; }
.tree .lvl2 .name { font-size: 16px; font-weight: 600; }
.tree .meta { color: var(--muted); font-size: 14px; }
.tree .sp { flex: 1; }
.tree .lvl2 { margin: 0 14px 12px 36px; background: var(--bg); box-shadow: none; }
.tree .lvl1 > .lvl2:last-child { margin-bottom: 14px; }
.tree table.works { width: calc(100% - 32px); margin: 0 16px 12px; border: 0; background: transparent; }
.tree table.works th, .tree table.works td { padding: 8px 10px; }
.tree .empty { margin: 0 16px 14px; }

/* состав работы */
table.spec td, table.spec th { padding: 11px 16px; }
table.spec .total-row td { background: var(--bg); }
table.cuts { border: 0; margin: 0; background: transparent; }
table.cuts td { padding: 8px 6px; }
.mk { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-weight: 700; }
.mk.m5 { background: var(--ok-soft); color: var(--ok); }
.mk.m4 { background: var(--accent-soft); color: var(--accent); }
.mk.m3 { background: var(--bg); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.mk.m2 { background: var(--pen-soft); color: var(--pen); }
.tile { display: grid; gap: 6px; color: var(--ink); transition: box-shadow .15s, border-color .15s; }
.tile:hover { text-decoration: none; border-color: var(--accent); }
.tile b { font-size: 18px; letter-spacing: -.01em; }

/* работа автора: таблица заданий, файл, сводка */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 22px; align-items: start; }
.side { display: grid; gap: 16px; }
.dropzone { border: 1.5px dashed var(--line); border-radius: 12px; padding: 16px 18px; text-align: center; color: var(--muted); cursor: pointer; margin-bottom: 16px; background: var(--surface); }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.has { border: 1.5px solid var(--ok); background: var(--ok-soft); color: var(--ink); }
#tasks { border-radius: 14px; box-shadow: var(--shadow); margin-bottom: 8px; }
#tasks td { padding: 6px 8px; }
#tasks input { width: 100%; padding: 0 10px; }
#tasks th:nth-child(2) { width: 96px; }
#tasks th:nth-child(3) { width: 20%; }
#tasks th:nth-child(4) { width: 22%; }
#tasks th:nth-child(5) { width: 34%; }
#tasks input.score { width: 84px; text-align: center; font-weight: 600; }
#tasks tr.is-sub td.num { text-align: right; padding-right: 22px; }
#tasks td.num button[data-act=sub] { position: absolute; right: 2px; bottom: 2px; width: 18px; height: 18px; padding: 0; display: grid; place-items: center; border-radius: 5px; background: var(--accent-soft); color: var(--accent); box-shadow: none; }
#tasks td.num button[data-act=sub]:hover { background: var(--accent); color: var(--on-accent); }
#tasks td.num button[data-act=sub]:disabled { display: none; }
#tasks td.num button[data-act=sub] .i { width: 12px; height: 12px; stroke-width: 2.4; }
#tasks td.num { position: relative; width: 44px; color: var(--muted); text-align: center; }
#tasks td.acts { white-space: nowrap; width: 84px; }
#tasks td.acts button { color: var(--muted); padding: 4px; }
#tasks tr.rub td { padding-top: 0; border-top: 0; }
#tasks .rub-box { display: flex; flex-direction: column; gap: 4px; }
#tasks .rub-box label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
#tasks .rub-box b { min-width: 40px; color: var(--ink); }
#tasks .rub-box input { height: 30px; font-size: 14px; }
#tasks td.total { font-weight: 700; text-align: center; }
#tasks tr:focus-within { background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.big { font-size: 34px; line-height: 1; font-weight: 700; letter-spacing: -.02em; }
.band { height: 6px; border-radius: 3px; background: repeating-linear-gradient(90deg, var(--accent) 0 18px, transparent 18px 24px); opacity: .35; margin: 14px 0; }
.hb { display: grid; grid-template-columns: 170px 1fr 34px; align-items: center; gap: 12px; min-height: 30px; padding: 3px 0; }
.hb .track { position: relative; height: 12px; border-radius: 6px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); }
.hb .track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: var(--accent); }
.hb.low .track i { background: var(--pen); }
.hb .v { text-align: right; font-weight: 600; }
.hb .lbl { line-height: 1.25; overflow-wrap: anywhere; }
.todo { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.todo li { display: flex; gap: 10px; align-items: flex-start; }
.todo .chk { width: 20px; height: 20px; flex: none; margin-top: 1px; border-radius: 6px; box-shadow: inset 0 0 0 1.5px var(--muted); display: grid; place-items: center; color: var(--on-accent); }
.todo li.done .chk { background: var(--accent); box-shadow: none; }
.todo li.warn { color: var(--pen); }
.todo li.warn .chk { box-shadow: inset 0 0 0 1.5px var(--pen); }

/* журнал: подсказки, быстрый переход */
.fastbar { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; margin-bottom: 8px; }
label.fast { display: flex; flex-direction: row; gap: 8px; align-items: center; font-size: 15px; color: var(--ink); }
.hint { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 14px; }
.kbd { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px 0 6px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.kbd b { font-weight: 600; color: var(--ink); padding: 1px 7px; border-radius: 5px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); }

/* сетка ввода баллов */
#grid { --px: 8px; --hy: 14px; --fs-h: 15px; --name-w: 200px; --name-pl: 22px; --rh: 48px; --cw: 58px; --ch: 38px; --fs: 17px; --note-off: 15px; --mark: 34px; --wt: 60px; --wp: 64px; --wm: 64px; --wa: 44px; }
/* плотность сетки: 0 — компактная (по умолчанию), 1 — средняя, 2 — крупная; переключается кнопками «− / +» над сеткой */
#grid[data-zoom="0"] { --px: 3px; --hy: 8px; --fs-h: 13px; --name-w: 150px; --name-pl: 10px; --rh: 32px; --cw: 38px; --ch: 26px; --fs: 14px; --note-off: 11px; --mark: 26px; --wt: 48px; --wp: 52px; --wm: 44px; --wa: 34px; }
#grid[data-zoom="1"] { --px: 5px; --hy: 10px; --fs-h: 14px; --name-w: 180px; --name-pl: 14px; --rh: 40px; --cw: 48px; --ch: 32px; --fs: 15px; --note-off: 13px; --mark: 30px; --wt: 54px; --wp: 58px; --wm: 54px; --wa: 40px; }
#grid {border: 0; margin: 0; border-collapse: separate; border-spacing: 0; width: auto; min-width: 100%; background: transparent; }
#grid th, #grid td { padding: 0 var(--px); border-bottom: 1px solid var(--line); text-align: center; }
#grid thead th { position: sticky; top: 0; z-index: 2; padding: var(--hy) var(--px) 12px; background: var(--surface); font-weight: 600; font-size: var(--fs-h); color: var(--ink); line-height: 1.2; vertical-align: bottom; }
.fastbar .zoom button, .undo-bar button { height: 28px; padding: 0 12px; font-size: 16px; }
.grid-tools { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 20px; margin: 0 0 12px; }
.undo-bar { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.undo-bar .zoom { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; color: var(--ink); }
#grid .var { text-align: center; padding: 0 6px; }
#grid select.vsel { height: 26px; width: 50px; padding: 0 6px; font-size: 14px; border-radius: 6px; }
#grid .name { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; padding-left: var(--name-pl); min-width: var(--name-w); white-space: nowrap; border-right: 1px solid var(--line); font-weight: 500; }
#grid thead th.name { z-index: 3; }
#grid tbody td { height: var(--rh); position: relative; }
#grid .muted { font-weight: 400; font-size: 12px; }
#grid input[data-task] { width: var(--cw); height: var(--ch); margin: 3px 0; text-align: center; padding: 0; font-size: var(--fs); font-weight: 600; border: 0; border-radius: 9px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
#grid input[data-task].empty { background: var(--bg); box-shadow: none; }
/* у присутствующего ученика не внесено ни одного балла — красный контур ячеек (пустая ячейка среди внесённых — «не брался», без контура) */
#grid tr.unfilled:not(.is-absent) input[data-task].empty { box-shadow: inset 0 0 0 2px var(--pen); }
#grid input[data-task].zero { color: var(--pen); }
#grid input[data-task].skip { color: var(--muted); }
#grid input[data-task]:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 4px var(--accent-soft); }
#grid input.bad { background: var(--pen-soft); color: var(--pen); box-shadow: inset 0 0 0 2px var(--pen); }
@keyframes rej { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
#grid input.rej { animation: rej .3s; box-shadow: inset 0 0 0 2px var(--pen); }
#grid .fill { font-size: 12px; font-weight: 500; }
#grid tbody tr:hover td { background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }
#grid tbody tr:focus-within td { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
#grid .col-hl { background: color-mix(in srgb, var(--accent) 13%, var(--surface)); }
#grid tr.is-absent td { color: var(--muted); background: repeating-linear-gradient(135deg, var(--surface) 0 7px, var(--line) 7px 8px); }
#grid tr.is-absent .name { text-decoration: line-through; }
#grid tr.is-absent input[data-task] { opacity: .35; }
/* итог, %, оценка и «Н» закреплены справа: видны, даже когда заданий много */
#grid .sum, #grid .abs { position: sticky; z-index: 1; background: var(--surface); font-weight: 600; }
#grid .total { right: calc(var(--wa) + var(--wm) + var(--wp)); width: var(--wt); min-width: var(--wt); box-shadow: -1px 0 0 var(--line); }
#grid .pct { right: calc(var(--wa) + var(--wm)); width: var(--wp); min-width: var(--wp); }
#grid .mark { right: var(--wa); width: var(--wm); min-width: var(--wm); }
#grid .abs { right: 0; width: var(--wa); min-width: var(--wa); }
#grid thead th.sum, #grid thead th.abs { z-index: 3; }
#grid .pct .meter { display: grid; gap: 3px; justify-items: center; padding: 0; }
#grid .pct .meter span { width: calc(var(--wp) - 20px); }
#grid .pct .meter b { min-width: 0; font-size: 14px; }
#grid .mark span { display: inline-grid; place-items: center; width: var(--mark); height: var(--mark); border-radius: 50%; font-size: var(--fs); font-weight: 700; }
#grid .mark span:empty { display: none; }
#grid .mark .m5 { background: var(--ok-soft); color: var(--ok); }
#grid .mark .m4 { background: var(--accent-soft); color: var(--accent); }
#grid .mark .m3 { background: var(--bg); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
#grid .mark .m2 { background: var(--pen-soft); color: var(--pen); }
#grid .mark .part, #grid .pct .meter.part { opacity: .5; }
#grid tfoot td { height: 46px; background: var(--bg); color: var(--muted); font-size: 14px; border-bottom: 0; font-weight: 600; }
#grid tfoot td.name { font-weight: 500; }
#grid tfoot td.avg.low { color: var(--pen); } #grid tfoot td.avg.high { color: var(--ok); } #grid tfoot td.avg.mid { color: var(--accent); }

/* заметка к ячейке: маленькая карточка в углу, по клику — окошко с комментарием */
.note-btn { position: absolute; left: calc(50% + var(--note-off, 15px)); top: 1px; width: 17px; height: 17px; padding: 0; display: grid; place-items: center;
  border-radius: 5px; background: var(--surface); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); opacity: 0; cursor: pointer; }
.note-btn .i { width: 11px; height: 11px; stroke-width: 2.2; }
#grid td.cell:hover .note-btn, #grid td.cell:focus-within .note-btn { opacity: .9; }
.note-btn.name-note { position: static; display: inline-grid; vertical-align: middle; margin-left: 6px; opacity: .45; }
#grid tr:hover .name-note, .note-btn.name-note.has { opacity: 1; }
.note-btn:focus-visible { opacity: 1; outline: 2px solid var(--accent); }
.note-btn.has { opacity: 1; background: var(--accent); color: var(--on-accent); box-shadow: none; }
@media (hover: none) { .note-btn { opacity: .6; } }
.note-pop { position: fixed; z-index: 50; width: 300px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 36px rgba(20, 27, 45, .22); padding: 14px; display: grid; gap: 10px; }
.note-pop[hidden] { display: none; }
.note-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; font-size: 14px; line-height: 1.3; }
.note-head button { color: var(--muted); height: auto; }
.note-pop textarea { width: 100%; resize: vertical; min-height: 84px; }
.note-foot { display: flex; align-items: center; gap: 8px; }
.note-foot button { height: 36px; padding: 0 14px; }

/* узкие экраны */
@media (max-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr); } .side { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); } }
@media (max-width: 640px) {
  .topbar { padding: 8px 16px; gap: 4px 12px; }
  .nav a { min-height: 40px; padding: 0 8px; }
  main { padding: 16px 12px; }
  main > table, #tasks { display: block; overflow-x: auto; max-width: 100%; }
  .form-row > label, .form-row select, .form-row input:not([type=checkbox]) { width: 100%; }
  .stack { max-width: none; }
  h1 { font-size: 22px; }
  .rk-head, .rk { grid-template-columns: 28px 52px minmax(60px, 1fr) 52px; }
  .rk > :nth-child(5), .rk > :nth-child(6), .rk-head > :nth-child(5), .rk-head > :nth-child(6) { display: none; }
}

/* Значок «?» с пояснением к статистике (static/js/help.js) */
.card, .chart-box { position: relative; }
.help-wrap { position: relative; display: inline-block; }
.help-wrap.corner { position: absolute; top: 8px; right: 8px; z-index: 5; }
.help-wrap.inline { margin-left: 8px; vertical-align: middle; }
.help-wrap.inline .help-pop { left: 0; right: auto; }
.help { width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); color: var(--muted); font-family: inherit; font-size: 13px; font-weight: 600; line-height: 1; display: inline-grid; place-items: center; cursor: pointer; }
.help:hover, .help-wrap.open .help { color: var(--ink); border-color: var(--muted); }
.help-pop { position: absolute; top: 30px; right: 0; width: 300px; max-width: calc(100vw - 32px); padding: 12px 14px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(20, 27, 45, .18); font-size: 13px; font-weight: 400; line-height: 1.45; text-align: left; letter-spacing: 0; z-index: 20; }
.help-pop[hidden] { display: none; }
.help-pop b { display: block; margin-bottom: 4px; font-size: 14px; font-weight: 600; }

/* выпадающий список с галочками (классы и предметы учителя) */
.checks[hidden] { display: none; }
details.multi { position: relative; }
details.multi > summary { cursor: pointer; padding: 8px 12px; border: 1px solid var(--line, #ccc); border-radius: 8px; background: var(--surface, #fff); list-style: none; font-size: 14px; }
details.multi > summary::after { content: " ▾"; }
details.multi .multi-list { position: absolute; z-index: 20; margin-top: 4px; padding: 8px 12px; max-height: 260px; overflow: auto; min-width: 180px; display: grid; gap: 6px; border: 1px solid var(--line, #ccc); border-radius: 8px; background: var(--surface, #fff); box-shadow: 0 6px 18px rgba(0,0,0,.12); }
details.multi .multi-list label { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink, inherit); }

/* форма «Новый пользователь» свёрнута, открывается по кнопке */
details.newuser { margin-bottom: 16px; }
details.newuser > summary { display: inline-block; cursor: pointer; list-style: none; margin-bottom: 12px; }
details.newuser > summary::-webkit-details-marker { display: none; }

.multi-list label.taken { background: var(--pen-soft); border-radius: 6px; padding-left: 6px; padding-right: 6px; }
.multi-list label.taken .who { color: var(--pen); font-size: 11px; }

.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pick-col { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); min-width: 0; }
.pick-h { display: flex; gap: 8px; align-items: center; padding: 8px 12px; font-weight: 600; border-bottom: 1px solid var(--line); }
.pick-h .link { margin-left: auto; font-weight: 400; font-size: 13px; }
.pick-list { max-height: 320px; overflow: auto; padding: 6px; display: grid; gap: 2px; align-content: start; min-height: 60px; }
.pk { cursor: pointer; padding: 5px 8px; border-radius: 6px; font-size: 14px; user-select: none; }
.pk:hover { background: var(--bg); }
.pick-col:last-child .pk { background: var(--bg); }
.subj-pick { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.subj-pick label { display: flex; gap: 6px; align-items: center; }
@media (max-width: 640px) { .pick { grid-template-columns: 1fr; } }
