/* ===== Токены ===== */
:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #f0efea;
  --line: #e3e1da;
  --line-2: #d2d0c7;
  --ink: #1c1d22;
  --ink-2: #4a4c55;
  --ink-3: #80828b;
  --accent: #3346c9;
  --accent-2: #2839a8;
  --accent-soft: #e8ebfb;
  --ok: #1d8a5f; --ok-soft: #e2f4ec;
  --warn: #b7791f; --warn-soft: #fbf0dc;
  --bad: #c43d3d; --bad-soft: #fbe6e4;
  --info: #2a7bbf; --info-soft: #e3f0fa;
  --violet: #7a4fd1; --violet-soft: #efe8fb;
  --radius: 12px;
  --radius-s: 8px;
  --shadow: 0 1px 2px rgba(20, 20, 30, .04), 0 6px 24px rgba(20, 20, 30, .06);
  --font: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16171b; --surface: #1f2026; --surface-2: #26272e; --line: #31323a; --line-2: #3d3e47;
    --ink: #ececef; --ink-2: #b9bac2; --ink-3: #85868f;
    --accent: #8b9bff; --accent-2: #a6b2ff; --accent-soft: #272c4d;
    --ok: #5cc998; --ok-soft: #173327; --warn: #e6b45c; --warn-soft: #3a2f18;
    --bad: #f07b7b; --bad-soft: #3d1f1f; --info: #6fb3ea; --info-soft: #172c3d;
    --violet: #b79cff; --violet-soft: #2c2342;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
svg:not([width]) { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0 0 .6em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--ink-3); }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-s { display: flex; flex-direction: column; gap: 6px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ===== Каркас ===== */
.layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; padding: 20px 14px; border-right: 1px solid var(--line);
  background: var(--surface); display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; padding: 4px 10px 18px; }
.brand img { width: 28px; height: 28px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; color: var(--ink-2); font-weight: 520;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.on { background: var(--accent-soft); color: var(--accent); }
.nav svg { width: 19px; height: 19px; flex: none; }
.nav .count { margin-left: auto; background: var(--accent); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; font-weight: 650; }
.side .me { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid transparent;
}
.topbar .title { font-weight: 650; font-size: 15px; }
.page { padding: 8px 28px 60px; max-width: 1240px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 10px 0 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); }
.bottom-nav { display: none; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar { padding: 12px 16px; }
  .page { padding: 4px 16px 96px; }
  h1 { font-size: 22px; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--surface);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--ink-3); padding: 4px 0; position: relative; }
  .bottom-nav a.on { color: var(--accent); }
  .bottom-nav a:hover { text-decoration: none; }
  .bottom-nav svg { width: 22px; height: 22px; }
  .bottom-nav .count { position: absolute; top: 0; left: 55%; background: var(--bad); color: #fff; border-radius: 99px; font-size: 10px; padding: 0 5px; }
}

/* ===== Карточки ===== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card.pad-0 { padding: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2 { font-size: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .g2, .g3 { grid-template-columns: 1fr; } .span2 { grid-column: auto; } }

.stat { padding: 16px 18px; }
.stat .label { color: var(--ink-3); font-size: 13px; }
.stat .value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: 12px; color: var(--ink-3); }
.stat.accent .value { color: var(--accent); }
.stat.warn .value { color: var(--warn); }
.stat.bad .value { color: var(--bad); }
.stat.ok .value { color: var(--ok); }
a.stat { color: inherit; display: block; }
a.stat:hover { text-decoration: none; border-color: var(--line-2); }

/* ===== Списки ===== */
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); color: inherit; }
.item:first-child { border-top: 0; }
a.item:hover { text-decoration: none; background: linear-gradient(90deg, transparent, var(--surface-2) 12%, var(--surface-2) 88%, transparent); }
.item .t { font-weight: 560; }
.item .s { font-size: 13px; color: var(--ink-3); }
.empty { color: var(--ink-3); padding: 18px 0; text-align: center; font-size: 14px; }
.empty.big { padding: 48px 16px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 650; font-size: 13px; flex: none; }
.avatar.l { width: 56px; height: 56px; font-size: 20px; }
.when { min-width: 62px; text-align: center; line-height: 1.2; }
.when .d { font-size: 12px; color: var(--ink-3); }
.when .h { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ===== Таблицы ===== */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 560; color: var(--ink-3); font-size: 12.5px; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface-2); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ===== Бейджи ===== */
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 99px; padding: 2px 9px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.score { font-weight: 700; font-variant-numeric: tabular-nums; }
.score.hi { color: var(--ok); } .score.mid { color: var(--warn); } .score.lo { color: var(--bad); }

