/* Вход и админка тренажёра: светлая палитра — та же, что у светлой темы тренажёра (src/style.css). */
:root {
  --bg: #f4f2ee; --panel: #ffffff; --panel-2: #f7f5f1; --line: #e2ddd4; --line-strong: #8f8a80; --text: #1d1b22; --text-soft: #2b2832; --muted: #66626f;
  --accent: #5b3fd6; --accent-ink: #ffffff; --ok: #0f6d4d; --bad: #b03028; --warn: #9a6200; --code-bg: #f3f1ec;
  --heat-0: #ece8e1; --heat-1: #d9d0f7; --heat-2: #b3a1ef; --heat-3: #8667e3; --heat-4: #5b3fd6;
  --sans: Manrope, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--sans); }
a { color: var(--accent); }
h1 { font-size: 24px; margin: 0 0 8px; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: 17px; margin: 0 0 12px; }
h2.sec { margin: 28px 0 12px; }
h3 { font-size: 15px; margin: 18px 0 8px; }
code, pre { font-family: var(--mono); font-size: .92em; background: var(--code-bg); border-radius: 6px; }
code { padding: 1px 5px; }
.muted { color: var(--muted); }
.sub { display: block; font-size: 13px; color: var(--text-soft); }
.sub.muted { color: var(--muted); }
.note { color: var(--muted); font-size: 13px; margin: 10px 0 0; max-width: 90ch; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.brand { font-weight: 800; margin: 0; }
.brand a { color: inherit; text-decoration: none; }
.mark { font-family: var(--mono); color: var(--accent); margin-right: 4px; }

.btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); border-radius: 9px; padding: 9px 16px; cursor: pointer; }
.btn:hover { border-color: var(--line-strong); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
.btn.small { padding: 4px 10px; font-size: 13px; }
button.link { font: inherit; background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; text-decoration: underline; }
input { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line-strong); border-radius: 9px; padding: 9px 12px; width: 100%; min-width: 0; }
input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
label.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; }

.msg { border-radius: 10px; padding: 10px 14px; margin: 0 0 16px; border: 1px solid var(--line); background: var(--panel); }
.msg p { margin: 0; }
.msg.bad { border-color: color-mix(in srgb, var(--bad) 60%, var(--line)); color: var(--bad); }
.msg.ok { border-color: color-mix(in srgb, var(--ok) 60%, var(--line)); }
.invite { margin-top: 10px; display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.invite pre { margin: 0; padding: 10px 14px; font-size: 15px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; border: 1px solid var(--line); flex: 1 1 320px; min-width: 0; }

/* вход */
body.login { min-height: 100vh; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
.login-box { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: 0 10px 30px rgb(29 27 34 / .06); }
.login-box .brand { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.login-box .lead { color: var(--muted); margin: 0 0 20px; }
.stack { display: grid; gap: 14px; }
.stack .btn { margin-top: 6px; padding: 11px; }

/* админка */
.top { display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap; padding-block: 12px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); border-bottom: 1px solid var(--line); background: var(--panel); }
.top-links { margin-left: auto; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.top-links form { margin: 0; }
.wrap { max-width: 1100px; margin: 0 auto; padding-block: 20px 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.wrap.wide { max-width: none; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin-bottom: 16px; min-width: 0; }
.panel.danger { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h1, .panel-head h2 { margin: 0; }
.row-form { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.row-form label { flex: 1 1 180px; }
.row-form .btn { flex: none; }
.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); vertical-align: 1px; }
.chip.bad { color: var(--bad); }
.chip.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--panel-2); font-size: 14px; }
.seg a { padding: 6px 12px; text-decoration: none; color: var(--text-soft); }
.seg a + a { border-left: 1px solid var(--line); }
.seg a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.score { font-variant-numeric: tabular-nums; }
.score.good { color: var(--ok); }
.score.mid { color: var(--warn); }
.score.low { color: var(--bad); }

progress { -webkit-appearance: none; appearance: none; width: 100%; max-width: 220px; height: 6px; border: 0; border-radius: 99px; background: var(--heat-0); overflow: hidden; vertical-align: middle; display: block; margin: 2px 0 4px; }
progress::-webkit-progress-bar { background: var(--heat-0); border-radius: 99px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 99px; }
td progress { display: inline-block; width: 90px; margin: 0 6px 0 0; }
.cell progress, .people progress { display: block; width: 100%; margin: 2px 0 4px; }

.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-weight: 600; }
thead th { color: var(--muted); font-size: 13px; }
th, td { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tests td, table.tests th { white-space: nowrap; }
table.topics td { white-space: nowrap; font-variant-numeric: tabular-nums; }
table.topics tr.dim th, table.topics tr.dim td { color: var(--muted); }
table.people td { min-width: 180px; }
table.people td.who { min-width: 150px; }

/* активность: последние дни, клетка — день */
.heat, .cal { display: grid; gap: 3px; }
.heat { grid-template-columns: repeat(14, 12px); margin: 2px 0 6px; }
.cal { grid-template-columns: repeat(28, minmax(10px, 1fr)); max-width: 640px; margin: 14px 0 0; }
.heat i, .cal i { display: block; aspect-ratio: 1; border-radius: 3px; background: var(--heat-0); }
.heat i { width: 12px; }
.l1 { background: var(--heat-1) !important; } .l2 { background: var(--heat-2) !important; } .l3 { background: var(--heat-3) !important; } .l4 { background: var(--heat-4) !important; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stats div { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.stats b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.stats span { font-size: 13px; color: var(--muted); }

/* матрица тем: первый столбец закреплён при горизонтальной прокрутке */
.matrix-wrap { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
table.matrix th, table.matrix td { padding: 10px 12px; border-bottom: 1px solid var(--line); min-width: 150px; }
table.matrix thead th { background: var(--panel-2); position: sticky; top: 0; }
table.matrix .topic { position: sticky; left: 0; background: var(--panel); min-width: 190px; max-width: 240px; border-right: 1px solid var(--line); z-index: 1; }
table.matrix thead .topic { background: var(--panel-2); z-index: 2; }
table.matrix tr.total th, table.matrix tr.total td { background: var(--panel-2); }
.cell { display: grid; gap: 1px; font-variant-numeric: tabular-nums; }
form.inline { display: flex; gap: 10px; align-items: center; margin: 0; }

@media (max-width: 720px) {
  table.people thead { display: none; }
  table.people, table.people tbody, table.people tr, table.people td { display: block; width: auto; min-width: 0; }
  table.people tr { border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; margin-bottom: 10px; }
  table.people td { border: 0; padding: 6px 0; }
  table.people td:not(.who)::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
  .heat { grid-template-columns: repeat(14, minmax(10px, 1fr)); }
  .heat i { width: auto; }
}
