/* ESA SEO — дизайн-система. Без внешних шрифтов и библиотек.
   Светлая тема по умолчанию, тёмная — по системной настройке (prefers-color-scheme).
   Структура: 1 переменные · 2 основа · 3 каркас · 4 компоненты · 5 экраны · 6 адаптивность */

/* ============================== 1. Переменные ============================== */
:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #eef0f4;
  --border: #e2e5ea;
  --border-strong: #c8cdd6;
  --text: #19212b;
  --text-2: #4a5565;
  --text-3: #768091;

  --accent: #0e7c6e;
  --accent-hover: #0a655a;
  --accent-soft: #e2f3f0;
  --accent-text: #0a5e53;
  --on-accent: #ffffff;

  --danger: #c0291f;
  --danger-hover: #a02018;
  --danger-soft: #fdebe9;
  --danger-text: #a4170f;
  --warning: #b45309;
  --warning-soft: #fef3dc;
  --warning-text: #8a4106;
  --success: #12794a;
  --success-soft: #e0f5ea;
  --success-text: #0d6a3f;
  --info: #1d63b8;
  --info-soft: #e5effb;
  --info-text: #1a559e;

  --sev-critical-bg: #fde8e6; --sev-critical-fg: #a4170f; --sev-critical-bd: #f6c3be;
  --sev-high-bg: #ffeedd;     --sev-high-fg: #a74208;     --sev-high-bd: #f8cfa6;
  --sev-medium-bg: #fdf3c8;   --sev-medium-fg: #765000;   --sev-medium-bd: #f1dc8a;
  --sev-low-bg: #e3effd;      --sev-low-fg: #1b5aa8;      --sev-low-bd: #bcd6f5;
  --sev-info-bg: #eceff3;     --sev-info-fg: #475467;     --sev-info-bd: #d5dae1;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 28px rgba(16, 24, 40, .14), 0 2px 6px rgba(16, 24, 40, .06);
  --focus: 0 0 0 3px rgba(14, 124, 110, .30);
  --topbar-h: 56px;
  --container: 1200px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1217;
    --surface: #151b22;
    --surface-2: #1a2129;
    --surface-3: #222a34;
    --border: #28313c;
    --border-strong: #3a4653;
    --text: #e7ebf0;
    --text-2: #aab4c0;
    --text-3: #7f8a98;

    --accent: #2bb5a0;
    --accent-hover: #43c9b4;
    --accent-soft: rgba(43, 181, 160, .14);
    --accent-text: #5fd3c1;
    --on-accent: #06201c;

    --danger: #ef6a5f;
    --danger-hover: #f58880;
    --danger-soft: rgba(239, 106, 95, .14);
    --danger-text: #f59a92;
    --warning: #e5a04a;
    --warning-soft: rgba(229, 160, 74, .14);
    --warning-text: #efbd7e;
    --success: #43bf86;
    --success-soft: rgba(67, 191, 134, .14);
    --success-text: #7fd8ae;
    --info: #6aa7ec;
    --info-soft: rgba(106, 167, 236, .15);
    --info-text: #9bc4f4;

    --sev-critical-bg: rgba(239, 106, 95, .16); --sev-critical-fg: #f7a49c; --sev-critical-bd: rgba(239, 106, 95, .35);
    --sev-high-bg: rgba(237, 142, 63, .16);     --sev-high-fg: #f4b27e;     --sev-high-bd: rgba(237, 142, 63, .35);
    --sev-medium-bg: rgba(226, 190, 66, .15);   --sev-medium-fg: #ecd077;   --sev-medium-bd: rgba(226, 190, 66, .32);
    --sev-low-bg: rgba(106, 167, 236, .15);     --sev-low-fg: #9bc4f4;      --sev-low-bd: rgba(106, 167, 236, .32);
    --sev-info-bg: rgba(160, 172, 186, .14);    --sev-info-fg: #b3bdc9;     --sev-info-bd: rgba(160, 172, 186, .28);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow: 0 1px 3px rgba(0, 0, 0, .45);
    --shadow-lg: 0 14px 30px rgba(0, 0, 0, .55);
    --focus: 0 0 0 3px rgba(43, 181, 160, .35);
  }
}

