:root {
  color-scheme: light;
  --bg: #f5f6fa; --card: #fff; --ink: #1d2433; --muted: #6b7385; --line: #e3e6ee;
  --brand: #5436a2; --brand-ink: #fff; --accent: #f8d61b; --ok: #1a8a4a; --warn: #b8730b; --bad: #c0392b;
}
/* Тёмная тема: по настройке устройства, если выбор не сделан, или по кнопке «Тёмная тема» (data-theme="dark"). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #14161d; --card: #1d212c; --ink: #e8eaf1; --muted: #98a0b5; --line: #2c3242; --brand: #8b76ff; --brand-ink: #14161d; --ok: #4cc27f; --warn: #e0a030; --bad: #ee7a6c;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14161d; --card: #1d212c; --ink: #e8eaf1; --muted: #98a0b5; --line: #2c3242; --brand: #8b76ff; --brand-ink: #14161d; --ok: #4cc27f; --warn: #e0a030; --bad: #ee7a6c;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
header.top { display: flex; gap: 12px; align-items: center; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
header.top .logo { font-weight: 700; color: var(--brand); }
header.top .spacer { flex: 1; }
nav.tabs { display: flex; gap: 4px; padding: 8px 16px 0; overflow-x: auto; }
nav.tabs button { border: 0; background: transparent; padding: 8px 12px; border-radius: 8px 8px 0 0; color: var(--muted); cursor: pointer; font: inherit; white-space: nowrap; }
nav.tabs button.on { background: var(--card); color: var(--ink); font-weight: 600; border: 1px solid var(--line); border-bottom-color: var(--card); }
main { padding: 16px 16px 40px; max-width: 1280px; width: 100%; min-width: 0; margin: 0 auto; }
section.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-top: 0; }
h2 { margin: 0 0 12px; font-size: 18px; } h3 { margin: 18px 0 8px; font-size: 15px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; }
form.inline, .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin: 10px 0; }
label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); min-width: 120px; }
input[type=checkbox] { min-width: 0; width: 18px; height: 18px; }
button.btn { font: inherit; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); cursor: pointer; }
button.btn.ghost { background: transparent; color: var(--brand); }
button.btn.danger { border-color: var(--bad); background: transparent; color: var(--bad); }
button.btn.small { padding: 3px 9px; font-size: 13px; }
.muted { color: var(--muted); } .center { text-align: center; margin-top: 60px; }
.badge { display: inline-block; white-space: nowrap; padding: 1px 8px; border-radius: 10px; font-size: 12px; border: 1px solid var(--line); }
.badge.paid { color: var(--ok); border-color: var(--ok); } .badge.unpaid { color: var(--bad); border-color: var(--bad); }
.badge.partial { color: var(--warn); border-color: var(--warn); } .badge.planned, .badge.cancelled { color: var(--muted); }
.login { max-width: 360px; margin: 12vh auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.login h1 { margin: 0 0 4px; font-size: 20px; color: var(--brand); }
.login label { margin-top: 12px; } .login input { width: 100%; }
.login button { width: 100%; margin-top: 16px; }
.login .login-theme { text-align: center; } .login .login-theme { margin-top: 12px; } .login .login-theme button { width: auto; margin-top: 0; }
label[hidden] { display: none; }
pre { background: var(--bg); padding: 10px; border-radius: 8px; overflow: auto; max-height: 280px; font-size: 12px; }
#toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; z-index: 10; }
#toast.show { opacity: 1; } #toast.err { background: var(--bad); color: var(--card); }
@media (max-width: 640px) { main { padding: 0 8px 40px; } section.card { padding: 12px; } }

.qr { display: block; background: #fff; padding: 8px; border-radius: 8px; margin: 8px 0 12px; }

/* этап 4: финансы, загрузка ЗП, планы */
.neg { color: var(--bad); } .pos { color: var(--ok); }
table.fin tr.total td { font-weight: 700; border-top: 2px solid var(--line); background: var(--bg); }
table.plan input { min-width: 0; width: 84px; padding: 4px 6px; text-align: right; }
.note { border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px; padding: 8px 12px; margin: 8px 0; font-size: 14px; }
.note.bad { border-left-color: var(--bad); } .note.warn { border-left-color: var(--warn); } .note.info { border-left-color: var(--muted); }
.panel { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 14px 0; }
details { margin: 12px 0; } summary { cursor: pointer; color: var(--brand); } h4 { margin: 14px 0 6px; font-size: 14px; }
a { color: var(--brand); }
td.num, th.num { white-space: nowrap; }

