/* Современное приложение: светлая и тёмная тема, один синий акцент.
   Тема: системная по умолчанию, либо выбранная вручную (html[data-theme]). */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --ink: #12151b;
  --muted: #5c6370;
  --faint: #99a0ab;
  --line: #e5e7eb;
  --line-strong: #d3d7de;
  --accent: #2f5bea;
  --accent-hover: #2349c9;
  --accent-soft: #eaf0ff;
  --on-accent: #ffffff;
  --good: #15803d;
  --good-soft: #e8f6ee;
  --bad: #c62828;
  --bad-soft: #fdecec;
  --warn: #b45309;
  --warn-soft: #fdf3e2;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 2px 8px rgba(16, 24, 40, .06);
  --shadow-lg: 0 8px 28px rgba(16, 24, 40, .12);
  --r: 14px;
  --r-sm: 10px;
  --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115; --surface: #171a21; --surface-2: #1d212a; --ink: #eef0f4; --muted: #a3aab5; --faint: #6b7280;
    --line: #262b35; --line-strong: #353b47; --accent: #7390ff; --accent-hover: #8ea5ff; --accent-soft: #1d2645; --on-accent: #0b1020;
    --good: #4ade80; --good-soft: #13291d; --bad: #f87171; --bad-soft: #2e1616; --warn: #fbbf24; --warn-soft: #2d2412;
    --shadow: 0 0 0 1px var(--line); --shadow-lg: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115; --surface: #171a21; --surface-2: #1d212a; --ink: #eef0f4; --muted: #a3aab5; --faint: #6b7280;
  --line: #262b35; --line-strong: #353b47; --accent: #7390ff; --accent-hover: #8ea5ff; --accent-soft: #1d2645; --on-accent: #0b1020;
  --good: #4ade80; --good-soft: #13291d; --bad: #f87171; --bad-soft: #2e1616; --warn: #fbbf24; --warn-soft: #2d2412;
  --shadow: 0 0 0 1px var(--line); --shadow-lg: 0 10px 30px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; transition: background-color .2s, color .2s; }
