/* Панель ЭМЗЕ, оформление «Графит».
   Рабочий инструмент: страница и меню в одном тоне, один синий акцент,
   цветом говорят только статусы. Светлая и тёмная темы — одни и те же
   токены: без data-theme тема берётся из системы, data-theme="light|dark"
   на <html> ставит переключатель в меню (panel.js). Шрифты и иконки —
   файлами из static, внешних адресов нет. */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/inter-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("fonts/jetbrains-mono-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ------------------------------------------------------------------ токены */

:root {
  color-scheme: light;
  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-2: #fafafb;
  --input: #ffffff;
  --line: #e3e3e8;
  --line-2: #eeeef2;
  --line-strong: #c9c9d1;
  --chip: #efeff3;
  --ink: #18181d;
  --ink-2: #55555f;
  --ink-3: #85858f;
  --link: #3151c9;
  --accent: #3e63dd;
  --accent-ink: #ffffff;
  --accent-soft: #ecf0fd;
  --accent-strong: #2e4fc0;
  --ok: #18794e;
  --ok-soft: #e5f4eb;
  --warn: #a35c00;
  --warn-soft: #fdf2e0;
  --warn-ink: #6f4000;
  --bad: #cd2b31;
  --bad-soft: #fcebec;
  --bad-ink: #8c1d21;
  --nav-hover: #ededf1;
  --nav-on: #ffffff;
  --row-hover: #fafafb;
  --toast-bg: #18181d;
  --toast-ink: #f2f2f4;
  --toast-line: #18181d;
  --term-bg: #121216;
  --term-ink: #d9dbe3;
  --shadow-pop: 0 12px 32px rgba(20, 20, 30, 0.16);
  --mark: linear-gradient(135deg, #7b97ff, #3e63dd 55%, #2a45a8);
  --radius: 9px;
  --radius-sm: 6px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f0f12; --surface: #17171b; --surface-2: #1b1b20; --input: #121216;
    --line: #29292f; --line-2: #212126; --line-strong: #3a3a42; --chip: #232329;
    --ink: #ededf0; --ink-2: #a6a6af; --ink-3: #75757f; --link: #8da2ff;
    --accent: #6e8bff; --accent-ink: #0b0b10; --accent-soft: #1d2343; --accent-strong: #a5b6ff;
    --ok: #3dd68c; --ok-soft: #11281d; --warn: #f1a10d; --warn-soft: #2a2010; --warn-ink: #f6c56a;
    --bad: #ff6369; --bad-soft: #2e1517; --bad-ink: #ffb3b6;
    --nav-hover: #1a1a1f; --nav-on: #1f1f25; --row-hover: #1b1b20;
    --toast-bg: #ededf0; --toast-ink: #18181d; --toast-line: #ededf0;
    --term-bg: #0a0a0d; --term-ink: #d9dbe3;
    --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.5);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0f12; --surface: #17171b; --surface-2: #1b1b20; --input: #121216;
  --line: #29292f; --line-2: #212126; --line-strong: #3a3a42; --chip: #232329;
  --ink: #ededf0; --ink-2: #a6a6af; --ink-3: #75757f; --link: #8da2ff;
  --accent: #6e8bff; --accent-ink: #0b0b10; --accent-soft: #1d2343; --accent-strong: #a5b6ff;
  --ok: #3dd68c; --ok-soft: #11281d; --warn: #f1a10d; --warn-soft: #2a2010; --warn-ink: #f6c56a;
  --bad: #ff6369; --bad-soft: #2e1517; --bad-ink: #ffb3b6;
  --nav-hover: #1a1a1f; --nav-on: #1f1f25; --row-hover: #1b1b20;
  --toast-bg: #ededf0; --toast-ink: #18181d; --toast-line: #ededf0;
  --term-bg: #0a0a0d; --term-ink: #d9dbe3;
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.5);
}

/* ------------------------------------------------------------------ основа */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5;
  color: var(--ink); background: var(--bg);
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; line-height: 1.25; font-weight: 650; letter-spacing: -0.018em; margin: 0; text-wrap: balance; }
h2 { font-size: 14px; font-weight: 600; margin: 0; letter-spacing: -0.005em; }
h3 { font-size: 14px; font-weight: 600; margin: 0; }
p { margin: 0; }
code, pre, .code { font-family: var(--mono); }
.code { font-size: 12.5px; letter-spacing: -0.01em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ico {
  width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px;
}
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.up { color: var(--ok); }
.down { color: var(--bad); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------------ каркас */

.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--bg); border-right: 1px solid var(--line); padding: 14px 10px 12px;
  display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; color: var(--ink); }