.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.pager[hidden] { display: none; }
.pager button[disabled] { opacity: .4; cursor: default; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { text-decoration: underline; }

/* этап 5: ученики */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.tile { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg); }
.tile-value { font-size: 24px; font-weight: 700; }
.tile-label { font-size: 13px; color: var(--muted); }
.small { font-size: 13px; }
.subtabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.subtabs button { font: inherit; padding: 5px 12px; border-radius: 16px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.subtabs button.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.chart { width: 100%; max-width: 720px; height: auto; display: block; margin: 8px 0; }
.chart polyline { fill: none; stroke: var(--brand); stroke-width: 2; }
.chart circle { fill: var(--brand); }
.axis { fill: var(--muted); font-size: 11px; }
ul.tight { margin: 0; padding-left: 16px; } ul.tight li { margin: 2px 0; }
tr.picked td { background: var(--bg); font-weight: 600; }
.funnel { margin: 12px 0; }
.funnel-row { display: grid; grid-template-columns: minmax(150px, 230px) 1fr minmax(120px, 220px); gap: 10px; align-items: center; margin: 6px 0; }
.funnel-track { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; height: 22px; overflow: hidden; }
.funnel-bar { background: var(--brand); height: 100%; }
@media (max-width: 640px) { .funnel-row { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- этап 8: каркас сайта (боковое меню, шапка), главная панель, очередь проблем, глоссарий, выгрузки ---------- */
:root { --c1: #5436a2; --c2: #159a8c; --c3: #d9822b; --brand-soft: rgba(84, 54, 162, .12); --shadow: 0 1px 2px rgba(20, 22, 40, .06), 0 4px 14px rgba(20, 22, 40, .04); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --c1: #8b76ff; --c2: #3cc4b4; --c3: #f0a050; --brand-soft: rgba(139, 118, 255, .18); --shadow: none; } }
:root[data-theme="dark"] { --c1: #8b76ff; --c2: #3cc4b4; --c3: #f0a050; --brand-soft: rgba(139, 118, 255, .18); --shadow: none; }
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
aside.side { background: var(--card); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 14px 10px 24px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 12px; }
.brand-mark { width: 40px; height: 40px; border-radius: 11px; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; flex: none; padding: 3px; } .brand-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.login-logo { display: block; width: 220px; max-width: 100%; margin: 0 auto 10px; background: #fff; border-radius: 10px; padding: 6px 10px; }
.brand-name { font-weight: 700; line-height: 1.15; } .brand-name small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
aside.side h6 { margin: 16px 8px 4px; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
aside.side button.nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font: inherit; cursor: pointer; }
aside.side button.nav:hover { background: var(--bg); }
aside.side button.nav.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad); color: #fff; font-size: 12px; text-align: center; line-height: 20px; }
.count.warn { background: var(--warn); }
.workarea { min-width: 0; display: flex; flex-direction: column; }
header.top2 { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
header.top2 .spacer { flex: 1; }
#menu-btn { display: none; }
.sync-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 12px; border: 1px solid var(--line); border-radius: 18px; font-size: 13px; background: var(--bg); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); display: inline-block; flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
.dot.run { background: var(--c1); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.exportbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.page-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; justify-content: space-between; margin-bottom: 12px; }
.page-head h2 { margin: 0; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); }
.seg button { font: inherit; border: 0; padding: 7px 13px; background: transparent; color: var(--muted); cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
.monthnav { display: inline-flex; gap: 4px; align-items: center; }
.monthnav select { min-width: 150px; }
.banner { border: 1px solid var(--line); background: var(--brand-soft); border-radius: 10px; padding: 8px 12px; margin: 8px 0 12px; font-size: 14px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 12px; margin: 12px 0; }
.kpi { border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 12px 14px 10px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi.unavailable { background: var(--bg); }
.kpi.partial { border-style: dashed; }
.kpi-head { display: flex; align-items: start; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.info-btn { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; font: 600 12px/1 system-ui; padding: 0; }
.info-btn:hover, .info-btn[aria-expanded="true"] { color: var(--brand); border-color: var(--brand); }
.kpi-value { font-size: 27px; font-weight: 700; letter-spacing: -.01em; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi.unavailable .kpi-value { color: var(--muted); }
.kpi-sub { font-size: 12.5px; color: var(--muted); }
.delta { font-size: 13px; font-weight: 600; } .delta.good { color: var(--ok); } .delta.bad { color: var(--bad); } .delta.flat { color: var(--muted); }
.plan { font-size: 12.5px; color: var(--muted); } .bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 3px; } .bar > i { display: block; height: 100%; background: var(--c1); }
.bar.over > i { background: var(--warn); }
.chip { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); }
.chip.warn { color: var(--warn); border-color: var(--warn); } .chip.bad { color: var(--bad); border-color: var(--bad); } .chip.ok { color: var(--ok); border-color: var(--ok); }
.kpi-foot { margin-top: auto; padding-top: 6px; display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.kpi-foot a { font-size: 13px; }
.kpi-help { margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: var(--bg); font-size: 12.5px; }
.kpi-help dt { color: var(--muted); font-size: 11.5px; margin-top: 4px; } .kpi-help dd { margin: 0; }
.parts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.part-v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; } .part-t { font-size: 12px; color: var(--muted); }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 12px; margin: 12px 0; }
.chart-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--card); box-shadow: var(--shadow); min-width: 0; }
.chart-card h3 { margin: 0 0 4px; font-size: 14px; }
svg.c { width: 100%; height: auto; display: block; }
svg.c text { fill: var(--muted); font-size: 11px; font-family: inherit; }
svg.c .grid { stroke: var(--line); stroke-width: 1; } svg.c .zero { stroke: var(--muted); }
svg.c .b1 { fill: var(--c1); } svg.c .b2 { fill: var(--c2); } svg.c .b3 { fill: var(--c3); }
svg.c .bar-hit { fill: transparent; cursor: pointer; } svg.c .bar-hit:hover { fill: var(--brand-soft); }
svg.c .l1 { fill: none; stroke: var(--c1); stroke-width: 2.2; } svg.c .lplan { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-dasharray: 5 4; }
svg.c .pt { fill: var(--c1); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); margin: 4px 0; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.skel { border-radius: 14px; min-height: 120px; background: linear-gradient(90deg, var(--line), var(--bg), var(--line)); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; border: 1px dashed var(--line); border-radius: 12px; }
.issue { display: grid; grid-template-columns: 90px 1fr; gap: 6px 12px; border: 1px solid var(--line); border-left-width: 5px; border-radius: 10px; padding: 10px 12px; margin: 8px 0; background: var(--card); }
.issue.critical { border-left-color: var(--bad); } .issue.warning { border-left-color: var(--warn); } .issue.info { border-left-color: var(--muted); }
.issue .meta { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.issue .acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.issue textarea { width: 100%; min-height: 56px; }
.gl-item { border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; background: var(--card); }
.gl-item > summary { padding: 10px 12px; list-style: none; display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; color: var(--ink); }
.gl-item > summary::-webkit-details-marker { display: none; }
.gl-item[open] > summary { border-bottom: 1px solid var(--line); }
.gl-item.focus { outline: 2px solid var(--brand); }
.gl-item dl { margin: 0; padding: 8px 12px 12px; display: grid; grid-template-columns: minmax(130px, 200px) 1fr; gap: 6px 14px; }
.gl-item dt { color: var(--muted); font-size: 13px; } .gl-item dd { margin: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.exp-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--card); box-shadow: var(--shadow); }
.exp-card h3 { margin: 0 0 6px; } .exp-card .row { margin: 8px 0; }
.checks { display: flex; flex-direction: column; gap: 6px; }
.checks label { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); }
.report-sec { margin: 16px 0; } .report-sec h3 { margin: 0 0 6px; }
.mgr-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.mgr-top .spacer { flex: 1; }
/* сборка 8e: выбор периода, подсказки и крупный вид графиков, план/факт, таблица планов с закреплённым столбцом */
.period-bar { margin: 6px 0 10px; }
.period-bar .presets { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: end; }
.period-bar .presets .btn.on { background: var(--brand); color: var(--brand-ink); }
.period-msg { margin-top: 6px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--bad); color: var(--bad); background: var(--card); font-size: 14px; font-weight: 600; }
input.bad { border-color: var(--bad); outline: 1px solid var(--bad); }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chart-click { cursor: zoom-in; border-radius: 10px; } .chart-click:focus-visible { outline: 2px solid var(--brand); }
svg.c .val { fill: var(--ink); font-size: 11px; font-weight: 600; } svg.c.big text { font-size: 13px; } svg.c.big .val { font-size: 13px; }
svg.c .pt.key { fill: var(--c1); stroke: var(--card); stroke-width: 2; }
svg.c .line-hit { fill: transparent; cursor: crosshair; }
svg.c .guide { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; } svg.c .focus { fill: var(--card); stroke: var(--c1); stroke-width: 2.5; }
svg.c .bar-hit { cursor: zoom-in; }
.chart-tip { position: fixed; z-index: 40; pointer-events: none; background: var(--ink); color: var(--bg); border-radius: 8px; padding: 7px 10px; font-size: 12.5px; box-shadow: 0 6px 22px rgba(0, 0, 0, .3); max-width: 280px; }
.chart-tip[hidden] { display: none; } .chart-tip b { font-weight: 700; } .chart-tip > div { margin-top: 2px; white-space: nowrap; }
.chart-tip i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; }
.modal-back { position: fixed; inset: 0; z-index: 30; background: rgba(10, 12, 20, .62); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--card); color: var(--ink); border-radius: 14px; padding: 16px 18px; width: min(1180px, 100%); max-height: 94vh; overflow: auto; box-shadow: 0 10px 40px rgba(0, 0, 0, .4); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; } .modal-head h3 { margin: 0; font-size: 17px; }
.pf-attention { border: 1px solid var(--line); border-left: 5px solid var(--warn); border-radius: 10px; padding: 8px 12px; margin: 8px 0 12px; background: var(--bg); }
.pf-attention ul { margin: 6px 0 0; padding-left: 18px; }
.pf-scope { margin: 14px 0 6px; } .pf-scope h4 { margin: 0 0 4px; }
table.pf td, table.pf th { vertical-align: top; } table.pf .pf-advice { min-width: 300px; font-size: 13.5px; }
table.pf .bar { min-width: 90px; }
.plan-wrap { max-height: 72vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
table.plan { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }
table.plan th, table.plan td { white-space: nowrap; }
table.plan thead th { position: sticky; top: 0; z-index: 2; background: var(--card); }
table.plan th:first-child, table.plan td:first-child { position: sticky; left: 0; z-index: 3; background: var(--card); min-width: 230px; max-width: 300px; white-space: normal; border-right: 2px solid var(--line); }
table.plan thead th:first-child { z-index: 4; }
table.plan td.unit { color: var(--muted); font-size: 12px; }
table.plan input[readonly] { background: transparent; border-color: transparent; }
.auto-box { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin: 10px 0; background: var(--bg); }
.auto-box label { flex-direction: row; align-items: center; gap: 8px; font-size: 15px; color: var(--ink); font-weight: 600; }
@media (max-width: 640px) { .chart-tip { max-width: 220px; } table.plan th:first-child, table.plan td:first-child { min-width: 150px; } }
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  aside.side { position: fixed; z-index: 20; left: 0; top: 0; width: 270px; max-width: 86vw; transform: translateX(-102%); transition: transform .2s; box-shadow: 0 0 30px rgba(0, 0, 0, .3); }
  body.menu-open aside.side { transform: none; }
  #menu-btn { display: inline-block; }
  .chart-grid { grid-template-columns: minmax(0, 1fr); }
  .issue { grid-template-columns: 1fr; }
  .gl-item dl { grid-template-columns: 1fr; }
}
@media (max-width: 640px) { .kpis { grid-template-columns: 1fr 1fr; } .kpi-value { font-size: 22px; } }
@media (max-width: 420px) { .kpis { grid-template-columns: 1fr; } }
@media print { aside.side, header.top2, .exportbar, .seg, .monthnav { display: none !important; } .shell { display: block; } }

