:root {
  --night: oklch(0.17 0.03 265); --night-2: oklch(0.205 0.035 262); --night-ink: oklch(0.95 0.008 250);
  --night-mut: oklch(0.74 0.02 255); --night-line: oklch(0.34 0.03 260);
  --ice: oklch(0.8 0.11 215); --ice-soft: oklch(0.87 0.07 210); --ice-deep: oklch(0.52 0.13 240);
  --day: oklch(0.965 0.007 235); --paper: oklch(0.99 0.004 240); --ink: oklch(0.23 0.02 260);
  --mut: oklch(0.46 0.018 255); --line: oklch(0.895 0.012 245);
  --ok: oklch(0.55 0.13 160); --ok-bg: oklch(0.95 0.04 160); --warn: oklch(0.7 0.14 80); --warn-bg: oklch(0.96 0.05 85);
  --bad: oklch(0.55 0.18 25); --bad-bg: oklch(0.95 0.04 25);
  --display: 'Unbounded', 'Arial Black', sans-serif; --body: 'Golos Text', 'Helvetica Neue', Arial, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body { font-family: var(--body); font-size: 16px; line-height: 1.55; color: var(--ink); background: var(--day); }
button { font-family: var(--body); cursor: pointer; }
[hidden] { display: none !important; }
.muted { color: var(--mut); font-weight: 400; font-size: 13px; }

/* ---------- вход / приглашение ---------- */
.login-screen { min-height: 100%; display: flex; align-items: center; justify-content: center; background: var(--night); color: var(--night-ink); position: relative; overflow: hidden; padding: 24px; }
.login-screen .glow { position: absolute; border-radius: 50%; filter: blur(90px); pointer-events: none; }
.login-screen .g1 { width: 55vw; height: 45vh; left: 6%; top: -10%; background: oklch(0.5 0.13 175 / 0.5); }
.login-screen .g2 { width: 40vw; height: 40vh; right: -8%; bottom: -12%; background: oklch(0.5 0.14 230 / 0.45); }
.login-card { position: relative; z-index: 2; width: 100%; max-width: 400px; background: oklch(0.205 0.035 262 / 0.85); border: 1px solid var(--night-line); border-radius: 20px; padding: 38px 34px 34px; box-shadow: 0 30px 80px -30px oklch(0.08 0.02 260 / 0.9); }
.login-mark { height: 44px; width: auto; display: block; margin-bottom: 22px; }
.login-card h1 { font-family: var(--display); font-weight: 700; font-size: 24px; margin-bottom: 6px; }
.login-card .sub { color: var(--night-mut); font-size: 14.5px; margin-bottom: 26px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--night-mut); margin-bottom: 6px; }
.field input { width: 100%; font: 16px var(--body); color: var(--night-ink); background: oklch(0.17 0.03 265); border: 1px solid var(--night-line); border-radius: 10px; padding: 12px 14px; outline: none; transition: border-color 0.2s; }
.field input:focus { border-color: var(--ice); }
.login-err { color: oklch(0.75 0.16 25); font-size: 14px; min-height: 20px; margin: 4px 0 10px; }
.btn-login { width: 100%; border: 0; border-radius: 12px; padding: 13px; font-weight: 600; font-size: 15.5px; background: var(--ice); color: oklch(0.16 0.03 262); transition: background 0.2s, transform 0.25s var(--ease); }
.btn-login:hover { background: var(--ice-soft); transform: translateY(-1px); }
.btn-login:disabled { opacity: 0.6; transform: none; }
.login-foot { margin-top: 20px; font-size: 12.5px; color: var(--night-mut); }