/* ================================ 2. Основа ================================ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 64px); }
body {
  margin: 0;
  font: 15px/1.55 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0 0 .75em; }
p:last-child { margin-bottom: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.rule { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
code, .mono { font-family: var(--mono); font-size: .92em; }
ul, ol { margin: 0; padding: 0; }
[hidden] { display: none !important; }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; padding: 8px 14px; background: var(--accent); color: var(--on-accent); border-radius: var(--radius-sm); }
.skip-link:focus { top: 8px; text-decoration: none; }
.muted { color: var(--text-3); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { font-variant-numeric: tabular-nums; }
.text-danger { color: var(--danger-text); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.stack > * + * { margin-top: 14px; }
.stack-lg > * + * { margin-top: 20px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ================================ 3. Каркас ================================ */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding-left: 20px; padding-right: 20px; }
.main { padding-top: 22px; padding-bottom: 48px; min-height: calc(100vh - var(--topbar-h) - 70px); }
.footer { display: flex; justify-content: space-between; gap: 12px; padding-top: 18px; padding-bottom: 28px; font-size: 13px; color: var(--text-3); border-top: 1px solid var(--border); }

.topbar { position: sticky; top: 0; z-index: 50; height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; gap: 22px; height: 100%; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--accent); font-weight: 700; letter-spacing: -.01em; flex: none; }
.brand:hover { text-decoration: none; }
.brand-name { color: var(--text); font-size: 17px; }
.topnav { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a { padding: 7px 12px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; white-space: nowrap; }
.topnav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.topnav a.active { background: var(--accent-soft); color: var(--accent-text); }

.user-menu { position: relative; flex: none; margin-left: auto; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 999px; cursor: pointer; color: var(--text-2); }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--surface-3); }
.avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-weight: 650; font-size: 13px; }
.user-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 230px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.menu-head { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-item { display: block; width: 100%; padding: 8px 10px; text-align: left; border: 0; background: none; border-radius: var(--radius-sm); color: var(--text); font: inherit; cursor: pointer; }
.menu-item:hover { background: var(--surface-3); text-decoration: none; }

.flash-zone:empty { display: none; }
.flash-zone { padding-top: 14px; display: grid; gap: 8px; position: sticky; top: var(--topbar-h); z-index: 45; pointer-events: none; }
.flash-zone > .alert { pointer-events: auto; }
.flash-zone > .alert-success { background: linear-gradient(var(--success-soft), var(--success-soft)), var(--surface); box-shadow: var(--shadow, 0 4px 14px rgba(0,0,0,.25)); }
.flash-zone > .alert-error { background: linear-gradient(var(--danger-soft), var(--danger-soft)), var(--surface); box-shadow: var(--shadow, 0 4px 14px rgba(0,0,0,.25)); }
.flash-zone > .alert-warning { background: linear-gradient(var(--warning-soft), var(--warning-soft)), var(--surface); box-shadow: var(--shadow, 0 4px 14px rgba(0,0,0,.25)); }
.flash-zone > .alert-info { background: linear-gradient(var(--info-soft), var(--info-soft)), var(--surface); box-shadow: var(--shadow, 0 4px 14px rgba(0,0,0,.25)); }
/* оповещение видно и после перехода к разделу по #якорю */
.flash-zone + .main { padding-top: 14px; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-title { font-size: 26px; }
.page-sub { margin-top: 4px; color: var(--text-3); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================== 4. Компоненты ============================== */
/* --- Оповещения --- */
.alert { position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius); border: 1px solid; font-size: 14px; }
.alert-title { display: block; margin-bottom: 2px; }
.alert-body { flex: 1; min-width: 0; }
.alert-close { flex: none; margin: -3px -6px 0 0; padding: 0 8px; border: 0; background: none; color: inherit; font-size: 20px; line-height: 1.4; cursor: pointer; opacity: .6; border-radius: var(--radius-sm); }
.alert-close:hover { opacity: 1; }
.alert-success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 35%, transparent); color: var(--success-text); }
.alert-error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger-text); }
.alert-warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 35%, transparent); color: var(--warning-text); }
.alert-info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 35%, transparent); color: var(--info-text); }
.alert .muted { color: inherit; opacity: .8; }