/* Таблицы (сборка 8g): полосы по строкам, линии между колонками, ровное выравнивание, закреплённый первый столбец при прокрутке вправо. */
:root { --row-alt: color-mix(in srgb, var(--ink) 4.5%, var(--card)); --head-bg: color-mix(in srgb, var(--ink) 7%, var(--card)); --row-hover: color-mix(in srgb, var(--brand) 10%, var(--card)); }
.scroll { border: 1px solid var(--line); border-radius: 10px; }
.scroll th, .scroll td { vertical-align: middle; border-left: 1px solid var(--line); text-align: left; }
.scroll th:first-child, .scroll td:first-child { border-left: 0; }
.scroll th { background: var(--head-bg); }
.scroll th.num, .scroll td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.scroll td ul.tight { margin: 0; padding-left: 16px; }
:where(.scroll td) { background: var(--cell-bg, var(--card)); }
:where(.scroll tbody tr:nth-child(even)) { --cell-bg: var(--row-alt); }
:where(.scroll tbody tr:hover) { --cell-bg: var(--row-hover); }
:where(.scroll th:first-child, .scroll td:first-child) { position: sticky; left: 0; z-index: 1; box-shadow: 1px 0 0 var(--line); }
:where(.scroll th:first-child) { z-index: 2; }
.scroll td:first-child { min-width: 140px; max-width: 280px; }
.scroll tbody tr:last-child td { border-bottom: 0; }
.loadcell { min-width: 96px; } .loadpct { font-weight: 600; } .loadpct.low { color: var(--warn); } .loadpct.high { color: var(--bad); } .loadpct.ok { color: var(--ok); }
.loadbar { height: 6px; background: var(--line); border-radius: 4px; margin-top: 3px; overflow: hidden; }
.loadfill { height: 100%; border-radius: 4px; background: var(--ok); } .loadfill.low { background: var(--warn); } .loadfill.high { background: var(--bad); }
.bulkbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; padding: 10px 12px; margin: 8px 0; border: 1px solid var(--brand); border-radius: 10px; background: color-mix(in srgb, var(--brand) 8%, var(--card)); }
.bulkbar[hidden] { display: none; }
.scroll td:first-child:has(> input.rowchk) { min-width: 0; width: 40px; text-align: center; }
input.rowchk, input.rowchk-all { width: 18px; height: 18px; min-width: 0; cursor: pointer; }