/* ---------- каркас ---------- */
.app { min-height: 100%; display: flex; flex-direction: column; }
.topbar { background: var(--night); color: var(--night-ink); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px clamp(16px, 3vw, 28px); position: sticky; top: 0; z-index: 10; }
.topbar .mark { height: 18px; width: auto; display: block; }
.topbar .brand { font-family: var(--display); font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; margin-right: 8px; }
.topbar .brand small { font-family: var(--body); font-weight: 500; color: var(--night-mut); font-size: 12.5px; margin-left: 2px; }
.topnav { display: flex; gap: 6px; flex-wrap: wrap; }
.topbar .who { margin-left: auto; font-size: 13.5px; color: var(--night-mut); }
.btn-quiet { background: transparent; color: var(--night-ink); border: 1px solid var(--night-line); border-radius: 9px; padding: 6px 13px; font-size: 13px; }
.btn-quiet:hover { border-color: var(--ice); color: var(--ice); }
.btn-quiet.on { border-color: var(--ice); color: var(--ice); background: oklch(0.8 0.11 215 / 0.12); }
.btn-quiet.small { padding: 5px 10px; font-size: 12.5px; }
.more { position: relative; }
.more-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; display: grid; gap: 4px; padding: 6px; min-width: 230px; background: var(--night-2); border: 1px solid var(--night-line); border-radius: 12px; box-shadow: 0 16px 36px -12px oklch(0.08 0.02 260 / 0.8); }
.more-menu[hidden] { display: none; }
.more-menu .btn-quiet { text-align: left; white-space: nowrap; }

.layout { flex: 1; display: grid; grid-template-columns: 230px minmax(0, 1fr) 380px; gap: 0; align-items: stretch; min-height: 0; }

/* ---------- сайдбар ---------- */
.side { border-right: 1px solid var(--line); background: var(--paper); padding: 18px 10px; overflow-y: auto; }
.side h2 { font-size: 11.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mut); padding: 0 10px 6px; }
.side .counter { font-size: 11.5px; color: var(--mut); padding: 0 10px 8px; }
.lesson-btn { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 10px; padding: 9px 10px; font-size: 14px; color: var(--ink); line-height: 1.35; transition: background 0.15s; }
.lesson-btn:hover { background: oklch(0.93 0.012 235); }
.lesson-btn.on { background: var(--night); color: var(--night-ink); }
.lesson-btn .n { display: inline-block; min-width: 21px; font-weight: 700; color: var(--ice-deep); }
.lesson-btn.on .n { color: var(--ice); }
.lesson-btn .st { float: right; font-size: 12px; color: var(--ok); margin-left: 6px; }
.lesson-btn.on .st { color: oklch(0.8 0.12 160); }
.doc-btn { margin-bottom: 8px; border: 1px solid var(--line) !important; background: var(--day) !important; }
.doc-btn.on { background: var(--night) !important; }

/* ---------- контент ---------- */
.content { overflow-y: auto; padding: 28px clamp(20px, 3.5vw, 44px) 80px; background: var(--day); }
.content-inner { max-width: 880px; }
.placeholder { color: var(--mut); max-width: 50ch; padding-top: 8vh; }
.placeholder h2 { font-family: var(--display); font-size: 21px; color: var(--ink); margin-bottom: 12px; }
.box h2 { font-family: var(--display); font-size: 21px; margin-bottom: 6px; }
.box p.hint { color: var(--mut); font-size: 14px; margin-bottom: 16px; max-width: 62ch; }
.box .err { color: var(--bad); font-size: 13.5px; margin: 6px 0 10px; min-height: 18px; }
.box .ok { color: var(--ok); }
.box table { border-collapse: collapse; width: 100%; font-size: 14px; margin-bottom: 20px; }
.box th, .box td { text-align: left; padding: 8px 9px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.box th { font-size: 11.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--mut); }
.box .act { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-sm { font-size: 12.5px; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--day); color: var(--ink); white-space: nowrap; }
.btn-sm:hover { border-color: var(--mut); }
.btn-sm.danger:hover { border-color: var(--bad); color: var(--bad); }
.btn-sm.primary { background: var(--ice); border-color: var(--ice); color: oklch(0.16 0.03 262); font-weight: 600; }
.btn-mark { border: 0; border-radius: 9px; padding: 8px 14px; font-weight: 600; font-size: 13.5px; background: var(--ice); color: oklch(0.16 0.03 262); }
.btn-mark:hover { background: var(--ice-soft); }
.btn-mark.undo { background: transparent; color: var(--mut); border: 1px solid var(--line); font-weight: 500; }
.add-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.add-form input, .add-form select { font: 14.5px var(--body); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; background: var(--paper); color: var(--ink); min-width: 160px; }
.pw-box { background: var(--night); color: var(--night-ink); border-radius: 12px; padding: 14px 16px; margin: 8px 0 18px; font-size: 14.5px; line-height: 1.6; }
.pw-box code { font-family: ui-monospace, Menlo, monospace; font-size: 15px; background: oklch(0.26 0.04 262); padding: 2px 8px; border-radius: 6px; user-select: all; word-break: break-all; }
.pw-box .muted { color: var(--night-mut); }
.pill { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 100px; background: var(--paper); border: 1px solid var(--line); color: var(--mut); }
.pill.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.pill.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.pill.warn { background: var(--warn-bg); color: oklch(0.5 0.12 80); border-color: transparent; }