/* --- Карточки --- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px 0; }
.card-title { font-size: 16px; }
.card-sub { margin-top: 3px; font-size: 13px; color: var(--text-3); }
.card-actions { flex: none; }
.card-body { padding: 16px 18px 18px; }
.card-header + .card-body { padding-top: 14px; }
.card-body-flush { padding: 0; }
.card-header + .card-body-flush { margin-top: 12px; }
.card-pad { padding: 16px 18px; }
.card-danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.card-danger .card-title { color: var(--danger-text); }

/* --- Кнопки --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 7px 15px; border: 1px solid transparent; border-radius: var(--radius-sm); font: inherit; font-weight: 550; line-height: 1.2; text-align: center; cursor: pointer; white-space: nowrap; transition: background-color .12s, border-color .12s, color .12s, box-shadow .12s; }
.btn:hover { text-decoration: none; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-3); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-link { background: none; color: var(--accent-text); padding-left: 6px; padding-right: 6px; min-height: 30px; }
.btn-link:hover { background: var(--accent-soft); }
.btn-sm { min-height: 30px; padding: 4px 11px; font-size: 13px; }
.btn-lg { min-height: 42px; padding: 9px 20px; font-size: 15px; }
.btn-block { display: flex; width: 100%; }

/* --- Формы --- */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.label { font-weight: 550; font-size: 14px; }
.req { margin-left: 3px; color: var(--danger); }
.input, .select, .textarea { width: 100%; min-height: 38px; padding: 8px 11px; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); transition: border-color .12s, box-shadow .12s; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); }
.input-sm, .select-sm { min-height: 34px; padding: 5px 10px; font-size: 14px; }
.textarea { resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23768091' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.hint { font-size: 13px; color: var(--text-3); }
.error { font-size: 13px; color: var(--danger-text); font-weight: 500; }
.has-error .input, .has-error .select, .has-error .textarea { border-color: var(--danger); }
.field-check { gap: 3px; }
.check { display: inline-flex; align-items: flex-start; gap: 8px; cursor: pointer; font-weight: 500; }
.check input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 4px 0; }
.form-section { margin: 0; padding: 0; border: 0; min-width: 0; }
.form-section > legend, .form-section > .form-section-title { float: left; width: 100%; padding: 0; margin: 0 0 12px; font-size: 15px; font-weight: 650; }
.form-section > legend + *, .form-section > .form-section-title + * { clear: both; }
.form-section > :not(legend):not(.form-section-title) ~ :not(legend):not(.form-section-title) { margin-top: 14px; }
.form-section + .form-section { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--border); }
.form-narrow { max-width: 780px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.inline-fields { display: grid; grid-template-columns: minmax(0, 1fr) 190px auto; gap: 12px; align-items: end; margin-top: 16px; }
.field-button { justify-content: flex-end; }
.card-body > form + .hint, .card-body > .plain-list + form { margin-top: 14px; }

/* --- Бейджи --- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; border: 1px solid transparent; font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.badge-count { padding-left: 6px; border-left: 1px solid currentColor; font-variant-numeric: tabular-nums; opacity: .9; }
.badge-neutral { background: var(--surface-3); color: var(--text-2); border-color: var(--border); }
.badge-success { background: var(--success-soft); color: var(--success-text); }
.badge-warning { background: var(--warning-soft); color: var(--warning-text); }
.badge-danger { background: var(--danger-soft); color: var(--danger-text); }
.badge-info { background: var(--info-soft); color: var(--info-text); }
.badge-sev-critical { background: var(--sev-critical-bg); color: var(--sev-critical-fg); border-color: var(--sev-critical-bd); }
.badge-sev-high { background: var(--sev-high-bg); color: var(--sev-high-fg); border-color: var(--sev-high-bd); }
.badge-sev-medium { background: var(--sev-medium-bg); color: var(--sev-medium-fg); border-color: var(--sev-medium-bd); }
.badge-sev-low { background: var(--sev-low-bg); color: var(--sev-low-fg); border-color: var(--sev-low-bd); }
.badge-sev-info { background: var(--sev-info-bg); color: var(--sev-info-fg); border-color: var(--sev-info-bd); }

/* --- Таблицы: шапка остаётся на месте при прокрутке --- */
.table-wrap { max-height: 72vh; overflow: auto; border-radius: inherit; }
.card-body-flush > .table-wrap { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th, .table td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.table thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); white-space: nowrap; }
.table thead th.right, .table td.right { text-align: right; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.row-muted td { color: var(--text-3); }
.table-tight th, .table-tight td { padding: 7px 12px; }

/* --- Вкладки --- */
.tabs { display: flex; gap: 0; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--border); background: var(--bg); }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 11px 12px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--text-2); font-size: 14px; font-weight: 550; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; background: var(--surface-3); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.tab.active { color: var(--accent-text); border-bottom-color: var(--accent); }
.tab-badge { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 11.5px; font-weight: 650; line-height: 19px; text-align: center; font-variant-numeric: tabular-nums; }
.tab-badge-danger { background: var(--danger-soft); color: var(--danger-text); }
.tab.active .tab-badge { background: var(--accent-soft); color: var(--accent-text); }
.tabs-page { margin-bottom: 20px; }

