/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

/* ---------- design tokens ---------- */
:root {
  --bg: #F6F7F8;
  --surface: #FFFFFF;
  --text: #1A2238;
  --text-muted: #6B7280;
  --border: #E5E7EB;
  --border-strong: #D1D5DB;

  --accent: #1F4F4A;          /* тёмно-изумрудный */
  --accent-600: #173F3A;
  --accent-100: #DDEEEB;

  --green: #10B981;
  --green-soft: #DCFCE7;
  --amber: #F59E0B;
  --amber-soft: #FEF3C7;
  --red: #EF4444;
  --red-soft: #FEE2E2;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 16px rgba(16, 24, 40, 0.04);
}

html, body { background: var(--bg); color: var(--text); font-family: -apple-system, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
body { margin: 0; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-600); }

/* ---------- layout: sidebar + main ---------- */
.app-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

.burger {
  display: none; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; font-size: 20px; color: var(--text);
}
.burger:hover { background: #F3F4F6; }
.sidebar-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4);
  z-index: 99; opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
.sidebar-backdrop.is-open { opacity: 1; pointer-events: auto; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 20px 14px;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px 18px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  color: var(--text);
}
.sidebar a.brand:hover { color: var(--text); }
.sidebar .brand .logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; letter-spacing: 0.5px;
}
.sidebar .brand .name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.sidebar .brand .sub  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.sidebar nav ul { list-style: none; padding: 0; margin: 0; }
.sidebar nav li { margin-bottom: 4px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: #4B5563; font-size: 14px; font-weight: 500;
  transition: background .15s ease, color .15s ease;
}
.sidebar nav a:hover { background: #F1F3F5; color: var(--text); }
.sidebar nav a.active { background: var(--accent); color: #fff; }
.sidebar nav a.active:hover { background: var(--accent-600); color: #fff; }
.sidebar nav a .icon { width: 18px; height: 18px; display: inline-block; flex-shrink: 0; }

.sidebar .support {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted);
  display: flex; gap: 10px; align-items: flex-start;
}
.sidebar .support .ico { font-size: 16px; }

/* ---------- main column ---------- */
.main-col { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex; align-items: center; gap: 18px;
  position: sticky; top: 0; z-index: 5;
}
.topbar .chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px;
}
.topbar .chip + .chip { border-left: 1px solid var(--border); }
.topbar .chip .ico {
  width: 28px; height: 28px; border-radius: 50%;
  background: #F1F3F5; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.topbar .chip .label { font-size: 12px; color: var(--text-muted); line-height: 1.1; }
.topbar .chip .value { font-weight: 600; font-size: 14px; line-height: 1.2; }

.topbar .spacer { flex: 1; }
.topbar .topbar-link {
  display: flex; align-items: center; gap: 6px;
  color: var(--accent); font-weight: 500; font-size: 14px;
  padding: 8px 12px; border-radius: var(--radius-sm);
}
.topbar .topbar-link:hover { background: var(--accent-100); color: var(--accent-600); }

.content { padding: 28px 32px 56px 32px; flex: 1; width: 100%; max-width: 1480px; }

.breadcrumbs { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs .sep { margin: 0 6px; color: var(--border-strong); }
.breadcrumbs .current { color: var(--text); }

h1.page-title, .page-title { font-size: 28px; font-weight: 700; margin: 0 0 6px 0; letter-spacing: -0.01em; }
.page-subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 28px; }

/* ---------- card ---------- */
.card-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 28px;
  margin-bottom: 20px;
}
.card-panel + .card-panel { margin-top: 0; }
.card-panel h3 { font-size: 18px; font-weight: 600; margin: 0 0 16px 0; }
.card-panel .muted { color: var(--text-muted); font-size: 13px; }
/* Карточка для чтения из полей формы (компания у СУ, сотрудник, «Моя
   компания»): у формы расстояние даёт её сетка, у карточки сетки нет — подписи
   липли к значениям, кнопки к плашке (владелец 25.09.2026: «всё склеенное»).
   Только div-карточки: у форм-карточек поиска поля стоят в ряд. */
div.card-panel > .field + *,
div.card-panel > form.field + * { margin-top: 18px; }
div.card-panel > h2 + .field { margin-top: 12px; }

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.section-head h2,
.section-head h3 { margin: 0; }

.scoring-form-wide { width: 100%; max-width: 1080px; }
.scoring-form-wide .note { max-width: none; }
.profile-form-wide { width: 100%; max-width: 1080px; }
.scoring-form-compact .card-panel { padding: 22px 28px; margin-bottom: 14px; }
.scoring-form-compact .field-grid { gap: 14px 24px; }
.scoring-form-compact h2 { font-size: 24px; margin-bottom: 18px; }
.scoring-form-compact .form-actions { margin-top: 10px; }

/* ---------- form fields ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 600; color: var(--text); }
.field .hint { font-size: 12px; color: var(--text-muted); }
.field .hint.warn { color: var(--amber); font-weight: 500; }
.field input,
.field select,
.field textarea {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
  font-family: inherit;
}
.field input::placeholder,
.field select::placeholder { color: #9CA3AF; }
.field input:focus,
.field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-100); }
/* Списки — одного вида с полями ввода в любом браузере. Без appearance:none
   Safari рисует <select> системным (мелким, со своей стрелкой) и не видит
   наших отступов — «половина слева убого выглядит» (владелец 24.09.2026). */
.field select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  height: 43px; box-sizing: border-box; padding-right: 36px; line-height: 1.2;
  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='%236B7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 12px 8px;
  cursor: pointer;
}
.field select[multiple] { height: auto; background-image: none; padding-right: 14px; }
.field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]) { box-sizing: border-box; }
.field input[disabled] { background: #F3F4F6; color: var(--text-muted); }

.field textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
.field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-100); }
.field textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.field .hint.error { color: var(--red); font-weight: 500; }