/* статус урока + заметки */
.status-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px; }
.status-bar.done { border-color: oklch(0.75 0.1 160); background: var(--ok-bg); }
.status-bar .txt { flex: 1; min-width: 200px; }
.status-bar select, .status-bar input { font: 13.5px var(--body); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--day); color: var(--ink); }
.lim { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.lim-in { width: 80px; font: 14px var(--body); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--paper); color: var(--ink); }
.limlog { margin-top: 10px; }
.keybox { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.keybox code { font-size: 12.5px; background: var(--day); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; word-break: break-all; user-select: all; }
.limlog summary { cursor: pointer; color: var(--mut); font-size: 13.5px; }
/* Выпадающие списки в стиле сайта (static/vselect.js); настоящий <select> спрятан внутри */
.vs { position: relative; display: inline-block; vertical-align: middle; min-width: 160px; }
.vs-native { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
.vs-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; font: 14.5px var(--body); text-align: left; line-height: 1.35; cursor: pointer; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; transition: border-color 0.2s, box-shadow 0.2s; }
.vs-btn:hover { border-color: oklch(0.78 0.03 240); }
.vs-btn:focus-visible, .vs.is-open .vs-btn { outline: none; border-color: var(--ice-deep); box-shadow: 0 0 0 3px oklch(0.8 0.11 215 / 0.25); }
.vs-chev { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--ice-deep); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.25s var(--ease); }
.vs.is-open .vs-chev { transform: rotate(180deg); }
.vs-list { position: absolute; left: 0; top: calc(100% + 6px); z-index: 40; min-width: 100%; margin: 0; padding: 5px; list-style: none; max-height: 320px; overflow-y: auto; white-space: nowrap; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 40px -14px oklch(0.25 0.03 260 / 0.35); animation: vs-in 0.18s var(--ease); }
.vs-list[hidden] { display: none; }
.vs.is-up .vs-list { top: auto; bottom: calc(100% + 6px); animation-name: vs-in-up; }
@keyframes vs-in { from { opacity: 0; transform: translateY(-4px); } }
@keyframes vs-in-up { from { opacity: 0; transform: translateY(4px); } }
.vs-opt { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14.5px; line-height: 1.35; color: var(--ink); }
.vs-opt.is-act { background: var(--day); }
.vs-opt.is-sel { color: var(--ice-deep); font-weight: 600; }
.vs-tick { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--ice-deep); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.vs-opt.is-sel .vs-tick { opacity: 1; }
.vs.is-disabled .vs-btn { opacity: 0.6; cursor: default; }
.status-bar .vs { min-width: 0; }
.status-bar .vs-btn { font-size: 13.5px; border-radius: 8px; padding: 6px 8px; background: var(--day); }
@media (prefers-reduced-motion: reduce) { .vs-list { animation: none; } .vs-chev { transition: none; } }
.notes { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 18px; font-size: 14px; }
.notes h3 { font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--mut); margin-bottom: 8px; }
.note { padding: 8px 0; border-top: 1px dashed var(--line); display: flex; gap: 10px; align-items: flex-start; }
.note:first-of-type { border-top: 0; }
.note .meta { color: var(--mut); font-size: 12px; white-space: nowrap; }
.note .txt { flex: 1; white-space: pre-wrap; }
.note-form { display: flex; gap: 8px; margin-top: 8px; }
.note-form textarea { flex: 1; font: 14px var(--body); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; resize: vertical; min-height: 40px; background: var(--day); }