/* ===== Кнопки и поля ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 9px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: inherit; font-weight: 560; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
@media (prefers-color-scheme: dark) { .btn.primary { color: #10122a; } }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.s { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 7px; }
.btn.icon { width: 38px; padding: 0; }
.btn.icon.s { width: 30px; }
.btn svg { width: 17px; height: 17px; }

label.f { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 560; color: var(--ink-2); }
label.f .hint { font-weight: 400; color: var(--ink-3); font-size: 12px; }
input, select, textarea {
  font: inherit; font-size: 15px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: 9px; padding: 8px 11px; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; border-color: var(--accent); }
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--accent); flex: none; margin: 0; }
input[type=color] { padding: 2px; height: 38px; width: 60px; }
.form { display: grid; gap: 14px; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form .three { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .form .two, .form .three { grid-template-columns: 1fr; } }
.check { display: flex; gap: 9px; align-items: center; font-size: 14px; cursor: pointer; }
.search { position: relative; }
.search input { padding-left: 34px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 17px; color: var(--ink-3); }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button, .seg a { border: 0; background: transparent; font: inherit; font-size: 13.5px; font-weight: 560; color: var(--ink-2); padding: 6px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.seg button.on, .seg a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.seg a:hover { text-decoration: none; }
.seg .n { color: var(--ink-3); font-weight: 500; margin-left: 4px; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }

/* ===== Модальные окна ===== */
.overlay { position: fixed; inset: 0; background: rgba(15, 16, 22, .45); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 560px; box-shadow: var(--shadow); animation: pop .18s ease-out; }
.modal.wide { max-width: 820px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 0; gap: 12px; }
.modal-body { padding: 18px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 22px 20px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
@media (max-width: 560px) { .overlay { padding: 0; align-items: flex-end; } .modal { border-radius: 16px 16px 0 0; max-height: 94vh; overflow-y: auto; } }

#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); animation: pop .2s; max-width: 90vw; white-space: pre-line; }
.toast.bad { background: var(--bad); color: #fff; }
@media (max-width: 860px) { #toasts { bottom: 84px; } }

/* ===== Уведомления ===== */
.bell { position: relative; }
.bell .count { position: absolute; top: 2px; right: 2px; background: var(--bad); color: #fff; border-radius: 99px; font-size: 10px; padding: 0 5px; line-height: 16px; }
.panel { position: absolute; right: 16px; top: 56px; width: min(380px, calc(100vw - 32px)); max-height: 70vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); z-index: 50; }
.panel .n { display: block; padding: 11px 16px; border-top: 1px solid var(--line); color: var(--ink); font-size: 14px; }
.panel .n.unread { background: var(--accent-soft); }
.panel .n:hover { text-decoration: none; background: var(--surface-2); }

/* ===== Вход ===== */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: 100%; max-width: 380px; padding: 30px; }
.login h1 { font-size: 22px; margin: 16px 0 4px; }

/* ===== Задания ===== */
.task { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.task-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.task-num { font-weight: 700; }
.task .body { font-size: 15.5px; overflow-wrap: anywhere; }
.task .body img { max-width: 100%; }
.options { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.opt { display: flex; gap: 11px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.opt:hover { border-color: var(--line-2); }
.opt input { margin-top: 2px; }
.opt.chosen { border-color: var(--accent); background: var(--accent-soft); }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.readonly { cursor: default; }
.answer-box { margin-top: 12px; }
.correct-box { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--ok-soft); font-size: 14px; }
.expl { margin-top: 10px; padding: 10px 12px; border-left: 3px solid var(--info); background: var(--info-soft); border-radius: 0 8px 8px 0; font-size: 14px; }
.tcomment { margin-top: 10px; padding: 10px 12px; border-left: 3px solid var(--warn); background: var(--warn-soft); border-radius: 0 8px 8px 0; font-size: 14px; }
.review-row { display: flex; gap: 10px; align-items: flex-end; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line-2); flex-wrap: wrap; }
.review-row .pts { width: 90px; }
.review-row .cmt { flex: 1; min-width: 200px; }
.review-row textarea { min-height: 38px; height: 38px; }

.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.file { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; padding: 5px 10px 5px 6px; font-size: 13px; color: var(--ink); background: var(--surface); max-width: 100%; }
.file:hover { text-decoration: none; border-color: var(--line-2); }
.file .thumb { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; background: var(--surface-2); display: grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--ink-3); flex: none; }
.file .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.file .x { border: 0; background: none; color: var(--ink-3); cursor: pointer; font-size: 16px; padding: 0 2px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-top: 10px; }
.gallery a { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); aspect-ratio: 4/3; background: var(--surface-2); }
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.drop { border: 1.5px dashed var(--line-2); border-radius: 10px; padding: 14px; text-align: center; color: var(--ink-3); font-size: 14px; cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.sticky-bar { position: sticky; bottom: 0; z-index: 10; margin-top: 20px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding: 12px 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
@media (max-width: 860px) { .sticky-bar { bottom: 62px; } }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 18px; padding: 4px 12px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); }
.timer.low { background: var(--bad-soft); color: var(--bad); }
.banner { border-radius: var(--radius); padding: 14px 18px; display: flex; gap: 14px; align-items: flex-start; }
.banner.ok { background: var(--ok-soft); } .banner.warn { background: var(--warn-soft); } .banner.info { background: var(--info-soft); } .banner.accent { background: var(--accent-soft); }
.big-score { font-size: 34px; font-weight: 750; letter-spacing: -0.02em; line-height: 1; }

/* ===== Конструктор ===== */
.builder { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
@media (max-width: 980px) { .builder { grid-template-columns: 1fr; } }
.builder .settings { position: sticky; top: 76px; }
@media (max-width: 980px) { .builder .settings { position: static; } }
.bt { display: flex; gap: 12px; align-items: flex-start; }
.bt .order { display: flex; flex-direction: column; gap: 2px; }
.opt-edit { display: flex; gap: 8px; align-items: center; }
.opt-edit input[type=text] { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border-radius: 99px; padding: 3px 4px 3px 11px; font-size: 13px; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--ink-3); font-size: 15px; line-height: 1; padding: 0 5px; }
.typepick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.typepick button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 10px; padding: 9px 4px; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--ink-2); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.typepick button svg { width: 20px; height: 20px; }
.typepick button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
@media (max-width: 520px) { .typepick { grid-template-columns: repeat(3, 1fr); } }
.taskcard { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-top: 1px solid var(--line); }
.taskcard:first-child { border-top: 0; }
.taskcard .snip { font-size: 14px; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.taskcard:hover { background: var(--surface-2); }
.helpbox { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; font-size: 13px; }
.helpbox pre { margin: 6px 0 0; font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; }

/* ===== Календарь ===== */
.week { display: grid; grid-template-columns: 52px repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.week .wh { padding: 10px 6px; text-align: center; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); font-size: 13px; position: sticky; top: 0; }
.week .wh b { display: block; font-size: 18px; }
.week .wh.today b { color: var(--accent); }
.week .hours { position: relative; }
.week .hl { height: 48px; font-size: 11px; color: var(--ink-3); text-align: right; padding-right: 6px; transform: translateY(-7px); }
.week .col { position: relative; border-left: 1px solid var(--line); cursor: copy; }
.week .col .slot { height: 48px; border-top: 1px solid var(--line); }
.week .col .slot:first-child { border-top: 0; }
.week .col.today { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.week .ev { position: absolute; left: 3px; right: 3px; border-radius: 7px; padding: 3px 6px; font-size: 12px; overflow: hidden; cursor: pointer; color: #fff; line-height: 1.3; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.week .ev.done { opacity: .55; }
.week .ev.cancelled { opacity: .4; text-decoration: line-through; }
.week .ev .pending { background: #fff; color: #b7791f; border-radius: 4px; padding: 0 3px; font-weight: 700; }
.week .now { position: absolute; left: 0; right: 0; height: 2px; background: var(--bad); z-index: 2; }
.agenda-day { margin-top: 18px; }
.agenda-day:first-child { margin-top: 0; }
.agenda-day h3 { font-size: 13px; color: var(--ink-3); text-transform: capitalize; margin-bottom: 4px; }
.slots { display: flex; flex-wrap: wrap; gap: 6px; }
.slots span { font-size: 12.5px; background: var(--bad-soft); color: var(--bad); border-radius: 6px; padding: 2px 7px; }

/* ===== Графики ===== */
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis { stroke: var(--line); }
.chart .lbl { fill: var(--ink-3); font-size: 11px; }
.chart .ln { stroke: var(--accent); stroke-width: 2.5; fill: none; }
.chart .area { fill: var(--accent); opacity: .1; }
.chart .pt { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar { display: grid; grid-template-columns: minmax(90px, 1fr) 2fr 44px; gap: 10px; align-items: center; font-size: 13.5px; }
.bar .track { height: 9px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar .fill { height: 100%; border-radius: 99px; }
.bar .v { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }

.katex { font-size: 1.05em; }
.md p:last-child { margin-bottom: 0; }
.md ul, .md ol { margin: 4px 0 8px; padding-left: 22px; }
.creds { font-family: var(--mono); background: var(--surface-2); border-radius: 10px; padding: 14px; font-size: 14px; white-space: pre-wrap; }
.timeline { display: flex; flex-direction: column; gap: 10px; }
.timeline .ev { display: flex; gap: 10px; font-size: 13.5px; }
.timeline .ev .dot { margin-top: 6px; background: var(--line-2); }
.mobile-only { display: none; }
@media (max-width: 860px) { .mobile-only { display: inline-flex; } }

/* перетаскивание занятий */
.week .ev.draggable { cursor: grab; touch-action: none; user-select: none; }
.week .ev.dragging { cursor: grabbing; opacity: .92; z-index: 6; box-shadow: 0 8px 24px rgba(0,0,0,.25); outline: 2px solid #fff; transition: none; }
.grip { display: none; cursor: grab; color: var(--ink-3); font-weight: 700; letter-spacing: -2px; padding: 4px 2px; user-select: none; touch-action: none; }
.sortable-on .grip { display: block; }
.sort-ghost { opacity: .35; background: var(--accent-soft); }

/* ===== Анимации ===== */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.page > *, .grid > *, .stack > .task { animation: rise .38s cubic-bezier(.2,.7,.3,1) both; }
.grid > *:nth-child(2) { animation-delay: .04s; } .grid > *:nth-child(3) { animation-delay: .08s; }
.grid > *:nth-child(4) { animation-delay: .12s; } .grid > *:nth-child(5) { animation-delay: .16s; } .grid > *:nth-child(n+6) { animation-delay: .2s; }
.stack > .task:nth-child(2) { animation-delay: .05s; } .stack > .task:nth-child(3) { animation-delay: .1s; } .stack > .task:nth-child(n+4) { animation-delay: .14s; }
a.stat, a.item, .card, .btn, .opt { transition: transform .15s ease, box-shadow .2s ease, border-color .15s, background .15s; }
a.stat:hover, .grid > .card[data-id]:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn:active:not(:disabled) { transform: scale(.97); }
.opt:active { transform: scale(.995); }
.bar .fill { animation: grow .8s cubic-bezier(.2,.7,.3,1) both; transform-origin: left; }
@keyframes grow { from { transform: scaleX(0); } }
.chart .ln { stroke-dasharray: 2000; animation: draw 1.1s ease-out both; }
@keyframes draw { from { stroke-dashoffset: 2000; } to { stroke-dashoffset: 0; } }
.nav a svg { transition: transform .2s; } .nav a:hover svg { transform: scale(1.08); }
.badge { transition: background .2s; }
::view-transition-old(root) { animation: .14s ease-in both vt-out; }
::view-transition-new(root) { animation: .22s ease-out both vt-in; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(6px); } }
::view-transition-group(*) { animation-duration: .28s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.mobile-block { display: none; }
@media (max-width: 860px) { .mobile-block { display: flex; } }
