/* ========================================================================
   МАНТИЯ — стили. Весь внешний вид настраивается переменными ниже.
   Цвета, скругления, шрифт — меняйте здесь, остальной файл трогать не нужно.
   ======================================================================== */

:root {
  /* Фон и текст */
  --bg: #f6f4ee;
  --surface: #ffffff;
  --surface-2: #faf8f3;
  --text: #17203a;
  --muted: #636a7d;
  --line: #e4e0d4;

  /* Главный цвет (кнопки, ссылки) */
  --primary: #25336b;
  --primary-hover: #1a254f;
  --primary-ink: #ffffff;
  --accent: #a9741a; /* латунь: мелкие акценты фирменного стиля */
  --danger: #c43b3b;

  /* Цвета стадий дела */
  --stage-prep: #7b8499;
  --stage-first: #2f5bd6;
  --stage-appeal: #7a4fd1;
  --stage-cassation: #d98a10;
  --stage-enforcement: #1f9d63;
  --stage-closed: #9aa1ae;

  /* Календарь и признаки */
  --c-hearing: #2f5bd6;
  --c-deadline: #d98a10;
  --c-late: #c43b3b;
  --c-ok: #1f9d63;
  --c-step: #7b8499;

  /* Форма */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 24, 36, .06), 0 3px 10px rgba(20, 24, 36, .05);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --column-width: 250px; /* минимальная ширина колонки доски; шире — колонки растягиваются */
}

/* Темы: data-theme="light" | "dark" | "auto" (как в системе) на <html>. Меняется в «Настройках». */
:root { color-scheme: light; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1320;
    --surface: #181e30;
    --surface-2: #141929;
    --text: #e8eaf2;
    --muted: #9aa3b8;
    --line: #272e44;
    --primary: #9db0f2;
    --primary-hover: #bccaf7;
    --primary-ink: #0c1226;
    --accent: #d8a84b;
    --danger: #ef6b6b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 3px 10px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
    --bg: #0f1320;
    --surface: #181e30;
    --surface-2: #141929;
    --text: #e8eaf2;
    --muted: #9aa3b8;
    --line: #272e44;
    --primary: #9db0f2;
    --primary-hover: #bccaf7;
    --primary-ink: #0c1226;
    --accent: #d8a84b;
    --danger: #ef6b6b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 3px 10px rgba(0, 0, 0, .25);
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0; }
p { margin: 0; }
.mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); }

/* ---------- Верхняя панель ---------- */
.topbar {
  display: flex; align-items: center; gap: 24px; padding: 0 24px; height: 56px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-weight: 700; color: var(--text); font-size: 20px; letter-spacing: .01em; }
.brand:hover { text-decoration: none; }
.brand-mark {
  position: relative; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: #25336b; color: #fff; font-family: var(--serif); font-size: 18px; font-weight: 700; line-height: 1; padding-bottom: 3px;
}
.brand-mark::after { content: ""; position: absolute; left: 7px; right: 7px; bottom: 5px; height: 2px; border-radius: 2px; background: #d8a84b; }
.topnav { display: flex; gap: 4px; flex: 1; }
.topnav a { padding: 6px 12px; border-radius: var(--radius-sm); color: var(--muted); font-weight: 500; }
.topnav a:hover { background: var(--surface-2); text-decoration: none; }
.topnav a.active { color: var(--text); background: var(--surface-2); }
.topbar-right { display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 14px; }
.topbar-right form { margin: 0; }
button.link { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; cursor: pointer; }
button.link:hover { text-decoration: underline; }

/* ---------- Страница ---------- */
.page { padding: 24px; max-width: 1800px; margin: 0 auto; }
.messages { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.msg {
  padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface);
  border: 1px solid var(--line); border-left: 4px solid var(--stage-enforcement);
}
.msg-error { border-left-color: var(--danger); }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-danger { color: var(--danger); }

/* ---------- Панель над доской ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 18px; }
.toolbar h1 { margin-right: 8px; }
.toolbar .spacer { flex: 1; }
.segmented { display: inline-flex; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.segmented a { padding: 5px 14px; border-radius: 7px; color: var(--muted); font-weight: 500; }
.segmented a:hover { text-decoration: none; color: var(--text); }
.segmented a.on { background: var(--primary); color: var(--primary-ink); }
.search { display: flex; gap: 6px; }
.search .input { width: 220px; }

/* ---------- Поля ввода ---------- */
.input {
  width: 100%; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit;
}
/* Свой значок-стрелка у выпадающих списков: у системного он прижат к самой рамке */
select.input {
  appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%236b7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 8px;
}
.input:focus { outline: 2px solid color-mix(in srgb, var(--primary) 35%, transparent); border-color: var(--primary); }
textarea.input { resize: vertical; }

/* ---------- Цвета стадий ---------- */
.stage-prep { --c: var(--stage-prep); }
.stage-first { --c: var(--stage-first); }
.stage-appeal { --c: var(--stage-appeal); }
.stage-cassation { --c: var(--stage-cassation); }
.stage-enforcement { --c: var(--stage-enforcement); }
.stage-closed { --c: var(--stage-closed); }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent);
}
.chip {
  display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px;
  color: var(--muted); background: var(--surface-2); border: 1px solid var(--line);
}

/* ---------- Доска по стадиям ---------- */
.board { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding-bottom: 12px; }
.column {
  flex: 1 1 var(--column-width); min-width: var(--column-width); background: color-mix(in srgb, var(--c) 6%, var(--bg));
  border: 1px solid var(--line); border-radius: var(--radius); border-top: 3px solid var(--c);
  display: flex; flex-direction: column;
}
.column-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; }
.column-head h2 { flex: 1; }
.count {
  min-width: 22px; padding: 1px 7px; text-align: center; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
}
.add {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px;
  color: var(--muted); font-size: 18px; line-height: 1;
}
.add:hover { background: var(--surface); text-decoration: none; color: var(--text); }
.column-body { padding: 4px 10px 12px; display: grid; gap: 10px; align-content: start; }
.empty { text-align: center; color: var(--muted); padding: 18px 0; font-size: 13px; }

/* ---------- Карточка дела ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px; box-shadow: var(--shadow); display: grid; gap: 6px; position: relative;
}
.card.overdue { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.card-title { font-weight: 600; color: var(--text); line-height: 1.3; }
.card-title:hover { color: var(--primary); text-decoration: none; }
.card-sub { color: var(--muted); font-size: 13px; }
.card-line { color: var(--muted); font-size: 13px; }
.next { font-size: 13px; padding: 6px 8px; border-radius: 6px; background: var(--surface-2); }
.next-date { display: block; font-weight: 600; margin: 0 0 1px; }  /* дата шага — отдельной строкой над текстом */
.next.late { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); color: var(--danger); }
.card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.card-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.chip { white-space: nowrap; }
.card-actions form { margin: 0; }

/* ---------- Меню «Перенести в…» ---------- */
.menu { position: relative; }
.menu summary {
  list-style: none; cursor: pointer; width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--muted);
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover { background: var(--surface-2); }
.menu-pop {
  position: absolute; right: 0; bottom: 36px; z-index: 10; min-width: 190px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
}
.menu-pop.down { bottom: auto; top: 36px; }
.menu-title { padding: 4px 8px; font-size: 12px; color: var(--muted); }
.menu-pop form { margin: 0; }
.menu-item {
  display: block; width: 100%; text-align: left; padding: 6px 8px; border: 0; border-radius: 6px;
  background: none; color: var(--text); font: inherit; cursor: pointer;
}
.menu-item:hover { background: var(--surface-2); }

/* ---------- Доска по судам ---------- */
.court-group { margin-bottom: 26px; }
.court-group > h2 { display: flex; align-items: center; gap: 8px; font-size: 17px; margin-bottom: 10px; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }

/* ---------- Страница дела: шапка ---------- */
.back { display: inline-block; margin-bottom: 8px; color: var(--muted); font-size: 14px; }
.detail-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 20px; margin: 4px 0 16px; }
.detail-title { flex: 1 1 420px; min-width: 0; }
.detail-head h1 { font-size: 28px; line-height: 1.15; overflow-wrap: anywhere; }
.sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; color: var(--muted); font-size: 14px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent);
}
/* Меню «⋯ Ещё»: пункты-ссылки и заметка, которая раскрывается прямо в меню */
.head-menu .menu-pop { min-width: 240px; }
.menu-pop summary.menu-item, .menu-pop a.menu-item {
  width: 100%; height: auto; display: block; border: 0; border-radius: 6px; padding: 7px 10px; color: var(--text); text-align: left; cursor: pointer;
}
.menu-pop summary.menu-item::-webkit-details-marker { display: none; }
.menu-pop a.menu-item:hover, .menu-pop summary.menu-item:hover { background: var(--surface-2); text-decoration: none; }
.menu-note { padding: 4px 10px 8px; }
.menu-note textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg);
  color: var(--text); font: inherit; font-size: 13.5px; line-height: 1.4; resize: vertical;
}
.menu-note textarea:focus { outline: none; border-color: var(--primary); }
.menu-pop.left { left: 0; right: auto; }

/* Этапы: точки и линия, у текущего — «сейчас» */
.stepper {
  display: flex; list-style: none; margin: 0 0 16px; padding: 14px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.step { flex: 1; position: relative; min-width: 0; padding: 20px 4px 0; text-align: center; font-size: 13px; line-height: 1.25; color: var(--muted); }
.step::after { content: ""; position: absolute; top: 5px; left: 50%; width: 100%; height: 2px; background: var(--c); opacity: .35; }
.step:last-child::after { display: none; }
.step.todo::after { background: var(--line); opacity: 1; }
.step-dot { position: absolute; top: 0; left: calc(50% - 6px); width: 12px; height: 12px; border-radius: 50%; background: var(--c); z-index: 1; }
.step.todo .step-dot { background: var(--line); }
.step.done { color: var(--text); }
.step.current { color: var(--text); font-weight: 700; }
.step.current .step-dot { background: var(--surface); border: 3px solid var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 25%, transparent); }
.step small { display: block; font-size: 11px; font-weight: 600; color: var(--c); }

/* Главное: карточка «Что дальше» и две мини-карточки справа (срок, заседание) */
.case-hero { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; margin-bottom: 18px; }
.next-card {
  min-width: 0; padding: 20px 22px; border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--c) 45%, var(--line)); background: color-mix(in srgb, var(--c) 9%, var(--surface));
}
.next-card.late { --c: var(--danger); }
.next-card .eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--c); }
.next-card h2 { margin: 6px 0 4px; font-size: 22px; line-height: 1.25; overflow-wrap: anywhere; }
.next-card > p { margin: 0 0 14px; color: var(--muted); }
.next-card .watch { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 12px; font-size: 13.5px; line-height: 1.45; color: var(--muted); }
.next-card .watch b { color: var(--text); }
.next-card .watch .pulse { margin-top: 5px; }
.watch-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.watch-actions form { margin: 0; }
.watch-actions { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }  /* кнопки поровну по ширине */
.watch-actions .btn { width: 100%; justify-content: center; text-align: center; box-sizing: border-box; }
.next-card .row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.next-card .row form { margin: 0; }
.pulse {
  display: inline-block; flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--c-ok);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--c-ok) 50%, transparent); animation: pulse 2s infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.side-cards { display: grid; gap: 12px; align-content: start; min-width: 0; }