/* ---------- выбор варианта ----------
   Один вид на все формы кабинета (владелец 23.09.2026: «все формы в срм
   должны быть в одном стиле проекта»). До этого каждый экран рисовал
   переключатели своими встроенными стилями, и они разъехались. Вариант —
   карточка: заголовок и пояснение, выбранная подсвечена. */
.choice-list { display: flex; flex-direction: column; gap: 10px; }
.choice-list.row { flex-direction: row; flex-wrap: wrap; }
.choice-list.row .choice { flex: 1 1 220px; }
.choice {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
.choice:hover { border-color: var(--border-strong); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-100); }
.choice input[type="radio"], .choice input[type="checkbox"] {
  accent-color: var(--accent); width: 18px; height: 18px; margin: 1px 0 0; flex: none; cursor: pointer;
}
.choice__body { display: flex; flex-direction: column; gap: 2px; }
.field .choice__title, .choice__title { font-size: 14px; font-weight: 600; color: var(--text); }
.choice__hint { font-size: 12px; color: var(--text-muted); font-weight: 400; }

/* Вариант с подтверждением: переключатель и галочка «да» одной карточкой —
   там, где выбор меняет, уйдёт ли письмо клиенту. */
.choice-box {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface);
}
.choice-box:has(input[type="radio"]:checked) { border-color: var(--accent); background: var(--accent-100); }
.choice-box.is-disabled { opacity: .55; }
.choice-box__main, .choice-box__confirm { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.field .choice-box__main, .field .choice-box__confirm { font-weight: 400; }
.choice-box__confirm { padding-left: 30px; font-size: 13px; }
.choice-box input[type="radio"], .choice-box input[type="checkbox"] {
  accent-color: var(--accent); width: 18px; height: 18px; margin: 1px 0 0; flex: none; cursor: pointer;
}
.choice-box.is-disabled .choice-box__main { cursor: default; }

/* Узкая колонка формы: подтверждения и короткие формы не растягиваются на
   весь экран — вместо встроенного max-width на каждом экране. */
.form-narrow { max-width: 760px; }
.form-stack { display: flex; flex-direction: column; gap: 18px; }

.field-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 24px; }
@media (max-width: 760px) { .field-grid { grid-template-columns: 1fr; } }

.bankruptcy-check {
  margin-top: 14px;
}

.bankruptcy-check__label {
  align-items: center;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.bankruptcy-check__label input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
  height: 18px;
  margin: 0;
  width: 18px;
}