/* Сборка 8i: таблица с вертикальной прокруткой вместо страниц; таблица плана оформлена как остальные (полосы, рамки) */
.scroll.vscroll { overflow: auto; }
.scroll.vscroll thead th { position: sticky; top: 0; z-index: 3; }
.scroll.vscroll thead th:first-child { z-index: 4; }

/* Сборка 8k: окно на 10 строк, закрепление любого столбца, фамилия и имя ученика рядом с номером карточки */
.scroll[data-enh] { overscroll-behavior: contain; scrollbar-gutter: stable; }
.scroll[data-enh] :is(th, td):first-child:not(.pinned) { position: static; box-shadow: none; }
.scroll[data-enh] thead th { position: sticky; top: 0; z-index: 3; }
.scroll[data-enh] thead th:first-child:not(.pinned) { z-index: 3; }
.scroll[data-enh] tbody td.pinned { position: sticky; z-index: 1; box-shadow: 1px 0 0 var(--line); }
.scroll[data-enh] thead th.pinned { position: sticky; z-index: 5; box-shadow: 1px 0 0 var(--line); }
.pinbtn { margin-left: 6px; padding: 0 3px; border: 0; background: transparent; cursor: pointer; font-size: 12px; line-height: 1; opacity: .35; filter: grayscale(1); vertical-align: middle; }
.pinbtn::before { content: "📌"; }
.pinbtn:hover, .pinbtn:focus-visible { opacity: .9; }
.pinbtn.on { opacity: 1; filter: none; }
.tcount { margin: 4px 2px 0; }
.crmref { display: inline-flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; }
.sname:not(:empty) { font-weight: 600; }
table.plan th, table.plan td { border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); vertical-align: middle; }
table.plan th:first-child, table.plan td:first-child { border-left: 0; }
table.plan thead th { background: var(--head-bg); }
table.plan thead th:first-child { background: var(--head-bg); }
table.plan tbody tr:nth-child(even) td { background: var(--row-alt); }
table.plan tbody tr:hover td { background: var(--row-hover); }
table.plan tbody tr:last-child td { border-bottom: 0; }