/* --- Прогресс --- */
.progress-wrap { display: grid; gap: 5px; }
.progress-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); }
.progress { height: 8px; overflow: hidden; background: var(--surface-3); border-radius: 999px; }
.progress-bar { height: 100%; border-radius: inherit; background: var(--accent); transition: width .35s ease; }
.progress-success { background: var(--success); }
.progress-danger { background: var(--danger); }
.progress-warning { background: var(--warning); }
.progress-sm { height: 5px; }
.job-box { display: grid; gap: 8px; }
.job-head { display: flex; justify-content: space-between; gap: 12px; }
.job-error { color: var(--danger-text); font-weight: 500; }
.job-box.job-failed .progress-bar { background: var(--danger); }
.job-box.job-done .progress-bar { background: var(--success); }

/* --- Шаговый индикатор этапов (вертикальный) --- */
.stepper { list-style: none; display: grid; gap: 0; }
.step { position: relative; display: flex; align-items: flex-start; gap: 12px; padding-bottom: 14px; }
.step:last-child { padding-bottom: 0; }
.step::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--border); }
.step:last-child::before { display: none; }
.step-dot { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3); color: var(--text-3); font-size: 13px; font-weight: 650; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); }
.step-body { flex: 1; display: flex; justify-content: space-between; gap: 12px; padding-top: 3px; min-width: 0; }
.step-title { font-weight: 550; }
.step-meta { color: var(--text-3); font-size: 13px; }
.step-done .step-dot { background: var(--success); color: #fff; box-shadow: 0 0 0 1px var(--success); }
.step-done::before { background: var(--success); }
.step-done .step-title { color: var(--text-2); }
.step-started .step-dot { background: var(--accent-soft); color: var(--accent-text); box-shadow: 0 0 0 1px var(--accent); }
.step-current .step-dot { background: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 1px var(--accent), 0 0 0 5px var(--accent-soft); }
.step-current .step-title { font-weight: 700; }
.step-todo .step-title { color: var(--text-2); }

/* --- Пустое состояние --- */
.empty { display: grid; justify-items: center; gap: 8px; max-width: 460px; margin: 32px auto; padding: 36px 24px; text-align: center; }
.empty-mark { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); }
.empty-title { font-size: 18px; margin-top: 4px; }
.empty-text { color: var(--text-3); margin: 0; }
.empty-actions { margin-top: 6px; }
.card-pad .empty, .card-body .empty { margin: 8px auto; padding: 20px 12px; }

/* --- Ключевые числа --- */
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); }
a.stat:hover { border-color: var(--border-strong); background: var(--surface-3); text-decoration: none; }
.stat-label { font-size: 12.5px; color: var(--text-3); line-height: 1.3; }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-hint { font-size: 12px; color: var(--text-3); }
.stat-danger .stat-value { color: var(--danger-text); }

/* --- Прочее --- */
.plain-list { list-style: none; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.list-row > div:first-child { display: flex; flex-direction: column; min-width: 0; }
.copy-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.token-value { flex: 1; min-width: 220px; padding: 9px 12px; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); word-break: break-all; user-select: all; }
.token-reveal { margin-bottom: 20px; }

/* Markdown-текст */
.prose { max-width: 74ch; line-height: 1.65; }
.prose > * + * { margin-top: .85em; }
.prose h1, .prose h2, .prose h3, .prose h4 { margin-top: 1.4em; line-height: 1.3; }
.prose h1 { font-size: 24px; } .prose h2 { font-size: 20px; } .prose h3 { font-size: 17px; } .prose h4 { font-size: 15px; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: .3em; }
.prose blockquote { margin-left: 0; padding: 4px 14px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-2); }
.prose code { padding: 1px 5px; background: var(--surface-3); border-radius: 4px; }
.prose pre { overflow-x: auto; padding: 12px 14px; background: var(--surface-3); border-radius: var(--radius); }
.prose pre code { padding: 0; background: none; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 7px 11px; border: 1px solid var(--border); text-align: left; }
.prose th { background: var(--surface-2); }
.prose hr { margin: 1.6em 0; }
.prose img { max-width: 100%; height: auto; }