.brand:hover { text-decoration: none; }
/* Знак: синее стекло с искрой — блеск зеркала. Тот же рисунок в favicon.svg. */
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px; flex: none; position: relative; background: var(--mark);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 1px 3px rgba(40, 70, 180, 0.3);
}
.brand-mark::after {
  content: ""; position: absolute; inset: 0; background: center / 100% no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 26'%3E%3Cpath fill='white' d='M11.5 7C12.18 11.2 14.8 13.83 19 14.5C14.8 15.18 12.18 17.8 11.5 22C10.82 17.8 8.2 15.18 4 14.5C8.2 13.83 10.82 11.2 11.5 7Z'/%3E%3Cpath fill='white' fill-opacity='.8' d='M19.5 3.3C19.79 5.09 20.91 6.21 22.7 6.5C20.91 6.79 19.79 7.91 19.5 9.7C19.21 7.91 18.09 6.79 16.3 6.5C18.09 6.21 19.21 5.09 19.5 3.3Z'/%3E%3C/svg%3E");
}
.brand b { font-size: 14px; font-weight: 700; letter-spacing: 0.06em; }
.brand span { font-size: 12px; color: var(--ink-3); }

.nav {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 7px;
  color: var(--ink-2); font-weight: 500;
}
.nav .ico { color: var(--ink-3); }
.nav:hover { background: var(--nav-hover); color: var(--ink); text-decoration: none; }
.nav.on { background: var(--nav-on); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.nav.on .ico { color: var(--accent); }
.nav-label {
  font-size: 11px; font-weight: 600; color: var(--ink-3); padding: 14px 8px 4px;
  letter-spacing: 0.05em; text-transform: uppercase;
}

.who {
  margin-top: auto; display: flex; align-items: center; gap: 6px; padding: 12px 0 0 4px;
  border-top: 1px solid var(--line);
}
.who-text { min-width: 0; flex: 1; line-height: 1.3; }
.who-text b { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-text span { display: block; font-size: 11px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .icon-btn { width: 26px; height: 26px; }
.who form { margin: 0; display: flex; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-size: 12px; font-weight: 600; background: var(--accent-soft); color: var(--accent-strong);
}
.icon-btn {
  width: 28px; height: 28px; border-radius: 7px; border: 0; padding: 0; background: transparent;
  display: grid; place-items: center; color: var(--ink-3); cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--nav-hover); color: var(--ink); }
.theme-toggle .ico-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .ico-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .ico-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .ico-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .ico-moon { display: none; }
}

.col { display: flex; flex-direction: column; min-width: 0; }
.main { flex: 1; padding: 22px 28px 48px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.mbar, .tabbar { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
.page-head .sub { color: var(--ink-3); margin-top: 3px; }
.eyebrow { font-size: 12px; color: var(--ink-3); margin-bottom: 2px; }
.head-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.note {
  display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-size: 12.5px;
}
.note .ico { color: var(--ink-3); }
.note .tag { margin-left: auto; }

.alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius);
  font-size: 13px; white-space: pre-line;
}
.alert .ico { margin-top: 2px; }
.alert.error { background: var(--bad-soft); color: var(--bad-ink); }
.alert.error .ico { color: var(--bad); }
.alert.warning { background: var(--warn-soft); color: var(--warn-ink); }
.alert.warning .ico { color: var(--warn); }

/* ------------------------------------------------------------------ статусы */

.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 550; line-height: 1; white-space: nowrap; letter-spacing: 0;
  background: var(--chip); color: var(--ink-2); vertical-align: 2px;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill.plain::before { display: none; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.run { background: var(--accent-soft); color: var(--accent-strong); }
.pill.run::before { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }
.tag {
  display: inline-block; font-size: 11px; line-height: 16px; padding: 0 6px; border-radius: 5px;
  border: 1px solid var(--line); color: var(--ink-3); white-space: nowrap;
}
.count {
  font-size: 11.5px; font-weight: 600; color: var(--ink-3); background: var(--chip);
  border-radius: 999px; padding: 0 7px; line-height: 18px;
}

/* ------------------------------------------------------------------ показатели */

/* Одна полоса: ячейки разделены промежутком в 1px на цвете линии,
   поэтому границы сходятся при любом числе колонок. */
.stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.stat { background: var(--surface); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stat-label { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 500; color: var(--ink-3); }
.stat-value {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 18px; font-weight: 600;
  letter-spacing: -0.012em; line-height: 1.3; font-variant-numeric: tabular-nums;
}
.stat-meta { font-size: 12px; color: var(--ink-2); overflow-wrap: anywhere; }
.stat-meta .code { font-size: 11.5px; color: var(--ink-3); }

/* ------------------------------------------------------------------ карточки */

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  min-width: 0; overflow: hidden;
}
.card-head {
  display: flex; justify-content: space-between; align-items: center; gap: 6px 12px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--line-2);
}
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head h2 .ico { color: var(--ink-3); }
.card-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.card-foot { padding: 10px 16px; border-top: 1px solid var(--line-2); font-size: 12px; color: var(--ink-3); }
.aside { font-size: 12px; color: var(--ink-3); }
.subhead { padding: 12px 16px 8px; font-size: 12px; font-weight: 600; color: var(--ink-2); border-top: 1px solid var(--line-2); }

.two { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  padding: 26px 16px 28px; color: var(--ink-3); font-size: 12.5px;
}
.empty-ico {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 6px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-3);
}
.empty b { color: var(--ink); font-size: 13px; font-weight: 600; }