.mini {
  display: flex; gap: 14px; align-items: center; min-width: 0; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text);
}
a.mini:hover { text-decoration: none; border-color: color-mix(in srgb, var(--c) 45%, var(--line)); }
.mini .ico { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; font-size: 20px; background: color-mix(in srgb, var(--c) 14%, transparent); }
.mini-text { min-width: 0; }
.mini b { display: block; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.mini small { display: block; margin-top: 2px; color: var(--muted); font-size: 12.5px; }
.mini.none { border-style: dashed; color: var(--muted); }
.mini.none b { font-weight: 600; }
.mini.soon, .mini.late { --c: var(--c-late); }
.mini.soon b, .mini.late b { color: var(--c-late); }
.mini-links a { font-weight: 600; }

/* Вкладки: Обзор, Заседания, Документы, Судебные расходы, История */
.tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs .tab {
  margin-bottom: -1px; padding: 10px 14px; border: 0; border-bottom: 3px solid transparent; background: none;
  color: var(--muted); font: inherit; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.tabs .tab:hover { color: var(--text); }
.tabs .tab.on { color: var(--text); border-bottom-color: var(--primary); }
.tabs .tab .count { margin-left: 2px; vertical-align: 1px; }
.tabs-wrap { position: relative; }
.tabs-more { display: none; position: absolute; top: 0; bottom: 0; width: 44px; align-items: center; justify-content: center; padding: 0 0 3px;
  border: 0; background: none; color: var(--primary); font: inherit; font-size: 26px; line-height: 1; font-weight: 600; cursor: pointer; }
.tabs-more.prev { left: 0; }
.tabs-more.next { right: 0; }
.pane { display: none; }
.pane.on { display: block; }
.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.cols > * { min-width: 0; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px; }
.panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.panel-head h2 { flex: 1; font-size: 16px; }
.panel-head .find-instances { margin: 0; }
.facts { display: grid; grid-template-columns: 160px 1fr; gap: 8px 14px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.notes { white-space: pre-wrap; }

/* «О деле», сводка, «Что нового» и история */
.about { display: grid; grid-template-columns: 120px 1fr; gap: 7px 12px; margin: 0; }
.about dt { color: var(--muted); }
.about dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.about-tabs { display: grid; justify-items: start; gap: 8px; margin: 0 0 14px; }
/* Путь дела в «О деле»: инстанции сверху вниз от первой к последней, между ними маленькие стрелки */
.about-chain { list-style: none; margin: 0; padding: 0; display: grid; justify-items: start; }
.about-chain li { display: grid; justify-items: start; }
.about-chain li + li::before { content: "↓"; display: block; margin: 1px 0 1px 13px; color: var(--muted); font-size: 12px; line-height: 14px; }
.chain-btn { display: inline-flex; align-items: center; gap: 8px; padding: 4px 11px 4px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text); cursor: pointer; }
.chain-btn:hover { background: color-mix(in srgb, var(--c, var(--primary)) 8%, var(--surface)); }
.chain-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--primary)); flex: none; }
.chain-btn.on { background: color-mix(in srgb, var(--c, var(--primary)) 14%, var(--surface)); border-color: var(--c, var(--primary)); color: var(--text); }
.chip-btn { padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--muted); }
.chip-btn:hover { background: var(--surface-2); color: var(--text); }
.chip-btn.on { background: var(--c, var(--primary)); border-color: var(--c, var(--primary)); color: #fff; }
.chip-btn[data-about-reset].on { --c: var(--text); }
.about [hidden] { display: none; }
.stage-costs { --c: #0f8b8d; }
.cost-material { margin: 0 0 18px; padding: 0 0 16px; border-bottom: 1px dashed var(--line); }
.cost-material h3 { margin: 0 0 8px; font-size: 14px; color: var(--muted); font-weight: 600; }
.cost-mat-row { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 8px;
  border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: var(--radius-sm); background: var(--surface); }
.costs-hint { margin: 0 0 14px; padding: 10px 12px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px dashed var(--line); font-size: 14px; }
.costs-hint .cost-find { margin-top: 8px; }
.cost-find { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; } .cost-find .input { flex: 1 1 240px; min-width: 0; }
.about-summary { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.about-summary h3 { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.about-summary details summary { cursor: pointer; color: var(--primary); font-size: 13px; margin-top: 8px; }
.about-summary textarea { margin-top: 8px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.timeline li { padding: 6px 0 6px 12px; border-left: 3px solid var(--line); font-size: 14px; overflow-wrap: anywhere; }
.timeline li.new { border-left-color: var(--c-deadline); }
.timeline time { display: block; color: var(--muted); font-size: 12px; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 0 8px 8px 0; }
.table td { padding: 10px 8px 10px 0; border-top: 1px solid var(--line); vertical-align: top; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table tfoot td { font-weight: 700; }
.table .sort-btn { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; color: inherit; font: inherit; border-radius: 4px; }
.table .sort-btn:hover { color: var(--text); }
.table .sort-btn:focus-visible { outline: 2px solid var(--accent, currentColor); outline-offset: 2px; }
.table .sort-mark::after { content: "↕"; opacity: .35; font-size: 11px; }
.table th[aria-sort="ascending"] .sort-mark::after { content: "↑"; opacity: 1; }
.table th[aria-sort="descending"] .sort-mark::after { content: "↓"; opacity: 1; }
.table th.num .sort-btn { flex-direction: row-reverse; }
.table .row-actions { text-align: right; white-space: nowrap; }
.table .row-actions form { display: inline; margin: 0; }

/* ---------- Формы ---------- */
.form-page { max-width: 760px; margin: 0 auto; }
.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-top: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field.wide { grid-column: 1 / -1; }
.field label { display: block; margin-bottom: 5px; font-weight: 500; font-size: 14px; }
.help { color: var(--muted); font-size: 12px; margin-top: 4px; }
.error, .errorlist { color: var(--danger); font-size: 13px; margin: 4px 0 0; padding: 0; list-style: none; }
.form-actions { display: flex; gap: 10px; margin-top: 22px; }

/* ---------- Вход ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 32px; box-shadow: var(--shadow);
}
.auth-card .brand { margin-bottom: 22px; }
.auth-card h1 { font-size: 22px; margin-bottom: 4px; }
.auth-card .field { margin-top: 16px; }
.auth-card .btn-primary { width: 100%; justify-content: center; margin-top: 22px; padding: 10px; }
.auth-ops .brand-mark { background: var(--text); color: var(--bg); }
.auth-tag { display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; color: var(--muted); }

/* ---------- Администратор платформы ---------- */
.ops-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.ops-grid .field { margin-bottom: 14px; }

@media (max-width: 900px) {
  .page { padding: 16px; }
  .topbar { padding: 0 16px; gap: 12px; }
  .topbar-right .user { display: none; }
  .ops-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .stepper { padding: 12px 6px; }
  .step { font-size: 11.5px; }
  .facts { grid-template-columns: 1fr; gap: 2px 0; }
  .facts dd { margin-bottom: 8px; }
}


/* ======================================================================
   Фильтры, поля карточки, стороны, признаки
   ====================================================================== */
.toolbar-filters { margin-top: -6px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters .input { width: auto; min-width: 150px; }
.filters input[type=search] { min-width: 240px; }
.menu-pop.right { right: 0; left: auto; }
.fields-pop { min-width: 240px; padding: 10px; }

/* ---------- Шапка доски: тихий стиль — серый сегмент, иконки с подсказками, одно меню «Вид карточек» ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.page-board .toolbar { gap: 10px; }
.page-board .toolbar h1 { display: inline-flex; align-items: center; gap: 8px; }
.title-count { display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font-size: 12.5px; font-weight: 600; line-height: 1;
  font-family: ui-sans-serif, -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; letter-spacing: 0; }
.page-board .toolbar > .segmented { background: color-mix(in srgb, var(--text) 5%, var(--bg)); border-color: transparent; border-radius: 10px; padding: 3px; gap: 2px; }
.page-board .toolbar > .segmented a { padding: 5px 12px; font-size: 13.5px; border-radius: 7px; transition: background .15s ease, color .15s ease; }
.page-board .toolbar > .segmented a.on { background: var(--surface); color: var(--text); font-weight: 600;
  box-shadow: 0 1px 2px rgba(20, 24, 36, .08), 0 0 0 1px rgba(20, 24, 36, .04); }
.tool-group { display: inline-flex; align-items: center; gap: 4px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 36px; height: 36px; padding: 0 9px;
  border-color: transparent; background: transparent; color: var(--muted); transition: background .15s ease, color .15s ease; }
.icon-btn:hover { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); }
.icon-btn.on { color: var(--text); background: color-mix(in srgb, var(--text) 7%, transparent); }
.menu summary.icon-btn { padding: 0 9px; color: var(--muted); }
.menu[open] > summary.icon-btn { background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text); }
.t-ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-btn .count { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fav-filter.on { background: color-mix(in srgb, var(--c-deadline) 12%, transparent); color: var(--c-deadline); border-color: transparent; }
.fav-filter.on .t-ico { fill: currentColor; }
.lbl-m { display: none; }
.view-menu .fields-pop { min-width: 280px; }
.density-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 3px; margin: 0 0 12px; border-radius: 9px;
  background: color-mix(in srgb, var(--text) 5%, var(--surface)); }
.density-seg button { display: grid; justify-items: center; gap: 5px; padding: 8px 4px 6px; border: 0; border-radius: 7px; background: transparent;
  color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; transition: background .15s ease, color .15s ease; }
.density-seg button:hover { color: var(--text); }
.density-seg button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(20, 24, 36, .08); }
.density-ico { display: inline-grid; width: 16px; gap: 2px; }
.density-ico i { display: block; height: 2px; border-radius: 1px; background: currentColor; }
.density-ico-compact i:nth-child(n+3) { display: none; }
.density-ico-standard { gap: 3px; } .density-ico-detailed i { height: 3px; }
.search-box { position: relative; display: inline-flex; align-items: center; }
.search-box .t-ico { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search-box input[type=search] { padding-left: 34px; }
.page-board .toolbar-filters .filters select.input { border-color: transparent; background-color: color-mix(in srgb, var(--text) 4%, var(--bg)); }
.page-board .toolbar-filters .filters select.input:hover { background-color: color-mix(in srgb, var(--text) 7%, var(--bg)); }

/* Подсказки к значкам: появляются при наведении, без задержки на чтение title */
@media (hover: hover) {
  [data-tip] { position: relative; }
  [data-tip]:hover::after { content: attr(data-tip); position: absolute; top: calc(100% + 7px); left: 50%; transform: translateX(calc(-50% + var(--tip-shift, 0px)));
    padding: 5px 8px; border-radius: 6px; background: var(--text); color: var(--bg); font-size: 12px; font-weight: 500; line-height: 1.2;
    white-space: nowrap; pointer-events: none; z-index: 80; animation: tip-in .12s ease-out; }
  .menu[open] > summary[data-tip]:hover::after { display: none; }
}
@keyframes tip-in { from { opacity: 0; transform: translate(calc(-50% + var(--tip-shift, 0px)), -2px); } to { opacity: 1; transform: translate(calc(-50% + var(--tip-shift, 0px)), 0); } }

.card-summary { font-size: 13px; color: var(--text); line-height: 1.45; padding: 6px 8px; border-left: 3px solid var(--line); background: var(--surface-2); border-radius: 0 6px 6px 0; white-space: pre-line; }

.density-compact .card { padding: 8px 10px; gap: 3px; }
.density-compact .card-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; }
.density-compact .card-top .chip:not(.chip-new):not(.chip-note), .density-compact .card .fresh,
.density-compact .card-actions > form, .density-compact .card-foot > .chip { display: none; }
.density-compact .card-foot { margin-top: 0; }
@media (hover: hover) {
  .density-compact .card-foot { display: none; }
  .density-compact .card:hover .card-foot, .density-compact .card:focus-within .card-foot { display: flex; }
}
.density-compact .flag, .density-compact .next { padding: 2px 6px; font-size: 12.5px; }
.density-compact .column-body { gap: 6px; }

.density-detailed .card { gap: 7px; }
/* Таблица в компактном режиме: одна строка на дело, без подписей мелким шрифтом */
.density-compact .cases-table td { padding-top: 7px; padding-bottom: 7px; }
.density-compact .cases-table td small, .density-compact .cases-table .chip-note { display: none; }
.density-compact .cases-table .c-event b { font-weight: 600; }
.cases-table .t-summary { color: var(--text); white-space: pre-line; margin-top: 4px; }
.check { display: flex; align-items: center; gap: 8px; padding: 5px 4px; cursor: pointer; font-weight: 400 !important; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.pop-actions { display: flex; gap: 8px; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.pop-actions form { margin: 0; }
.card-top { display: flex; flex-wrap: wrap; gap: 6px; }
.card-top:empty { display: none; }
.party { font-size: 13px; color: var(--muted); display: grid; grid-template-columns: 58px 1fr; gap: 6px; }
.party span { color: var(--muted); font-size: 12px; padding-top: 1px; }
.party.mine { color: var(--text); font-weight: 600; }
.party.mine::after { content: ""; }
.mine { font-weight: 600; }
.chip.role-plaintiff { color: var(--stage-first); background: color-mix(in srgb, var(--stage-first) 10%, transparent); border-color: transparent; }
.chip.role-defendant { color: var(--stage-cassation); background: color-mix(in srgb, var(--stage-cassation) 12%, transparent); border-color: transparent; }
.chip-blue { color: var(--c-hearing); background: color-mix(in srgb, var(--c-hearing) 10%, transparent); border-color: transparent; }
.flag { font-size: 13px; font-weight: 600; padding: 4px 8px; border-radius: 6px; }
.flag-hearing { color: var(--c-hearing); background: color-mix(in srgb, var(--c-hearing) 10%, transparent); }
.flag-deadline { color: var(--c-deadline); background: color-mix(in srgb, var(--c-deadline) 13%, transparent); }
.flag-deadline.soon, .flag-deadline.late { color: var(--c-late); background: color-mix(in srgb, var(--c-late) 11%, transparent); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.rule { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.notice { padding: 10px 14px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--c-deadline) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c-deadline) 35%, var(--line)); margin: 0 0 14px; font-size: 14px; }
.ok { color: var(--c-ok); font-size: 14px; margin-top: 8px; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.head-actions form { margin: 0; }
.subhead { font-size: 13px; color: var(--muted); font-weight: 500; margin: 18px 0 6px; }

/* ---------- Доска «суды × стадии» ---------- */
.matrix-wrap { overflow-x: auto; padding-bottom: 12px; border-radius: var(--radius); }
.matrix { display: grid; gap: 0; min-width: min-content; }
.matrix-row { display: grid; grid-template-columns: 210px repeat(var(--cols), minmax(250px, 1fr)); }
.matrix-head { background: var(--bg); }
.m-court {
  position: sticky; left: 0; z-index: 3; background: var(--bg); padding: 14px 12px 14px 4px;
  display: flex; gap: 8px; align-items: flex-start; border-top: 1px solid var(--line);
}
.m-court b { line-height: 1.3; }
.m-corner { border-top: 0; color: var(--muted); font-size: 12px; align-items: flex-end; padding-bottom: 8px; z-index: 6; }
.m-colhead {
  padding: 8px 12px; font-weight: 600; font-size: 14px; border-top: 3px solid var(--c);
  background: color-mix(in srgb, var(--c) 7%, var(--bg)); border-radius: 8px 8px 0 0; margin: 0 4px;
}
.m-cell {
  padding: 10px 4px 10px; margin: 0 4px; display: grid; gap: 10px; align-content: start;
  border-top: 1px solid var(--line); background: color-mix(in srgb, var(--c) 4%, transparent);
}
.m-cell.m-empty { background: repeating-linear-gradient(135deg, transparent 0 8px, color-mix(in srgb, var(--line) 35%, transparent) 8px 9px); min-height: 56px; }
.m-cell .card { margin: 0 6px; }

/* ---------- Импорт по ссылке ---------- */
.import-box {
  background: color-mix(in srgb, var(--primary) 6%, var(--surface)); border: 1px dashed color-mix(in srgb, var(--primary) 45%, var(--line));
  border-radius: var(--radius); padding: 16px 18px; margin-top: 16px;
}
.import-box label { display: block; font-weight: 600; margin-bottom: 8px; }
.import-row { display: flex; gap: 10px; }
.import-row .input { flex: 1; }

/* ---------- Списки и таблицы сроков ---------- */
.rows { list-style: none; margin: 0; padding: 0; display: grid; }
.rows li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }
.rows li > div:first-child { flex: 1; }
.rows li.past { color: var(--muted); }
.rows .row-actions { display: flex; gap: 6px; }
.rows .row-actions form { margin: 0; }
.deadlines tr.dl-late td:nth-child(2) b, .deadlines tr.dl-late td:nth-child(2) .small { color: var(--c-late); }
.deadlines tr.dl-soon td:nth-child(2) b { color: var(--c-deadline); }
.deadlines tr.dl-done td, .deadlines tr.dl-dismissed td { opacity: .55; }

/* ---------- Календарь ---------- */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal-head, .cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head div { padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.cal-day { min-height: 112px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.off { background: var(--surface-2); }
.cal-day.out { opacity: .45; }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--primary); }
.cal-num { font-size: 12px; font-weight: 600; color: var(--muted); }
.cal-day.today .cal-num { color: var(--primary); }
.ev {
  display: block; margin: 0; font-size: 11.5px; line-height: 1.3; padding: 2px 6px; border-radius: 5px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; color: var(--text); text-decoration: none;
  border-left: 3px solid var(--c-step); background: color-mix(in srgb, var(--c-step) 10%, transparent);
}
.ev:hover { text-decoration: none; filter: brightness(.96); }
.ev.hearing { border-left-color: var(--c-hearing); background: color-mix(in srgb, var(--c-hearing) 12%, transparent); }
.ev.deadline { border-left-color: var(--c-deadline); background: color-mix(in srgb, var(--c-deadline) 14%, transparent); }
.ev.deadline.soon { border-left-color: var(--c-late); background: color-mix(in srgb, var(--c-late) 11%, transparent); }
.ev.deadline.late { border-left-color: var(--c-late); background: color-mix(in srgb, var(--c-late) 20%, transparent); font-weight: 600; }
.ev.deadline.done { border-left-color: var(--c-ok); background: color-mix(in srgb, var(--c-ok) 10%, transparent); text-decoration: line-through; opacity: .7; }
.ev.todo { border-left-color: var(--c-step); }
.ev-more { font-size: 11px; color: var(--muted); padding-left: 4px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--line); }
.cal-legend .ev { white-space: nowrap; }
.legend-off { font-size: 12px; color: var(--muted); margin-left: auto; }
.agenda { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.agenda li { font-size: 14px; padding-left: 12px; border-left: 3px solid var(--c-hearing); }
.agenda li.deadline { border-left-color: var(--c-deadline); }
.agenda li.deadline.soon { border-left-color: var(--c-late); }
.agenda a { color: var(--text); }
.agenda time { display: block; color: var(--muted); font-size: 12px; }
.panel-alert { border-color: color-mix(in srgb, var(--c-late) 50%, var(--line)); background: color-mix(in srgb, var(--c-late) 5%, var(--surface)); }
.panel-alert .agenda li { border-left-color: var(--c-late); }
.field .check { margin-top: 4px; }

@media (max-width: 900px) {
  .cal-layout { grid-template-columns: 1fr; }
  .cal-day { min-height: 80px; padding: 3px; }
  .import-row { flex-direction: column; }
  .filters .input { width: 100%; }
}

/* Кнопка-меню в панели (например «Поля карточки») */
.menu summary.btn { width: auto; height: auto; display: inline-flex; padding: 8px 14px; color: var(--text); }
.filters select.input { max-width: 190px; }
.filters input[type=search] { width: 240px; }

/* ---------- Путь дела по судам: инстанции от новой к старой, каждая раскрывается ---------- */
.chain { list-style: none; margin: 0 0 4px; padding: 0; }
.chain > li { margin-bottom: 8px; }
.inst { border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: var(--radius-sm); background: var(--surface); }
.inst > summary { list-style: none; display: flex; gap: 12px; align-items: center; padding: 11px 14px; cursor: pointer; }
.inst > summary::-webkit-details-marker { display: none; }
.inst .dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.inst .ttl { flex: 1; min-width: 0; }
.inst .ttl b { display: block; }
.inst .ttl small { display: block; color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.inst .res { flex: 0 1 auto; max-width: 240px; font-size: 13px; font-weight: 600; color: var(--muted); text-align: right; overflow-wrap: anywhere; }
.inst .chev { flex: none; color: var(--muted); transition: transform .15s; }
.inst[open] .chev { transform: rotate(90deg); }
.inst.now { background: color-mix(in srgb, var(--c) 6%, var(--surface)); }
.inst.now .res { color: var(--c); }
.inst.wait { border-style: dashed; background: transparent; }
.inst.wait .dot { background: transparent; border: 2px solid var(--c); }
.inst .body { padding: 4px 14px 14px 30px; border-top: 1px dashed var(--line); font-size: 14px; }
.inst .body > p { margin: 8px 0; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 5px 12px; margin: 10px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.explain { margin: 8px 0; padding: 9px 12px; border-radius: 8px; background: var(--surface-2); color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.explain p { margin: 0 0 6px; }
.explain p:last-child { margin: 0; }
.explain b { color: var(--text); }
.inst .row-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.inst .row-actions form { margin: 0; }
.add-instance { margin-top: 10px; font-size: 14px; }
.add-instance summary { display: none; }  /* открывается кнопкой «Добавить инстанцию самостоятельно» */
.add-instance .import-row { margin-top: 10px; }
.chain-found { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 4px; font-size: 14px; }
.chain-found li.missing { color: var(--c-deadline); }

/* ---------- Лента событий ---------- */
.badge-count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 999px; background: var(--c-late); color: #fff; font-size: 11px; font-weight: 700; text-align: center; line-height: 18px; }
.feed-note { margin: -4px 0 14px; }
.feed { padding: 0; overflow: hidden; }
.feed-item { display: grid; grid-template-columns: 150px 1fr auto; gap: 14px; align-items: start; padding: 12px 18px; border-top: 1px solid var(--line); color: var(--text); }
.feed-item:first-child { border-top: 0; }
.feed-item:hover { background: var(--surface-2); text-decoration: none; }
.feed-item.unread { background: color-mix(in srgb, var(--primary) 6%, var(--surface)); box-shadow: inset 3px 0 0 var(--primary); }
.feed-item time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.feed-kind { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; width: fit-content; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.feed-kind.kind-hearing_new, .feed-kind.kind-hearing_result { color: var(--c-hearing); background: color-mix(in srgb, var(--c-hearing) 10%, transparent); border-color: transparent; }
.feed-kind.kind-instance_new { color: var(--stage-appeal); background: color-mix(in srgb, var(--stage-appeal) 10%, transparent); border-color: transparent; }
.feed-kind.kind-reminder { color: var(--c-deadline); background: color-mix(in srgb, var(--c-deadline) 13%, transparent); border-color: transparent; }
@media (max-width: 900px) { .feed-item { grid-template-columns: 1fr; gap: 4px; } }

/* ---------- Перетаскивание карточек ---------- */
.card[draggable=true] { cursor: grabbing; }
.card.dragging { opacity: .45; transform: rotate(1.5deg); }
.column.drop-over, .m-cell.drop-over { outline: 2px dashed var(--primary); outline-offset: -4px; background: color-mix(in srgb, var(--primary) 7%, transparent); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); padding: 10px 16px; border-radius: 10px; background: var(--text); color: var(--bg); z-index: 50; box-shadow: var(--shadow); }

/* ---------- Приглашения и формы входа ---------- */
.invites { margin-top: 16px; }
.invites .input { margin-top: 6px; }
.auth-card .check { align-items: flex-start; }
.auth-card .check span { font-weight: 400; font-size: 14px; }
.auth-card .help { text-align: left; }

/* ---------- Документы ---------- */
.upload { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; padding-top: 14px; border-top: 1px dashed var(--line); }
.upload input[type=file] { grid-column: 1 / -1; padding: 12px; background: var(--surface-2); }
.upload .btn { justify-self: start; }
@media (max-width: 900px) { .upload { grid-template-columns: 1fr; } }

/* ---------- Настройки уведомлений ---------- */
.steps-list { margin: 0 0 8px; padding-left: 20px; display: grid; gap: 6px; }
.form-card + .form-card { margin-top: 14px; }
code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* ---------- Предложенные акты ---------- */
.suggest { margin-bottom: 14px; padding: 12px 14px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--primary) 6%, var(--surface)); border: 1px dashed color-mix(in srgb, var(--primary) 40%, var(--line)); }
.suggest-title { font-weight: 600; margin-bottom: 8px; font-size: 14px; }
.suggest-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.suggest-row:first-of-type { border-top: 0; }
.suggest-row > div { flex: 1; }
.suggest-row form { display: flex; gap: 6px; margin: 0; }

.upload input[type=file]::file-selector-button { margin-right: 12px; padding: 7px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; }
.upload input[type=file]::file-selector-button:hover { background: var(--surface-2); }

.auth-alt { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); text-align: center; display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }

/* ---------- Прятать скрытое (поиск на лету), заметки, ФССП ---------- */
[hidden] { display: none !important; }
.chip.chip-note:has(.clip) { padding: 3px 6px; line-height: 0; }
.clip { display: block; }
.chip-note { color: var(--c-deadline); background: color-mix(in srgb, var(--c-deadline) 13%, transparent); border-color: transparent; }
.tip {
  position: fixed; z-index: 60; max-width: 340px; padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.45;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow); white-space: pre-wrap; pointer-events: none;
}
.fssp-line { font-weight: 600; color: var(--stage-enforcement); }
.m-fssp b::before { content: "ФССП"; display: block; font-size: 11px; letter-spacing: .04em; color: var(--stage-enforcement); font-weight: 700; }
.m-fssp b { font-weight: 600; }
.card-line.awaiting { color: var(--muted); font-size: 13px; }
.card-line.awaiting b { color: var(--text); font-weight: 600; }

.comments { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
.comments li { padding: 8px 12px; border-left: 3px solid var(--line); background: var(--surface-2); border-radius: 0 8px 8px 0; display: flex; gap: 10px; }
.comments li > div { flex: 1; white-space: pre-wrap; }
.comments time { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.comment-form { display: grid; gap: 8px; }
.comment-form .btn { justify-self: start; }
.progress { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 4px; }
.progress > i { display: block; height: 100%; background: var(--stage-enforcement); }
.doc-hit { color: var(--muted); font-size: 13px; margin-top: 2px; }
.doc-hit mark { background: color-mix(in srgb, var(--c-deadline) 30%, transparent); color: inherit; padding: 0 2px; border-radius: 3px; }

.chip-ok { color: var(--c-ok); background: color-mix(in srgb, var(--c-ok) 10%, transparent); border-color: transparent; }
.panel-fssp { border-top: 3px solid var(--stage-enforcement); }
.enf + .enf { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); }
.enf-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.enf-head > div:first-child { flex: 1; }
.enf-head .row-actions { display: flex; gap: 6px; }
.enf-head .row-actions form { margin: 0; }
.doc-filters { margin-bottom: 14px; }
.doc-filters input[type=search] { min-width: 320px; flex: 1; }
.doc-row { padding: 12px 18px; border-top: 1px solid var(--line); }
.doc-row:first-child { border-top: 0; }

.filters input[type=search] { width: 360px; max-width: 100%; }

/* Панель «Обход инстанций» на странице дела */
.sync-panel { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin: 0 0 16px; background: var(--surface); }
.sync-panel.is-active { border-color: var(--primary); }
.sync-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sync-spinner { display: none; width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: sync-spin 0.9s linear infinite; }
.sync-panel.is-active .sync-spinner { display: inline-block; }
@keyframes sync-spin { to { transform: rotate(360deg); } }
.sync-steps { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.sync-step { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.sync-step small { display: block; color: var(--muted); margin-top: 2px; }
.sync-mark { flex: none; width: 14px; height: 14px; margin-top: 3px; border-radius: 50%; border: 2px solid var(--line); }
.sync-step.run .sync-mark { border-color: var(--primary); border-top-color: transparent; animation: sync-spin 0.9s linear infinite; }
.sync-step.ok .sync-mark { background: var(--c-ok); border-color: var(--c-ok); }
.sync-step.warn .sync-mark { background: var(--c-deadline); border-color: var(--c-deadline); }
.sync-step.skip .sync-mark { background: #b8bdc8; border-color: #b8bdc8; }
.sync-step.wait { color: var(--muted); }
.sync-summary { margin: 10px 0 0; font-weight: 600; }
.sync-summary:empty { display: none; }

/* Контакты суда в карточке инстанции */
.contacts { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); display: grid; gap: 3px; font-size: 13px; }
.contact-row { display: grid; grid-template-columns: 110px 1fr; gap: 2px 10px; align-items: baseline; }
.contact-role { color: var(--muted); }
.contact-name { grid-column: 2; font-weight: 600; }
.contact-name:empty { display: none; }
.contact-phones { grid-column: 2; }
.contact-phones a { color: var(--primary); text-decoration: none; }

/* Выбор итога апелляции или кассации */
.outcome-form { display: grid; gap: 10px; max-width: 640px; }
.outcome-option { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
.outcome-option:has(input:checked) { border-color: var(--primary); }
.outcome-option small { display: block; color: var(--muted); margin-top: 2px; }
.outcome-option input { margin-top: 4px; }

/* Карандашик у названия дела */
.title-line { display: flex; align-items: flex-start; gap: 10px; }
.title-line[hidden], .title-form[hidden] { display: none; }
.title-line .icon-btn { flex: none; margin-top: 6px; width: 30px; min-width: 0; height: 30px; padding: 0; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); font-size: 17px; line-height: 1; cursor: pointer; opacity: 0.55; }
.title-line .icon-btn:hover, .title-line .icon-btn:focus-visible { opacity: 1; background: var(--surface); border-color: var(--line); color: var(--primary); }
.title-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0 8px; }
.title-form .input { flex: 1 1 360px; font-size: 20px; font-weight: 600; }

/* Страница «Настройки»: выбор темы */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 8px 0 18px; }
.theme-option { display: block; border: 2px solid var(--line); border-radius: 12px; padding: 10px; background: var(--surface); cursor: pointer; }
.theme-option input { position: absolute; opacity: 0; pointer-events: none; }
.theme-option:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
.theme-option:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.theme-name { display: block; margin-top: 8px; font-weight: 600; }
.theme-note { display: block; color: var(--muted); font-size: 13px; }
.theme-preview { display: grid; grid-template-columns: 1fr 1fr; height: 84px; border-radius: 8px; overflow: hidden; border: 1px solid #c9ccd4; }
.theme-preview .half { padding: 8px; display: grid; gap: 5px; align-content: start; }
.theme-preview .bar { height: 8px; border-radius: 4px; }
.theme-preview .btn-dot { width: 46%; height: 12px; border-radius: 6px; margin-top: 3px; }
.theme-preview.light .half, .theme-preview .half.l { background: #f4f3ef; }
.theme-preview .half.l .bar { background: #1c2230; opacity: .75; }
.theme-preview .half.l .btn-dot { background: #2f5bd6; }
.theme-preview .half.d { background: #12151c; }
.theme-preview .half.d .bar { background: #e8eaf0; opacity: .8; }
.theme-preview .half.d .btn-dot { background: #6b8cff; }
.theme-preview.one { grid-template-columns: 1fr; }

/* Индикатор загрузки при отправке форм (data-loading) */
.spinner { display: inline-block; flex: none; width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: sync-spin 0.8s linear infinite; }
.busy-note { position: fixed; z-index: 1000; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; max-width: min(92vw, 640px); padding: 12px 16px; border-radius: 12px; background: var(--surface); color: var(--text); border: 1px solid var(--primary); box-shadow: var(--shadow); font-size: 14px; }
.btn.is-busy { opacity: .7; cursor: progress; }
.btn.is-busy::before { content: ""; display: inline-block; width: 13px; height: 13px; margin-right: 8px; vertical-align: -2px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sync-spin 0.8s linear infinite; }
@media (prefers-reduced-motion: reduce) { .spinner, .btn.is-busy::before, .sync-spinner { animation-duration: 3s; } }

/* Первая инстанция не найдена: ручной выбор участка или автопоиск */
.lower-box { margin: 12px 0; padding: 14px 16px; border: 1px solid var(--c-deadline); border-radius: 10px; background: var(--surface); }
.lower-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.lower-actions label { display: block; font-weight: 600; margin-bottom: 6px; }
.lower-actions .input, .lower-actions .btn { width: 100%; margin-bottom: 8px; }
@media (max-width: 720px) { .lower-actions { grid-template-columns: 1fr; } }

/* Новое дело: вкладки «По ссылке» и «По номеру или УИД» */
.import-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.import-tabs .tab { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 8px; padding: 6px 14px; cursor: pointer; font: inherit; }
.import-tabs .tab.active { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.import-panel[hidden] { display: none; }
.import-panel label { display: block; font-weight: 600; margin: 8px 0 6px; }
.import-panel .import-row { margin-top: 10px; }

/* Избранное, свежесть данных, неполная цепочка */
.fav-form { display: inline; margin: 0; }
.fav-btn { background: none; border: 0; padding: 0 4px; font-size: 18px; line-height: 1; color: var(--muted); cursor: pointer; }
.fav-btn:hover, .fav-btn.on { color: var(--c-deadline); }
.btn.fav-btn { padding: 8px 14px; font: inherit; font-weight: 500; line-height: normal; border: 1px solid var(--line); background: var(--surface); color: var(--text); }  /* как соседние кнопки */
.btn.fav-btn:hover { color: var(--text); background: var(--surface-2); }
.btn.fav-btn.on { border-color: var(--c-deadline); background: color-mix(in srgb, var(--c-deadline) 12%, var(--surface)); color: var(--text); }

/* Кнопка «★ Избранное» над списком дел: включает показ только отмеченных звёздочкой */
.fav-filter .fav-star { color: var(--muted); }
.fav-filter .count { margin-left: 2px; }
.fav-filter.on { border-color: var(--c-deadline); background: color-mix(in srgb, var(--c-deadline) 12%, var(--surface)); }
.fav-filter.on .fav-star { color: var(--c-deadline); }

/* «Скачать список»: окно выбора формата и кодировки */
.export-pop { width: 330px; max-width: calc(100vw - 24px); }
.export-pop .field-label { display: block; margin: 10px 0 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.export-pop .input { width: 100%; }
.card-top .fav-form { margin-right: 2px; }
.fresh { font-size: 12px; color: var(--muted); }
.fresh.stale { color: var(--c-deadline); }
.chain-notes { border: 1px solid var(--c-deadline); background: color-mix(in srgb, var(--c-deadline) 10%, var(--surface)); border-radius: 10px; padding: 12px 16px; margin: 0 0 16px; }
.chain-notes p { margin: 6px 0; }
.chain-report { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0 0; }
.chain-updated { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 6px; }

/* Подсказки по состоянию дела */
.status-help { margin-top: 4px; font-size: 13px; }
.status-help summary { cursor: pointer; color: var(--primary); }
.status-help p { margin: 6px 0 0; line-height: 1.45; }

/* Калькуляторы */
.calc-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 20px; }
.calc-grid .form-card { display: grid; gap: 10px; align-content: start; }
.calc-grid label { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
.calc-grid label.check { display: flex; font-weight: 400; }
.calc-result { border: 1px solid var(--primary); border-radius: 12px; background: var(--surface); padding: 16px 20px; margin: 16px 0; }
.calc-result.calc-error { border-color: var(--danger); }
.calc-total { font-size: 32px; font-weight: 700; margin: 4px 0 8px; }
.calc-result ul { margin: 0 0 8px; padding-left: 20px; }
@media (max-width: 760px) { .calc-grid { grid-template-columns: 1fr; } }

/* Счётчики в заголовках, «новое», читалка документа */
.count { display: inline-block; min-width: 22px; padding: 0 7px; margin-left: 6px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 600; text-align: center; vertical-align: 2px; }
.chip-new { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.reader { max-width: 820px; margin: 0 auto; }
.reader-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.reader-head h1 { font-size: 22px; margin: 8px 0; }
.reader-actions { display: flex; gap: 8px; }
.reader-text { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 22px 26px; font-size: 16px; line-height: 1.65; }
.reader-text p { margin: 0 0 10px; }

/* Быстрая заметка на карточке */
.note-pop { width: 300px; padding: 10px; right: 0; left: auto; }
.note-pop textarea { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg);
  color: var(--text); font: inherit; font-size: 13.5px; line-height: 1.4; resize: vertical; }
.note-pop textarea:focus { outline: none; border-color: var(--primary); }
.note-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.note-label textarea { margin-top: 3px; font-weight: 400; }
.note-actions { display: flex; gap: 8px; margin-top: 8px; }
.note-detail summary.btn { list-style: none; }
.note-detail summary.btn::-webkit-details-marker { display: none; }
.note-detail .note-pop { text-align: left; }

/* Календарь: свои события, окно ввода, кнопка «+» в дне */
.ev.own { border-left-color: var(--stage-appeal); background: color-mix(in srgb, var(--stage-appeal) 13%, transparent); width: 100%; text-align: left; cursor: pointer;
  font: inherit; font-size: 11.5px; line-height: 1.3; color: inherit; }  /* это кнопка: font: inherit снимает системный шрифт, размер — как у остальных событий */
.cal-legend .ev.own { width: auto; }
.cal-day { position: relative; }
.cal-add { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 6px; border: 0; background: transparent; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; opacity: 0; }
.cal-day:hover .cal-add, .cal-add:focus-visible { opacity: 1; }
.cal-add:hover { background: var(--surface-2); color: var(--primary); }
@media (hover: none) { .cal-add { opacity: .55; } }
.agenda li.own a, .agenda li.own { border-left-color: var(--stage-appeal); }
.cal-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.ev-dialog { width: min(440px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 16px; padding: 22px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.ev-dialog::backdrop { background: rgba(10, 14, 24, .45); }
.ev-dialog h2 { margin: 0 0 12px; font-size: 19px; }
.ev-dialog label { display: block; margin: 12px 0 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.ev-dialog .input, .ev-dialog select { width: 100%; box-sizing: border-box; }
.ev-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ev-actions { display: flex; gap: 8px; margin-top: 18px; }
.ev-actions .btn-danger { margin-left: auto; }
.card[data-href] { cursor: pointer; }

.remind-custom { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 2px; }
.remind-custom .input { width: auto; min-width: 0; }
.remind-custom input[type=number] { width: 110px; }

/* Кнопка (i) с примером при наведении */
.info { position: relative; display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: 6px; border-radius: 50%; vertical-align: 1px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font: 700 11px/1 var(--font); font-style: italic; cursor: help; }
.info:hover, .info:focus-visible { color: var(--primary); border-color: var(--primary); outline: none; }
.info-pop { position: absolute; z-index: 40; left: 50%; bottom: calc(100% + 8px); transform: translateX(-30%) translateY(4px); width: 340px; max-width: 80vw; padding: 12px 14px;
  border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow); font: 400 13px/1.45 var(--font); font-style: normal; text-align: left;
  opacity: 0; visibility: hidden; transition: opacity .15s ease, transform .18s cubic-bezier(.23, 1, .32, 1), visibility 0s .18s; pointer-events: none; }
.info:hover .info-pop, .info:focus .info-pop, .info:focus-within .info-pop { opacity: 1; visibility: visible; transform: translateX(-30%); transition-delay: 0s; }
.info-pop b { display: block; margin: 6px 0 2px; font-size: 12px; opacity: .75; }
.info-pop b:first-child { margin-top: 0; }
.info-pop code { display: block; margin: 4px 0 8px; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--bg) 14%, transparent); font: 12.5px/1.45 var(--font); white-space: normal; }
.check-line { display: flex; align-items: flex-start; gap: 4px; }
@media (prefers-reduced-motion: reduce) { .info-pop { transition: none; } }
.how { margin: 4px 0 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; line-height: 1.5; }
.how p { margin: 0 0 8px; } .how ul { margin: 0 0 8px; padding-left: 20px; display: grid; gap: 4px; } .how-example { color: var(--muted); margin: 0; }

.skin-preview { display: grid; grid-template-columns: 2fr 2fr 1fr; height: 56px; border-radius: 8px; overflow: hidden; border: 1px solid #c9ccd4; }

/* Ручка перетаскивания карточки и выделение текста */
.drag-handle { margin-left: auto; order: 99; color: var(--muted); font-size: 13px; letter-spacing: -2px; line-height: 1; padding: 3px 4px; border-radius: 5px;
  cursor: grab; opacity: .45; user-select: none; transition: opacity .15s ease, background-color .15s ease; }
.card:hover .drag-handle, .drag-handle:hover { opacity: 1; }
.drag-handle:hover { background: var(--surface-2); }
.card { user-select: text; cursor: pointer; }
.card .btn, .card button, .card summary { cursor: pointer; }
@media (hover: none) { .drag-handle { display: none; } }


/* ---------- Подсказки судов под полем ввода ---------- */
.suggest-wrap { position: relative; }
.label-row { position: relative; display: flex; align-items: center; gap: 8px; }
.label-row label { margin: 0; }
.info-i > summary { list-style: none; cursor: pointer; width: 20px; height: 20px; border: 1px solid var(--line); border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; color: var(--muted); font: italic 600 12px/1 Georgia, serif; user-select: none; }
.info-i > summary::-webkit-details-marker { display: none; }
.info-i > summary:hover, .info-i[open] > summary { color: var(--text); border-color: var(--muted); }
.info-i-body { position: absolute; left: 0; top: calc(100% + 6px); z-index: 70; width: min(92vw, 400px); padding: 12px 14px; font-size: 14px; line-height: 1.45;
  color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0, 0, 0, .12); }
.info-i-body ul, .info-i-body ol { margin: 6px 0; padding-left: 20px; }
.info-i-body li + li { margin-top: 4px; }
.court-suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 60; margin: 0; padding: 4px; list-style: none;
  max-height: 264px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px -8px rgba(20, 24, 36, .22); }
.court-suggest[hidden] { display: none; }
.court-suggest li { padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: 15px; line-height: 1.3; color: var(--text); }
.court-suggest li:hover, .court-suggest li[aria-selected="true"] { background: color-mix(in srgb, var(--primary) 9%, var(--surface)); }

/* ---------- Кнопки стадий (видны только на телефоне) ---------- */
.stage-tabs { display: none; }
.filters-toggle { display: none; }
.ico-m { display: none; }

/* ---------- Режим «Таблица» ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.cases-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 980px; }
.cases-table thead th { position: sticky; top: 0; text-align: left; padding: 10px 12px; font-size: 12px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.cases-table td { padding: 10px 12px; vertical-align: top; border-bottom: 1px solid var(--line); }
.cases-table small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.tgroup-head th { padding: 10px 12px; background: color-mix(in srgb, var(--c, var(--muted)) 7%, var(--surface-2)); border-bottom: 1px solid var(--line); text-align: left; }
.tgroup-head .count { margin-left: 6px; }
.trow:hover td { background: var(--surface-2); }
.trow.overdue td { background: color-mix(in srgb, var(--danger) 5%, var(--surface)); }
.c-fav { width: 34px; padding-right: 0; } .c-fav form { margin: 0; }
.c-court { min-width: 170px; } .c-case { min-width: 170px; } .c-case .card-title { font-weight: 700; font-family: var(--mono); font-size: 13.5px; }
.c-status { min-width: 180px; max-width: 260px; } .c-event { min-width: 150px; } .c-event b { display: block; }
.c-parties { min-width: 220px; } .c-parties span { display: block; } .c-parties i { font-style: normal; color: var(--muted); font-size: 12px; margin-right: 4px; }
.c-new { width: 70px; white-space: nowrap; }
@media (hover: none) { .cases-table { min-width: 0; } }

/* Режим «Граф»: центр → стадии → суды → дела */
.graph-wrap { position: relative; height: max(560px, calc(100vh - 190px)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--primary) 7%, var(--surface)), var(--surface-2)); touch-action: none; }
.graph-svg { width: 100%; height: 100%; display: block; cursor: grab; user-select: none; -webkit-user-select: none; }
.graph-svg:active { cursor: grabbing; }
.graph-bar { position: absolute; left: 10px; top: 10px; display: flex; gap: 6px; flex-wrap: wrap; z-index: 2; }
.graph-hint { position: absolute; left: 12px; right: 12px; bottom: 8px; margin: 0; font-size: 12px; color: var(--muted); pointer-events: none; }
.graph-card { position: absolute; z-index: 3; width: min(290px, calc(100% - 16px)); padding: 12px 14px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow); display: grid; gap: 4px; }
.graph-card[hidden] { display: none; }
.graph-card p { margin: 0; } .graph-card .late { color: var(--c-late); font-weight: 600; } .graph-card .btn { margin-top: 6px; justify-self: start; }
.glink { stroke: color-mix(in srgb, var(--c, var(--muted)) 55%, transparent); stroke-width: 1.6; }
.gnode { cursor: pointer; outline: none; }
.gnode .gshape { fill: var(--c, var(--muted)); stroke: var(--surface); stroke-width: 3; transition: filter .12s; }
.gnode:hover .gshape, .gnode:focus-visible .gshape { filter: brightness(1.12) drop-shadow(0 2px 6px rgba(0, 0, 0, .3)); }
.gnode.k-root .gshape { fill: var(--primary); }
.gnode.k-court .gshape { fill: var(--surface); stroke: var(--c); stroke-width: 3.5; }
.gnode.k-court.open .gshape, .gnode.k-stage.open .gshape { stroke-dasharray: 0; filter: drop-shadow(0 0 7px color-mix(in srgb, var(--c) 60%, transparent)); }
.gnode.dim { opacity: .28; }
.gstar { fill: none; stroke: var(--c-deadline); stroke-width: 2.5; }
.glate { fill: none; stroke: var(--c-late); stroke-width: 2.5; stroke-dasharray: 3 2; }
.glabel { font: 600 12px var(--font); fill: var(--text); paint-order: stroke; stroke: var(--surface-2); stroke-width: 4px; stroke-linejoin: round; pointer-events: none; }
.gnode.k-case .glabel { font-weight: 500; font-size: 11.5px; }
.gnode.k-stage .glabel { font-size: 13.5px; font-weight: 700; }

/* Кнопки «Google» и «.ics» у заседания в повестке календаря */
.agenda-add { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.agenda-add a { font-weight: 600; }

/* ======================================================================
   Телефон (до 720 px): шапка в две строки, фильтры сеткой, колонки доски листаются пальцем
   ====================================================================== */
.nav-mobile { display: none; }
@media (max-width: 720px) {
  html, body { overflow-x: hidden; }
  .page { padding: 12px; }
  h1 { font-size: 22px; }

  /* Шапка: сверху марка и «Настройки/Выйти», ниже меню в одну прокручиваемую строку */
  .topbar { height: auto; flex-wrap: wrap; padding: 8px 12px 0; gap: 4px 12px; }
  .topbar .brand { order: 1; font-size: 19px; }
  .topbar-right { order: 2; margin-left: auto; gap: 14px; font-size: 14px; }
  .topbar-right .hide-mobile, .topbar-right .user { display: none; }
  .topnav { order: 3; flex: 1 0 100%; gap: 2px; margin: 0 -12px; padding: 0 12px; overflow-x: auto; scrollbar-width: none; }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a, .nav-mobile { white-space: nowrap; padding: 10px 12px; border-radius: 0; border-bottom: 2px solid transparent; }
  .nav-mobile { display: block; }
  .topnav a.active { background: none; border-bottom-color: var(--accent); color: var(--text); }

  /* Первая строка: поле поиска на всю ширину и справа три кнопки-значка: «+» (новое дело), ⚙ (что видно на карточках),
     ↻ (обновить дела). Шапка и панель фильтров «растворяются» (contents), чтобы расставить их части в нужном порядке */
  .page-board { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .page-board > * { min-width: 0; }
  .page-board > .messages { flex: 1 0 100%; }
  .toolbar, .toolbar-filters, .toolbar-filters .filters, .tool-group, .search-box { display: contents; }
  .search-box .t-ico { display: none; }
  .search-box input[type=search] { padding-left: 12px; }
  .toolbar-filters .lbl-m { display: inline; }
  .toolbar-filters > .icon-btn .count { display: none; }
  .title-count { display: none; }
  .page-board .toolbar h1 { display: none; }
  .page-board .toolbar > .segmented { padding: 3px; overflow-x: auto; scrollbar-width: none; }
  .page-board .toolbar > .segmented a { flex: 1 1 0; min-width: 0; text-align: center; padding: 9px 3px; font-size: 13px; white-space: nowrap; }
  .toolbar h1, .toolbar > .muted, .toolbar > .spacer { display: none; }
  .toolbar-filters .filters input[type=search] { order: 1; flex: 1 1 0; width: auto; min-width: 0; max-width: none; height: 44px; }
  .toolbar > a.btn-primary { order: 2; }
  .toolbar details.view-menu { order: 3; position: static; }
  .tool-group > form { order: 4; margin: 0; }
  .toolbar .t-ico { display: none; }
  .toolbar > a.btn-primary, .toolbar details.view-menu summary.btn, .tool-group > form .btn {
    width: 44px; height: 44px; padding: 0; justify-content: center; font-size: 21px; line-height: 1; }
  .toolbar .lbl { display: none; }
  .toolbar .plus { font-size: 26px; font-weight: 400; margin-top: -2px; }
  .toolbar .ico-m { display: inline; }
  .toolbar > .segmented { order: 5; flex: 1 0 100%; display: flex; }
  .toolbar > .segmented a { flex: 1 1 auto; text-align: center; padding: 9px 9px; font-size: 13px; white-space: nowrap; }
  /* «Фильтры» и «Избранное» — пополам на своей строке: иначе раскрытые фильтры подтягивали в неё первый список,
     и «Избранное» сжималось до 40 px, текст налезал на «Фильтры» (скриншот 02.11.2026) */
  .filters-toggle { display: inline-flex; order: 6; flex: 1 1 calc(50% - 4px); justify-content: center; padding: 8px 4px; font-size: 13px;
    background: transparent; border-color: transparent; color: var(--muted); }
  .toolbar .fav-filter { order: 6; flex: 1 1 calc(50% - 4px); justify-content: center; padding: 8px 4px; font-size: 13px; height: auto; border-color: var(--line); background: var(--surface);
    min-width: 0; white-space: nowrap; overflow: hidden; }
  .toolbar .fav-filter .t-ico { display: inline; width: 15px; height: 15px; }
  .toolbar .fav-filter .lbl-m { display: inline; }

  /* Остальные фильтры и «Скачать в Excel» — по кнопке «Фильтры» */
  .page-board:not(.filters-open) .toolbar-filters .filters select.input,
  .page-board:not(.filters-open) .toolbar-filters .filters .btn,
  .page-board:not(.filters-open) .toolbar-filters > .btn { display: none; }
  .toolbar-filters .filters select.input { order: 7; flex: 1 1 calc(50% - 4px); width: auto; min-width: 0; max-width: none; }
  .toolbar-filters .filters .btn { order: 7; flex: 1 0 100%; }
  .toolbar-filters > .btn { order: 8; flex: 1 1 calc(50% - 4px); justify-content: center; }
  .toolbar.toolbar-filters > details.export-menu { order: 8; flex: 1 1 calc(50% - 4px); position: static; }  /* .toolbar > details.menu выше — это значки ⚙/↻, сюда они не относятся */
  .toolbar.toolbar-filters > details.export-menu summary.btn { width: 100%; height: auto; padding: 9px 14px; font-size: 14px; justify-content: center; }
  .page-board:not(.filters-open) .toolbar.toolbar-filters > details.export-menu { display: none; }
  .input, select.input, input[type=search] { font-size: 16px; }  /* крупнее 16 px — телефон не приближает страницу при вводе */

  /* Доска: кнопки по стадиям сверху (цвета колонок), под ними дела выбранной стадии вертикальным списком */
  .stage-tabs { order: 9; flex: 1 0 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 5px;
    position: sticky; top: 88px; z-index: 15; padding: 6px 0; background: var(--bg); }
  .stage-tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 58px; padding: 6px 1px;
    border: 1px solid var(--line); border-top: 4px solid var(--c); border-radius: 10px; background: var(--surface); color: var(--muted);
    font: inherit; font-size: 10.5px; font-weight: 600; line-height: 1.15; letter-spacing: -.01em; text-align: center; cursor: pointer; }
  .stage-tab-count { font-size: 19px; font-weight: 700; color: var(--c); line-height: 1; }
  .stage-tab.active { background: var(--c); border-color: var(--c); color: #fff; }
  .stage-tab.active .stage-tab-count { color: #fff; }
  .stage-tab[data-empty]:not(.active) { opacity: .55; }
  #refresh-note { order: 10; flex: 1 0 100%; margin: 0; }
  .board { order: 11; flex: 1 0 100%; }
  .board.has-tabs { display: block; overflow: visible; margin: 0; padding: 0 0 14px; scroll-snap-type: none; }
  .board.has-tabs .column { display: flex; width: auto; max-width: none; margin: 0 0 10px; }
  .board.has-tabs .column.tab-hidden { display: none; }

  /* Прежняя лента колонок остаётся, если скрипт не загрузился */
  .board { margin: 0 -12px; padding: 0 12px 14px; gap: 10px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
  .column { flex: 0 0 88vw; min-width: 0; max-width: 380px; scroll-snap-align: center; }
  .column-head { padding: 12px 12px 6px; }
  .add { width: 32px; height: 32px; }
  .card .btn, .card button { min-height: 36px; }
  /* «По судам и ФССП» и «Таблица»: стоят в общем списке после переключателя вида (без order они вставали выше поиска)
     и на телефоне перестраиваются из широких таблиц в вертикальные блоки без горизонтальной прокрутки */
  .graph-wrap { order: 11; flex: 1 0 100%; height: 66vh; min-height: 420px; }
  .graph-hint { display: none; }
  .toolbar > .segmented a { font-size: 12.5px; padding: 9px 6px; }
  .matrix-wrap, .table-wrap { order: 11; flex: 1 0 100%; margin: 0; padding: 0; overflow: visible; border: 0; border-radius: 0; background: none; }

  .matrix { display: block; min-width: 0; }
  .matrix-row.matrix-head { display: none; }
  .matrix-row { display: block; margin: 0 0 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
  .m-court { position: static; padding: 12px 14px; background: var(--surface-2); border-top: 0; align-items: center; justify-content: space-between; }
  .m-cell { margin: 0; padding: 10px 8px; border-top: 1px solid var(--line); }
  .m-cell.m-empty { display: none; }
  .m-cell::before { content: ""; display: block; padding: 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--c); }
  .m-cell.stage-prep::before { content: "Досудебное урегулирование"; }
  .m-cell.stage-first::before { content: "1 инстанция"; }
  .m-cell.stage-appeal::before { content: "Апелляция"; }
  .m-cell.stage-cassation::before { content: "Кассация"; }
  .m-cell.stage-enforcement::before { content: "Исполнение"; }
  .m-cell.stage-closed::before { content: "Закрытые"; }
  .m-cell .card { margin: 0; }

  .cases-table { display: block; min-width: 0; font-size: 14px; }
  .cases-table thead { display: none; }
  .cases-table tbody { display: block; margin: 0 0 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
  .cases-table tbody[hidden] { display: none; }
  .cases-table tr { display: block; }
  .tgroup-head th { display: block; }
  .cases-table tr.trow { display: flex; flex-direction: column; position: relative; padding: 12px 14px 12px 46px; border-top: 1px solid var(--line); }
  .cases-table td { display: block; padding: 0; border: 0; min-width: 0; max-width: none; width: auto; margin-top: 6px; }
  .trow:hover td, .trow.overdue td { background: none; }
  .trow.overdue { background: color-mix(in srgb, var(--danger) 5%, var(--surface)); }
  .trow .c-fav { position: absolute; left: 6px; top: 6px; margin: 0; }
  .trow .c-court { order: -1; margin: 0; color: var(--muted); font-size: 13px; }
  .trow .c-case { margin-top: 2px; }
  .trow .c-status::before, .trow .c-event::before { display: block; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
  .trow .c-status::before { content: "Состояние"; }
  .trow .c-event::before { content: "Ближайшее событие"; }
  .trow .c-parties:empty, .trow .c-new:empty { display: none; }
  .trow .c-court.is-empty, .trow .c-status.is-empty { display: none; }  /* на телефоне «—» без подписи только мешает */

  /* Прочее: формы и карточки без боковых полей, диалоги на всю ширину */
  .form-card, .panel { padding: 14px; }
  .btn { padding: 9px 14px; }
  dialog { max-width: calc(100vw - 24px); width: calc(100vw - 24px); }
  img, table, pre { max-width: 100%; }
  table { display: block; overflow-x: auto; }
  code, .mono { overflow-wrap: anywhere; }

  /* Страница дела: шапка в столбик, три кнопки в ряд на всю ширину, всё в одну колонку — ничего не шире экрана */
  .detail-head { gap: 10px; margin-bottom: 12px; }
  .detail-head h1 { font-size: 23px; }
  .detail-title { flex: 1 1 100%; }
  .head-actions { width: 100%; flex-wrap: nowrap; }
  .head-actions > form, .head-actions > details { flex: 1 1 0; min-width: 0; }
  .head-actions .btn, .head-actions summary.btn { width: 100%; justify-content: center; padding: 9px 4px; font-size: 13px; line-height: 1.2; white-space: normal; }
  .stepper { padding: 12px 2px; }
  .step { font-size: 10px; padding-left: 1px; padding-right: 1px; overflow-wrap: anywhere; hyphens: auto; }  /* «урегулирование» не налезает на соседа */
  .step small { font-size: 10px; }
  .case-hero, .cols { grid-template-columns: minmax(0, 1fr); }
  .next-card { padding: 16px; }
  .next-card h2 { font-size: 19px; }
  .next-card .row form, .next-card .row > .btn { flex: 1 1 auto; }
  .next-card .row .btn { width: 100%; justify-content: center; }
  .next-card .row details { flex: 1 1 100%; }
  .next-card .row details summary.btn { width: 100%; justify-content: center; }
  .tabs-wrap { margin: 0 -12px 14px; }
  .tabs { margin: 0; padding: 0 12px; scroll-padding: 0 44px; }
  /* Не все разделы поместились: край ленты тает, стрелка ведёт дальше. Классы more-left и more-right ставит detail_tabs.js */
  .tabs-wrap.more-right .tabs { -webkit-mask-image: linear-gradient(to left, transparent 30px, #000 72px); mask-image: linear-gradient(to left, transparent 30px, #000 72px); }
  .tabs-wrap.more-left .tabs { -webkit-mask-image: linear-gradient(to right, transparent 30px, #000 72px); mask-image: linear-gradient(to right, transparent 30px, #000 72px); }
  .tabs-wrap.more-left.more-right .tabs { -webkit-mask-image: linear-gradient(to right, transparent 30px, #000 72px, #000 calc(100% - 72px), transparent calc(100% - 30px));
    mask-image: linear-gradient(to right, transparent 30px, #000 72px, #000 calc(100% - 72px), transparent calc(100% - 30px)); }
  .tabs-wrap.more-left .tabs-more.prev, .tabs-wrap.more-right .tabs-more.next { display: flex; }
  .panel-head { flex-wrap: wrap; gap: 8px; }
  /* «Путь дела по судам»: заголовок на своей строке, кнопки под ним двумя равными колонками (одна кнопка занимает всю ширину) */
  .chain-head { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chain-head h2 { grid-column: 1 / -1; }
  .chain-head > :nth-child(2):last-child { grid-column: 1 / -1; }
  .chain-head .find-instances { display: flex; }
  .chain-head .find-instances .btn { flex: 1; }
  .chain-head .btn { width: 100%; box-sizing: border-box; justify-content: center; text-align: center; white-space: normal; line-height: 1.25; padding: 9px 8px; }
  .inst > summary { flex-wrap: wrap; position: relative; padding: 10px 30px 10px 12px; }
  .inst .chev { position: absolute; right: 12px; top: 12px; }  /* иначе шеврон уезжает на отдельную строку */
  .inst .res { flex: 1 1 100%; max-width: none; text-align: left; padding-left: 22px; }
  .inst .body { padding-left: 12px; }
  .enf-head { flex-wrap: wrap; }  /* ФССП: название ОСП на всю ширину, статус и кнопки — строкой под ним */
  .enf-head > div:first-child { flex: 1 1 100%; }
  .enf-head .row-actions { margin-left: auto; }
  .kv, .about { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt, .about dt { margin-top: 6px; }
  .explain, .timeline li, .comments li > div { overflow-wrap: anywhere; }
  .contact-row { grid-template-columns: 1fr; gap: 0; }
  .contact-row .contact-name, .contact-row .contact-phones { grid-column: 1; }
  .contact-row .contact-name:empty { display: none; }
  .suggest-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .suggest-row form { flex-wrap: wrap; }
  .suggest-row form .btn { flex: 1 1 auto; justify-content: center; }
  .rows li { flex-wrap: wrap; row-gap: 8px; }
  .rows li > div:first-child { flex: 1 1 100%; min-width: 0; overflow-wrap: anywhere; }
  .row-actions { flex-wrap: wrap; max-width: 100%; }
  .chip { white-space: normal; max-width: 100%; }  /* длинный результат заседания переносится, а не растягивает страницу */
  .lower-actions { grid-template-columns: minmax(0, 1fr); }
  .lower-manual, .lower-auto { min-width: 0; }
  .status-help, .small, .muted { overflow-wrap: anywhere; }

  /* Все всплывающие окна (⋯, ✎, ⚙, заметка) — «шторкой» у нижнего края: не обрезаются и не вылезают за экран */
  .menu-pop, .menu-pop.down, .menu-pop.right, .note-pop, .fields-pop {
    position: fixed; left: 12px; right: 12px; top: auto; bottom: 12px; width: auto; max-width: none;
    max-height: 72vh; overflow: auto; z-index: 60; transform: none; box-shadow: 0 -8px 32px rgba(20, 24, 36, .28); }

  /* Подсказки (i): на телефоне наведения нет, показываем окошком у нижнего края по нажатию */
  .info-pop { position: fixed; left: 12px; right: 12px; bottom: 12px; top: auto; width: auto; max-width: none; transform: none; }
  .info:hover .info-pop, .info:focus .info-pop, .info:focus-within .info-pop { transform: none; }
}

@media (hover: none) { #note-tip { display: none !important; } }

/* Значки-кнопки в меню: перекрывают общий вид .menu summary (рамка и белый фон) */
.menu > summary.btn.icon-btn { width: auto; min-width: 36px; height: 36px; display: inline-flex; padding: 0 9px; border-color: transparent; background: transparent; color: var(--muted); }
.menu > summary.btn.icon-btn:hover, .menu[open] > summary.btn.icon-btn { background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text); }
/* Число на значке (избранное, закрытые): без плашки, иначе оно вылезает за подсветку кнопки */
.icon-btn .count { min-width: 0; margin: 0; padding: 0; border: 0; background: none; font-size: 12.5px; vertical-align: 0; color: inherit; }
.tool-group .fav-filter.on, .tool-group .fav-filter.on:hover { border-color: transparent; background: color-mix(in srgb, var(--c-deadline) 13%, transparent); color: var(--c-deadline); }
.tool-group .fav-filter.on .fav-star { color: var(--c-deadline); }

/* Аналитика владельца (/ops/analytics/) */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 0 0 18px; }
.kpi { display: grid; gap: 2px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.kpi b { font-size: 30px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi span { font-weight: 600; } .kpi small { color: var(--muted); font-size: 12.5px; }
.funnel-row { display: grid; grid-template-columns: minmax(150px, 1.2fr) 2fr 48px; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.funnel-row:first-of-type { border-top: 0; }
.funnel-label { display: grid; font-size: 14px; } .funnel-label small { color: var(--muted); font-size: 12px; }
.funnel-bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.funnel-bar i { display: block; height: 100%; background: var(--primary); border-radius: 4px; }

/* Дело ждёт карточку суда (подана жалоба, суд ещё не зарегистрировал): серая карточка с мягким переливом */
.card.waiting { background: linear-gradient(100deg, var(--surface-2) 35%, color-mix(in srgb, var(--surface) 75%, var(--surface-2)) 50%, var(--surface-2) 65%);
  background-size: 260% 100%; animation: card-shimmer 2.8s ease-in-out infinite; box-shadow: none; }
@keyframes card-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .card.waiting { animation: none; } }
.card.waiting .card-line.mono { color: var(--muted); }
.await-pill { justify-self: start; display: inline-block; max-width: 100%; margin: 2px 0; padding: 3px 10px 3px 8px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 12.5px; line-height: 1.3; }
.await-pill b { color: var(--text); font-weight: 600; }
.await-pill .pulse { width: 7px; height: 7px; margin-right: 6px; vertical-align: 1px; }

/* Следующий шаг прямо со страницы дела */
.step-pop { min-width: 300px; padding: 12px; }
.step-pop form { display: grid; gap: 6px; margin: 0; }
.step-pop .field-label { margin-top: 4px; font-size: 13px; font-weight: 600; }

/* Уведомления: настройки слева, справа живой пример сообщения */
.notify-page { max-width: 1040px; }
.digest-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
.notify-preview { position: sticky; top: 84px; display: grid; gap: 8px; margin-top: 18px; }
.preview-label { margin: 0; font-size: 13px; font-weight: 600; }
.preview-msg { padding: 14px 16px; border-radius: 14px; background: #1c2333; color: #e9ecf3; font-size: 13.5px; line-height: 1.5;
  box-shadow: 0 10px 30px -18px rgba(20, 24, 36, .6); }
.preview-msg p { margin: 0; } .preview-msg [hidden] { display: none !important; }
.preview-msg .pv-title { font-weight: 600; margin-bottom: 2px; }
.preview-msg .pv-time { margin-left: 6px; padding: 0 6px; border-radius: 6px; background: rgba(255, 255, 255, .12); font-size: 12px; font-weight: 500; }
.preview-msg .pv-gap, .preview-msg [data-part="changes"] > p + p, .preview-msg .pv-group { margin-top: 10px; }
.preview-msg .pv-h { font-weight: 600; }
.preview-msg .pv-dim { color: #aeb6c7; }
.preview-msg .pv-foot { margin-top: 10px; color: #8e97ab; font-size: 12.5px; }
.preview-note { margin: 0; font-size: 12.5px; color: var(--muted); }
.preview-note[hidden] { display: none; }
@media (max-width: 960px) {
  .digest-grid { grid-template-columns: 1fr; gap: 8px; }
  .notify-preview { position: static; }
}

/* Следующий шаг в «Что дальше», когда заголовок карточки занят другим (поиск иска, заседание, срок) */
.step-plaque { display: grid; gap: 2px; margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; background: var(--surface);
  border: 1px solid var(--line); border-left: 3px solid var(--primary); }
.step-plaque.late { border-left-color: var(--danger); }
.step-plaque-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.step-plaque p { margin: 0; font-size: 15px; line-height: 1.45; }
.step-plaque.late b { color: var(--danger); }
.step-pop textarea.input { resize: vertical; min-height: 64px; }
/* Шаг правится на месте: текст плашки → поле того же вида, снизу дата и кнопки */
.step-view { margin: 0; font-size: 15px; line-height: 1.45; cursor: text; border-radius: 6px; padding: 2px 4px; margin-left: -4px; }
.step-view:hover, .step-view:focus-visible { background: color-mix(in srgb, var(--primary) 6%, transparent); outline: none; }
.step-pen { margin-left: 8px; color: var(--muted); font-size: 13px; opacity: 0; transition: opacity .15s ease; }
.step-view:hover .step-pen, .step-view:focus-visible .step-pen { opacity: 1; }
.step-late { color: var(--danger); font-size: 12.5px; font-weight: 600; }
.step-text { width: 100%; box-sizing: border-box; margin: 0 0 0 -4px; padding: 2px 4px; border: 0; border-radius: 6px; resize: none; overflow: hidden;
  font: inherit; font-size: 15px; line-height: 1.45; color: var(--text); background: color-mix(in srgb, var(--primary) 6%, var(--surface));
  outline: 2px solid color-mix(in srgb, var(--primary) 35%, transparent); }
.step-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.step-edit[hidden] { display: none; }
.step-date { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.step-date .input { width: auto; padding: 5px 8px; font-size: 13px; }
.step-plaque.editing { border-left-color: var(--primary); }

.step-date-line { display: block; }
.step-plaque-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.step-edit-btn { border: 0; background: none; padding: 2px 6px; border-radius: 6px; font: inherit; font-size: 13px; font-weight: 600; color: var(--primary); cursor: pointer; }
.step-edit-btn:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.step-edit-btn[hidden] { display: none; }
.step-pen { display: none; }
/* Кнопки «Что дальше»: слева стадия дела, справа ссылка на суд */
.case-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 16px; }
.act-group { display: grid; gap: 4px; }
.act-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.act-side { display: flex; flex-wrap: wrap; gap: 8px; }
/* В режиме «Сразу» блок «Что в сводке» приглушён: он для ежедневной сводки */
.digest-parts.is-off .check { opacity: .55; }
.digest-parts.is-off .check:hover { opacity: .85; }
.digest-off-note { margin: -2px 0 6px; }
.digest-off-note[hidden] { display: none; }

/* Оформления (скины) задают .btn рамку и фон — значки шапки и «Фильтры» должны оставаться тихими во всех скинах,
   иначе при смене оформления кнопки меняют размер и «прыгают». Специфичность выше, чем у [data-skin] .btn */
html[data-skin] .btn.icon-btn, html[data-skin] .menu > summary.btn.icon-btn, html[data-skin] .btn.filters-toggle {
  border-color: transparent; background: transparent; box-shadow: none; }
html[data-skin] .btn.icon-btn:hover, html[data-skin] .menu[open] > summary.btn.icon-btn {
  background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text); }
html[data-skin] .icon-btn .count { font-family: inherit; font-size: 12.5px; font-weight: 600; }
@media (max-width: 720px) {
  html[data-skin] .toolbar .btn.fav-filter { border-color: var(--line); background: var(--surface); }
}
/* Скины A и B делают .chip прозрачным: «N нов.» (белый текст на основном цвете) становился невидимым */
html[data-skin] .chip.chip-new { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
/* «В избранное» не ломается после «В» на узком экране */
.head-actions .btn.fav-btn { white-space: nowrap; }
/* Доска на компьютере: у всех колонок шапка на две строки, иначе длинное название («Досудебное урегулирование»,
   «Исполнение (ФССП)») делает одну шапку выше остальных и карточки в колонках начинаются на разной высоте */
@media (min-width: 721px) {
  html .board .column-head { align-items: center; }
  .board .column-head h2 { display: flex; align-items: center; min-height: 2.6em; line-height: 1.3; margin: 0; }
}

/* Таблица: сворачиваемые группы-стадии */
.tgroup-toggle { display: inline-flex; align-items: center; gap: 8px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.tgroup-toggle .count { margin-left: 0; }
.tgroup-chev { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s ease; }
.tgroup.collapsed .tgroup-chev { transform: rotate(-90deg); }
.tgroup-toggle:hover .tgroup-chev { stroke: var(--text); }
.cases-table:not(.is-filtering) .tgroup.collapsed > tr.trow { display: none; }

/* Карточка: значки в верхней строке не тянутся по высоте звёздочки; заметка — тихий значок без плашки; «N нов.» — аккуратная пилюля */
.card-top { align-items: center; }
html .card-top .chip.chip-note, html .trow .chip.chip-note { display: inline-flex; align-items: center; padding: 0 2px; border: 0; background: none; box-shadow: none; color: var(--c-deadline); line-height: 0; }
html .card-top .chip.chip-note .clip, html .trow .chip.chip-note .clip { width: 17px; height: 17px; }
html .card-top .chip.chip-new, html .trow .chip.chip-new { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; border: 0; font-size: 11.5px; font-weight: 700; line-height: 1; letter-spacing: 0; text-transform: none; white-space: nowrap; }

/* Заметка: металлическая скрепка, «держит» карточку за верхний край строки */
:root { --clip-wire: #8d93a0; --clip-shine: #e9ecf2; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --clip-wire: #a9b0bf; --clip-shine: #f3f5fa; } }
:root[data-theme="dark"] { --clip-wire: #a9b0bf; --clip-shine: #f3f5fa; }
.clip .clip-wire { stroke: var(--clip-wire); }
.clip .clip-shine { stroke: var(--clip-shine); opacity: .85; transform: translate(-.35px, -.2px); }
html .card-top .chip.chip-note .clip { width: 11px; height: 30px; margin: -12px 2px -4px; filter: drop-shadow(0 1px .6px rgba(20, 24, 36, .25)); }
html .trow .chip.chip-note .clip { width: 9px; height: 24px; filter: drop-shadow(0 1px .6px rgba(20, 24, 36, .25)); }

/* Удаление дела */
.menu-pop a.menu-item.menu-danger, .menu-item.menu-danger { color: var(--danger); }
.delete-page .delete-list { margin: 6px 0 14px; padding-left: 20px; line-height: 1.7; }
.delete-page .delete-alt { margin: 16px 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.delete-page .delete-alt p { margin: 0 0 10px; }
.delete-page .delete-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.btn.btn-delete, html[data-skin] .btn.btn-delete { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.btn-delete:hover { filter: brightness(1.08); }

/* Вход, регистрация, пароль: ссылка «На главную» над карточкой, логотип ведёт на главную */
.auth { align-content: center; gap: 12px; }
.auth-home { justify-self: center; width: 100%; max-width: 400px; color: var(--muted); font-size: 14px; text-decoration: none; }
.auth-home:hover { color: var(--text); }
.auth-card a.brand { color: inherit; text-decoration: none; }

/* /ops: пользователи с активностью */
.ops-people { margin-bottom: 18px; }
.ops-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0 0 16px; }
.ops-stats span { display: grid; gap: 2px; padding: 14px 16px; border-radius: 14px; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--muted); font-size: 13.5px; line-height: 1.3; }
.ops-stats b { color: var(--text); font-size: 32px; line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
.ok-mark { color: var(--c-ok); font-weight: 600; }
.ops-people + .ops-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.ops-people + .ops-grid > div { display: contents; }

/* Письма Почты России */
.letter-add { display: grid; grid-template-columns: 1.2fr 1fr 1.2fr; gap: 8px 10px; align-items: end; margin: 0 0 14px; }
.letter-add .lf-row { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1.4fr 150px auto; gap: 10px; align-items: end; }
.letter-add .lf-help { grid-column: 1 / -1; margin: 0; }
.letter-add label { display: grid; gap: 4px; }
.letters .letter-due { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 4px; }
.letters .letter-due form { margin: 0; }
.letters .letter-history summary { cursor: pointer; color: var(--muted); }
.letters .letter-history ol { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 2px; }
.rows.letters .letter-history li { display: list-item; border: 0; padding: 0; }
.letters .danger { color: var(--danger); }
.rows.letters > li { align-items: flex-start; }
.letters .letter-body { flex: 1; min-width: 0; }
.letter-sum, .lf-help-toggle { display: none; }
@media (max-width: 720px) {
  .letter-add { grid-template-columns: 1fr; }
  .letter-add .lf-row { grid-template-columns: 1fr; }
  .letter-add .btn { justify-self: start; }
  /* Письмо в столбик. Не flex: вместе с flex-wrap и основой 100% из общих .rows кнопки уезжали во второй столбец за экран */
  .rows.letters > li { display: block; padding: 0; }
  .letters .letter-body { padding: 10px 0 0; overflow-wrap: anywhere; }
  .rows.letters .row-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px 0 14px; }
  .rows.letters .row-actions .btn { width: 100%; min-height: 44px; box-sizing: border-box; justify-content: center; text-align: center; white-space: normal; }
  /* Сворачивание работает только со скриптом (html.folds из detail_tabs.js); без него письма и справка раскрыты */
  .folds .letter-sum { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 2px 8px; align-items: center; width: 100%; min-height: 60px;
    padding: 10px 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
  .letter-sum::before { content: "▸"; grid-row: 1; grid-column: 1; color: var(--muted); }
  .letters > li.open .letter-sum::before { content: "▾"; }
  .letter-sum .ls-who { grid-column: 2; font-weight: 600; overflow-wrap: anywhere; }
  .letter-sum .chip { grid-column: 3; grid-row: 1; white-space: nowrap; }
  .letter-sum .ls-what, .letter-sum .ls-note { grid-column: 2 / -1; overflow-wrap: anywhere; }
  .folds .letters > li:not(.open) > .letter-body, .folds .letters > li:not(.open) > .row-actions { display: none; }
  .folds .letters > li.open > .letter-body { padding: 0 0 0 22px; }
  .folds .letters .letter-who { display: none; }  /* уже есть в строке письма */
  .folds .lf-help-toggle { display: inline-flex; align-items: center; justify-self: start; min-height: 44px; padding: 0; border: 0; background: none;
    color: var(--primary); font: inherit; font-size: 14px; cursor: pointer; }
  .lf-help-toggle::before { content: "▸"; margin-right: 6px; }
  .lf-help-toggle[aria-expanded="true"]::before { content: "▾"; }
  .folds .lf-help:not(.open) { display: none; }
}

/* Вид «Шаги»: следующие шаги всех дел списком по датам */
.seg-short { display: none; }
.steps-view { display: grid; gap: 14px; }
.steps-group { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.steps-group[hidden] { display: none; }
.steps-head { display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 14px; font-size: 14px; font-weight: 600; background: var(--surface-2); }
.steps-late .steps-head { color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.steps-group ul { list-style: none; margin: 0; padding: 0; }
.step-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) minmax(180px, 300px) 200px; gap: 14px; align-items: start; padding: 10px 14px; border-top: 1px solid var(--line); cursor: pointer; font-size: 14px; }
.step-row[hidden] { display: none; }
.step-row:hover { background: var(--surface-2); }
.step-row small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.steps-late .step-when b { color: var(--danger); }
.step-stage { justify-self: end; white-space: nowrap; }
@media (max-width: 720px) {
  .page-board > .steps-view { flex: 1 0 100%; order: 10; }
  .seg-full { display: none; }
  .seg-short { display: inline; }
  .step-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; }
  .step-when { grid-column: 1; }
  .step-stage { grid-column: 2; grid-row: 1; }
  .step-what, .step-case { grid-column: 1 / -1; }
}
.ops-letters .danger { color: var(--danger); }

/* страница «Тариф и оплата» */
.bill-count { font-size: 18px; margin: 0 0 8px; } .bill-count b { font: 700 30px var(--serif); }
.bill-periods { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.bill-tiers { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.bill-tiers li { border: 1px solid var(--line, #e4e0d4); border-radius: 10px; padding: 0; }
.bill-tiers .row, .bill-tiers a { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; color: inherit; text-decoration: none; border-radius: 10px; }
.bill-tiers a:hover { background: var(--surface-2); }
.bill-tiers li.off { opacity: .55; }
.bill-tiers li.current { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, transparent); }

/* Переключатель вида на узких телефонах: отступы уменьшаются, чтобы все пять вкладок помещались целиком */
@media (max-width: 400px) {
  .toolbar > .segmented a, .page-board .toolbar > .segmented a { padding: 9px 6px; font-size: 12.5px; }
}
@media (max-width: 340px) {
  .toolbar > .segmented a, .page-board .toolbar > .segmented a { padding: 9px 3px; font-size: 12px; }
}

/* ---------- Календарь: виды «неделя», «день», «список»; нажатие на день открывает день ---------- */
.cal-day { position: relative; }
.cal-open { position: absolute; inset: 0; z-index: 0; }
.cal-open:hover { background: color-mix(in srgb, var(--primary) 5%, transparent); }
.cal-day .ev, .cal-day .ev-more { position: relative; z-index: 1; }
.cal-day .cal-add { z-index: 1; }
.cal-main { min-width: 0; }
.wk { display: grid; gap: 10px; }
.wk-day, .day-view, .lst-day { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; align-content: start; }
.wk-day.today, .day-view.today { box-shadow: inset 0 0 0 2px var(--primary); }
.wk-day.off, .day-view.off { background: var(--surface-2); }
.wk-day header, .day-head { display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; }
.day-head .muted { white-space: nowrap; }
.wk-title { color: var(--text); font-size: 15px; text-decoration: none; }
.wk-title b { text-transform: capitalize; }
.wk-today { font-size: 11px; font-weight: 700; color: var(--primary); }
.wk-day header .cal-add { margin-left: auto; position: static; opacity: 1; width: 28px; height: 28px; font-size: 18px; }
.day-head h2 { margin: 0; font: 700 20px var(--serif); }
.ev-full, .cal-day button.ev { border: 0; border-left: 3px solid var(--c-step); }
.ev-full.own, .cal-day button.ev.own { border-left-color: var(--stage-appeal); }
.ev-full { white-space: normal; font-size: 14px; line-height: 1.35; padding: 8px 10px; text-align: left; width: 100%; font-family: inherit; cursor: pointer; }
.ev-full small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.lst { display: grid; gap: 10px; }
.lst-day h3 { margin: 0 0 4px; font-size: 15px; } .lst-day h3 a { color: var(--text); }
.lst-day .agenda { gap: 8px; }
@media (min-width: 1200px) { .wk { grid-template-columns: repeat(7, minmax(0, 1fr)); } .wk-day { padding: 8px; } .ev-full { font-size: 12.5px; padding: 6px 8px; } }
@media (max-width: 720px) {
  .cal-day { min-height: 62px; }
  .cal-day .ev { pointer-events: none; font-size: 0; line-height: 0; height: 7px; min-height: 0; padding: 0; border-left-width: 0; border-radius: 4px; }
  .cal-day .ev-more { pointer-events: none; font-size: 10px; }
  .cal-day .cal-add { display: none; }
}

/* Календарь на телефоне: три ровных ряда. Виды на четыре равные части, стрелки одинаковые, нижние кнопки одной ширины и высоты */
@media (max-width: 720px) {
  .cal-toolbar { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; align-items: stretch; }
  .cal-toolbar > h1, .cal-toolbar > .spacer { display: none; }
  .cal-toolbar > .segmented { grid-column: 1 / -1; display: grid; flex: none; gap: 2px; }
  .cal-toolbar > .cal-views { order: 1; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cal-toolbar > .cal-nav { order: 2; grid-template-columns: 56px minmax(0, 1fr) 56px; }
  .cal-toolbar > .segmented a { flex: none; width: auto; display: flex; align-items: center; justify-content: center; text-align: center; padding: 10px 4px; min-height: 40px; box-sizing: border-box; }
  .cal-toolbar > .btn { order: 3; display: flex; align-items: center; justify-content: center; height: 44px; padding: 0 8px; box-sizing: border-box; white-space: nowrap; }
  .cal-toolbar.acts-3 > .btn { grid-column: span 2; }
  .cal-toolbar.acts-2 > .btn { grid-column: span 3; }
}

.icon-btn.is-off { opacity: .35; pointer-events: none; cursor: default; }
/* Неактивная шестерёнка (вид «Шаги») стоит там же и такая же, как рабочая: панель не «прыгает» между видами */
@media (max-width: 720px) {
  .toolbar .tool-group > .icon-btn.is-off { order: 3; display: inline-flex; width: 44px; height: 44px; padding: 0; justify-content: center; font-size: 21px; line-height: 1; }
}

/* Карточки сбоку: между текстом и кнопкой/полем всегда есть воздух */
.panel > p.small + form,
.panel > p.small + .input,
.panel > p.small + .cal-links,
.panel > .input + .help,
.panel > .help + form { margin-top: 12px; }
.panel > p.small + p.small { margin-top: 8px; }

/* Служебная зона на телефоне: обычные кнопки с текстом в ряд и с зазором (общие правила .toolbar делают display: contents и
   «основную» кнопку квадратом 44 px под «+ Новое дело», из-за этого «Аналитика» сжималась и текст вылезал) */
@media (max-width: 720px) {
  .toolbar.ops-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; margin-bottom: 14px; }
  .toolbar.ops-bar > a.btn, .toolbar.ops-bar > a.btn-primary { order: 0; width: auto; height: auto; min-height: 36px; padding: 8px 14px; font-size: 14px;
    justify-content: center; line-height: 1.2; flex: 0 1 auto; }
  .toolbar.ops-bar > .muted { display: block; flex: 1 0 100%; order: 9; }
  .toolbar.ops-bar > .spacer { display: block; flex: 1 0 100%; height: 0; order: 0; margin: -4px 0; }  /* перенос: назад — на своей строке, периоды — на следующей */
}

/* Кнопка привязки Telegram в служебной зоне: свой ряд с воздухом сверху и снизу, а не вплотную к строкам */
.ops-letters .ops-link-form { display: block; margin: 10px 0; }

/* Раздел «Оплата» в настройках: строки «название — значение» */
.bill-sum { margin: 0 0 10px; }
.bill-sum > div { display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line, rgba(128,128,128,.25)); }
.bill-sum dt { color: var(--muted, #6b7280); }
.bill-sum dd { margin: 0; text-align: right; font-weight: 600; }
.bill-sum .warn { color: var(--danger, #b42318); font-weight: 600; }
@media (max-width: 520px) { .bill-sum > div { flex-direction: column; } .bill-sum dd { text-align: left; } }

/* Настройки: раскрывающиеся разделы */
.set-acc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-top: 14px; }
.set-acc > summary { display: flex; align-items: center; gap: 12px; padding: 16px 22px; cursor: pointer; list-style: none; min-height: 52px; }
.set-acc > summary::-webkit-details-marker { display: none; }
.set-acc > summary::after { content: ""; flex: none; width: 8px; height: 8px; margin-left: 4px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
.set-acc[open] > summary::after { transform: rotate(-135deg); }
.set-acc > summary:hover { background: var(--surface-2); border-radius: var(--radius); }
.set-title { font-size: 17px; font-weight: 600; }
.set-hint { margin-left: auto; color: var(--muted); font-size: 13px; text-align: right; }
.set-body { padding: 4px 22px 22px; }
.set-acc[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.set-acc[open] > .set-body, .set-acc[open] > form.set-body { padding-top: 16px; }
@media (max-width: 520px) { .set-acc > summary { padding: 14px 16px; } .set-body { padding: 4px 16px 18px; } .set-hint { font-size: 12px; } }

/* «Тариф и оплата»: выбор срока и явная кнопка «Оплатить» */
.bill-periods { flex-direction: column; align-items: stretch; gap: 14px; }
.bill-choices { display: flex; flex-wrap: wrap; gap: 10px; }
.bill-choice { position: relative; cursor: pointer; }
.bill-choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.bill-choice span { display: block; padding: 10px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-size: 14px; min-height: 44px; line-height: 22px; }
.bill-choice input:checked + span { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); font-weight: 600; }
.bill-choice input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-pay { align-self: flex-start; min-height: 48px; padding: 0 28px; font-size: 16px; }
@media (max-width: 520px) { .bill-choices { flex-direction: column; } .btn-pay { align-self: stretch; } }

/* Телефон: «Выйти» с зоной нажатия под палец без изменения высоты шапки; кнопки в «Настройках» и «Тариф и оплата» не ниже 40 px */
@media (max-width: 720px) {
  .topbar-right button.link { position: relative; }
  .topbar-right button.link::after { content: ""; position: absolute; inset: -12px -8px; }
  .set-body .btn, .bill-pay .btn:not(.btn-pay), .bill-state .btn { min-height: 40px; }
}
.set-title:last-child { margin-right: auto; } /* раздел без подсказки справа: стрелка у края, как у остальных */

/* Сообщение о cookie на публичных страницах */
.cookie-bar { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 1000; max-width: 760px; margin: 0 auto;
  display: flex; gap: 16px; align-items: center; padding: 14px 18px; border-radius: 14px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: 0 10px 40px rgba(0, 0, 0, .18); }
.cookie-bar[hidden] { display: none; }
.cookie-bar p { margin: 0; font-size: 14px; line-height: 1.45; flex: 1; }
.cookie-bar-actions { display: flex; gap: 8px; flex-shrink: 0; }
.cookie-bar-actions .btn { min-height: 40px; }
@media (max-width: 640px) { .cookie-bar { flex-direction: column; align-items: stretch; } .cookie-bar-actions .btn { flex: 1; } }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline; }