/* ================================ 5. Экраны ================================ */
/* --- Вход --- */
.page-auth .main { display: grid; align-items: center; }
.auth-wrap { display: grid; place-items: center; padding: 24px 0; }
.auth-card { width: 100%; max-width: 420px; padding: 28px; box-shadow: var(--shadow); }
.auth-head { margin-bottom: 20px; }
.auth-title { font-size: 22px; margin-bottom: 4px; }
.auth-note { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }

/* --- Ошибки --- */
.error-page { display: grid; justify-items: center; gap: 10px; padding: 64px 0; text-align: center; }
.error-code { font-size: 72px; line-height: 1; font-weight: 750; letter-spacing: -.04em; color: var(--accent); opacity: .85; }
.error-title { font-size: 22px; }
.error-page p { max-width: 460px; }

/* --- Список проектов --- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 14px; }
.toolbar-grow { flex: 1; min-width: 220px; }
.toolbar-form { margin: 0; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: var(--radius); }
.segment { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 7px; color: var(--text-2); font-weight: 550; font-size: 14px; }
.segment:hover { text-decoration: none; color: var(--text); }
.segment.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segment-count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.summary-line { margin: 0 0 14px; font-size: 14px; }
.empty-filter { padding: 28px 0; text-align: center; }

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.project-card { position: relative; display: flex; flex-direction: column; gap: 11px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); transition: border-color .12s, box-shadow .12s, transform .12s; }
.project-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.project-card.has-critical { border-left: 3px solid var(--danger); }
.pc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pc-title-wrap { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pc-title { font-size: 17px; overflow-wrap: anywhere; }
.pc-link { color: var(--text); }
.pc-link:hover { text-decoration: none; color: var(--accent-text); }
.pc-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-lg); }
.pc-domain { position: relative; z-index: 1; align-self: flex-start; font-size: 13px; color: var(--text-3); overflow-wrap: anywhere; }
.pc-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--text-2); }
.pc-meta span + span::before { content: "·"; margin-right: 14px; color: var(--text-3); }
.pc-stage-title { margin-bottom: 6px; font-size: 13.5px; font-weight: 600; }
.pc-step { position: relative; z-index: 1; display: flex; gap: 8px; align-items: baseline; padding: 8px 10px; background: var(--accent-soft); border-radius: var(--radius-sm); font-size: 13.5px; }
.pc-step-label { flex: none; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-text); }
.pc-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: auto; padding-top: 2px; }
.pc-tasks { margin-left: auto; font-size: 13px; color: var(--text-2); }
.pc-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.pc-alert { position: relative; z-index: 1; font-size: 13px; font-weight: 600; color: var(--danger-text); }

/* --- Страница проекта --- */
.project-head { margin-bottom: 14px; }
.crumbs { display: flex; gap: 8px; font-size: 13px; margin-bottom: 6px; }
.crumbs a { color: var(--text-3); }
.crumbs a:hover { color: var(--accent-text); }
.project-head-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.project-title { font-size: 26px; overflow-wrap: anywhere; }
.project-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; margin-top: 6px; font-size: 14px; color: var(--text-2); }
.project-meta > * + *::before { content: "·"; margin: 0 10px; color: var(--text-3); }
.project-meta > * + *::before { display: inline-block; }
.domain-link { font-weight: 600; }
.project-body { padding-top: 20px; }
.tabs + .next-step { margin-top: 16px; }
.project-head + .tabs { position: sticky; top: var(--topbar-h); z-index: 20; margin: 0 -20px; padding: 0 20px; }

