/* AI LMS — стиль интерфейса.
   Сделан по принципам unslop (Damir Sokolovsky, @heydamir, CC BY 4.0, https://github.com/heydamir/unslop):
   тихий интерфейс на одной нейтральной шкале, сетка 4px, яркое место — разбор попытки (баллы по критериям),
   подпись — номер попытки как номер тикета (#12).
   Стиль — «премиальный монохром» (владелец, ноябрь 2026): белый/серый вместо цветного акцента, графитовый
   (не чёрный) фон в тёмной теме, крупные скругления, плотный геометрический шрифт.
   Шрифты — Manrope (интерфейс) и IBM Plex Mono (номера, логины), SIL OFL 1.1 — fonts/OFL-*.txt. */

/* ---------- шрифты */
/* Manrope — статичные начертания с флагом наложения контуров. Переменный файл без этого флага на Windows
   при масштабе 125% терял дугу у «n», «h», «m» (читалось как «r») */
@font-face { font-family: "Manrope"; font-weight: 500; font-display: swap; src: url("/fonts/Manrope-500.woff") format("woff"); }
@font-face { font-family: "Manrope"; font-weight: 600; font-display: swap; src: url("/fonts/Manrope-600.woff") format("woff"); }
@font-face { font-family: "Manrope"; font-weight: 700; font-display: swap; src: url("/fonts/Manrope-700.woff") format("woff"); }
@font-face { font-family: "Manrope"; font-weight: 800; font-display: swap; src: url("/fonts/Manrope-800.woff") format("woff"); }
@font-face { font-family: "Plex Mono"; font-weight: 400; font-display: swap; src: url("/fonts/IBMPlexMono-Regular-Latin1.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+2013-2014, U+2018-201A, U+201C-201E, U+2026, U+2039-203A, U+2212; }
@font-face { font-family: "Plex Mono"; font-weight: 400; font-display: swap; src: url("/fonts/IBMPlexMono-Regular-Cyrillic.woff2") format("woff2"); unicode-range: U+0400-04FF; }
@font-face { font-family: "Plex Mono"; font-weight: 500; font-display: swap; src: url("/fonts/IBMPlexMono-Medium-Latin1.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+2013-2014, U+2018-201A, U+201C-201E, U+2026, U+2039-203A, U+2212; }
@font-face { font-family: "Plex Mono"; font-weight: 500; font-display: swap; src: url("/fonts/IBMPlexMono-Medium-Cyrillic.woff2") format("woff2"); unicode-range: U+0400-04FF; }

/* ---------- светлая тема: светло-серый фон, белые карточки, акцент — почти чёрный */
:root {
  color-scheme: light;
  --bg: #efeff1;
  --panel: #ffffff;
  --panel-2: #f4f4f5;
  --hover: #f0f0f2;
  --row-hover: #f7f7f8;
  --input-bg: #ffffff;
  --line: rgba(20, 20, 22, .08);
  --line-strong: rgba(20, 20, 22, .15);
  --text: #141416;
  --muted: #55555b;
  --faint: #7a7a80;
  --label: #3c3c41;
  --nav-text: #55555b;
  --accent: #141416;
  --accent-fill: #141416;
  --on-accent: #ffffff;
  --accent-soft: rgba(20, 20, 22, .05);
  --accent-line: rgba(20, 20, 22, .2);
  --primary-fill: #141416;
  --on-primary: #ffffff;
  --bubble-me: #1d1d20;
  --on-bubble-me: #f4f4f5;
  --meter-from: #a3a3a9;
  --meter-to: #141416;
  --ok: #16a34a;   --ok-soft: rgba(22, 163, 74, .07);   --ok-line: rgba(22, 163, 74, .24);   --ok-text: #15803d;
  --warn: #b45309; --warn-soft: rgba(180, 83, 9, .07);  --warn-line: rgba(180, 83, 9, .24);  --warn-text: #92400e;
  --danger: #dc2626; --danger-soft: rgba(220, 38, 38, .06); --danger-line: rgba(220, 38, 38, .24); --danger-text: #b91c1c;
  --badge-bg: transparent;
  --badge-text: #55555b;
  --toast-bg: #141416;
  --overlay: rgba(10, 10, 12, .36);
  --shadow: 0 1px 2px rgba(20, 20, 22, .04);
  --modal-shadow: 0 24px 48px rgba(0, 0, 0, .12), 0 2px 6px rgba(0, 0, 0, .06);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- тёмная тема: графит, а не чёрный; акцент — белый, «хромовые» шкалы */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1b1b1e;
  --panel: #242427;
  --panel-2: #2e2e32;
  --hover: #2e2e32;
  --row-hover: #29292c;
  --input-bg: #1f1f22;
  --line: rgba(255, 255, 255, .07);
  --line-strong: rgba(255, 255, 255, .14);
  --text: #f2f2f3;
  --muted: #a7a7ad;
  --faint: #86868c;
  --label: #c4c4c9;
  --nav-text: #a7a7ad;
  --accent: #f2f2f3;
  --accent-fill: #f2f2f3;
  --on-accent: #161618;
  --accent-soft: rgba(255, 255, 255, .07);
  --accent-line: rgba(255, 255, 255, .2);
  --primary-fill: #f2f2f3;
  --on-primary: #161618;
  --bubble-me: #3a3a3f;
  --on-bubble-me: #f2f2f3;
  --meter-from: #6b6b71;
  --meter-to: #f2f2f3;
  --ok: #4cc38a;   --ok-soft: rgba(76, 195, 138, .10);  --ok-line: rgba(76, 195, 138, .28);  --ok-text: #6fd3a2;
  --warn: #e0a84a; --warn-soft: rgba(224, 168, 74, .10); --warn-line: rgba(224, 168, 74, .28); --warn-text: #e8bb6c;
  --danger: #e5484d; --danger-soft: rgba(229, 72, 77, .10); --danger-line: rgba(229, 72, 77, .30); --danger-text: #f07479;
  --badge-text: #a7a7ad;
  --toast-bg: #333337;
  --overlay: rgba(0, 0, 0, .55);
  --shadow: none;
  --modal-shadow: 0 24px 48px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 500 14px/22px var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { margin: 0; font-weight: 700; }
h1 { font-size: 32px; line-height: 40px; letter-spacing: -0.02em; }
h2 { font-size: 18px; line-height: 24px; letter-spacing: -0.01em; }
h3 { font-size: 15px; line-height: 20px; }
p { margin: 0 0 8px; }
p:last-child { margin-bottom: 0; }
strong { font-weight: 700; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; line-height: 20px; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; word-break: break-word; }
.grow { flex: 1 1 auto; min-width: 0; }
.mono, input.mono { font-family: var(--mono); font-size: 13px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 8px; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack.tight { gap: 8px; }
.ticket { font-family: var(--mono); font-size: 13px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* ---------- кнопки и поля */
button, .btn {
  font: 600 14px/20px var(--font); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 20px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--text); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease), transform 120ms var(--ease);
}
button:hover, .btn:hover { background: var(--hover); text-decoration: none; }
button:active:not(:disabled), .btn:active { transform: scale(0.98); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary, .btn.primary { background: var(--primary-fill); border-color: transparent; color: var(--on-primary); }
button.primary:hover, .btn.primary:hover { background: var(--primary-fill); filter: brightness(1.08); }
:root[data-theme="dark"] button.primary:hover, :root[data-theme="dark"] .btn.primary:hover { filter: brightness(0.92); }
button.danger { color: var(--danger-text); border-color: var(--danger-line); }
button.danger:hover { background: var(--danger-soft); }
button.ghost { border-color: transparent; background: transparent; color: var(--muted); }
button.ghost:hover { background: var(--hover); color: var(--text); }
button.small, .btn.small { height: 32px; padding: 0 14px; font-size: 13px; border-radius: 10px; }
button.icon { height: 32px; width: 32px; padding: 0; border-radius: 10px; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--text); outline-offset: 2px;
}

label.field { display: flex; flex-direction: column; gap: 8px; }
label.field > span.label, span.label { font-size: 13px; line-height: 16px; font-weight: 600; color: var(--label); }
.hint { font-size: 13px; line-height: 20px; color: var(--faint); }
input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  font: 500 14px/20px var(--font); color: var(--text); background: var(--input-bg); border: 1px solid var(--line-strong);
  border-radius: 12px; padding: 10px 14px; width: 100%; min-height: 40px;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
input.mono { font-family: var(--mono); }
select.auto { width: auto; }
textarea { resize: vertical; min-height: 88px; }
textarea.tall { min-height: 176px; }
input:focus, textarea:focus, select:focus { border-color: var(--text); outline: none; box-shadow: 0 0 0 4px var(--accent-soft); }
::placeholder { color: var(--faint); opacity: 1; }
label.check { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; font-size: 14px; line-height: 20px; }
label.check input { margin: 2px 0 0; width: 16px; height: 16px; accent-color: var(--accent-fill); flex: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ---------- каркас */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; height: 64px; padding: 0 28px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; letter-spacing: -0.01em; font-size: 16px; line-height: 20px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px; background: var(--accent-fill); color: var(--on-accent); display: grid; place-items: center;
  font: 800 13px/1 var(--font); letter-spacing: -0.02em;
}
.brand-sub { font-weight: 500; color: var(--faint); }
.topbar .who { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.layout { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: calc(100vh - 64px); }
.sidenav { background: var(--bg); border-right: 1px solid var(--line); padding: 20px 16px; display: flex; flex-direction: column; gap: 2px; }
.sidenav a {
  display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 14px; border-radius: 12px;
  color: var(--nav-text); font-weight: 600; font-size: 14px;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.sidenav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.sidenav a.active { background: var(--panel); color: var(--text); box-shadow: inset 0 0 0 1px var(--line), var(--shadow); }
.sidenav a.active .nav-ico { color: var(--accent); }
.nav-ico { width: 18px; height: 18px; flex: none; }
.main { padding: 40px; min-width: 0; max-width: 1440px; width: 100%; }
.main-narrow { max-width: 1024px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head .grow { display: flex; flex-direction: column; gap: 4px; }
.page-head p { color: var(--muted); margin: 4px 0 0; }
.crumbs { font-size: 13px; line-height: 20px; color: var(--faint); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.crumbs a { color: var(--faint); }
.crumbs a:hover { color: var(--text); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.card-pad { padding: 24px 28px; }
.card + .card { margin-top: 16px; }
.stack > .card, .cards > .card, .editor-side > .card, .tiles > .card { margin-top: 0; }
.main > .notice, .main > .tabs + .notice { margin-bottom: 16px; }
.section-title { display: flex; align-items: center; gap: 12px; margin: 32px 0 12px; }
.section-title:first-child, .row.section-title { margin-top: 0; }
.section-title .hint { margin-left: auto; }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--text); font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.empty button, .empty .btn { margin-top: 16px; }

/* ---------- таблицы */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font-size: 13px; font-weight: 600; color: var(--faint); padding: 14px 20px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 14px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: none; }
table.list th:first-child, table.list td:first-child { padding-left: 28px; }
table.list th:last-child, table.list td:last-child { padding-right: 28px; }
table.list tr.click { cursor: pointer; }
table.list tr.click td { transition: background-color 150ms var(--ease); }
table.list tr.click:hover td { background: var(--row-hover); }
table.list td.actions { text-align: right; white-space: nowrap; }
table.list td.actions > * + * { margin-left: 8px; }
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- метки: тихий текст с тонкой рамкой; статус — точка и слово */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 8px;
  font-size: 12px; line-height: 16px; font-weight: 600; color: var(--badge-text); background: var(--badge-bg);
  border: 1px solid var(--line-strong); white-space: nowrap;
}
.badge.ok { color: var(--ok-text); border-color: var(--ok-line); }
.badge.warn { color: var(--warn-text); border-color: var(--warn-line); }
.badge.danger { color: var(--danger-text); border-color: var(--danger-line); }
.badge.accent { color: var(--accent); border-color: var(--accent-line); }
.status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); flex: none; }
.status.ok::before { background: var(--ok); }
.status.warn::before { background: var(--warn); }
.status.danger::before { background: var(--danger); }
.status.accent::before { background: var(--accent); }
.score { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.score.good { color: var(--text); }
.score.mid { color: var(--warn-text); }
.score.bad { color: var(--danger-text); }

/* ---------- вкладки */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; overflow-y: hidden; }
.tabs button { border: none; border-radius: 0; background: none; height: 44px; padding: 0 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.tabs button:hover { background: none; color: var(--text); }
.tabs button:active { transform: none; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- окна и уведомления */
.overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 50; display: grid; place-items: center; padding: 24px; animation: fade 160ms var(--ease); }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--modal-shadow); width: min(560px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; animation: rise 200ms var(--ease); }
.modal.wide { width: min(760px, 100%); }
.modal-head { padding: 24px 28px 8px; display: flex; align-items: center; gap: 12px; }
.modal-head h2 { font-size: 20px; line-height: 28px; }
.modal-body { padding: 8px 28px; overflow-y: auto; }
.modal-foot { padding: 20px 28px 24px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.toasts { position: fixed; right: 24px; bottom: 24px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 48px)); }
.toast { background: var(--toast-bg); color: #fafafa; padding: 14px 18px; border-radius: 14px; box-shadow: var(--modal-shadow); font-size: 14px; animation: rise 200ms var(--ease); }
.toast.error { background: #b91c1c; }
.toast.ok { background: var(--toast-bg); box-shadow: inset 3px 0 0 var(--ok), var(--modal-shadow); }
.notice { padding: 14px 18px; border-radius: 14px; font-size: 14px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.notice.warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-text); }
.notice.danger { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger-text); }
.notice.ok { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok-text); }
.secret-box { font-family: var(--mono); font-size: 14px; line-height: 22px; background: var(--panel-2); border: 1px solid var(--line); padding: 14px 18px; border-radius: 12px; word-break: break-all; }

/* ---------- вход */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(420px, 100%); padding: 40px; border-radius: 28px; }
.auth-card .brand { margin-bottom: 32px; }
.auth-card h1 { font-size: 30px; line-height: 36px; margin-bottom: 8px; }
.auth-card form { display: flex; flex-direction: column; gap: 16px; margin-top: 24px; }
.auth-card button.primary { width: 100%; height: 48px; font-size: 15px; border-radius: 14px; }
.code-input { font-family: var(--mono) !important; font-size: 24px !important; line-height: 32px !important; letter-spacing: 8px; text-align: center; font-variant-numeric: tabular-nums; }
.form-error { color: var(--danger-text); font-size: 13px; line-height: 20px; }
.form-error:empty { display: none; }

/* ---------- курсы и задания */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.course-card { padding: 28px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; transition: border-color 150ms var(--ease); min-height: 136px; }
.course-card:hover { border-color: var(--line-strong); }
.course-card .meta { display: flex; gap: 16px; font-size: 13px; color: var(--faint); margin-top: auto; font-variant-numeric: tabular-nums; }
.task-row { display: flex; align-items: center; gap: 16px; padding: 16px 28px; min-height: 72px; border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: none; }
.task-row .grow > a { color: var(--text); font-weight: 700; font-size: 15px; }
.task-row .small a { color: var(--muted); }
.task-num { width: 24px; text-align: right; font-family: var(--mono); font-size: 13px; color: var(--faint); flex: none; font-variant-numeric: tabular-nums; }

/* ---------- редактор задания */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.editor-side { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 16px; }
.crit-row { display: grid; grid-template-columns: 1fr 88px 32px; gap: 8px; align-items: center; }
.crit-total { font-size: 13px; color: var(--faint); font-variant-numeric: tabular-nums; }
.savebar { display: flex; gap: 12px; align-items: center; }
.dirty-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); display: inline-block; }