/* сценарий */
article.lesson { font-size: 15.5px; }
article.lesson h1 { font-family: var(--display); font-size: clamp(20px, 2.6vw, 27px); line-height: 1.25; margin: 4px 0 14px; }
article.lesson h2 { font-family: var(--display); font-weight: 700; font-size: 17px; margin: 30px 0 10px; }
article.lesson h3 { font-size: 15.5px; margin: 20px 0 8px; }
article.lesson p, article.lesson li { color: oklch(0.32 0.02 260); }
article.lesson p { margin: 0 0 10px; }
article.lesson ul, article.lesson ol { margin: 0 0 12px; padding-left: 22px; }
article.lesson li { margin-bottom: 4px; }
article.lesson em { color: var(--mut); }
article.lesson hr { border: 0; border-top: 1px solid var(--line); margin: 26px 0; }
article.lesson blockquote { position: relative; margin: 12px 0 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 13px 16px; }
article.lesson blockquote p { margin-bottom: 6px; }
article.lesson blockquote p:last-child { margin-bottom: 0; }
.copy-btn { position: absolute; top: 8px; right: 8px; font-size: 11.5px; padding: 3px 9px; border-radius: 7px; border: 1px solid var(--line); background: var(--day); color: var(--mut); }
.copy-btn:hover { color: var(--ink); border-color: var(--mut); }
.copy-btn.done { color: var(--ok); border-color: oklch(0.7 0.09 160); }
article.lesson table { border-collapse: collapse; width: 100%; margin: 10px 0 16px; font-size: 14px; display: block; overflow-x: auto; }
article.lesson th, article.lesson td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
article.lesson th { background: var(--paper); font-size: 12.5px; letter-spacing: 0.03em; }
article.lesson code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; background: oklch(0.93 0.012 235); border-radius: 5px; padding: 1px 5px; }
article.lesson pre { background: var(--night); color: var(--night-ink); border-radius: 12px; padding: 14px 16px; overflow-x: auto; margin: 10px 0 16px; }
article.lesson pre code { background: none; color: inherit; padding: 0; }

/* посещаемость / домашки */
.att { display: flex; flex-wrap: wrap; gap: 6px; }
.att button { font-size: 13px; padding: 6px 11px; border-radius: 100px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); }
.att button.present { background: var(--ok-bg); border-color: transparent; color: var(--ok); font-weight: 600; }
.att button.late { background: var(--warn-bg); border-color: transparent; color: oklch(0.5 0.12 80); font-weight: 600; }
.att button.absent { background: var(--bad-bg); border-color: transparent; color: var(--bad); font-weight: 600; text-decoration: line-through; }
.hw-wrap { overflow-x: auto; }
.hw { border-collapse: collapse; font-size: 13px; }
.hw th, .hw td { border: 1px solid var(--line); padding: 5px 6px; text-align: center; }
.hw th.name, .hw td.name { text-align: left; white-space: nowrap; min-width: 150px; position: sticky; left: 0; background: var(--day); }
.hw th .d { display: block; font-size: 10px; color: var(--ok); }
.hw td.cell { cursor: pointer; width: 44px; user-select: none; }
.hw td.cell:hover { background: oklch(0.93 0.012 235); }
.hw td.done { background: var(--ok-bg); color: var(--ok); font-weight: 700; }
.hw td.partial { background: var(--warn-bg); color: oklch(0.5 0.12 80); font-weight: 700; }
.hw td.none { background: var(--bad-bg); color: var(--bad); font-weight: 700; }
.legend { font-size: 13px; color: var(--mut); margin: 10px 0 18px; }

/* статистика */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 14px 0 22px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.card .n { font-family: var(--display); font-size: 24px; font-weight: 700; line-height: 1.1; }
.card .c { font-size: 12.5px; color: var(--mut); margin-top: 4px; }
.bar { position: relative; height: 8px; background: oklch(0.92 0.01 240); border-radius: 100px; min-width: 90px; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 100px; background: var(--ice-deep); }
.bar.hw i { background: var(--ok); }
.risk { background: var(--bad-bg); border-radius: 12px; padding: 12px 14px; margin-bottom: 18px; font-size: 14px; }
.risk h3 { font-size: 14px; color: var(--bad); margin-bottom: 6px; }
.section-title { font-family: var(--display); font-size: 15px; margin: 22px 0 8px; }