a { color: var(--accent); text-underline-offset: 3px; }
button, input, textarea, select { font: inherit; color: inherit; }
button, .btn, label.btn, .seg span, .checks label, tr.go { cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.02em; text-wrap: balance; }
h1 { font-size: clamp(28px, 4.2vw, 38px); font-weight: 700; }
h2 { font-size: 22px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0 0 12px; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.boot { padding: 40px 16px; color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- каркас ---------- */
.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1120px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 28px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; white-space: nowrap; font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.brand::before { content: ""; flex: none; width: 34px; height: 34px; border-radius: 10px; background: #09090b url(logo.png) center / cover no-repeat; box-shadow: 0 0 0 1px var(--line); }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: var(--r-sm); color: var(--muted); text-decoration: none; white-space: nowrap; font-weight: 500; font-size: 15px; transition: background-color .15s, color .15s; }
.nav a svg.i { display: none; }
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a.on { color: var(--accent); background: var(--accent-soft); }
.nav .count { margin-left: 2px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-grid; place-items: center; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 700; }
.nav .only-mobile { display: none; }
.top-right { display: flex; align-items: center; gap: 6px; }
.who { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border-radius: var(--r-sm); color: var(--ink); font-size: 14px; font-weight: 500; white-space: nowrap; text-decoration: none; }
.who:hover { background: var(--surface-2); }
.who .ava { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px; }
.theme-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-sm); border: 0; background: none; color: var(--muted); transition: background-color .15s, color .15s; }
.theme-btn:hover { background: var(--surface-2); color: var(--ink); }

main { max-width: 1120px; margin: 0 auto; padding: 36px 24px 96px; }
main > * { animation: rise .3s var(--ease) both; }
main > *:nth-child(2) { animation-delay: .03s; }
main > *:nth-child(n+3) { animation-delay: .06s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.head p { color: var(--muted); margin: 8px 0 0; max-width: 62ch; }
.crumb { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; margin-bottom: 8px; font-size: 14px; font-weight: 500; color: var(--muted); text-decoration: none; }
.crumb:hover { color: var(--accent); }
section + section { margin-top: 44px; }
section > h2 { margin-bottom: 14px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.num { font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); padding: 28px 24px; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r); text-align: center; }

/* ---------- кнопки и поля ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap; transition: background-color .15s, border-color .15s, color .15s, transform .08s, box-shadow .15s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 1px 2px rgba(47, 91, 234, .25); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 14px; }
.link { background: none; border: 0; padding: 0; min-height: 32px; color: var(--accent); font-weight: 500; text-decoration: none; }
.link:hover { text-decoration: underline; }
.link.danger { color: var(--bad); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.field { display: block; margin-bottom: 18px; }
.field > span { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.input, textarea.input, select.input { width: 100%; min-height: 46px; padding: 11px 14px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm); transition: border-color .15s, box-shadow .15s; }
.input:hover { border-color: var(--faint); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.input[readonly] { background: var(--surface-2); }
.input::placeholder { color: var(--faint); }
textarea.input { min-height: 130px; resize: vertical; line-height: 1.6; }
textarea.answer { min-height: 340px; font-size: 17px; line-height: 1.7; padding: 16px 18px; }
.input.short { max-width: 150px; }
select.input { appearance: auto; }
/* Explicit styling prevents native macOS select chrome from shrinking these fields. */
.assignment-choice { position: relative; }
.assignment-choice select.input {
  -webkit-appearance: none;
  appearance: none;
  height: 46px;
  min-height: 46px;
  padding: 11px 36px 11px 18px;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.assignment-choice::after {
  content: '';
  position: absolute;
  right: 15px;
  bottom: 21px;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
  transform: rotate(45deg);
  pointer-events: none;
}
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > .field { flex: 1 1 160px; }
.hint { font-size: 14px; color: var(--muted); margin-top: 8px; font-weight: 400; }
.error { color: var(--bad); margin: 0 0 14px; font-weight: 500; }
.ok { color: var(--good); }

.seg, .tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span, .tabs button { display: flex; align-items: center; min-height: 38px; padding: 0 14px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-weight: 600; font-size: 14px; transition: background-color .15s, color .15s, box-shadow .15s; }
.seg span:hover, .tabs button:hover { color: var(--ink); }
.seg input:checked + span, .tabs button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.tabs { margin-bottom: 20px; }

.checks { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.checks label { display: flex; gap: 12px; align-items: center; min-height: 50px; padding: 4px 16px; border-bottom: 1px solid var(--line); }
.checks label:last-child { border-bottom: 0; }
.checks label:hover { background: var(--surface-2); }
.checks input { width: 20px; height: 20px; accent-color: var(--accent); }

/* ---------- карточки и таблицы ---------- */
.card, .table, .prog-item, .sum, .grade, .task, .answer-view, .rec, .auth { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; overflow: hidden; }
.table th { text-align: left; padding: 12px 18px; font-size: 13px; font-weight: 600; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.table td { padding: 15px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.go td { transition: background-color .12s; }
.table tr.go:hover td { background: var(--surface-2); }
.table .r { text-align: right; }
.table td a.title { color: var(--ink); text-decoration: none; font-weight: 600; }
.table tr.go:hover a.title { color: var(--accent); }

.st { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: 8px; font-size: 13px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.st.todo { background: var(--accent-soft); color: var(--accent); }
.st.returned, .st.late { background: var(--bad-soft); color: var(--bad); }
.st.submitted { background: var(--warn-soft); color: var(--warn); }
.st.graded { background: var(--good-soft); color: var(--good); }
.seen { color: var(--muted); font-weight: 400; }
.seen.on { color: var(--good); font-weight: 600; }
.seen.on::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--good); vertical-align: 1px; }
.up { color: var(--good); font-weight: 600; }
.down { color: var(--bad); font-weight: 600; }
.same { color: var(--muted); }

@media (max-width: 680px) {
  .table.stack { box-shadow: none; background: none; border-radius: 0; overflow: visible; }
  .table.stack thead { display: none; }
  .table.stack tbody { display: grid; gap: 10px; }
  .table.stack tr { display: block; padding: 14px 16px; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); }
  .table.stack td { display: block; border: 0; padding: 3px 0; text-align: left; }
  .table.stack td:empty { display: none; }
  .table.stack td[data-l]::before { content: attr(data-l) " · "; color: var(--muted); font-size: 13px; }
  .table.stack tr.go:hover td { background: none; }
}

/* ---------- баллы и шкала ---------- */
.score { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.score b { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.score span { font-size: 15px; color: var(--muted); font-weight: 500; }
.score.empty b { color: var(--faint); }
.score.lg b { font-size: 48px; }

.scale { margin-top: 16px; }
.scale-track { position: relative; height: 10px; background: var(--surface-2); border-radius: 99px; box-shadow: inset 0 0 0 1px var(--line); }
.scale-track .fill { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--accent); transform-origin: left; animation: grow .7s var(--ease) both .1s; }
.scale-track .prev { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 2px; background: var(--ink); opacity: .45; }
.scale-ticks { display: none; }
.scale-nums { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
@keyframes grow { from { transform: scaleX(0); } }

.mini { display: block; height: 4px; margin-top: 8px; background: var(--surface-2); border-radius: 99px; max-width: 110px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.mini i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* ---------- задание и ответ ---------- */
.task { font-size: 17px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; padding: 22px 24px; }
.meta { display: flex; gap: 8px 18px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 14px; margin-top: 10px; }
.files { list-style: none; padding: 0; margin: 14px 0 0; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.files li { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.files li:last-child { border-bottom: 0; }
.files .fname { flex: 1 1 200px; overflow-wrap: anywhere; font-weight: 500; }
.files .fname a { color: var(--ink); text-decoration: none; }
.files .fname a:hover { color: var(--accent); }
.files audio { width: 100%; max-width: 440px; height: 44px; }
.files img { display: block; max-width: 100%; max-height: 520px; border-radius: var(--r-sm); }
.files .imgwrap { flex-basis: 100%; }

.note { background: var(--surface-2); border-radius: var(--r); padding: 16px 18px; margin: 20px 0; white-space: pre-wrap; overflow-wrap: anywhere; border: 1px solid var(--line); }
.note.bad { background: var(--bad-soft); border-color: transparent; }
.note.good { background: var(--good-soft); border-color: transparent; }
.note b { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; }

.words { font-size: 14px; color: var(--muted); display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.words .out { color: var(--bad); font-weight: 600; }
.words .in { color: var(--good); font-weight: 600; }

.rec { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 18px 20px; margin-bottom: 16px; }
.rec .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--bad); animation: pulse 1.2s ease-in-out infinite; }
.rec .time { font-size: 26px; font-weight: 700; min-width: 76px; font-variant-numeric: tabular-nums; }
@keyframes pulse { 50% { opacity: .25; } }
.upbar { height: 4px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.upbar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

.answer-view { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 17px; line-height: 1.75; padding: 20px 24px; }

.cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: start; }
.aside { position: sticky; top: 88px; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; gap: 28px; } .aside { position: static; } }

.grade { padding: 22px; }
.grade h3 { margin-bottom: 12px; }
.grade .scorein { display: flex; align-items: center; gap: 12px; color: var(--muted); font-weight: 500; }
.grade .scorein .input { width: 96px; min-height: 60px; font-size: 28px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; margin-top: 12px; }
.pick button { min-height: 40px; padding: 0; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; transition: background-color .12s, color .12s, border-color .12s; }
.pick button:hover { border-color: var(--accent); color: var(--accent); }
.pick button.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* ---------- критерии, тесты, пометки, группы ---------- */
.crit { margin-bottom: 16px; }
.crit-h { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; font-size: 14px; font-weight: 600; }
.crit-h .num { color: var(--muted); font-weight: 500; white-space: nowrap; }
.crit-h b { color: var(--accent); font-size: 18px; }
.crit .pick { margin-top: 8px; }
.crit-total { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 0 6px; margin-bottom: 4px; border-top: 1px solid var(--line); font-weight: 700; }
.crit-total b { color: var(--accent); font-size: 28px; font-weight: 800; }
.crit-edit { display: grid; grid-template-columns: minmax(0, 1fr) 84px auto; gap: 8px; align-items: center; margin-bottom: 8px; }

.crit-sum { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.crit-sum-h { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.crit-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 12px; font-size: 14px; padding: 6px 0; }
.crit-row .mini { grid-column: 1 / -1; max-width: none; margin-top: 6px; }

.qa { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 16px; margin-top: 14px; }
.qa label { display: grid; grid-template-columns: 36px minmax(0, 1fr); align-items: center; gap: 8px; }
.qa label > span { display: grid; place-items: center; height: 36px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 14px; }
.qa-result { margin-bottom: 18px; }
.qa-result td:first-child, .qa-result th:first-child { width: 56px; color: var(--muted); }

mark { background: color-mix(in srgb, var(--warn) 22%, transparent); color: inherit; border-radius: 4px; padding: 1px 2px; box-shadow: inset 0 -2px 0 var(--warn); }
mark::after { content: attr(data-n); font-size: 11px; font-weight: 800; color: var(--warn); vertical-align: super; margin-left: 2px; }
.marks { margin: 14px 0 0; padding-left: 24px; }
.marks li { padding: 5px 0; overflow-wrap: anywhere; }
.marks li::marker { font-weight: 800; color: var(--warn); }
.marks q { font-style: italic; }
.marks .link { margin-left: 8px; }
.note .marks { margin-top: 0; white-space: normal; }
.mark-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.mark-form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.mark-form .input { flex: 1 1 240px; }
.bulk { margin-bottom: 28px; max-width: 760px; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); }
.bulk summary { padding: 14px 18px; font-weight: 600; cursor: pointer; list-style-position: inside; }
.bulk form { padding: 0 18px 18px; }
.bulk .actions select.input { flex: 0 1 220px; }
.group-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }

/* ---------- прогресс ---------- */
.sum { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; padding: 24px; }
.sum-l { font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.sum-pct { text-align: right; }
.sum-pct b { display: block; font-size: 48px; font-weight: 800; line-height: 1; letter-spacing: -0.03em; color: var(--accent); }
.sum-pct span { font-size: 14px; color: var(--muted); }
.prog { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
@media (max-width: 800px) { .prog { grid-template-columns: 1fr; } }
.prog-item { padding: 22px 22px 16px; }
.prog-item .line1 { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.prog-item h3 { font-size: 19px; }
.prog-item .delta { font-size: 14px; margin-top: 14px; min-height: 22px; }
.chart { width: 100%; height: auto; display: block; margin-top: 18px; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--faint); font: 10px var(--font); }
.chart .area { fill: var(--accent); opacity: .12; }
.chart .ln { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw .9s var(--ease) forwards .15s; }
.chart .pt { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.chart .pt.last { fill: var(--accent); }
.chart .lbl { fill: var(--ink); font: 600 12px var(--font); }
@keyframes draw { to { stroke-dashoffset: 0; } }
.attempts { list-style: none; margin: 14px 0 0; padding: 0; font-size: 14px; }
.attempts li { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 40px; border-top: 1px solid var(--line); }
.attempts li a, .attempts li > span:first-child { color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attempts li a:hover { color: var(--accent); }
.cell-score { white-space: nowrap; font-weight: 700; font-variant-numeric: tabular-nums; }
.cell-score .muted { font-weight: 500; }
.cell-score .d { font-size: 13px; margin-left: 8px; }

/* ---------- вход ---------- */
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.auth { width: 100%; max-width: 420px; padding: 36px 32px 28px; box-shadow: var(--shadow-lg); animation: rise .35s var(--ease) both; }

.auth h1 { font-size: 28px; margin-bottom: 6px; }
.auth .lead { color: var(--muted); margin-bottom: 26px; }
.auth .btn { width: 100%; min-height: 50px; font-size: 16px; }
.install-help { margin-top: 20px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); }
.install-help summary { cursor: pointer; font-weight: 650; color: var(--accent); }
.install-help p { margin: 12px 0 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.install-help b { color: var(--ink); }

.creds { font: 14px/1.6 ui-monospace, Consolas, monospace; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 14px 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 500; box-shadow: var(--shadow-lg); z-index: 20; max-width: calc(100% - 32px); animation: rise .25s var(--ease) both; }

/* ---------- администратор и объявления ---------- */
.pad { padding: 18px 20px; }
.pad h2 { font-size: 19px; margin-bottom: 12px; }
.admin-tools { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.admin-tools .tabs { margin-bottom: 0; }
.admin-tools .input { flex: 1 1 220px; max-width: 340px; }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; margin-bottom: 36px; }
@media (max-width: 800px) { .admin-grid { grid-template-columns: minmax(0, 1fr); } }
.access.wide { justify-content: flex-start; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { display: grid; gap: 2px; align-content: start; padding: 16px 18px; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; }
a.stat:hover { box-shadow: var(--shadow-lg); }
.stat b { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.chips.big span { padding: 8px 12px; font-size: 14px; color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
.log { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; max-width: 760px; }
.log li { padding: 10px 14px; background: var(--surface); border-radius: var(--r-sm); font-size: 15px; }
.bars { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; align-items: end; height: 170px; }
.bar { display: grid; grid-template-rows: auto 1fr auto; justify-items: center; gap: 4px; height: 100%; }
.bar i { align-self: end; width: 70%; min-height: 2px; background: var(--accent); border-radius: 6px 6px 0 0; }
.ann-banner { position: relative; display: grid; gap: 18px; margin-bottom: 28px; padding: 22px 24px; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); border-top: 3px solid var(--accent); }
.ann-item { display: grid; gap: 10px; }
.ann-item + .ann-item { padding-top: 18px; border-top: 1px solid var(--line); }
.ann-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ann-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 700; }
.ann-title { margin: 0; font-size: 20px; line-height: 1.3; letter-spacing: -0.01em; }
.ann-body { display: grid; gap: 12px; overflow-wrap: anywhere; max-width: 900px; }
.ann-body p { margin: 0; color: var(--muted); }
.ann-ul { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.ann-feats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ann-feat { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); }
.ann-feat b { display: block; font-size: 15px; margin-bottom: 2px; }
.ann-feat div > span { display: block; font-size: 14px; color: var(--muted); line-height: 1.45; }
.ann-feat .ann-ic { display: grid; line-height: 1; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); font-size: 20px; }
.ann-more summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px; margin-bottom: 10px; }
.ann-actions { display: flex; justify-content: flex-end; }
@media (max-width: 640px) { .ann-banner { padding: 18px 16px; } .ann-feats { grid-template-columns: minmax(0, 1fr); } .ann-actions .btn { width: 100%; } }
.ann-list { display: grid; gap: 12px; max-width: 760px; }
.ann-list h3 { margin: 6px 0; }
.ann-preview { margin-bottom: 16px; display: grid; gap: 6px; }
.ann-preview .ann-banner { margin-bottom: 0; }

/* ---------- первые шаги, подсказки, помощь ---------- */
.onboard { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 24px; display: grid; gap: 12px; }
.onboard-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.onboard-h h2 { font-size: 20px; margin-bottom: 2px; }
.onboard-bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.onboard-bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.onboard-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.onboard-list li { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 0; }
.onboard-list li > div { display: grid; gap: 1px; }
.onboard-list li a:not(.btn) { color: var(--ink); text-decoration: none; }
.onboard-list li a:not(.btn):hover { color: var(--accent); }
.dotmark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-weight: 700; font-size: 14px; }
.onboard-list li.ok .dotmark { background: var(--good-soft); color: var(--good); }
.onboard-list li.ok b { color: var(--muted); font-weight: 500; text-decoration: line-through; text-decoration-color: var(--line-strong); }
.onboard-list li.next .dotmark, .onboard-list.plain .dotmark { background: var(--accent-soft); color: var(--accent); }
.onboard-list.plain li { grid-template-columns: 32px minmax(0, 1fr); }
@media (max-width: 640px) { .onboard-list li { grid-template-columns: 32px minmax(0, 1fr); } .onboard-list li .btn { grid-column: 2; justify-self: start; } }
.help-list { display: grid; gap: 10px; max-width: 760px; }
.help-item { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 18px; }
.help-item summary { font-weight: 700; cursor: pointer; font-size: 17px; }
.help-a { margin-top: 10px; color: var(--ink); display: grid; gap: 8px; max-width: 68ch; }
.help-a ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
a.theme-btn { text-decoration: none; }

/* ---------- предметы ---------- */
.subj + .subj { margin-top: 40px; }
.subj-h { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.subj-h h3 { font-size: 22px; }
.chart-card { padding: 16px 20px 12px; margin-bottom: 20px; }
.panel-weak { background: var(--warn-soft); border-radius: var(--r-sm); padding: 12px 16px; margin-bottom: 14px; font-size: 15px; }
.tbl-wrap { overflow-x: auto; border-radius: var(--r); }
.tbl-wrap .table td .mini { display: inline-block; vertical-align: middle; width: 70px; margin: 0 0 0 8px; }
.subj-list { display: grid; gap: 12px; max-width: 760px; }
.subj-card { display: grid; gap: 10px; padding: 16px 18px; color: var(--ink); text-decoration: none; transition: box-shadow .15s; }
.subj-card:hover { box-shadow: var(--shadow-lg); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips span { padding: 2px 10px; border-radius: 8px; background: var(--surface-2); font-size: 13px; color: var(--muted); }
.sec-rows { display: grid; gap: 8px; }
.sec-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) 140px auto; gap: 8px; align-items: center; }
.sec-row .num { text-align: right; font-size: 14px; }
.sec-btns { display: flex; gap: 10px; align-items: center; white-space: nowrap; }
.sec-btns .link:disabled { opacity: .3; cursor: default; }
@media (max-width: 640px) { .sec-row { grid-template-columns: 22px minmax(0, 1fr); } .sec-row input[data-s] { grid-column: 2; } .sec-btns { grid-column: 2; } }
details.more { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; }
details.more summary { cursor: pointer; font-weight: 600; }
.teacher-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.teacher-list li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 12px 16px; background: var(--surface); border-radius: var(--r-sm); box-shadow: var(--shadow); }

.toggle { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; }
.toggle input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.toggle > span { display: grid; gap: 4px; font-size: 15px; margin: 0; color: var(--ink); font-weight: 400; }
.nocopy { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

.access { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.access select.input { width: auto; min-height: 40px; padding: 6px 10px; font-size: 14px; }
.access input.input { width: 150px; min-height: 40px; padding: 6px 10px; font-size: 14px; }
@media (max-width: 680px) { .access { justify-content: flex-start; margin-top: 8px; } }

code { font: 13px ui-monospace, Consolas, monospace; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }

.theme-pick { display: flex; gap: 10px; flex-wrap: wrap; }
.theme-pick button { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 12px; border-radius: var(--r); border: 2px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px; transition: border-color .15s; }
.theme-pick button:hover { border-color: var(--line-strong); }
.theme-pick button.on { border-color: var(--accent); color: var(--accent); }

/* ---------- телефон: нижнее меню с иконками ---------- */
@media (max-width: 640px) {
  main { padding: 22px 16px calc(100px + env(safe-area-inset-bottom, 0px)); }
  /* Без размытия и «липкости» у шапки: backdrop-filter делает шапку контейнером для position:fixed,
     и нижнее меню прилипало бы к шапке, а не к низу экрана */
  .top { position: static; backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); padding-top: env(safe-area-inset-top, 0px); }
  .top-in { padding: 0 16px; min-height: 56px; gap: 12px; }
  .brand { flex: 1; }
  .who { display: none; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; gap: 0; padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px)); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
  .nav a { flex: 1; flex-direction: column; justify-content: center; gap: 3px; min-height: 54px; padding: 0 2px; font-size: 11px; font-weight: 600; border-radius: 12px; position: relative; }
  .nav a svg.i { display: block; width: 22px; height: 22px; }
  .nav a.on { background: none; }
  .nav a:hover { background: none; }
  .nav .only-mobile { display: flex; }
  .nav .count { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: 11px; padding: 0 5px; }
  .head { margin-bottom: 20px; }
  /* Вкладки групп и разделов — одной строкой с прокруткой, а не переносом */
  .tabs { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  /* Переключатели в формах переносятся: третий вариант не должен прятаться за краем */
  .seg { flex-wrap: wrap; }
  .tabs button, .seg span { white-space: nowrap; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  .auth { padding: 28px 22px 22px; }
  .prog-item, .grade { padding: 18px 16px 14px; }
  .task, .answer-view { padding: 16px; }
  .score.lg b { font-size: 40px; }
  .sum { padding: 18px 16px; }
  .sum-pct b { font-size: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .chart .ln { stroke-dashoffset: 0; }
}

/* ---------- вкладки-ссылки (фильтр банка заданий) ---------- */
.tabs .tab-a { display: flex; align-items: center; min-height: 38px; padding: 0 14px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: none; transition: background-color .15s, color .15s, box-shadow .15s; }
.tabs .tab-a:hover { color: var(--ink); }
.tabs .tab-a.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.warn-t { color: var(--warn); }
label.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; white-space: nowrap; cursor: pointer; }
label.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- конструктор вопросов теста ---------- */
.q-rows { display: grid; gap: 8px; }
.q-row { display: grid; grid-template-columns: 28px 225px minmax(0, 1fr) auto; gap: 8px 10px; align-items: center; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); }
.q-row > .num { text-align: center; font-weight: 700; }
.q-extra { grid-column: 2 / -1; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.q-extra .input { width: 90px; min-height: 36px; padding: 4px 10px; }
.q-extra.wide { flex-wrap: wrap; }
.q-extra.wide .input { flex: 1 1 220px; width: auto; }

/* ---------- ответы ученика: варианты и соответствие ---------- */
.qa .qa-item.wide { grid-column: 1 / -1; grid-template-columns: 36px minmax(0, 1fr); }
.qa .qa-item.wide > .num { display: grid; place-items: center; height: 36px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 14px; }
.qa-item.wide { display: grid; align-items: start; gap: 8px; }
.qa-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.qa .qa-opts label.qa-opt { display: block; }
.qa-opt input { position: absolute; opacity: 0; pointer-events: none; }
.qa .qa-opt > span { display: flex; align-items: center; height: auto; min-height: 36px; padding: 6px 14px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14px; transition: background-color .15s, border-color .15s; }
.qa .qa-opt input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.qa .qa-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.qa-match { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.qa .qa-match label { display: flex; align-items: center; gap: 6px; }
.qa .qa-match label > b { font-size: 15px; }
.qa-match select.input { width: 64px; min-height: 36px; padding: 4px 8px; }

/* ---------- таймер говорения ---------- */
.prep-label { font-weight: 700; color: var(--warn); text-transform: uppercase; letter-spacing: .04em; font-size: 13px; }

/* ---------- файлы с кодом ---------- */
.code-view { margin-top: 8px; width: 100%; }
.code-view summary { cursor: pointer; color: var(--accent); }
.code-view pre { margin: 8px 0 0; max-height: 420px; overflow: auto; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); font: 13px/1.5 ui-monospace, "Cascadia Code", Consolas, monospace; white-space: pre; tab-size: 4; }

/* ---------- пометки на фото ---------- */
.annot { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; background: rgba(10, 12, 16, .92); }
.annot-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.annot-tools, .annot-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.annot-actions { margin-left: auto; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--ink); }
.annot-stage { flex: 1; overflow: auto; display: grid; place-items: center; padding: 12px; }
.annot-stage canvas { max-width: 100%; height: auto; background: #fff; touch-action: none; cursor: crosshair; border-radius: 6px; }

/* ---------- выбор шаблона предмета ---------- */
.preset-pick { display: grid; gap: 14px; margin-bottom: 20px; }
.preset-group { display: grid; gap: 6px; }
.preset-group .btn.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

@media (max-width: 640px) {
  .q-row { grid-template-columns: 24px minmax(0, 1fr) auto; }
  .q-row > input[data-qa] { grid-column: 2 / -1; }
  .q-row > [data-qrm] { grid-column: 3; grid-row: 1; }
  .q-extra { grid-column: 2 / -1; }
  .annot-actions { margin-left: 0; width: 100%; justify-content: flex-end; }
  .tabs .tab-a { white-space: nowrap; }
}
.auth-brand { margin-bottom: 22px; font-size: 19px; gap: 12px; }
.auth-brand::before { width: 48px; height: 48px; border-radius: 14px; }

/* ---------- тариф: расход и предупреждение ---------- */
.note.warn { background: var(--warn-soft); border-color: transparent; }
.plan-note { white-space: normal; margin: 0 0 20px; }
.plan-note p { margin: 0 0 6px; }
.plan-note p:last-child { margin: 8px 0 0; }
.meter { margin: 14px 0; }
.meter-h { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; margin-bottom: 6px; }
.meter-track { height: 8px; border-radius: 99px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.meter-track i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.meter.warn .meter-track i { background: var(--warn); }
.meter.bad .meter-track i { background: var(--bad); }
.meter.bad .meter-h b { color: var(--bad); }
/* ---------- карточка тарифа в Профиле ---------- */
.plan-card { max-width: 760px; padding: 24px; display: grid; gap: 20px; margin-bottom: 40px; }
.plan-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.plan-eyebrow { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.plan-name { margin: 2px 0 0; font-size: 28px; letter-spacing: -0.02em; }
.plan-until { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); }
.plan-until div { display: grid; line-height: 1.3; }
.plan-until span:not(.plan-stat-ic) { font-size: 13px; color: var(--muted); }
.plan-until.warn { background: var(--warn-soft); border-color: transparent; }
.plan-until.warn span:not(.plan-stat-ic), .plan-until.warn .plan-stat-ic { color: var(--warn); }
.plan-until.bad { background: var(--bad-soft); border-color: transparent; }
.plan-until.bad b, .plan-until.bad .plan-stat-ic { color: var(--bad); }
.plan-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.plan-stat { display: grid; gap: 8px; padding: 16px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); }
.plan-stat-h { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.plan-stat-ic { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); flex: none; }
.plan-stat-ic .i { width: 16px; height: 16px; }
.plan-stat-v { display: flex; align-items: baseline; gap: 6px; }
.plan-stat-v b { font-size: 26px; line-height: 1.1; }
.plan-stat-v span { color: var(--muted); font-size: 14px; }
.plan-stat.warn .meter-track i { background: var(--warn); }
.plan-stat.bad .meter-track i { background: var(--bad); }
.plan-stat.bad .plan-stat-v b { color: var(--bad); }
.plan-compare { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.plan-opt { display: grid; gap: 2px; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.plan-opt b { color: var(--ink); font-size: 15px; }
.plan-opt.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-soft); }
.plan-opt-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.plan-cur { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; color: var(--accent); }
.plan-cur .i { width: 14px; height: 14px; }
.plan-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; padding-top: 16px; border-top: 1px solid var(--line); }
.plan-foot p { margin: 0; color: var(--muted); font-size: 14px; flex: 1 1 280px; }
.referral-card { max-width: 760px; padding: 24px; margin-bottom: 40px; }
.referral-card > p { margin-top: 10px; }
.referral-card > .small { margin-bottom: 0; }
.referral-link { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.referral-link .input { flex: 1 1 300px; min-width: 0; }
@media (max-width: 640px) {
  .plan-card { padding: 18px 16px; }
  .plan-stats, .plan-compare { grid-template-columns: minmax(0, 1fr); }
  .plan-foot .btn { width: 100%; }
  .referral-card { padding: 18px 16px; }
  .referral-link .btn { width: 100%; }
}
/* ---------- публичные страницы: тарифы, оферта, реквизиты ---------- */
.pub-nav { display: flex; gap: 4px; margin-left: auto; margin-right: 12px; }
.pub-nav a { padding: 8px 12px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 15px; text-decoration: none; }
.pub-nav a:hover { color: var(--ink); }
.pub-nav a.on { color: var(--accent); background: var(--accent-soft); }
.pub { padding-bottom: 40px; }
.pub .head p { max-width: 720px; }
.pub-sec { max-width: 860px; margin-top: 40px; }
.pub-sec p { color: var(--muted); max-width: 72ch; }
.trial-strip { display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin-bottom: 18px; border-radius: var(--r); background: var(--good-soft); color: var(--good); max-width: 860px; }
.trial-strip div { display: grid; }
.trial-strip span { color: var(--ink); font-size: 14px; opacity: .8; }
.price-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; max-width: 1000px; }
.price-card { position: relative; display: grid; align-content: start; gap: 6px; padding: 24px 22px; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); border: 1px solid var(--line); }
.price-card.hot { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.price-tag { position: absolute; top: -11px; left: 20px; padding: 2px 10px; border-radius: 99px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 700; }
.price-card h3 { margin: 0; font-size: 18px; }
.price { display: flex; align-items: baseline; gap: 6px; margin-top: 6px; }
.price b { font-size: 34px; letter-spacing: -0.02em; line-height: 1.1; }
.price span { color: var(--muted); font-size: 14px; }
.price-year { margin: 0 0 8px; font-size: 14px; color: var(--good); font-weight: 600; }
.price-list, .feat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.price-list li, .feat-list li { display: flex; gap: 8px; align-items: flex-start; font-size: 15px; }
.price-list .i, .feat-list .i { width: 18px; height: 18px; color: var(--good); flex: none; margin-top: 3px; }
.steps { margin: 0; padding-left: 22px; display: grid; gap: 10px; max-width: 72ch; }
.steps li { padding-left: 4px; }
.req { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 24px; margin: 0; padding: 20px 22px; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); max-width: 640px; }
.req dt { color: var(--muted); }
.req dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.fill-me { display: inline-block; padding: 0 8px; border-radius: 6px; background: var(--bad-soft); color: var(--bad); font-weight: 600; font-size: 14px; }
.offer { max-width: 78ch; }
.offer h2 { font-size: 18px; margin: 28px 0 8px; }
.offer p { margin: 0 0 8px; line-height: 1.6; }
.pub-foot { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); }
.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-top: 18px; font-size: 14px; }
.legal-links a { color: var(--muted); }
.pub-foot .legal-links { justify-content: flex-start; margin-top: 0; }
@media (max-width: 800px) {
  .price-grid { grid-template-columns: minmax(0, 1fr); }
  .pub-nav { margin-right: 6px; }
  .pub-nav a { padding: 6px 8px; font-size: 14px; }
  .req { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .req dd { margin-bottom: 10px; }
}
/* ---------- подтверждение телефона или почты ---------- */
.verify-opt { display: grid; gap: 12px; padding: 16px; margin-bottom: 12px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); }
.verify-h { display: flex; gap: 12px; align-items: center; }
.verify-h div { display: grid; line-height: 1.35; }
.verify-h span:not(.plan-stat-ic) { font-size: 14px; color: var(--muted); }
.verify-row { display: flex; flex-wrap: wrap; gap: 8px; }
.verify-row .input { flex: 1 1 200px; min-width: 0; }
.verify-row .btn { flex: 1 0 auto; }
.verify-opt .hint, .verify-opt .error { margin: 0; }
.price-edit { display: grid; gap: 10px; }
.price-edit-row { display: grid; grid-template-columns: minmax(0, 1.2fr) 1fr 1fr; gap: 12px; align-items: end; padding: 14px 16px; background: var(--surface); border-radius: var(--r-sm); box-shadow: var(--shadow); }
.price-edit-row > div { display: grid; align-self: center; }
.price-edit-row .field { margin: 0; }
@media (max-width: 640px) { .price-edit-row { grid-template-columns: 1fr 1fr; } .price-edit-row > div { grid-column: 1 / -1; } }
/* ответы столбиком и подсказка о несохранённом */
.q-lines { font: 15px/1.7 ui-monospace, "Cascadia Code", Consolas, monospace; margin-top: 8px; }
.unsaved { align-self: center; font-size: 14px; color: var(--warn); font-weight: 600; }
.nowrap { white-space: nowrap; }
#who { scroll-margin-top: 84px; }

/* Администратор: состояние сайта, обращения и рефералы */
.good-text { color: var(--good); }
.bad-text { color: var(--bad); }
.health-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.health-grid > div { display: grid; gap: 5px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); }
.health-grid b { font-size: 18px; }
.support-form { max-width: 680px; display: grid; gap: 12px; }
.support-form h2 { margin: 0; }
.support-form .field { margin: 0; }
.support-list, .support-messages { display: grid; gap: 10px; }
.support-list { max-width: 900px; }
.support-row { display: flex; justify-content: space-between; gap: 8px 22px; align-items: baseline; flex-wrap: wrap; text-decoration: none; color: var(--ink); }
a.support-row:hover { border-color: var(--accent); }
.support-row b { color: var(--ink); }
.referral-row { padding: 11px 4px; border-bottom: 1px solid var(--line); }
.support-messages { max-width: 760px; margin-bottom: 24px; }
.support-message { max-width: 90%; }
.support-message.from-admin { margin-left: auto; background: var(--accent-soft); }
.support-message p { margin: 8px 0 0; overflow-wrap: anywhere; line-height: 1.55; }
@media (max-width: 700px) {
  .health-grid { grid-template-columns: 1fr; }
  .support-message { max-width: 100%; }
  .support-row { display: grid; }
}

/* Время заданий и пояснения тестов */
.assignment-timing{min-width:0;margin:20px 0;padding:18px;border:1px solid var(--line);border-radius:12px}
.assignment-timing legend{padding:0 8px;font-weight:600}.assignment-timing .row{flex-wrap:wrap}.assignment-timing .field{min-width:0;flex:1 1 240px}.assignment-timing input[type=datetime-local]{width:100%;min-width:0}
.timing-check{display:flex;align-items:flex-start;gap:10px}.timing-check input{margin-top:4px}
.timing-panel{margin:20px 0;padding:22px;border:1px solid var(--line);border-radius:14px;background:var(--surface);overflow-wrap:anywhere}.timing-panel h2{font-size:20px;margin:0 0 10px}.timing-panel p{margin-bottom:12px}.timing-panel form{max-width:560px}.timing-panel .input{max-width:100%;min-width:0}.timing-reason{white-space:pre-wrap}.late-request-list{display:grid;gap:10px}.late-request-list a{display:grid;gap:4px;padding:12px;border:1px solid var(--line);border-radius:10px;color:var(--ink)}.late-request-list small{color:var(--muted)}
.q-extra.q-explanation{display:grid;gap:6px}.q-extra.q-explanation .input{width:100%;min-height:90px;padding:10px;flex:none}.q-option-explanations{grid-column:2/-1;min-width:0;font-size:14px}.q-option-explanations summary{cursor:pointer;margin:8px 0}.q-option-explanations .field{margin-top:12px}.test-explanation{padding:14px 16px;background:var(--surface);border-radius:10px;white-space:normal;overflow-wrap:anywhere;font-size:15px;line-height:1.6}.test-explanation>b{display:block;margin-bottom:6px}.test-explanation ul{padding-left:22px}.test-explanation li+li{margin-top:8px}.qa-result .test-explanation-row td{padding-top:0}
@media(max-width:600px){.timing-panel{padding:16px}.timing-panel .actions{display:flex;flex-wrap:wrap}.timing-panel .actions button{width:100%}.assignment-timing{padding:12px}.assignment-timing .row{display:flex}.test-explanation{font-size:15px;padding:12px}}

/* Единый выбор даты и времени в светлой и тёмной теме. */
.dt-pair{display:grid;align-items:start;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin:18px 0}
.dt-field{min-width:0;border:1px solid var(--line);border-radius:14px;padding:15px;background:var(--surface)}
.dt-title{display:block;font-size:14px;font-weight:600;margin-bottom:12px}
.dt-control{display:flex;gap:8px;align-items:stretch}.dt-date{font:inherit;font-size:14px;display:flex;align-items:center;gap:9px;flex:1;min-width:0;min-height:48px;text-align:left;border:1px solid var(--line);border-radius:10px;padding:10px;background:var(--bg);color:var(--ink);cursor:pointer}.dt-date span{overflow-wrap:anywhere}.dt-date svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.6;flex-shrink:0;color:var(--muted)}
.dt-date:hover,.dt-date[aria-expanded=true]{border-color:var(--accent,#3155ee)}.dt-date:focus-visible,.dt-calendar button:focus-visible,.dt-clear:focus-visible{outline:2px solid var(--accent,#3155ee);outline-offset:3px}
.dt-clock{position:relative;flex:0 0 80px;min-width:0}.dt-clock>span{position:absolute;top:5px;left:11px;font-size:10px;line-height:1;color:var(--muted)}.dt-clock .input{width:100%;min-height:48px;padding:16px 10px 4px!important;font-size:16px!important;font-variant-numeric:tabular-nums;text-align:center;border-radius:10px}.dt-clock input:disabled{opacity:.45;cursor:default}
.dt-foot{display:flex;gap:8px;align-items:baseline;justify-content:space-between;margin-top:10px;min-height:18px;font-size:11px;color:var(--muted)}.dt-foot [data-date-note]{overflow-wrap:anywhere}.dt-clear{padding:0;border:0;background:none;color:var(--muted);font:inherit;font-size:11px;cursor:pointer;white-space:nowrap}.dt-clear:hover{color:var(--ink)}
.dt-calendar{margin-top:14px;border-top:1px solid var(--line);padding-top:12px}.dt-calendar-head{display:flex;gap:6px;justify-content:space-between;align-items:center;margin-bottom:10px}.dt-calendar-head>button{border:1px solid var(--line);background:var(--bg);border-radius:8px;color:var(--ink);font:inherit;font-size:24px;line-height:1;min-width:32px;min-height:36px;cursor:pointer}.dt-calendar-head>div{display:flex;min-width:0;gap:2px;justify-content:center;align-items:center;flex:1}.dt-calendar-head select,.dt-calendar-head input{border:0;background:var(--surface);color:var(--ink);font:inherit;font-size:13px;font-weight:600;min-width:0;padding:4px}.dt-calendar-head select{width:105px;max-width:60%}.dt-calendar-head input{width:60px;appearance:textfield}.dt-calendar-head input::-webkit-inner-spin-button{appearance:none}
.dt-weekdays,.dt-days{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:3px;text-align:center}.dt-weekdays{color:var(--muted);font-size:11px;margin-bottom:6px}.dt-days>button{font:inherit;font-size:13px;border:1px solid transparent;border-radius:8px;background:none;color:var(--ink);min-width:0;height:34px;cursor:pointer;font-variant-numeric:tabular-nums}.dt-days>button:hover{background:var(--bg);border-color:var(--line)}.dt-days>button.today{border-color:var(--line);font-weight:700}.dt-days>button.selected{background:#3155ee;color:#fff;border-color:#3155ee;box-shadow:0 3px 9px #3155ee25}
.dt-shortcuts{display:flex;gap:5px;flex-wrap:wrap;margin-top:12px;padding-top:10px;border-top:1px solid var(--line)}.dt-shortcuts button{font:inherit;font-size:11px;border:1px solid var(--line);color:var(--ink);background:var(--bg);padding:6px 8px;border-radius:7px;cursor:pointer}.dt-shortcuts button:hover{border-color:#3155ee;color:#3155ee}
.assignment-timing>.field{margin-bottom:0}.timing-panel .dt-field{margin:16px 0;max-width:360px}
@media(max-width:620px){.dt-pair{grid-template-columns:1fr;gap:12px}.dt-field{padding:14px}.dt-date{min-height:52px;font-size:15px}.dt-clock{flex-basis:88px}.dt-clock .input{min-height:52px}.dt-days>button{height:40px;font-size:14px}.dt-shortcuts button{font-size:12px;padding:8px 10px}.dt-calendar-head select,.dt-calendar-head input{font-size:14px}.dt-foot,.dt-clear{font-size:12px}}