/* ------------------------------------------------------------------ шаги */

.steps {
  list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px; background: var(--line-2);
}
.step { background: var(--surface); display: flex; gap: 12px; padding: 16px; min-width: 0; position: relative; }
.step:not(:last-child)::after {
  content: ""; position: absolute; right: -7px; top: 22px; width: 12px; height: 12px; z-index: 1;
  background: var(--surface); border-top: 1px solid var(--line); border-right: 1px solid var(--line);
  transform: rotate(45deg);
}
.step-mark {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 600; background: var(--accent-soft); color: var(--accent-strong);
}
.step-mark .ico { width: 14px; height: 14px; }
.step.is-done .step-mark { background: var(--ok-soft); color: var(--ok); }
.step.is-warn .step-mark { background: var(--warn-soft); color: var(--warn); }
.step.is-bad .step-mark { background: var(--bad-soft); color: var(--bad); }
.step.is-blocked .step-mark { background: var(--chip); color: var(--ink-3); }
.step.is-run .step-mark .ico { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.step-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.step-n { font-size: 11px; font-weight: 600; color: var(--ink-3); letter-spacing: 0.05em; text-transform: uppercase; }
.step-top { display: flex; align-items: center; justify-content: space-between; gap: 6px 8px; flex-wrap: wrap; margin-top: -4px; }
.step p { color: var(--ink-2); font-size: 12.5px; }
.step-act { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.step-act form { display: contents; }
.step-meta { font-size: 12px; color: var(--ink-3); }

.reasons {
  list-style: none; margin: 0; padding: 10px 12px; display: grid; gap: 6px; border-radius: var(--radius-sm);
  background: var(--warn-soft); color: var(--warn-ink); font-size: 12.5px;
}
.reasons li { display: flex; gap: 8px; align-items: flex-start; }
.reasons .ico { width: 14px; height: 14px; margin-top: 2px; color: var(--warn); }

/* ------------------------------------------------------------------ формы */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 550; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); text-decoration: none; }
.btn .ico { width: 15px; height: 15px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.small { height: 26px; padding: 0 9px; font-size: 12px; font-weight: 500; }
.btn.large { height: 36px; padding: 0 16px; font-size: 14px; }
.btn.wide { width: 100%; }
.btn[disabled], .btn.disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.inp, input[type=text], input[type=password], textarea, select {
  width: 100%; min-width: 0; font: inherit; font-size: 13px; color: var(--ink); background: var(--input);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 5px 10px; min-height: 30px;
}
textarea { resize: vertical; line-height: 1.45; }
select { width: auto; padding-right: 28px; cursor: pointer; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; margin: 2px 0 0; flex: none; }

.drop {
  position: relative; display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px; min-width: 0;
  flex: 1 1 180px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
  color: var(--ink-3); font-size: 12.5px; cursor: pointer; background: var(--input);
}
.drop span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop.has-file { color: var(--ink); border-style: solid; }
.drop:hover { border-color: var(--accent); }
.drop:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1 1 140px; }
.form-row { display: flex; gap: 8px; padding: 12px 16px; flex-wrap: wrap; border-bottom: 1px solid var(--line-2); }
.form-row input[type=text] { flex: 1 1 130px; width: auto; }
form.inline { display: inline; }
label.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }

/* ------------------------------------------------------------------ таблицы */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-weight: 500; font-size: 12px; color: var(--ink-3); padding: 8px 16px;
  border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
td { padding: 9px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--row-hover); }
tfoot td { font-weight: 600; border-top: 1px solid var(--line); border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.when { color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
td.action { white-space: nowrap; }
td.empty-cell { padding: 0; }

.wh { display: flex; flex-direction: column; line-height: 1.3; min-width: 150px; }
td.code { white-space: nowrap; }
.wh small { color: var(--ink-3); font-size: 11.5px; }
.share { display: flex; align-items: center; gap: 8px; justify-content: flex-end; color: var(--ink-3); }
.bar { width: 80px; height: 6px; border-radius: 3px; background: var(--chip); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.delta {
  display: inline-block; min-width: 46px; padding: 1px 6px; border-radius: 5px; font-size: 12px; font-weight: 600;
  text-align: right; font-variant-numeric: tabular-nums; background: var(--chip); color: var(--ink-3);
}
.delta.up { background: var(--ok-soft); color: var(--ok); }
.delta.down { background: var(--bad-soft); color: var(--bad); }
.person { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.person i {
  font-style: normal; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font-size: 10.5px; font-weight: 600; background: var(--accent-soft); color: var(--accent-strong);
}

.diff-sum { display: flex; gap: 12px 28px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; align-items: center; }
.diff-sum div { display: flex; flex-direction: column; }
.diff-sum span { font-size: 12px; color: var(--ink-3); }
.diff-sum b { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.diff-sum .ico { color: var(--ink-3); }

/* ------------------------------------------------------------------ списки */

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--line-2); }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.list .by { font-size: 11.5px; color: var(--ink-3); text-align: right; line-height: 1.3; }

.q { padding: 12px 16px; border-bottom: 1px solid var(--line-2); display: flex; gap: 10px; }
.q:last-child { border-bottom: 0; }
.q-body { flex: 1; min-width: 0; }
.q-meta { font-size: 12px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.q-meta b { color: var(--ink); font-weight: 600; }
.q-text { white-space: pre-line; margin: 3px 0 6px; overflow-wrap: anywhere; }
details summary { cursor: pointer; color: var(--link); font-size: 12.5px; width: fit-content; }
details[open] summary { margin-bottom: 6px; }
details .row { margin-top: 6px; }

/* ------------------------------------------------------------------ сообщения */

.toasts {
  position: fixed; top: 16px; right: 16px; z-index: 50; display: grid; gap: 8px;
  width: min(420px, calc(100vw - 32px));
}
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 11px 10px 11px 12px; border-radius: var(--radius);
  background: var(--toast-bg); color: var(--toast-ink); border: 1px solid var(--toast-line);
  box-shadow: var(--shadow-pop); font-size: 13px; line-height: 1.45;
  max-height: 50vh; overflow: auto; animation: toast-in 0.18s ease-out;
}
.toast > span { flex: 1; min-width: 0; white-space: pre-line; overflow-wrap: anywhere; padding-top: 1px; }
.toast > .ico { margin-top: 2px; }
.toast.success > .ico { color: #3dd68c; }
.toast.error > .ico { color: #ff6369; }
.toast.warning > .ico { color: #f1a10d; }
.toast.info > .ico { color: #8da2ff; }
:root[data-theme="dark"] .toast.success > .ico { color: #18794e; }
:root[data-theme="dark"] .toast.error > .ico { color: #cd2b31; }
:root[data-theme="dark"] .toast.warning > .ico { color: #a35c00; }
:root[data-theme="dark"] .toast.info > .ico { color: #3e63dd; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .toast.success > .ico { color: #18794e; }
  :root:not([data-theme="light"]) .toast.error > .ico { color: #cd2b31; }
  :root:not([data-theme="light"]) .toast.warning > .ico { color: #a35c00; }
  :root:not([data-theme="light"]) .toast.info > .ico { color: #3e63dd; }
}
.toast .icon-btn { width: 22px; height: 22px; color: inherit; opacity: 0.6; }
.toast .icon-btn:hover { opacity: 1; background: transparent; color: inherit; }
.toast.leaving { opacity: 0; transform: translateY(-6px); transition: opacity 0.2s, transform 0.2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }

/* ------------------------------------------------------------------ задание */

.term-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
pre.output {
  background: var(--term-bg); color: var(--term-ink); padding: 14px 16px; margin: 0;
  font-size: 12px; line-height: 1.55; max-height: 62vh; overflow: auto; white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.result { display: flex; gap: 14px; padding: 16px; align-items: flex-start; }
.result-ico { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.result-ico .ico { width: 18px; height: 18px; }
.result-ico.ok { background: var(--ok-soft); color: var(--ok); }
.result-ico.bad { background: var(--bad-soft); color: var(--bad); }
.result-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.result-body h2 { font-size: 15px; }
.result-body p { color: var(--ink-2); }

/* ------------------------------------------------------------------ главная */

.sections { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.section-card {
  display: flex; flex-direction: column; gap: 6px; padding: 16px; min-height: 148px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
a.section-card:hover { border-color: var(--accent); text-decoration: none; }
.section-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.section-ico {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-strong);
}
.section-ico .ico { width: 18px; height: 18px; }
.section-card b { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.section-card span.text { font-size: 12.5px; color: var(--ink-2); }
.section-go { margin-top: auto; padding-top: 8px; display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 550; color: var(--link); }
.section-card.planned { background: transparent; border-style: dashed; border-color: var(--line-strong); }
.section-card.planned .section-ico { background: var(--chip); color: var(--ink-3); }
.section-card.planned b { color: var(--ink-2); }
.section-card.planned span.text { color: var(--ink-3); }

/* ------------------------------------------------------------------ вход */

.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-box { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 16px; }
.login-box .brand { padding: 0; justify-content: center; }
.login .card { padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.login h1 { font-size: 18px; text-align: center; }
.login label { display: block; font-size: 12px; font-weight: 500; color: var(--ink-2); margin-bottom: 4px; }
.login input[type=text], .login input[type=password] { min-height: 36px; font-size: 14px; }
.login .foot { text-align: center; font-size: 12px; color: var(--ink-3); }

/* ------------------------------------------------------------------ узкий экран */

@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1040px) {
  .two { grid-template-columns: minmax(0, 1fr); }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .step:not(:last-child)::after { display: none; }
}
@media (max-width: 760px) {
  .shell { display: block; }
  .side { display: none; }
  .mbar {
    display: flex; align-items: center; gap: 6px; padding: 8px 10px 8px 14px; position: sticky; top: 0; z-index: 20;
    background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .mbar .brand { padding: 0; margin-right: auto; }
  .mbar form { margin: 0; display: flex; }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: fixed; left: 0; right: 0; bottom: 0;
    z-index: 20; background: var(--bg); border-top: 1px solid var(--line);
    padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0;
    font-size: 10.5px; font-weight: 500; color: var(--ink-3); text-align: center;
  }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a.on { color: var(--accent); }
  .tabbar .ico { width: 20px; height: 20px; }
  .main { padding: 16px 14px calc(84px + env(safe-area-inset-bottom)); gap: 14px; }
  h1 { font-size: 21px; }
  .stat { padding: 12px; }
  .stat-value { font-size: 16px; }
  th, td { padding-left: 12px; padding-right: 12px; }
  .card-head, .form-row, .q, .list > li, .subhead, .diff-sum { padding-left: 12px; padding-right: 12px; }
  .diff-sum { gap: 10px 18px; }
  .diff-sum b { font-size: 17px; }
  .bar { width: 44px; }
  pre.output { font-size: 11px; padding: 12px; }
  .hide-sm { display: none; }
  .note .tag { display: none; }
  .toasts { top: 56px; right: 12px; width: calc(100vw - 24px); }
  .page-head { align-items: flex-start; }
}
@media (max-width: 420px) {
  .stats { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .stat-value { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------------------------ вход: тёмная сцена
   Страница входа всегда тёмная, независимо от темы панели: токены
   переопределены только внутри .login-dark. Виджет Телеграма — iframe,
   его только центрируем. */

.login-dark {
  color-scheme: dark;
  --surface: rgba(22, 24, 34, 0.72); --surface-2: #1b1d27; --input: #0d0e14;
  --line: rgba(255, 255, 255, 0.09); --line-strong: rgba(255, 255, 255, 0.18);
  --ink: #f1f2f6; --ink-2: #b3b6c3; --ink-3: #7c8a9c; --link: #6ff0cc;
  --accent: #22d3a8; --accent-ink: #04121a; --accent-strong: #7df3d2;
  --bad: #ff6369; --bad-soft: rgba(255, 99, 105, 0.12); --bad-ink: #ffb3b6;
  --warn: #f1a10d; --warn-soft: rgba(241, 161, 13, 0.12); --warn-ink: #f6c56a;
  position: relative; overflow: hidden; isolation: isolate;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(38, 214, 180, 0.16), transparent 60%),
    radial-gradient(900px 500px at 100% 110%, rgba(40, 90, 200, 0.18), transparent 60%),
    #040c1f;
  color: var(--ink);
}
/* Тонкая сетка — «чертёж» за карточкой, гаснет к краям. */
.login-dark::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 60% 55% at 50% 45%, #000 30%, transparent 75%);
}
.login-glow { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.login-glow i {
  position: absolute; width: 420px; height: 420px; border-radius: 50%;
  filter: blur(80px); opacity: 0.45; animation: login-drift 18s ease-in-out infinite alternate;
}
.login-glow i:nth-child(1) { background: #13c9a4; top: 6%; left: 14%; opacity: 0.28; }
.login-glow i:nth-child(2) { background: #2553c9; bottom: 4%; right: 10%; animation-delay: -6s; opacity: 0.32; }
.login-glow i:nth-child(3) { background: #5ff2c8; top: 55%; left: 45%; width: 260px; height: 260px;
  animation-delay: -12s; opacity: 0.12; }
@keyframes login-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(40px, -30px, 0) scale(1.12); }
}
@media (prefers-reduced-motion: reduce) { .login-glow i { animation: none; } }

.login-dark .login-box { max-width: 380px; gap: 22px; }
.login-hero { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.login-logo { margin: 0 0 4px; line-height: 0; }
.login-logo img {
  width: 170px; height: auto;
  filter: drop-shadow(0 18px 50px rgba(34, 211, 168, 0.28));
}
.login-hero h1:not(.login-logo) {
  font-size: 30px; font-weight: 700; letter-spacing: 0.22em; margin: 6px 0 0 0.22em;
  background: linear-gradient(180deg, #ffffff, #aeb8e6); -webkit-background-clip: text;
  background-clip: text; color: transparent;
}
.login-hero p { margin: 0; color: var(--ink-3); font-size: 13.5px; letter-spacing: 0.02em; }
.login-mark {
  width: 64px; height: 64px; border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), 0 0 0 8px rgba(62, 99, 221, 0.10),
    0 18px 50px rgba(62, 99, 221, 0.55);
}
.login-card {
  padding: 26px 24px 20px !important; gap: 14px !important;
  background: var(--surface); border: 1px solid var(--line);
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  border-radius: 16px;
}
.login .tg-login { display: flex; justify-content: center; min-height: 44px; }
.login .hint { text-align: center; font-size: 12.5px; color: var(--ink-3); margin: 0; }
.login .pw-login { display: flex; flex-direction: column; gap: 12px; }
.login-dark details { border-top: 1px solid var(--line); padding-top: 12px; }
.login-dark details summary { margin: 0 auto; color: var(--ink-3); }
.login-dark details summary:hover { color: var(--ink-2); }
.login-dark input[type=text], .login-dark input[type=password] {
  background: var(--input); border-color: var(--line-strong); color: var(--ink);
}
.login-dark .foot { color: #5d6173; letter-spacing: 0.04em; }
