/* ---------- Шрифты: крупный текст — Benzin, мелкий — Yandex Sans ---------- */
@font-face { font-family: "Benzin"; src: url("fonts/Benzin-Semibold.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Yandex Sans Text"; src: url("fonts/YandexSansText-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Yandex Sans Text"; src: url("fonts/YandexSansText-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Yandex Sans Text"; src: url("fonts/YandexSansText-Bold.woff2") format("woff2"); font-weight: 600 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Yandex Sans Text"; src: url("fonts/YandexSansText-RegularItalic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --bg: #ffffff;
  --bg-soft: #fafaf8;
  --text: #1c1c1c;
  --muted: #7a7a7a;
  --faint: #b5b5b5;
  --line: #e6e6e6;
  --line-strong: #2a2a2a;
  --accent: #e0212b;
  --accent-hover: #c81a23;
  --accent-soft: #fff1f1;
  --accent-line: #ffc9cb;
  --ok: #17a673;
  --info: #2c62c9;
  --warn: #b25e09;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --radius: 14px;
  --radius-sm: 8px;
  --sidebar: 240px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-text: "Yandex Sans Text", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Benzin", "Yandex Sans Text", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* иначе .layout / .fab с display перебивают атрибут hidden */
html, body { margin: 0; }
body {
  font-family: var(--font-text);
  font-size: 14.5px; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mono { font-family: var(--mono); }
/* Крупные заголовки и цифры — Benzin */
h1, h2, .display { font-family: var(--font-display); font-weight: 600; font-synthesis: none; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.accent { color: var(--accent); }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar);
  border-right: 1px solid var(--line-strong); background: var(--bg);
  display: flex; flex-direction: column; padding: 14px 12px; z-index: 30;
  transition: transform .2s;
}
.main { margin-left: var(--sidebar); flex: 1; min-width: 0; }
.topbar {
  height: 48px; display: flex; align-items: center; gap: 12px;
  padding: 0 24px; border-bottom: 1px solid var(--line-strong);
  position: sticky; top: 0; background: var(--bg); z-index: 10;
}
.crumbs { color: var(--muted); font-size: 13px; }
.crumbs a { color: var(--text); }
.crumbs span.sep { margin: 0 6px; }
.btn.burger { display: none; }
.content { padding: 24px; max-width: 1100px; }

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 18px; font-family: var(--font-display); font-size: 14px; font-weight: 600; font-synthesis: none; line-height: 1.2; }
.logo { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; font-family: var(--font-display); font-size: 12px; flex: none; }
.brand b { color: var(--accent); font-weight: 600; }

.nav { flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: 10px; color: var(--muted); margin-bottom: 2px; text-align: left;
}
.nav-item:hover { color: var(--text); background: var(--bg-soft); }
.nav-item.active { color: var(--accent); background: var(--bg); box-shadow: 0 1px 4px rgba(0,0,0,.12); border: 1px solid var(--line); }
.nav-item .chev { margin-left: auto; transition: transform .15s; }
.nav-item.open .chev { transform: rotate(90deg); }
.nav-sub { margin: 2px 0 6px 18px; padding-left: 10px; border-left: 1px solid var(--line); display: none; }
.nav-sub.open { display: block; }
.nav-sub .nav-item { font-size: 12.5px; padding: 7px 10px; }
.nav-item.locked { opacity: .5; }
.nav-item.locked .lock { margin-left: auto; }

.side-bottom { border-top: 1px solid var(--line); padding-top: 10px; }
.tariff { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--muted); font-size: 12px; letter-spacing: .04em; margin-bottom: 10px; }
.tariff svg { color: var(--accent); }
.me { display: flex; align-items: center; gap: 10px; padding: 4px 6px 8px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #1d1d1d; display: grid; place-items: center; color: #fff; font-size: 12px; flex: none; }
.me small { display: block; color: var(--muted); font-size: 11px; }

.overlay { display: none; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 26px; color: var(--text); }
.page-head h1.strong { color: var(--accent); }
.page-head p { margin: 4px 0 0; }
.page-head .ph-icon svg { width: 26px; height: 26px; color: var(--accent); }
.page-head .avatar { width: 48px; height: 48px; }
h2.sec { display: flex; align-items: center; gap: 8px; font-size: 18px; color: var(--text); margin: 24px 0 4px; }
h2.sec svg { color: var(--accent); }

/* ---------- Primitives ---------- */
.card { border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 18px; background: var(--bg); margin-bottom: 16px; }
.card.soft { border-color: var(--line); }
.card.accent { border-color: var(--accent-line); }
.card-title { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; margin: 0 0 14px; }
.card-title svg { color: var(--accent); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--bg); font-size: 13px; }
.btn:hover { background: var(--bg-soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { border-color: transparent; }
.btn.accent-o { border-color: var(--accent-line); color: var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.block { width: 100%; justify-content: center; }

.tabs { display: inline-flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--radius-sm); color: var(--text); border: 1px solid transparent; }
.tab.active { border-color: var(--line); box-shadow: 0 1px 3px rgba(0,0,0,.1); color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 2px; }
.seg button { padding: 4px 10px; border-radius: 6px; font-size: 12px; }
.seg button.active { border: 1px solid var(--accent-line); color: var(--accent); background: var(--accent-soft); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg); outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-icon .input { padding-left: 34px; }
.hint { font-size: 12px; color: var(--muted); }
.error-text { font-size: 12px; color: var(--danger); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; border: 1px solid var(--accent-line); color: var(--accent); background: var(--accent-soft); }
.badge.info { border-color: #cfe0fb; color: var(--info); background: #f2f7ff; }
.badge.gray { border-color: var(--line); color: var(--muted); background: var(--bg-soft); }
.badge.warn { border-color: #fcd9a8; color: var(--warn); background: #fff8ec; }

.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #e3e3e3; border-radius: 999px; transition: .15s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.setting { display: flex; gap: 16px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--line); }
.setting:first-of-type { border-top: 0; }
.setting .txt { flex: 1; }
.setting .txt b { display: block; font-weight: 500; margin-bottom: 2px; }

.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.empty svg { width: 34px; height: 34px; color: var(--faint); margin-bottom: 8px; }
.empty b { display: block; color: var(--text); font-weight: 500; margin-bottom: 4px; }

/* ---------- Stats ---------- */
.stat { border: 1px solid var(--line-strong); border-radius: 12px; padding: 12px 14px; }
.stat .lbl { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.stat .lbl svg { width: 14px; height: 14px; }
.stat .val { font-family: var(--font-display); font-size: 22px; font-weight: 600; font-synthesis: none; color: var(--text); margin: 6px 0 2px; }
.stat .val.accent { color: var(--accent); }
.stat .val.ok { color: var(--ok); }
.stat .val.info { color: var(--info); }
.stat small { color: var(--muted); font-size: 11.5px; }

/* ---------- Podium ---------- */
.podium { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; align-items: end; margin: 10px 0 14px; }
.podium .place { text-align: center; }
.podium .ava { width: 44px; height: 44px; border-radius: 50%; margin: 0 auto 8px; background: #1a1a1a; position: relative; border: 2px solid #c9c9c9; }
.podium .p1 .ava { width: 56px; height: 56px; border-color: #e3a73a; box-shadow: 0 0 0 4px #fbeccd; }
.podium .p3 .ava { border-color: #d68b4a; }
.podium .num { position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%); width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 1px solid #ccc; font-size: 10px; line-height: 14px; }
.podium .sum { font-family: var(--mono); color: var(--muted); font-size: 12px; margin: 4px 0 8px; }
.podium .col { border: 1px solid var(--line-strong); border-bottom: 0; border-radius: 6px 6px 0 0; }
.podium .p1 .col { height: 120px; border-color: var(--accent-line); }
.podium .p2 .col { height: 80px; }
.podium .p3 .col { height: 60px; }

.team-item { border: 1px solid var(--line-strong); border-radius: 10px; padding: 12px 14px; display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.team-item .ini { width: 24px; text-align: center; font-weight: 600; }
.team-item b { color: var(--muted); font-weight: 500; }
.team-item .links { font-size: 12px; margin-top: 4px; }
.team-item .links a:first-child { color: var(--accent); }
.team-item .links a + a::before { content: "·"; margin: 0 8px; color: var(--faint); }

.notif { padding: 12px 0; border-top: 1px solid var(--line); }
.notif:first-child { border-top: 0; }
.notif .h { display: flex; gap: 10px; align-items: baseline; }
.notif .h b { flex: 1; font-weight: 500; }
.notif .h time { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.notif p { margin: 6px 0; color: var(--muted); font-size: 13px; }
.notif p.clip { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.notif.unread .h b::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: middle; }
.link-btn { color: var(--accent); font-size: 12.5px; }

/* ---------- Manuals ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 18px; }
.chip { color: var(--text); font-size: 13px; }
.chip.active { color: var(--accent); font-weight: 500; }
.chip sup { color: var(--accent); margin-left: 4px; }
.art { border: 1px solid var(--line-strong); border-radius: 12px; padding: 16px 18px; position: relative; text-align: left; width: 100%; background: var(--bg); }
.art:hover { border-color: var(--accent-line); }
.art h3 { margin: 0 0 4px; font-size: 16px; font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 18px; }
.art p { margin: 0 0 10px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.art time { font-size: 11.5px; color: var(--muted); display: flex; gap: 5px; align-items: center; }
.art time svg { width: 12px; height: 12px; }
.art .ext { position: absolute; top: 14px; right: 14px; color: var(--accent); }

/* ---------- Alerts ---------- */
.alert { border: 1px solid #f3c7c7; background: var(--danger-soft); color: var(--danger); border-radius: 10px; padding: 10px 14px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.alert .btn { color: var(--text); }

/* ---------- Offers ---------- */
.promo { border: 1px solid var(--accent-line); border-radius: 16px; padding: 22px; display: flex; gap: 20px; align-items: center; margin-bottom: 18px; }
.promo .gift { width: 42px; height: 42px; border: 1px solid var(--accent-line); border-radius: 12px; display: grid; place-items: center; color: var(--accent); flex: none; }
.promo h3 { margin: 0 0 8px; font-family: var(--font-display); font-size: 19px; font-weight: 600; color: var(--text); }
.promo p { margin: 8px 0 0; }
.promo small { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; }
.filters { border: 1px solid var(--line-strong); border-radius: 14px; padding: 12px; display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters > * { flex: 1 1 160px; }
.offer { border: 1px solid var(--line-strong); border-radius: 14px; padding: 16px 18px; margin-bottom: 12px; }
.offer .top { display: flex; gap: 12px; align-items: flex-start; }
.offer .logo-o { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--bg-soft); color: var(--muted); font-weight: 600; flex: none; }
.offer h4 { margin: 0; font-size: 15px; font-weight: 500; color: var(--muted); }
.offer .partner { font-size: 12px; }
.offer .pay { margin-left: auto; text-align: right; }
.offer .pay b { font-family: var(--font-display); font-size: 19px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.offer .pay small { display: block; font-size: 11px; color: var(--muted); }
.offer .tags { display: flex; gap: 6px; margin: 10px 0; flex-wrap: wrap; }
.offer .star { color: var(--faint); }
.offer .star.on { color: #e3a73a; }
.offer .star.on svg { fill: #e3a73a; }
.offer details summary { cursor: pointer; font-size: 13px; list-style: none; display: flex; gap: 6px; align-items: center; }
.offer details summary::-webkit-details-marker { display: none; }
.offer details[open] summary svg { transform: rotate(90deg); }
.offer details p { color: var(--muted); font-size: 13px; }
.progress { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; margin: 6px 0 10px; }
.progress div { height: 100%; background: var(--accent); }
.linkbox { font-family: var(--mono); font-size: 12px; color: var(--muted); border: 1px dashed var(--line); padding: 8px 10px; border-radius: 8px; word-break: break-all; margin-bottom: 10px; }
.offer.compact .body { display: none; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line-strong); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-weight: 500; color: var(--muted); font-size: 12px; background: var(--bg-soft); }
tr:last-child td { border-bottom: 0; }

/* ---------- Modal & toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--bg); border-radius: 16px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; padding: 22px; }
.modal h3 { margin: 0 0 14px; font-family: var(--font-display); font-size: 17px; font-weight: 600; font-synthesis: none; }
.modal .body-text { white-space: pre-wrap; line-height: 1.55; }
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: #1c1c1c; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.fab { position: fixed; right: 20px; bottom: 20px; width: 44px; height: 44px; border-radius: 50%; background: var(--bg); box-shadow: 0 2px 10px rgba(0,0,0,.18); display: grid; place-items: center; z-index: 20; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  body.menu-open .sidebar { transform: none; }
  body.menu-open .overlay { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 25; }
  .main { margin-left: 0; }
  .btn.burger { display: inline-flex; }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .g3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .g2, .g3 { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 22px; }
  .promo { flex-direction: column; align-items: flex-start; }
  .offer .top { flex-wrap: wrap; }
}

/* ---------- Utilities ---------- */
.m0 { margin: 0 !important; }
.mb { margin-bottom: 14px; }
.mt { margin-top: 12px; }
.mt8 { margin-top: 8px; }
.pl0 { padding-left: 0 !important; }
.gap8 { gap: 8px !important; }
.flex1 { flex: 1 1 140px; min-width: 0; }
.flex2 { flex: 2 1 220px; min-width: 0; }
.w280 { max-width: 280px; width: 100%; }
.wauto { width: auto !important; }
.minw0 { min-width: 0; }
.small { font-size: 12.5px; }
.caps { font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.center { text-align: center; }
.span2 { grid-column: 1 / -1; }
.nowrap { white-space: nowrap; }
.wrap { white-space: normal; max-width: 260px; }
.wrap-cell { display: block; white-space: normal; min-width: 200px; max-width: 380px; }
.clip1 { display: inline-block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.inline-block { display: inline-block; }
.row.top { align-items: flex-start; }
.row.bottom { align-items: flex-end; }
.card-h { margin: 0 0 4px; font-size: 16px; font-weight: 500; color: var(--muted); }
.gold, svg.gold { color: var(--accent); }
.ok, svg.ok { color: var(--ok); }
.info, svg.info { color: var(--info); }
.bad, svg.bad { color: var(--danger); }
.card-title.m0 { margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.link-btn.muted { color: var(--muted); }
.narrow { max-width: 420px; margin: 32px auto; }
.avatar.lg { width: 48px; height: 48px; font-size: 18px; }
.avatar { font-weight: 600; }

.badge.ok { border-color: #bfe8d7; color: var(--ok); background: #effaf5; }
.badge.bad { border-color: #f3c7c7; color: var(--danger); background: var(--danger-soft); }

.notice { border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; display: flex; gap: 8px; align-items: flex-start; }
.notice svg { color: var(--accent); margin-top: 1px; flex: none; }
.form-error { color: var(--danger); font-size: 12.5px; min-height: 0; margin-bottom: 8px; }
.form-error:empty { display: none; }
.btn.danger { color: var(--danger); border-color: #f3c7c7; }
.btn.danger:hover { background: var(--danger-soft); }
.gift { width: 38px; height: 38px; border: 1px solid var(--accent-line); border-radius: 10px; display: grid; place-items: center; color: var(--accent); flex: none; }
.gift.info { border-color: #cfe0fb; color: var(--info); }
.card.row { flex-wrap: wrap; }

.spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; margin: 10px auto; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast.bad { background: var(--danger); }

.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.modal-head h3 { margin: 0; flex: 1; }
.modal.wide { max-width: 720px; }

.nav-item .count { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 10.5px; line-height: 18px; text-align: center; }
.nav-item .count[hidden] { display: none; }

.stat.link { display: block; transition: border-color .15s; }
.stat.link:hover { border-color: var(--accent); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--bg-soft); }
.pager { margin-top: 12px; }
.sticky-save { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; border-top: 1px solid var(--line); }

.list { border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); }
.list-item:first-child { border-top: 0; }
.list-item:hover { background: var(--bg-soft); }
.list-item b { font-weight: 500; }

.messages { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 85%; padding: 10px 12px; border-radius: 12px; background: var(--bg-soft); border: 1px solid var(--line); line-height: 1.5; word-break: break-word; }
.msg.mine { align-self: flex-end; background: var(--accent-soft); border-color: var(--accent-line); }
.msg-h { font-size: 11px; color: var(--muted); margin-bottom: 4px; }

.podium .ava { display: grid; place-items: center; color: #fff; font-weight: 600; }
.podium .nm { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .place.mine .nm { color: var(--accent); font-weight: 600; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--bg-soft); }
.auth-card { width: 100%; max-width: 400px; padding: 28px; }
.auth-card h2 { text-align: center; font-size: 20px; margin: 4px 0 20px; }
.auth-steps { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.auth-step { display: flex; gap: 12px; align-items: flex-start; }
.auth-step .n { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.auth-step.done .n { background: var(--ok); color: #fff; }
.auth-step .t { flex: 1; min-width: 0; }
.code-input { font-size: 22px; letter-spacing: .35em; text-align: center; font-weight: 600; }
.auth-card .brand { padding-bottom: 8px; }

/* ---------- Превью / карточки с картинкой ---------- */
.cover { position: relative; aspect-ratio: 16 / 9; background: var(--bg-soft); overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover.ph { display: grid; place-items: center; background: linear-gradient(135deg, #fff1f1, #ffd9da); }
.cover.ph span { font-family: var(--font-display); font-size: 34px; color: #f08a8f; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.span-all { grid-column: 1 / -1; }
.card-media { display: flex; flex-direction: column; text-align: left; width: 100%; border: 1px solid var(--line-strong); border-radius: 14px; overflow: hidden; background: var(--bg); transition: border-color .15s, transform .15s; }
.card-media:hover { border-color: var(--accent); transform: translateY(-1px); }
.cm-body { padding: 12px 14px 14px; position: relative; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.cm-body h3 { margin: 2px 0 0; font-size: 15px; font-weight: 600; line-height: 1.3; }
.cm-body p { margin: 0; font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cm-body time { margin-top: auto; padding-top: 6px; font-size: 11.5px; color: var(--muted); display: flex; gap: 5px; align-items: center; }
.cm-body time svg { width: 12px; height: 12px; }
.cm-badge { position: absolute; top: -16px; right: 12px; width: 30px; height: 30px; border-radius: 50%; background: var(--bg); box-shadow: 0 2px 8px rgba(0,0,0,.15); display: grid; place-items: center; color: var(--accent); }
.wide-cover { border-radius: 12px; margin-bottom: 12px; }
.thumb-sm { width: 64px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.thumb-sm .cover.ph span { font-size: 16px; }
.cover-thumb { width: 160px; flex: none; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.cover-edit input[type=file] { font-size: 12.5px; max-width: 100%; }

/* ---------- Уроки ---------- */
.cover-wrap { position: relative; }
.play-badge { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; }
.play-badge svg { width: 46px; height: 46px; fill: rgba(0,0,0,.45); stroke: #fff; }
.lesson-card.done { opacity: .78; }
.lesson-card.next { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.lesson-head { margin: 14px 0 14px; }
.lesson-head h1 { margin: 4px 0 0; font-size: 26px; line-height: 1.25; }
.video { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #111; margin-bottom: 16px; }
.video .cover { position: absolute; inset: 0; aspect-ratio: auto; height: 100%; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.play-btn { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 76px; height: 76px; border-radius: 50%; background: rgba(0,0,0,.55); display: grid; place-items: center; color: #fff; transition: transform .15s, background .15s; }
.play-btn:hover { transform: translate(-50%, -50%) scale(1.07); background: var(--accent); }
.play-btn svg { width: 44px; height: 44px; fill: #fff; stroke: none; }
.play-btn svg circle { display: none; }
.lesson-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0 30px; }
/* Текст уроков и статей (визуальный редактор и старый простой формат) */
.prose { line-height: 1.65; font-size: 15.5px; overflow-wrap: break-word; }
.prose h2 { font-size: 22px; line-height: 1.25; margin: 26px 0 10px; }
.prose h3 { font-family: var(--font-display); font-weight: 600; font-synthesis: none; font-size: 18px; line-height: 1.3; margin: 22px 0 8px; }
.prose h4 { font-size: 16px; font-weight: 700; margin: 18px 0 6px; }
.prose p { margin: 0 0 12px; }
.prose ul, .prose ol { margin: 0 0 12px; padding-left: 24px; }
.prose li { margin: 4px 0; }
.prose li > p { margin: 0; }
.prose blockquote { margin: 16px 0; padding: 12px 18px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 12px 12px 0; }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.prose img { display: block; max-width: 100%; height: auto; margin: 18px auto; border-radius: 12px; }
.prose hr { border: 0; margin: 28px 0; text-align: center; }
.prose hr::before { content: "• • •"; color: var(--faint); letter-spacing: .6em; }
.prose figure { margin: 18px 0; }
.prose figure.embed { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #111; }
.prose figure.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.prose figcaption { text-align: center; color: var(--muted); font-size: 13px; margin-top: 6px; }
.prose pre { background: var(--bg-soft); border: 1px solid var(--line); padding: 12px 14px; border-radius: 10px; overflow-x: auto; font-size: 13px; }
.prose code { font-family: var(--mono); font-size: .9em; background: var(--bg-soft); padding: 1px 5px; border-radius: 5px; }
.prose pre code { background: none; padding: 0; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.card.prose { padding: 22px 26px; }

/* ---------- Роадмап ---------- */
.learn-hero { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; border: 1px solid var(--accent-line); background: linear-gradient(135deg, #fff, var(--accent-soft)); border-radius: 16px; padding: 20px 22px; margin-bottom: 16px; }
.learn-hero h1 { margin: 4px 0 6px; font-size: 26px; line-height: 1.25; }
.hero-cta { flex: none; max-width: 100%; }
.btn.lg { padding: 12px 18px; font-size: 14.5px; border-radius: 10px; }
.progress.lg { height: 8px; border-radius: 6px; margin: 12px 0 6px; }
.done-banner { display: flex; gap: 10px; align-items: center; color: var(--ok); font-weight: 500; max-width: 320px; }
.done-banner svg { width: 28px; height: 28px; flex: none; }
.roadmap-card { padding: 8px 0; }
.roadmap { overflow-x: auto; padding: 16px 10px 8px; scroll-behavior: smooth; }
.rm-track { display: flex; min-width: max-content; }
.rm-point { position: relative; width: 132px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 6px 6px; text-align: center; }
.rm-point::before { content: ""; position: absolute; top: 17px; right: 50%; width: 100%; height: 3px; background: var(--line); z-index: 0; }
.rm-point:first-child::before { display: none; }
.rm-point.done::before, .rm-point.current::before { background: var(--accent); }
.rm-point .dot { position: relative; z-index: 1; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); border: 2px solid var(--line); color: var(--muted); font-weight: 600; font-size: 13px; transition: transform .15s; }
.rm-point .dot svg { width: 18px; height: 18px; }
.rm-point.done .dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.rm-point.current .dot { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); animation: pulse 2s infinite; }
.rm-point.sel .dot { transform: scale(1.15); }
.rm-point.sel .rm-label { color: var(--text); font-weight: 600; }
.rm-point:hover .dot { transform: scale(1.1); }
.rm-label { font-size: 12.5px; color: var(--muted); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 4px var(--accent-soft); } 50% { box-shadow: 0 0 0 8px var(--accent-soft); } }
.step-panel h2 { margin: 10px 0 6px; font-size: 20px; }
.step-panel .btn.accent-o { margin: 4px 0 6px; }
.step-nav { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }

/* ---------- Задачи-галочки ---------- */
.tasks { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.task { display: flex; gap: 12px; align-items: center; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; transition: background .15s, border-color .15s; }
.task:hover { border-color: var(--accent-line); background: #fffafa; }
.task input { position: absolute; opacity: 0; pointer-events: none; }
.task .box { width: 22px; height: 22px; flex: none; border-radius: 6px; border: 2px solid var(--line-strong); display: grid; place-items: center; color: transparent; transition: .15s; }
.task .box svg { width: 14px; height: 14px; stroke-width: 3; }
.task.done { background: #f6fbf8; border-color: #cdebdc; }
.task.done .box { background: var(--ok); border-color: var(--ok); color: #fff; }
.task.done .tt { color: var(--muted); text-decoration: line-through; }
.task input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Режим «глазами тарифа» ---------- */
.preview-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 24px; background: #1c1c1c; color: #fff; font-size: 13px; position: sticky; top: 48px; z-index: 9; }
.preview-bar .btn { color: var(--text); margin-left: auto; }
.preview-bar[hidden] { display: none; }

/* ---------- Админка: обучение ---------- */
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 14px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; cursor: pointer; }
.check input { margin-top: 2px; accent-color: var(--accent); }
.step-list { display: flex; flex-direction: column; gap: 8px; }
.step-row { display: flex; gap: 8px; align-items: center; border: 1px solid var(--line-strong); border-radius: 12px; padding: 10px 12px; }
.step-num { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 600; flex: none; }
.task-edit { display: flex; gap: 6px; margin-bottom: 6px; }
.pick-row { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); cursor: pointer; }
.pick-row:first-of-type { border-top: 0; }
td.move .btn { padding: 4px 6px; }
.break { word-break: break-all; }
svg.big { width: 40px; height: 40px; }
.sticky-actions { position: sticky; bottom: -22px; background: var(--bg); padding: 10px 0; }

@media (max-width: 560px) {
  .learn-hero { padding: 16px; }
  .learn-hero h1, .lesson-head h1 { font-size: 21px; }
  .hero-cta, .hero-cta .btn { width: 100%; justify-content: center; }
  /* На телефоне роадмап вертикальный */
  .roadmap { overflow-x: visible; padding: 8px 12px; }
  .rm-track { flex-direction: column; min-width: 0; }
  .rm-point { width: auto; flex-direction: row; text-align: left; gap: 12px; padding: 6px 0; }
  .rm-point::before { top: auto; bottom: 50%; right: auto; left: 17px; width: 3px; height: 100%; }
  .rm-label { font-size: 13.5px; -webkit-line-clamp: 2; }
  .cover-thumb { width: 110px; }
  .preview-bar { padding: 8px 16px; }
  .media-grid { grid-template-columns: 1fr; }
  .card.prose { padding: 16px; }
}

/* ---------- Широкие страницы и крупные карточки («Материалы», «База знаний») ---------- */
.content.wide { max-width: 1480px; }
.media-grid.lg { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 22px; }
.media-grid.lg .card-media { border-radius: 18px; }
.media-grid.lg .card-media:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,0,0,.08); }
.media-grid.lg .cm-body { padding: 18px 20px 18px; gap: 8px; }
.media-grid.lg .cm-body h3 { font-size: 19px; line-height: 1.3; }
.media-grid.lg .cm-body p { font-size: 14.5px; line-height: 1.5; -webkit-line-clamp: 3; }
.media-grid.lg .cm-badge { width: 42px; height: 42px; top: -21px; right: 18px; }
.media-grid.lg .cm-badge svg { width: 19px; height: 19px; }
.media-grid.lg .cover.ph span { font-size: 64px; }
.cm-kind { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.cm-foot { margin-top: auto; padding-top: 10px; display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); }
.cm-foot .go { margin-left: auto; color: var(--accent); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
@media (min-width: 1800px) { .media-grid.lg { grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); } }
@media (max-width: 560px) { .media-grid.lg { gap: 16px; } .media-grid.lg .cm-body h3 { font-size: 17px; } }

/* ---------- Визуальный редактор ---------- */
.modal.xl { max-width: 1000px; }
.rte { border: 1px solid var(--line-strong); border-radius: 12px; background: var(--bg); transition: border-color .15s, box-shadow .15s; }
.rte:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rte.drag { border-color: var(--accent); border-style: dashed; }
.rte-bar { position: sticky; top: -22px; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); background: var(--bg); border-radius: 12px 12px 0 0; }
.rte-bar button { width: 32px; height: 32px; border-radius: 7px; display: grid; place-items: center; color: var(--text); font-weight: 700; font-size: 13px; }
.rte-bar button:hover { background: var(--bg-soft); }
.rte-bar button.on { background: var(--accent-soft); color: var(--accent); }
.rte-bar select { height: 32px; border: 1px solid var(--line); border-radius: 7px; padding: 0 6px; background: var(--bg); font-size: 13px; margin-right: 4px; }
.rte-bar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.rte-area { position: relative; min-height: 340px; padding: 20px 24px; outline: none; }
.rte-area:empty::before, .rte-area.blank::before { content: attr(data-placeholder); color: var(--faint); pointer-events: none; position: absolute; }
.rte-area img { cursor: pointer; }
.rte-area img.sel { outline: 3px solid var(--accent); outline-offset: 2px; }
.rte-area figure.embed { user-select: none; }
.rte-area figure.embed iframe { pointer-events: none; }
.rte-area figure.embed.sel { outline: 3px solid var(--accent); outline-offset: 2px; }
.rte-foot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 6px 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.rte-foot .spacer { flex: 1; }
.rte-uploading { color: var(--accent); }