.next-step { padding: 14px 18px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: var(--radius-lg); }
.next-step-label { margin-bottom: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-text); }
.next-step-main { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.next-step-text { flex: 1; min-width: 240px; }
.next-step-title { font-size: 16px; }
.next-step-why { margin: 3px 0 0; font-size: 14px; color: var(--text-2); }
.next-step-more { margin-top: 10px; font-size: 14px; }
.next-step-more summary { cursor: pointer; color: var(--accent-text); font-weight: 550; }
.next-step-list { list-style: decimal; padding-left: 20px; margin-top: 8px; display: grid; gap: 8px; }
.next-step-list li { padding-left: 4px; }
.next-step-list li > div { display: inline; }
.next-step-list li .btn { margin-left: 8px; }

.overview-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.job-card { margin-bottom: 20px; border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.step-list { list-style: none; display: grid; gap: 0; }
.step-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.step-row:first-child { padding-top: 0; }
.step-row:last-child { padding-bottom: 0; border-bottom: 0; }
.step-num { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: 13px; }
.step-text { flex: 1; min-width: 0; }
.step-text p { margin: 2px 0 0; }
.feed { list-style: none; }
.feed-item { padding: 11px 18px; border-bottom: 1px solid var(--border); }
.feed-item:last-child { border-bottom: 0; }
.feed-text { overflow-wrap: anywhere; }
.findings-line { display: grid; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.findings-title { color: var(--text); }
.findings-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.action-list { display: grid; gap: 8px; }

/* --- Настройки --- */
.settings-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; align-items: start; }
.settings-nav { position: sticky; top: calc(var(--topbar-h) + 62px); display: grid; gap: 2px; }
.settings-nav a { padding: 7px 12px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; }
.settings-nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.settings-columns { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.portal-address { margin-top: 20px; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); display: grid; gap: 8px; }
.portal-address-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.danger-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.danger-row-stack { align-items: stretch; flex-direction: column; }
.danger-row-stack .inline-fields { margin-top: 4px; grid-template-columns: minmax(0, 1fr) auto; }
.user-list { display: block; }
.user-item { border-bottom: 1px solid var(--border); }
.user-item:last-child { border-bottom: 0; }
.user-summary { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 12px 18px; cursor: pointer; list-style: none; }
.user-summary::-webkit-details-marker { display: none; }
.user-summary:hover { background: var(--surface-2); }
.user-item[open] > .user-summary { background: var(--surface-2); }
.user-main { display: flex; flex-direction: column; min-width: 0; }
.user-name-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.user-seen { min-width: 110px; text-align: right; }
.user-item.is-off .user-main, .user-item.is-off .avatar { opacity: .55; }
.user-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; padding: 16px 18px 18px 60px; background: var(--surface-2); border-top: 1px solid var(--border); }
.user-toggle { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }

/* ============================== 6. Адаптивность ============================== */
@media (max-width: 1000px) {
  .overview-grid, .settings-columns { grid-template-columns: minmax(0, 1fr); }
  .settings-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .settings-nav { position: static; display: flex; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
  .settings-nav a { white-space: nowrap; background: var(--surface-3); }
}

@media (max-width: 720px) {
  body { font-size: 15px; }
  .container { padding-left: 16px; padding-right: 16px; }
  .topbar-inner { gap: 12px; }
  .brand-name, .user-name { display: none; }
  .page-title, .project-title { font-size: 22px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .inline-fields, .danger-row-stack .inline-fields { grid-template-columns: minmax(0, 1fr); }
  .user-summary { grid-template-columns: auto minmax(0, 1fr); padding: 12px 14px; }
  .user-badges, .user-seen { grid-column: 2; text-align: left; }
  .user-panel { grid-template-columns: minmax(0, 1fr); padding: 14px; }
  .project-grid { grid-template-columns: minmax(0, 1fr); }
  .project-meta { gap: 2px 14px; }
  .project-meta > * + *::before { display: none; }
  .project-head + .tabs { margin: 0 -16px; padding: 0 16px; }
  .tab { padding: 11px 11px; }
  .card-header { padding: 14px 14px 0; }
  .card-body { padding: 14px; }
  .card-pad { padding: 14px; }
  .next-step { padding: 12px 14px; }
  .next-step-main .btn { width: 100%; }
  .toolbar-grow { flex-basis: 100%; }
  .step-row { flex-wrap: wrap; }
  .step-row .btn { margin-left: 38px; }
  .footer { flex-direction: column; gap: 4px; }
  .auth-card { padding: 22px 18px; }
  .menu { right: -6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media print {
  .topbar, .tabs, .footer, .flash-zone, .btn { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; }
}