/* ---------- чат */
.chat-page { max-width: 864px; margin: 0 auto; display: flex; flex-direction: column; height: calc(100vh - 64px); padding: 24px 24px 0; }
.chat-head { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.chat-brief { padding-top: 12px; }
.chat-brief summary { cursor: pointer; font-weight: 500; font-size: 13px; color: var(--muted); }
.chat-brief p { margin-top: 8px; color: var(--muted); }
.chat-log { flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 20px 0; }
.msg { max-width: 76%; padding: 14px 18px; border-radius: 18px; white-space: pre-wrap; word-break: break-word; font-size: 15px; line-height: 24px; border: 1px solid var(--line); }
.msg .who { display: block; font-size: 12px; line-height: 16px; font-weight: 500; margin-bottom: 4px; color: var(--faint); }
.msg.client { align-self: flex-start; background: var(--panel); border-top-left-radius: 6px; }
.msg.student { align-self: flex-end; background: var(--bubble-me); color: var(--on-bubble-me); border-color: transparent; border-top-right-radius: 6px; }
.msg.student .who { color: var(--on-bubble-me); opacity: .6; }
.msg.typing { color: var(--faint); }
.typing-dots::after { content: "…"; animation: dots 1.2s steps(3) infinite; display: inline-block; width: 1.2em; overflow: hidden; vertical-align: bottom; }
@keyframes dots { 0% { width: .3em; } 100% { width: 1.2em; } }
.composer { border-top: 1px solid var(--line); background: var(--bg); padding: 16px 0 20px; display: flex; gap: 12px; align-items: flex-end; }
.composer textarea { min-height: 52px; max-height: 200px; resize: none; padding: 14px 18px; font-size: 15px; line-height: 22px; border-radius: 16px; }
.composer button.primary { height: 52px; padding: 0 24px; border-radius: 16px; }
.turns { font-size: 13px; color: var(--faint); font-variant-numeric: tabular-nums; }
.feedback { padding: 32px; margin: 8px 0 24px; }

/* ---------- разбор: главное место экрана — баллы по критериям */
.score-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.big-score { font: 800 40px/44px var(--font); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; white-space: nowrap; }
.big-score small { font-size: 16px; color: var(--faint); letter-spacing: 0; }
.meter { height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--meter-from), var(--meter-to)); }
.big-meter { height: 10px; border-radius: 5px; margin: 16px 0 20px; }
.crit-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.crit-item:last-child { border-bottom: none; }
.crit-item .meter { grid-column: 1 / -1; height: 4px; margin: 4px 0 2px; }
.crit-item .score { font-size: 13px; }
.crit-item .c-comment { grid-column: 1 / -1; font-size: 14px; line-height: 20px; color: var(--muted); }
.advice { margin-top: 20px; padding: 16px 20px; border-radius: 14px; background: var(--panel-2); border-left: 2px solid var(--accent); color: var(--text); }
.advice strong { color: var(--text); font-weight: 700; }