/* ---------- чат ---------- */
.chat { border-left: 1px solid var(--line); background: var(--paper); display: flex; flex-direction: column; min-height: 0; position: sticky; top: 49px; height: calc(100vh - 49px); }
.chat-head { padding: 14px 18px 10px; border-bottom: 1px solid var(--line); }
.chat-head .t { font-weight: 600; font-size: 14.5px; }
.chat-head .s { font-size: 12.5px; color: var(--mut); }
.chat-log { flex: 1; overflow-y: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 92%; border-radius: 13px; padding: 9px 13px; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--night); color: var(--night-ink); border-bottom-right-radius: 5px; }
.msg.bot { align-self: flex-start; background: var(--day); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.msg.bot b { font-weight: 600; }
.msg.bot code { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; background: oklch(0.93 0.012 235); border-radius: 4px; padding: 0 4px; }
.msg.wait { color: var(--mut); font-style: italic; }
.chat-hint { padding: 0 14px 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.hint-chip { font-size: 12px; padding: 4px 10px; border-radius: 100px; border: 1px solid var(--line); background: var(--day); color: var(--mut); }
.hint-chip:hover { color: var(--ink); border-color: var(--mut); }
.chat-form { display: flex; gap: 8px; padding: 10px 14px 14px; border-top: 1px solid var(--line); }
.chat-form textarea { flex: 1; resize: none; font: 14px/1.4 var(--body); color: var(--ink); border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; outline: none; max-height: 130px; background: var(--day); }
.chat-form textarea:focus { border-color: var(--ice-deep); }
.chat-send { border: 0; border-radius: 11px; padding: 0 16px; font-weight: 600; font-size: 14px; background: var(--ice); color: oklch(0.16 0.03 262); }
.chat-send:hover { background: var(--ice-soft); }
.chat-send:disabled { opacity: 0.55; }

/* ---------- режим «Веду урок» ---------- */
.mode { position: fixed; inset: 0; z-index: 50; background: var(--night); color: var(--night-ink); display: flex; flex-direction: column; overflow: hidden; }
.mode-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 20px; border-bottom: 1px solid var(--night-line); }
.mode-title { font-family: var(--display); font-weight: 700; font-size: 16px; flex: 1; min-width: 200px; }
.mode-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.mode .btn-sm { background: transparent; color: var(--night-ink); border-color: var(--night-line); }
.mode .btn-sm:hover { border-color: var(--ice); color: var(--ice); }
.mode-grid { flex: 1; display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 0; min-height: 0; }
.mode-col { padding: 18px 20px; overflow-y: auto; border-right: 1px solid var(--night-line); }
.mode-col:last-child { border-right: 0; }
.mode h3 { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--night-mut); margin: 6px 0 10px; }
.timer { text-align: center; padding: 8px 0 16px; }
.timer-big { font-family: var(--display); font-weight: 900; font-size: clamp(56px, 7vw, 92px); line-height: 1; letter-spacing: -0.02em; color: var(--ice); }
.timer-big.over { color: oklch(0.75 0.16 25); }
.timer-sub { color: var(--night-mut); font-size: 14px; margin: 6px 0 12px; }
.timer-btns { display: flex; gap: 8px; justify-content: center; }
.blocks { list-style: none; padding: 0; }
.blocks li { display: flex; gap: 12px; padding: 9px 12px; border-radius: 10px; font-size: 14.5px; color: var(--night-mut); }
.blocks li .t { min-width: 58px; font-variant-numeric: tabular-nums; }
.blocks li.now { background: oklch(0.8 0.11 215 / 0.14); color: var(--night-ink); border: 1px solid oklch(0.8 0.11 215 / 0.5); }
.blocks li.past { opacity: 0.45; }
.checks label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; font-size: 14.5px; cursor: pointer; }
.checks label:hover { background: oklch(0.8 0.11 215 / 0.08); }
.checks input { margin-top: 4px; accent-color: var(--ice); width: 16px; height: 16px; }
.checks .h { color: var(--night-mut); font-size: 12.5px; margin-left: auto; white-space: nowrap; }
.checks label.done { color: var(--night-mut); text-decoration: line-through; }
.mode .att button { background: transparent; color: var(--night-ink); border-color: var(--night-line); }
.mode .att button.present { background: oklch(0.55 0.13 160 / 0.3); color: #cff2dc; }
.mode .att button.late { background: oklch(0.7 0.14 80 / 0.3); color: #f6e3b0; }
.mode .att button.absent { background: oklch(0.55 0.18 25 / 0.3); color: #f5c2b9; }
.prompts .pr { position: relative; background: var(--night-2); border: 1px solid var(--night-line); border-radius: 10px; padding: 10px 12px 10px; margin-bottom: 8px; font-size: 13.5px; white-space: pre-wrap; padding-right: 92px; }
.prompts .pr .copy-btn { background: transparent; color: var(--night-mut); border-color: var(--night-line); }

@media (max-width: 1150px) {
  .layout { grid-template-columns: 200px minmax(0, 1fr); }
  .chat { grid-column: 1 / -1; position: static; height: 460px; border-left: 0; border-top: 1px solid var(--line); }
  .mode-grid { grid-template-columns: 1fr 1fr; }
  .mode-col:last-child { grid-column: 1 / -1; border-top: 1px solid var(--night-line); }
}
@media (max-width: 760px) {
  .layout { display: block; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); padding: 10px; white-space: nowrap; overflow-x: auto; display: flex; gap: 4px; }
  .side h2, .side .counter { display: none; }
  .lesson-btn { width: auto; flex: 0 0 auto; font-size: 13px; }
  .content { padding: 20px 16px 40px; }
  .chat { height: 420px; }
  .topbar .brand small { display: none; }
  .mode-grid { grid-template-columns: 1fr; }
  .mode-col:last-child { grid-column: auto; }
}

/* v4: доступы к веб-чату */
.box h3 { font-size: 16px; margin: 22px 0 6px; }
.act-row { display: flex; gap: 8px; margin: 4px 0 10px; }
a.btn-sm { display: inline-block; text-decoration: none; }
.box td code { font-family: ui-monospace, Menlo, monospace; font-size: 14px; user-select: all; }

/* v5: заявки */
.act-row.wrap { flex-wrap: wrap; }
.ztable tr.zrow { cursor: pointer; }
.ztable tr.zrow:hover td { background: var(--day); }
.pill.z-new { background: oklch(0.93 0.06 85); }
.pill.z-contacted { background: oklch(0.93 0.04 240); }
.pill.z-accepted { background: oklch(0.9 0.09 155); }
.pill.z-waitlist { background: oklch(0.93 0.05 60); }
.pill.z-declined { background: oklch(0.92 0.02 260); color: var(--mut); }
.zcard { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin: 10px 0 14px; }
.zcard h3 { margin-top: 2px; }
.zvars { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 14px; margin-bottom: 8px; }
.zvars label, .ztpl { display: grid; gap: 4px; font-size: 13px; color: var(--mut); }
.zvars input, .ztpl textarea, .zarea { font: 14px var(--body); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; background: var(--paper); color: var(--ink); width: 100%; }
.ztpl { margin-bottom: 10px; }
.zgrid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .zgrid { grid-template-columns: 1fr; } }
.zq { font-size: 12.5px; color: var(--mut); margin-top: 10px; }
.za { font-size: 15px; white-space: pre-wrap; }
.zcheck { display: flex; gap: 8px; align-items: center; margin: 10px 0; font-weight: 600; }
.zpreview { background: var(--day); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; }
.zcard-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.zlegend { font-size: 13px !important; margin: -2px 0 12px !important; }
.zvars label b { color: var(--ink); font-weight: 600; }
.ztpl > b { color: var(--ink); font-size: 14px; }
.ztpl .hint { margin: 0 0 4px !important; font-size: 13px !important; }
.zprev-label { font-size: 12px; color: var(--mut); margin: 6px 0 0; }
.ztpl .zpreview { color: var(--ink); font-size: 14px; }
.zcard code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: var(--day); border-radius: 5px; padding: 1px 5px; }
.zmsg { background: var(--day); border-radius: 10px; padding: 8px 12px; margin: 8px 0; }
.zhist { padding-left: 18px; font-size: 13.5px; }