/* Воронка «путь клиента» (сборка 8i) */
.journey .jstep { margin: 10px 0 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.journey .jstep.worst { border-color: var(--bad, #c0392b); box-shadow: 0 0 0 1px var(--bad, #c0392b) inset; }
.journey .jnote { margin: 2px 0 0 0; }
.funnel-bar.ok { background: var(--good, #2e8b57); }
.jextra { margin: 6px 0; padding: 8px 10px; border: 1px dashed var(--line); border-radius: 10px; }
svg [hidden] { display: none; }
.journey .jstep.picked { background: var(--row-hover); }
.jbtns { margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; }
.kpi-short { margin: 4px 0 6px; font-size: 13px; }

/* Сборка 8k: воронка в одном окне — две колонки, списки людей в окне */
.jcols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; margin-top: 10px; }
.jcol { border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px 10px; background: var(--card); min-width: 0; }
.jcol h3 { margin: 10px 0 2px; font-size: 16px; }
.jcol .funnel-row { grid-template-columns: minmax(150px, 44%) 1fr 34px; gap: 8px; margin: 2px 0; font-size: 13.5px; }
.jcol .journey { max-height: max(320px, calc(100vh - 470px)); overflow-y: auto; padding-right: 4px; margin: 6px 0; }
.tiles.compact { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin: 8px 0; }
.tiles.compact .tile { padding: 6px 10px; }
.tiles.compact .tile-value { font-size: 20px; }
.tiles.compact .tile-label { font-size: 12px; }
@media (max-width: 900px) { .tiles.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.jcol .jstep { margin: 6px 0; padding: 6px 10px; }
.jline { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; justify-content: space-between; margin-top: 2px; }
.jline .jbtns { margin-top: 0; }
.jline .btn.small { padding: 3px 9px; font-size: 12px; }
.jtop { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.jtop .subtabs { margin: 8px 0; }
.jmini { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; margin: 8px 0 2px; }
.jmini div { display: flex; flex-direction: column; }
.jmodal select { min-width: 220px; }
body.modal-open { overflow: hidden; }
@media (max-width: 1000px) { .jcols { grid-template-columns: 1fr; } }