/* ---------- попытка у тренера */
.attempt-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.transcript { display: flex; flex-direction: column; gap: 12px; padding: 24px; max-height: calc(100vh - 220px); overflow-y: auto; background: var(--bg); border-radius: 19px; }
.kv { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; }
details.snap { font-size: 14px; }
details.snap summary { cursor: pointer; font-weight: 700; }
details.snap > div { margin-top: 12px; }
details.snap .pre { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 4px; font-size: 13px; max-height: 260px; overflow: auto; }

/* ---------- результаты */
table.matrix td.cell { text-align: center; cursor: pointer; min-width: 96px; }
table.matrix td.cell:hover { background: var(--row-hover); }
table.matrix th.task-col { max-width: 176px; white-space: normal; text-align: center; }
.cell-sub { font-size: 12px; color: var(--faint); display: block; font-variant-numeric: tabular-nums; }

/* ---------- расходы и модели */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.tile { padding: 24px 28px; display: flex; flex-direction: column; gap: 4px; }
.tile .t-label { font-size: 13px; color: var(--faint); }
.tile .t-value { font: 800 32px/40px var(--font); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding-top: 12px; border-bottom: 1px solid var(--line); }
.bars .bar { flex: 1 1 0; max-width: 32px; background: var(--line-strong); border-radius: 4px 4px 0 0; min-height: 2px; transition: background-color 150ms var(--ease); }
.bars .bar:last-child { background: linear-gradient(180deg, var(--meter-to), var(--meter-from)); }
.bars .bar:hover { background: var(--muted); }
.bars-axis { display: flex; justify-content: space-between; font: 400 12px/16px var(--mono); color: var(--faint); margin-top: 8px; }
.model-card { padding: 24px 28px; display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.model-card + .model-card { margin-top: 12px; }

/* ---------- переключатель темы и поле секрета */
.theme-toggle { height: 32px; width: 32px; padding: 0; }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle.floating { position: fixed; top: 16px; right: 16px; z-index: 30; }
/* Маскируем шрифтом, а не type=password — иначе менеджер паролей считает форму входом */
input.secret-input:not(.revealed) { -webkit-text-security: disc; text-security: disc; }

@media (prefers-reduced-motion: reduce) {
  .overlay, .modal, .toast { animation: none; }
}
@media (max-width: 1100px) {
  .editor, .attempt-layout { grid-template-columns: 1fr; }
  .editor-side { position: static; }
  .transcript { max-height: none; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidenav { flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--line); padding: 8px; }
  .sidenav a { white-space: nowrap; flex: none; }
  .main { padding: 20px 16px 48px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .topbar { padding: 0 12px; gap: 8px; }
  .brand-sub, .who .who-name { display: none; }
  .brand { white-space: nowrap; }
  .msg { max-width: 90%; }
  .chat-page { padding: 16px 12px 0; }
  h1 { font-size: 24px; line-height: 32px; }
}

/* ---------- полосы прокрутки не показываем (прокрутка колесом и пальцем работает) */
* { scrollbar-width: none; }
*::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* ---------- числа без стрелок-«крутилок» */
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- фильтры над таблицей */
.filters { margin-bottom: 16px; }

/* ---------- свой выпадающий список (js/select.js) */
.select { position: relative; width: 100%; }
.select.auto { width: auto; display: inline-block; }
.select-native { position: absolute !important; inset: 0; opacity: 0; pointer-events: none; width: 100%; height: 100%; }
.select-btn {
  width: 100%; justify-content: space-between; gap: 12px; height: 40px; padding: 0 12px 0 14px;
  font-weight: 500; background: var(--input-bg); border: 1px solid var(--line-strong); border-radius: 12px; text-align: left;
}
.select-btn:hover { background: var(--input-bg); border-color: var(--muted); }
.select-btn:active:not(:disabled) { transform: none; }
.select-btn.open { border-color: var(--text); box-shadow: 0 0 0 4px var(--accent-soft); }
.select-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.select-chevron { width: 16px; height: 16px; flex: none; color: var(--faint); transition: transform 180ms var(--ease); }
.select-btn.open .select-chevron { transform: rotate(180deg); color: var(--text); }
.select-menu {
  position: fixed; z-index: 70; max-width: min(480px, calc(100vw - 24px)); overflow-y: auto; padding: 6px;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--modal-shadow);
  opacity: 0; transform: translateY(-4px); transition: opacity 160ms var(--ease), transform 160ms var(--ease);
}
.select-menu.up { transform: translateY(4px); }
.select-menu.shown { opacity: 1; transform: none; }
.select-option {
  display: flex; align-items: center; min-height: 36px; padding: 8px 32px 8px 12px; border-radius: 10px; cursor: pointer;
  font-size: 14px; line-height: 20px; color: var(--text); position: relative; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.select-option.active { background: var(--hover); }
.select-option.selected { font-weight: 700; }
.select-option.selected::after {
  content: ""; position: absolute; right: 12px; top: 50%; width: 10px; height: 5px; margin-top: -4px;
  border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg);
}
.select-option.disabled { color: var(--faint); cursor: default; }

/* ---------- глаз у поля ключа: черта «скрыто» рисуется и стирается */
.eye-btn .eye-slash { stroke-dasharray: 26; stroke-dashoffset: 0; transition: stroke-dashoffset 220ms var(--ease); }
.eye-btn.revealed .eye-slash { stroke-dashoffset: 26; }
.eye-btn .eye-pupil { transition: transform 220ms var(--ease); transform-origin: 12px 12px; }
.eye-btn:not(.revealed) .eye-pupil { transform: scale(0.6); }
@media (prefers-reduced-motion: reduce) { .eye-btn .eye-slash, .eye-btn .eye-pupil, .select-menu, .select-chevron { transition: none; } }

/* ---------- подключение 2FA */
.enroll-qr { margin: 20px auto 12px; width: 200px; height: 200px; padding: 12px; background: #ffffff; border-radius: 16px; border: 1px solid var(--line); }
.enroll-qr img { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.enroll-manual { margin-bottom: 4px; }
.enroll-manual summary { cursor: pointer; font-size: 13px; color: var(--muted); font-weight: 600; text-align: center; }
.enroll-manual .secret-box { margin-top: 8px; text-align: center; letter-spacing: 1px; }
.clamp { max-width: 260px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.link-quiet { color: var(--faint); }
.link-quiet:hover { color: var(--text); }