/* v7: инструкция «Как пользоваться Учительской» */
article.lesson.guide { max-width: 880px; counter-reset: sec; }
.guide h1 { font-size: clamp(22px, 2.8vw, 30px); margin-bottom: 10px; }
.guide h1 + p { font-size: 16.5px; color: var(--ink); max-width: 68ch; }
.guide .toc { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; margin: 18px 0 8px; }
.guide .toc .toctitle { display: block; font-family: var(--display); font-weight: 700; font-size: 14px; margin: 0 0 8px 8px; }
.guide .toc ul { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 2px 14px; counter-reset: toc; }
.guide .toc li { counter-increment: toc; margin: 0; }
.guide .toc a { display: flex; gap: 10px; align-items: baseline; color: var(--ink); text-decoration: none; padding: 6px 8px; border-radius: 8px; font-size: 14.5px; }
.guide .toc a::before { content: counter(toc, decimal-leading-zero); font-family: var(--display); font-size: 11.5px; color: var(--ice-deep); min-width: 20px; }
.guide .toc a:hover { background: var(--day); }
.guide h2 { counter-increment: sec; display: flex; gap: 12px; align-items: baseline; font-size: 19px; margin: 40px 0 12px; padding-top: 20px; border-top: 1px solid var(--line); scroll-margin-top: 12px; }
.guide h2::before { content: counter(sec, decimal-leading-zero); font-size: 13px; color: var(--ice-deep); }
.guide .tip { position: relative; background: oklch(0.955 0.03 215); border: 1px solid oklch(0.89 0.05 215); border-radius: 14px; padding: 12px 16px 12px 46px; margin: 14px 0 18px; }
.guide .tip::before { content: "💡"; position: absolute; left: 16px; top: 11px; font-size: 17px; }
.guide .tip p { margin: 0; color: var(--ink); }
.guide .ui { display: inline-block; font-size: 13px; font-weight: 600; line-height: 1.35; padding: 1px 9px; margin: 1px 1px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); color: var(--ink); white-space: nowrap; box-shadow: 0 1px 0 var(--line); }
.guide ol { counter-reset: st; list-style: none; padding-left: 0; }
.guide ol > li { counter-increment: st; position: relative; padding-left: 38px; margin-bottom: 10px; }
.guide ol > li::before { content: counter(st); position: absolute; left: 0; top: 1px; width: 25px; height: 25px; border-radius: 50%; background: var(--night); color: var(--night-ink); font-size: 12.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.guide ul > li { margin-bottom: 7px; }
#helpBtn.on { background: var(--ice); color: var(--night); }

/* почта */
.mailcount { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 100px; background: var(--bad); color: oklch(0.99 0.005 250); font-size: 11.5px; line-height: 18px; text-align: center; }
.mailtable tr.unread td { font-weight: 600; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); text-align: left; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.linkbtn:hover { text-decoration-color: currentColor; }
.mailtext { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 70ch; line-height: 1.55; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--day); }
.mailatt { padding-left: 20px; }
.mailreply { width: 100%; max-width: 640px; font: inherit; font-size: 15px; line-height: 1.5; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); }
.net-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; background: var(--night); color: var(--night-ink); border: 1px solid var(--night-line); border-radius: 12px; padding: 12px 18px; font-size: 14px; box-shadow: 0 16px 36px -12px oklch(0.08 0.02 260 / 0.6); }
.net-toast[hidden] { display: none; }
.lesson-btn .when { display: block; margin: 2px 0 0 24px; font-size: 11.5px; color: var(--mut); font-weight: 400; }
.status-bar .sched-break { flex-basis: 100%; height: 0; }
.status-bar input[type=date], .status-bar input[type=time] { font: 13.5px var(--body); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; background: var(--day); color: var(--ink); }
.botlog { background: var(--night); color: var(--night-ink); border-radius: 10px; padding: 10px 12px; font: 12px ui-monospace, Menlo, monospace; white-space: pre-wrap; max-height: 260px; overflow: auto; margin: 6px 0 12px; }
.hw.sk th { font-size: 11.5px; vertical-align: bottom; }
.hw.sk th .d { color: var(--mut); font-weight: 400; max-width: 80px; margin: 0 auto; }
.hw.sk th.fin, .hw.sk td.fin { background: oklch(0.95 0.03 215); }
.hw.sk td.cell.fin { background: inherit; }
.hw td.busy { opacity: 0.5; }