.status-result-stack { display: flex; flex-direction: column; gap: 2px; }
.status-inline {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.status-inline .status-main { min-width: 120px; }
.status-inline .facts {
  flex: 1;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 22px;
}
.status-inline .hint { margin: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px solid transparent; border-radius: var(--radius-sm);
  padding: 11px 20px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .15s ease, border-color .15s ease, color .15s ease;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-600); color: #fff; }
.btn-primary[disabled],
.btn-primary.is-disabled { background: #B6C2C0; cursor: not-allowed; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: #F3F4F6; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #DC2626; color: #fff; }
/* Зелёная — «смотреть всегда» рядом с красной «больше не смотреть»
   (владелец 25.09.2026). Тёмнее --green: белый текст обязан читаться. */
.btn-success { background: #15803D; color: #fff; }
.btn-success:hover { background: #166534; color: #fff; }
/* У .btn свой display — без этого атрибут hidden кнопку не прятал. */
.btn[hidden] { display: none; }
/* Окно «точно ли?» отметки дел пачкой: вид — общего окна подтверждения, кого
   отмечают — списком, с прокруткой на длинной пачке. */
.kad-mark-dialog .field { margin-top: 12px; }
.kad-mark-dialog .form-actions { justify-content: flex-end; }
.kad-mark-people { margin: 8px 0 12px; padding-left: 18px; max-height: 220px; overflow-y: auto; line-height: 1.6; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* ---------- status & risk badges ---------- */
/* Листание номерами. Владелец 18.09.2026: «сделай чтоб там были просто
   цифры 1 2 3 4 и тп сколько есть страниц». Стрелки отвечали только на
   «шаг вперёд-назад», а на «покажи пятую» — нет. */
.pager {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 14px;
}
.pager-page {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 8px;
  border: 1px solid var(--border); border-radius: 999px;
  font-size: 14px; font-weight: 600; color: var(--text);
  background: #fff;
}
a.pager-page:hover { border-color: var(--accent); color: var(--accent); }
.pager-page.is-current {
  background: var(--accent); border-color: var(--accent); color: #fff;
  cursor: default;
}
.pager-gap { color: var(--text-muted); padding: 0 2px; }
.pager-total { color: var(--text-muted); font-size: 13px; margin-left: 6px; }

.status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
}
.status-badge.ok { background: var(--green-soft); color: #065F46; }
.status-badge.pending { background: #F3F4F6; color: var(--text-muted); }
.status-badge.progress { background: #DBEAFE; color: #1E40AF; }
.status-badge.failed { background: var(--red-soft); color: #991B1B; }
.status-badge.warn { background: var(--amber-soft); color: #92400E; }

.bankruptcy-badge,
.risk-pill {
  white-space: nowrap;
}
.bankruptcy-badge {
  padding-inline: 10px;
  font-size: 12px;
}
.bankruptcy-badge--active {
  background: var(--red-soft);
  color: #991B1B;
}
.bankruptcy-badge--completed {
  background: var(--amber-soft);
  color: #92400E;
}
.bankruptcy-badge--none {
  background: var(--green-soft);
  color: #065F46;
}
.bankruptcy-badge--unknown {
  background: #F3F4F6;
  color: var(--text-muted);
}
.risk-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
}
.risk-pill--low {
  background: var(--green-soft);
  color: #065F46;
}
.risk-pill--medium {
  background: var(--amber-soft);
  color: #92400E;
}
.risk-pill--high {
  background: var(--red-soft);
  color: #991B1B;
}
.risk-pill--unavailable {
  background: #EDEDED;
  color: var(--text-muted);
}
/* Плашка-итог словами («Оставлен под наблюдением: заявление судом не
   принято»): длинная, и в строку ячейки не влезает. Без переноса она
   вылезала поверх соседних столбцов (владелец 24.09.2026, список банкротств).
   Короткие уровни («90 Средний») остаются в одну строку. */
.risk-pill--text {
  white-space: normal;
  max-width: 100%;
  text-align: center;
  overflow-wrap: anywhere;
}

/* Строка риска: «90 дней — Средний». Плашка та же, что на дашборде и в
   карточке разовой проверки: один и тот же риск обязан выглядеть одинаково
   на всех экранах (владелец 22.09.2026: «сделай как в дашборде»). */
.risk-lines { display: flex; flex-direction: column; gap: 4px; }
.risk-line {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; line-height: 1.2;
}
.risk-line-horizon { color: var(--text-muted); min-width: 64px; }
.risk-line-changed {
  color: #92400E; background: var(--amber-soft);
  padding: 1px 6px; border-radius: 999px; font-size: 11px; font-weight: 600;
}

.scope-test {
  background: var(--amber-soft); color: #92400E;
  padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600;
  margin-left: 6px;
}

.risk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .risk-grid { grid-template-columns: 1fr; } }
.risk-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 6px;
  border-radius: var(--radius);
  padding: 20px 22px;
  position: relative;
}
.risk-card .horizon { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-muted); margin-bottom: 14px; }
.risk-card .horizon::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: currentColor; opacity: .9; }
.risk-card .level { font-size: 22px; font-weight: 700; }
.risk-unavailable-message {
  padding: 18px 20px;
  border: 1px solid #fecaca;
  border-left: 6px solid #dc2626;
  background: #fef2f2;
  color: #991b1b;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;
}

.risk-low    { border-left-color: var(--green); }
.risk-low    .horizon { color: var(--green); }
.risk-medium { border-left-color: var(--amber); }
.risk-medium .horizon { color: var(--amber); }
.risk-high   { border-left-color: var(--red); }
.risk-high   .horizon { color: var(--red); }
.risk-unavailable { border-left-color: #94A3B8; }
.risk-unavailable .horizon { color: #64748B; }

.section-kicker {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.bankruptcy-summary {
  background: #F9FAFB;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 18px;
  padding: 18px;
}

/* Итог карточки банкротства — в цвете исхода, когда у решения нет цвета
   отчёта (цвет отчёта приходит прямо в style). */
.bankruptcy-summary--low { background: var(--green-soft); border-color: var(--green-soft); color: #065F46; }
.bankruptcy-summary--medium { background: var(--amber-soft); border-color: var(--amber-soft); color: #92400E; }
.bankruptcy-summary--high { background: var(--red-soft); border-color: var(--red-soft); color: #991B1B; }

.bankruptcy-summary__head {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.bankruptcy-summary__head h3 {
  margin: 0;
}

.bankruptcy-summary__text {
  color: var(--text);
  line-height: 1.45;
  margin-top: 12px;
  max-width: 820px;
}

.bankruptcy-episodes {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 14px;
}

.bankruptcy-episode {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid #94A3B8;
  border-radius: 8px;
  padding: 12px 14px;
}

.bankruptcy-episode--active {
  border-left-color: var(--red);
}

.bankruptcy-episode--completed {
  border-left-color: var(--green);
}

.bankruptcy-episode__state {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.bankruptcy-episode__dates {
  align-items: center;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
}

.date-separator {
  color: var(--text-muted);
}

/* ---------- info banner ---------- */
/* Плашка — обычный блок текста. Флекс — только у плашки со значком: иначе
   текст и <strong> внутри становятся отдельными колонками («Каждый в этом
   списке | равен вам по правам | : компании…» — владелец 01.10.2026). */
.note {
  display: block;
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: #F3F4F6; color: var(--text);
  font-size: 13px; line-height: 1.5;
}
.note.info { background: var(--accent-100); }
.note.warn { background: var(--amber-soft); color: #78350F; }
.note.danger { background: var(--red-soft); color: #7F1D1D; }
.note:has(> .ico) { display: flex; gap: 12px; align-items: flex-start; }
.note .ico { font-size: 18px; line-height: 1; margin-top: 1px; }

/* ---------- разбор неудач ----------
   Владелец 29.09.2026: «выглядит неопрятно… непонятно, что послужило
   падением задачи». Причина — крупно и первой; сервисы в фильтре —
   переключателями, а не выпадающим списком. */
.source-toggles { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.source-toggle { position: relative; cursor: pointer; }
.source-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.source-toggle span {
  display: inline-block; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface);
  font-size: 13px; color: var(--text-muted);
}
.source-toggle input:checked + span { background: var(--accent-100); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.source-toggle input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.source-tag {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: #F3F4F6; color: var(--text); font-size: 12px; white-space: nowrap;
}
.source-tag.source-kad_monitoring { background: var(--accent-100); color: var(--accent-600); }
.source-tag.source-bp_monitoring,
.source-tag.source-single_score { background: #DBEAFE; color: #1E40AF; }
.source-tag.source-email { background: var(--amber-soft); color: #92400E; }
.failures-table .nowrap { white-space: nowrap; }
.failure-reason { font-weight: 500; }
.failure-cause { margin-bottom: 20px; font-size: 14px; }
.failure-cause-label { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; opacity: .75; margin-bottom: 4px; }
.failure-cause-text { font-size: 18px; font-weight: 600; margin-bottom: 6px; line-height: 1.35; }
.failure-cause-raw { margin-top: 8px; font-size: 12px; opacity: .8; overflow-wrap: anywhere; }
.failure-id { font-size: 13px; font-weight: 400; overflow-wrap: anywhere; }
.failure-raw summary { cursor: pointer; font-weight: 600; }
.failure-raw pre { white-space: pre-wrap; word-break: break-word; margin: 12px 0 0; font-size: 12px; }
.failure-cause .mono, .facts .mono, .failure-raw .mono { font-family: "SF Mono", "JetBrains Mono", Menlo, monospace; }

.stats-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 18px 0 10px;
}
.stat-pill {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #FAFBFC;
  padding: 12px 14px;
}
.stat-pill .label { color: var(--text-muted); font-size: 12px; margin-bottom: 4px; }
.stat-pill .value { color: var(--text); font-size: 20px; font-weight: 700; line-height: 1; }
/* Строка «источник — сколько» под сводкой (Запросы API, владелец 01.10.2026). */
.sources-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }

/* Сводка прокси по службам (владелец 25.09.2026: «убого»). */
.proxy-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin-bottom: 20px; }
.proxy-cards .card-panel + .card-panel { margin-top: 0; }
.proxy-card .section-head { margin-bottom: 14px; flex-wrap: nowrap; align-items: flex-start; min-height: 44px; }
.proxy-card .section-head h3 { font-size: 17px; }
.proxy-card .section-head .status-badge { flex-shrink: 0; }
.proxy-card.is-down { border-left: 4px solid var(--red); }
.proxy-card.is-warn { border-left: 4px solid var(--amber); }
.proxy-ready { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.proxy-ready-num { font-size: 36px; font-weight: 700; line-height: 1; color: var(--text); }
.proxy-card.is-warn .proxy-ready-num { color: var(--red); }
.proxy-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.proxy-stats .stat-pill { padding: 10px 12px; }
.proxy-stats .stat-pill .value { font-size: 18px; }
.proxy-outage { margin-top: 12px; }
.proxy-down { margin: 0 0 6px; }

.table-card { padding: 0; overflow: hidden; }
/* Адреса прокси (владелец 25.09.2026: «клеенные, дата плохо, всё съехало»). */
.proxy-table td { vertical-align: middle; }
table.proto-table.proxy-table th, table.proto-table.proxy-table td { padding-left: 10px; padding-right: 10px; }
.proxy-table .proxy-addr, .proxy-table .proxy-when, .proxy-table .proxy-actions { white-space: nowrap; }
.proxy-table .proxy-addr { font-size: 12px; }
.proxy-table .proxy-note { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); font-size: 12px; }
.proxy-table .proxy-actions { text-align: right; }
.proxy-table .proxy-actions .btn + .btn { margin-left: 6px; }
.table-card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 20px 22px; border-bottom: 1px solid var(--border);
}
.table-card-header h3 { margin: 0; }
.ids-summary-header {
  padding-bottom: 16px;
}
.ids-summary-title {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.ids-summary-counter {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #FAFBFC;
  border: 1px solid var(--border);
}
.ids-summary-counter .label {
  color: var(--text-muted);
  font-size: 12px;
}
.ids-summary-counter .value {
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}
.ids-summary-reasons {
  padding: 0 22px 14px;
}
.ids-summary-reasons .hint {
  margin-bottom: 6px;
}
.ids-summary-reasons ul {
  margin: 0;
  padding-left: 18px;
}
@media (max-width: 760px) {
  .ids-summary-header {
    padding-bottom: 14px;
  }
  .ids-summary-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-row-link { cursor: pointer; }
.cell-main { font-weight: 700; color: var(--text); }
.cell-sub { margin-top: 3px; color: var(--text-muted); font-size: 12px; }

/* ---------- definition list / facts ---------- */
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 24px; }
@media (max-width: 760px) { .facts { grid-template-columns: 1fr; } }
.facts .fact .label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; text-transform: none; letter-spacing: 0; }
.facts .fact .value { font-size: 15px; font-weight: 500; }
.facts.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.facts.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .facts.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .facts.four { grid-template-columns: 1fr; } }
.facts .fact .value { overflow-wrap: anywhere; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 760px) { .facts.compact { grid-template-columns: 1fr; } }

/* ---------- table ---------- */
table.proto-table { width: 100%; border-collapse: separate; border-spacing: 0; }
table.proto-table thead th {
  background: #F9FAFB; color: var(--text-muted);
  text-align: left; font-weight: 600; font-size: 12px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: 0.03em;
}
table.proto-table tbody td { padding: 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
table.proto-table tbody tr:hover { background: #FAFBFC; cursor: pointer; }
table.proto-table tbody tr:last-child td { border-bottom: none; }
.proto-table .mono { font-family: "SF Mono", "JetBrains Mono", Menlo, monospace; font-size: 13px; }
.proto-table .bankruptcy-col { width: 132px; }
.proto-table .risk-col { width: 82px; text-align: center; }

/* Таблица мониторинга: человек слева, всё остальное по центру, и ЗАГОЛОВОК
   выровнен так же, как его клетки. Стоит ПОСЛЕ базовых правил таблицы —
   раньше блок лежал выше и проигрывал им по порядку: клетки съезжали в
   центр, а шапка оставалась слева (владелец 22.09.2026: «оглавление криво
   стоит по отношению к тексту»). */
table.proto-table.table-center thead th,
table.proto-table.table-center tbody td { text-align: center; vertical-align: middle; }
table.proto-table.table-center thead th:first-child,
table.proto-table.table-center tbody td:first-child { text-align: left; }
.table-center .risk-lines { align-items: center; }
.table-center .risk-line { justify-content: center; }

/* Имя и подпись под ним не рвутся посреди отчества: строка таблицы от этого
   прыгает то на две, то на три высоты. Колонка получает свою ширину, а не
   делит её поровну со всеми (владелец 22.09.2026: «почему некоторые в одной
   строке, некоторые на двух»). */
.table-center .cell-person { min-width: 260px; white-space: nowrap; }
.table-center .cell-person .cell-sub { white-space: nowrap; }
/* Список мониторинга рисков и отчёт изнутри: столбцы переносятся, чтобы
   «Результат» помещался на экране 1280 (замер 23.09.2026: таблица была
   1430 px при 954 доступных — результат уезжал за край). */
.mon-table .cell-person { min-width: 0; max-width: 220px; white-space: normal; }
/* Как в списке банкротств (владелец 25.09.2026): ФИО — по центру, как все
   столбцы, а не прижатым влево жирным. */
table.proto-table.table-center.mon-table thead th:first-child,
table.proto-table.table-center.mon-table tbody td.cell-person { text-align: center; }
.mon-table .cell-schedule { max-width: 120px; }
.mon-table .status-badge { white-space: nowrap; }
.mon-table td, .mon-table th { padding-left: 8px; padding-right: 8px; }
.mon-table .risk-lines .risk-pill { white-space: normal; max-width: 180px; text-align: center; }
/* Отчёт по банкротствам изнутри: слова суда длинные — переносятся. */
.kad-report-table { table-layout: fixed; width: 100%; }
.kad-report-table td { font-size: 12px; vertical-align: top; word-break: break-word; }
.kad-report-table th:nth-child(1) { width: 15%; }
.kad-report-table th:nth-child(2) { width: 12%; }
.kad-report-table th:nth-child(3) { width: 14%; }
.kad-report-table th:nth-child(4) { width: 19%; }
.kad-report-table th:nth-child(5) { width: 14%; }
.kad-report-table th:nth-child(6) { width: 12%; }
.kad-report-table th:nth-child(7) { width: 14%; }
.kad-report-table .risk-pill { min-width: 0; word-break: normal; overflow-wrap: normal; hyphens: auto; }
.table-center .cell-nowrap { white-space: nowrap; }

/* Колонка, которой отдаётся вся слабина ширины: без неё лишнее место
   уходит в последнюю колонку, и кнопки висят посреди пустоты (владелец
   22.09.2026: «для чего в таблице справа столько свободного места?»). */
.proto-table .col-stretch { width: 100%; }
.proto-table .col-actions { white-space: nowrap; text-align: right; }
.proto-table .col-actions > .row-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* Список банкротств: столбцов девять, и каждый занятый лишним местом
   выталкивает за правый край соседей — на стенде 22.09.2026 за край ушли
   «следующая проверка» и обе кнопки. Поэтому здесь ФИО переносится, кнопки
   стоят друг под другом, а формулировка суда (бывает абзацем) обрезана —
   полную отдают подсказка браузера и карточка человека. */
.proto-table .cell-stage { max-width: 170px; }
table.proto-table.kad-table thead th,
table.proto-table.kad-table tbody td { padding-left: 7px; padding-right: 7px; }
.kad-table .cell-person { min-width: 0; white-space: normal; }
.kad-table .col-actions > .row-actions { flex-direction: column; align-items: stretch; gap: 6px; }
/* «Что с человеком» — плашка и фраза решения; без предела фраза тянула
   столбец на четверть таблицы и выталкивала действия за край. */
.kad-table .cell-outcome { max-width: 180px; }

/* Роли-выключатели: чекбоксы в ряд выглядели рассыпанными галочками
   (владелец 22.09.2026: «чекбоксы плохо выглядят»). Теперь это плашки —
   видно, что выбрано, и нажимать удобно всей подписью. */
.role-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.role-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border: 1.5px solid var(--border); border-radius: 999px;
  font-size: 13px; font-weight: 500; cursor: pointer; background: var(--surface);
  user-select: none;
}
.role-chip:hover { border-color: var(--accent); }
.role-chip input { margin: 0; accent-color: var(--accent); }
/* Плашка живёт внутри `.field`, и общие правила поля её раздували: галочка
   получала рамку и отступы поля ввода, подпись — вид заголовка поля. Итог —
   плашки выше соседних полей (владелец 24.09.2026: «роли больше других полей
   — не красиво»). Высота — как у полей и кнопки строки поиска: 43 px. */
.field .role-chip {
  height: 43px; box-sizing: border-box; padding: 0 14px;
  font-size: 13px; font-weight: 500; color: var(--text);
}
.field .role-chip input[type="checkbox"] {
  width: 16px; height: 16px; padding: 0; border: none; border-radius: 0;
  box-shadow: none; background: none; flex: none;
}
.role-chip:has(input:checked) {
  border-color: var(--accent); background: var(--accent-100); color: var(--accent-600);
}

/* Карточка клиента: имя крупно, под ним дата рождения и ИНН. Имя на экране
   ОДНО (в крошках не в счёт): владелец 22.09.2026 — «ты 3 раза вставил имя
   клиента, не нужно». Действия стоят в той же карточке справа, чтобы над ней
   не висела пустая полоса. */
.client-card { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.client-card__name { font-size: 24px; font-weight: 700; line-height: 1.2; }
.client-card__meta { margin-top: 6px; color: var(--text-muted); font-size: 14px; }
.client-card__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.employee-filters {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 170px minmax(260px, auto) auto;
  gap: 14px;
  align-items: end;
}
@media (max-width: 1100px) {
  .employee-filters { grid-template-columns: 1fr 180px; }
}
@media (max-width: 760px) {
  .employee-filters { grid-template-columns: 1fr; }
}

/* Строка поиска мониторинга. Не `employee-filters`: там жёсткий грид на
   четыре колонки, и пятый ребёнок (кнопка) уезжал на вторую строку под
   первое поле, а «Статус» оставался болтаться справа (владелец 22.09.2026:
   «почему статус так убого?»). Здесь всё в одну линию и по нижнему краю. */
.search-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.search-row .field { margin: 0; flex: 1 1 180px; min-width: 150px; }
.search-row .field-wide { flex: 2 1 260px; }
.search-row .field-narrow { flex: 0 1 190px; }
/* Список с длинными подписями («Оставлен под наблюдением: …»). */
.search-row .field-mid { flex: 1 1 300px; max-width: 420px; }
/* Поле с плашками ролей не сжимаем до полоски: подписи длинные. */
.search-row .field-chips { flex: 2 1 340px; }
.search-row .field-chips .role-chips { padding-top: 0; }
.search-row .btn { flex: 0 0 auto; height: 43px; }
/* Поля и кнопка — одной высоты: у `select` своя рамка и свой внутренний
   отступ, и без выравнивания он на два пиксела выше соседей. */
.search-row .field input,
.search-row .field select { height: 43px; box-sizing: border-box; }

/* Выбор компании — одной строкой, а не карточкой в пол-экрана: в ней жили
   подпись, список и кнопка тремя этажами, и на экране это выглядело пусто. */
.company-pick { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.company-pick .field { margin: 0; flex: 0 1 320px; }
.company-pick .btn { flex: 0 0 auto; }

/* ---------- двухколоночный грид карточек (responsive) ---------- */
.cards-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 767px) { .cards-grid-2 { grid-template-columns: 1fr; gap: 14px; } }

/* ---------- грид фильтров (history, etc.) — адаптивный 4→2→1 ---------- */
.filter-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 1023px) { .filter-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px)  { .filter-grid { grid-template-columns: 1fr; } }

.history-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 16px;
  align-items: end;
}
@media (max-width: 1100px) {
  .history-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .history-filter-grid { grid-template-columns: 1fr; }
}

/* ---------- KPI row ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
@media (max-width: 900px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px;
}
.kpi .label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.kpi .value { font-size: 24px; font-weight: 700; line-height: 1.1; }
.kpi.green .value { color: #065F46; }
.kpi.red   .value { color: #991B1B; }
.kpi.blue  .value { color: #1E40AF; }

/* ---------- forms layout helpers ---------- */
.form-actions {
  display: flex; gap: 12px; justify-content: flex-end;
  padding-top: 20px; border-top: 1px solid var(--border); margin-top: 24px;
}

/* ---------- role switcher (dev-tool, маленький в углу шапки) ---------- */
.role-switcher { position: relative; }
.role-switcher summary {
  cursor: pointer; list-style: none;
  font-size: 12px; color: var(--text-muted);
  padding: 4px 10px; border: 1px dashed var(--border-strong); border-radius: 6px;
}
.role-switcher summary::-webkit-details-marker { display: none; }
.role-switcher[open] summary { color: var(--accent); border-color: var(--accent); }
.role-switcher .switcher-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); padding: 6px; width: 280px;
}
.role-switcher .switcher-menu a {
  display: block; padding: 8px 10px; border-radius: 6px;
  font-size: 13px; color: var(--text);
}
.role-switcher .switcher-menu a:hover { background: #F3F4F6; }
.role-switcher .switcher-menu a.active { background: var(--accent-100); color: var(--accent-600); }
.role-switcher .switcher-menu a small { color: var(--text-muted); display: block; }

/* ---------- flash messages ---------- */
.flash-stack { margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; }
.flash.success { background: var(--green-soft); color: #065F46; }
.flash.warning { background: var(--amber-soft); color: #78350F; }
.flash.info    { background: var(--accent-100); color: var(--accent-600); }
.flash.error   { background: var(--red-soft); color: #7F1D1D; }

/* ============================================================
   Адаптивность: tablet (768–1023px) и mobile (<768px)
   ============================================================ */

/* --- Tablet --- */
@media (max-width: 1023px) {
  .app-shell { grid-template-columns: 220px 1fr; }
  .sidebar { padding: 16px 10px; }
  .sidebar .brand .name { font-size: 14px; }
  .sidebar nav a { padding: 9px 10px; font-size: 13px; }
  .topbar { padding: 12px 16px; gap: 10px; min-height: 56px; }
  /* На планшете скрываем chip «Имя» и «Роль» — оставляем только «Компания» (она информативнее
     всего и помещается); полные данные пользователя всё равно есть в sidebar и role-switcher */
  .topbar .chip:nth-of-type(1),
  .topbar .chip:nth-of-type(2) { display: none; }
  .topbar .chip .value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
  .topbar .role-switcher summary { font-size: 11px; padding: 3px 8px; }
  .topbar .topbar-link { padding: 6px 10px; font-size: 13px; }
  .content { padding: 20px 22px 40px 22px; }
  h1.page-title, .page-title { font-size: 24px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .field-grid { gap: 14px 18px; }
  .form-actions { flex-wrap: wrap; }
}

/* Универсально: ФИО в chip-е не должно разваливаться на 3 строки даже при сжатии */
.topbar .chip .label,
.topbar .chip .value {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

/* --- Mobile: sidebar превращается в off-canvas --- */
@media (max-width: 767px) {
  .app-shell { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 280px; height: 100vh; z-index: 100;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 0 0 24px rgba(15, 23, 42, .18);
    padding: 16px 14px;
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar .brand .name { font-size: 15px; }
  .sidebar nav a { padding: 11px 12px; font-size: 14px; }

  .burger { display: inline-flex; }

  .topbar {
    padding: 10px 14px; gap: 10px;
    flex-wrap: nowrap;
  }
  /* На мобильном скрываем все три chip'а: «Имя/Роль/Компания» — место экономим */
  .topbar .chip { display: none; }
  .topbar .role-switcher { display: none; }
  .topbar .topbar-link { padding: 6px 8px; font-size: 12px; }
  .topbar .topbar-link span:nth-of-type(2) { display: none; }   /* только иконка */

  /* На мобильном показываем «мини-шапку» — имя пользователя одной строкой */
  .topbar-mobile-user {
    display: inline-flex; flex-direction: column; line-height: 1.15;
    font-size: 12px; color: var(--text-muted); margin-left: 4px;
  }
  .topbar-mobile-user strong { font-size: 13px; color: var(--text); }

  .content { padding: 16px; }

  h1.page-title, .page-title { font-size: 20px; letter-spacing: 0; }
  .page-subtitle { font-size: 13px; margin-bottom: 18px; }

  .card-panel { padding: 18px; margin-bottom: 16px; border-radius: 10px; }
  .card-panel h3 { font-size: 16px; }

  .kpi-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi .value { font-size: 20px; }

  .risk-grid { grid-template-columns: 1fr; gap: 12px; }
  .risk-card .level { font-size: 19px; }

  .facts { grid-template-columns: 1fr; gap: 10px; }
  .field-grid { grid-template-columns: 1fr; gap: 14px; }

  .form-actions {
    flex-wrap: wrap; gap: 8px;
    padding-top: 14px; margin-top: 18px;
  }
  .form-actions .btn { flex: 1; min-width: 120px; }

  .btn { padding: 10px 14px; font-size: 13px; }
  .btn-sm { padding: 6px 10px; font-size: 12px; }

  /* На мобильном элементы внутри row с justify-content:space-between могут перенестись */
  .content > div[style*="justify-content:space-between"],
  .content > div[style*="justify-content: space-between"] {
    flex-wrap: wrap; gap: 12px;
  }
}

/* --- Таблицы: горизонтальный скролл при нехватке ширины --- */
/* :has() поддержан современными браузерами (Safari 15.4+, Chrome 105+, Firefox 121+) */
@media (max-width: 1023px) {
  .card-panel:has(table.proto-table) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table.proto-table { min-width: 760px; }
  table.proto-table tbody td { padding: 12px 10px; font-size: 13px; }
  table.proto-table thead th { padding: 10px; font-size: 11px; }
}
@media (max-width: 767px) {
  table.proto-table { min-width: 680px; }
}

/* --- Role switcher dropdown на мобильном из-за off-canvas мог не помещаться --- */
@media (max-width: 767px) {
  .role-switcher .switcher-menu { width: 240px; right: 0; }
}

/* ---------- личный кабинет ---------- */
/* Шапка профиля: кто ты, какая роль, какая компания — одним взглядом, без
   полей ввода. Раньше это были такие же серые «инпуты», как правимые поля, и
   экран не отвечал на вопрос «что тут вообще можно сделать» (владелец
   18.09.2026: «посмотри, как у похожих сервисов»). */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.profile-avatar {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-100);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .5px;
}
.profile-hero-name { font-size: 20px; font-weight: 700; line-height: 1.2; }
.profile-hero-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 13px;
}
/* Роль — значком, а не строкой: это ярлык, а не значение поля. */
.profile-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-100);
  color: var(--accent-600);
  font-size: 12px;
  font-weight: 600;
}
/* Строка раздела: подпись слева, значение и действие справа. Так устроены
   «настройки аккаунта» почти везде, и глаз читает их столбиком. */
.profile-row {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.profile-row:first-of-type { border-top: none; padding-top: 0; }
.profile-row:last-of-type { padding-bottom: 0; }
.profile-row-label { font-weight: 600; font-size: 14px; }
.profile-row-value { color: var(--text-muted); font-size: 14px; }

/* Профиль — ОДНОЙ карточкой (владелец 22.09.2026: «сделай все в одной рамке,
   сделай как-нибудь по-другому»). Раньше он распадался на четыре рамки с
   заголовками между ними, и короткий экран выглядел длиннее, чем есть.

   Внутри — полосы: шапка, затем разделы, разделённые чертой. Заголовок
   раздела стоит НАД полосой и не заводит новую рамку. */
.profile-card { padding: 0; overflow: hidden; }
.profile-band {
  padding: 20px 22px;
  border-top: 1px solid var(--border);
}
.profile-band:first-child { border-top: none; }
.profile-band-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 14px;
}
.profile-band-hero { background: var(--surface); }

/* Профиль, вариант «В» (владелец 24.09.2026): тонкая серая шапка «кто ты»,
   под ней одна форма сеткой 2×2. Логин и пароль — серыми «полями» той же
   высоты, что правимые: видно, что они есть, и видно, что тут не правятся. */
.profile-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 16px 22px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.profile-avatar--sm { width: 48px; height: 48px; font-size: 17px; }
.field-label { font-size: 14px; font-weight: 600; color: var(--text); }
.field-static {
  box-sizing: border-box;
  min-height: 43px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.field-with-action { display: flex; gap: 8px; align-items: stretch; }
.field-with-action .field-static { flex: 1 1 auto; min-width: 0; }
.field-with-action input { flex: 1 1 auto; min-width: 0; }
/* Выпуск ключа API в карточке компании: название и кнопка — одной строкой. */
.api-key-issue { display: flex; gap: 8px; align-items: stretch; flex: 0 1 460px; margin: 0; }
.api-key-issue .field { flex: 1 1 auto; min-width: 0; }
.api-key-issue .btn { flex: 0 0 auto; white-space: nowrap; }
.api-key-issue .field input { width: 100%; box-sizing: border-box; height: 100%; }
.profile-form-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
/* Проделанная работа под профилем: цифры во всю ширину, ниже действия и
   команда рядом (на узком экране — друг под другом). */
.profile-form-foot__hint { font-size: 13px; color: var(--text-muted); }
.profile-work { margin-top: 16px; }
.profile-work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
  align-items: start;
  margin-top: 16px;
}
.profile-work-grid > .profile-work { margin-top: 0; }
@media (max-width: 480px) {
  .profile-work-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Расписание мониторинга (владелец 24.09.2026): частота — выпадающей панелью
   с днями Пн…Вс, время — два поля «чч : мм». Вид — как у остальных полей:
   та же рамка, высота 43 px и акцент при выборе. */
.schedule { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-start; }
.schedule__days { flex: 0 1 360px; min-width: 260px; }
.schedule__time { flex: 0 0 auto; }
.schedule__hint { flex-basis: 100%; font-size: 12px; color: var(--text-muted); }
.schedule-days { position: relative; }
.schedule-days__summary {
  list-style: none; cursor: pointer; user-select: none;
  height: 43px; box-sizing: border-box; padding: 0 38px 0 14px;
  display: flex; align-items: center;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); font-size: 14px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.schedule-days__summary::-webkit-details-marker { display: none; }
.schedule-days__summary::after {
  content: "▾"; position: absolute; right: 14px; top: 11px; color: var(--text-muted);
}
.schedule-days[open] .schedule-days__summary { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-100); }
.schedule-days__panel {
  position: absolute; z-index: 20; left: 0; top: calc(100% + 6px); width: max(100%, 360px);
  box-sizing: border-box; padding: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(16, 24, 40, .12);
  display: flex; flex-direction: column; gap: 12px;
}
.schedule-days__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.schedule-day {
  display: flex; align-items: center; justify-content: center;
  height: 38px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; user-select: none;
  background: var(--surface);
}
.schedule-day:hover { border-color: var(--border-strong); }
.schedule-day:has(input:checked) { border-color: var(--accent); background: var(--accent-100); color: var(--accent-600); }
.field .schedule-day input[type="checkbox"] {
  position: absolute; opacity: 0; width: 1px; height: 1px; padding: 0; border: 0;
}
.schedule-days__quick { display: flex; gap: 8px; flex-wrap: wrap; }
.schedule-days__month { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; }
.schedule-days__month[hidden] { display: none; }
.field .schedule-days__month input { width: 64px; height: 38px; box-sizing: border-box; text-align: center; padding: 0 8px; }
.schedule-time { display: flex; align-items: center; gap: 6px; }
.field .schedule-time input { width: 64px; height: 43px; box-sizing: border-box; text-align: center; padding: 0 8px; }
.field .schedule-time input.is-invalid { border-color: var(--red); box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }
.schedule-time__sep { font-weight: 700; color: var(--text-muted); }

/* Окно подтверждения (<dialog>) — как карточки кабинета: скругление, тонкая
   рамка, мягкая тень. Своего стиля у него не было, и браузер рисовал
   квадратную чёрную рамку (владелец 24.09.2026: «сделай её закруглённой как
   наши рамки форм»). */
dialog.confirm-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  max-width: min(640px, calc(100vw - 32px));
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 48px rgba(16, 24, 40, .18);
}
dialog.confirm-dialog::backdrop { background: rgba(16, 24, 40, .35); }
dialog.confirm-dialog h3 { margin: 0 0 10px; font-size: 18px; line-height: 1.35; }
dialog.confirm-dialog .confirm-line { color: var(--text-muted); font-size: 14px; margin-top: 4px; }
dialog.confirm-dialog .confirm-warning {
  margin-top: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--red-soft); color: var(--red); font-size: 13px;
}
dialog.confirm-dialog .form-actions { margin-top: 18px; padding-top: 16px; }

/* ---------- ротационные прокси провайдера ----------
   Владелец 29.09.2026: карточка баланса над светофором служб; главное число —
   на сколько суток хватит денег. Столбики — расход по суткам за неделю. */
.provider-card.tone-warn { border-left: 4px solid var(--amber); }
.provider-card.tone-failed { border-left: 4px solid var(--red); }
.provider-card .facts .fact .provider-days { font-size: 22px; font-weight: 700; }
.traffic-bars { display: flex; align-items: flex-end; gap: 8px; height: 72px; margin-top: 18px; }
.traffic-bar { flex: 1 1 0; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; min-width: 0; }
.traffic-bar-fill { background: var(--accent-100); border-top: 2px solid var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.traffic-bar-label { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: 4px; }

/* ---------- отмеченные прокси (владелец 29.09.2026) ---------- */
.proxy-bulk-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.proxy-table .proxy-check { width: 36px; text-align: center; }
.proxy-table .proxy-check input { width: 16px; height: 16px; cursor: pointer; }
.proxy-table .proxy-probe { white-space: nowrap; }
.probe-ok { color: #065F46; }
.probe-bad { color: #991B1B; }
