/* ============================================================
   Legal Operations — Compact Design System
   ============================================================ */

/* 1. TOKENS */
:root {
  --bg: #f5f6f7;
  --panel: #ffffff;
  --border: #e1e4e8;
  --border-strong: #c9cdd2;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;
  --brand: #0f766e;
  --brand-dark: #0a5a54;
  --brand-bg: #f0fdf9;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --success: #059669;
  --success-bg: #f0fdf4;
  --radius: 4px;
  --fs: 13px;
  --container: 1280px;
}

/* 2. RESET + BASE */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: var(--fs);
  color-scheme: light;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.4;
  min-width: 320px;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
p { margin: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }

/* 3. LAYOUT */
.page-wrap {
  max-width: var(--container);
  margin: 0 auto;
  padding: 12px 16px 32px;
}

.page-wrap--auth {
  max-width: 100%;
  padding: 0;
}

/* 4. TOPBAR */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 40px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar__brand {
  font-weight: 700;
  font-size: 13px;
  color: var(--brand);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.topbar__nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.topbar__spacer { flex: 1; }

.topbar__link {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  transition: background 0.1s, color 0.1s;
}

.topbar__link:hover {
  background: var(--bg);
  color: var(--text);
}

.topbar__link--active {
  background: var(--brand-bg);
  color: var(--brand);
}

.topbar__user {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  padding: 0 6px;
}

/* 5. ALERTS */
.alert {
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  border: 1px solid transparent;
  margin-bottom: 10px;
}

.alert--success {
  background: var(--success-bg);
  border-color: #a7f3d0;
  color: #065f46;
}

.alert--error {
  background: var(--danger-bg);
  border-color: #fecaca;
  color: #991b1b;
}

.alert--warning {
  background: var(--warning-bg);
  border-color: #fde68a;
  color: #92400e;
}

.customer-edit-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.9fr);
  gap: 16px;
  align-items: start;
}

.customer-edit-layout__main,
.customer-edit-layout__side {
  min-width: 0;
}

.customer-edit-layout__side {
  display: grid;
  gap: 12px;
}

.customer-side-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

.customer-contact-list {
  display: grid;
  gap: 8px;
}

.customer-contact-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  background: #fcfcfd;
}

.customer-contact-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.customer-contact-card__actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.customer-contact-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--text-muted);
  font-size: 12px;
}

.customer-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.customer-checkbox input {
  margin: 0;
}

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

/* 6. TOOLBAR */
.toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.toolbar__spacer { flex: 1; }

.toolbar__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* 7. BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 28px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius);
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s, opacity 0.1s;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
}

.btn:hover {
  background: var(--bg);
  color: var(--text);
}

.btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn--primary:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}

.btn--danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn--danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #fff;
}

.btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn--ghost:hover {
  background: var(--bg);
  color: var(--text);
}

.btn--sm {
  height: 24px;
  padding: 0 8px;
  font-size: 11px;
}

.btn--full { width: 100%; }

/* 8. PILLS / BADGES */
.pill {
  display: inline-block;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 18px;
}

/* Status pills */
.pill--new      { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }
.pill--taken    { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.pill--in_work  { background: var(--brand-bg); color: var(--brand); border: 1px solid #99f6e4; }
.pill--returned { background: var(--warning-bg); color: var(--warning); border: 1px solid #fde68a; }
.pill--closed   { background: #f9fafb; color: var(--text-faint); border: 1px solid var(--border); }

/* Priority pills */
.pill--high   { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; }
.pill--medium { background: var(--warning-bg); color: var(--warning); border: 1px solid #fde68a; }
.pill--low    { background: #f9fafb; color: var(--text-faint); border: 1px solid var(--border); }

/* Deadline pills */
.pill--danger  { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; }
.pill--warning { background: var(--warning-bg); color: var(--warning); border: 1px solid #fde68a; }
.pill--success { background: var(--success-bg); color: var(--success); border: 1px solid #a7f3d0; }
.pill--muted   { background: #f3f4f6; color: var(--text-muted); border: 1px solid var(--border); }

/* 9. STAT CHIPS */
.stat-chips {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.stat-chip strong {
  color: var(--text);
  font-weight: 600;
}

.stat-chip--danger strong { color: var(--danger); }
.stat-chip--warning strong { color: var(--warning); }

/* 10. QUICK FILTERS */
.qfilters {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.qfilter {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  white-space: nowrap;
}

.qfilter:hover {
  background: var(--bg);
  color: var(--text);
}

.qfilter--active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.qfilter--active:hover {
  background: var(--brand-dark);
  color: #fff;
}

/* 11. FILTER ROW */
.filter-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}

.filter-row input,
.filter-row select {
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  outline: none;
}

.filter-row input:focus,
.filter-row select:focus {
  border-color: var(--brand);
}

.filter-row input { min-width: 180px; }
.filter-row select { min-width: 120px; }

/* 12. ATTENTION BAR */
.attention-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 6px 10px;
  background: var(--warning-bg);
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  font-size: 12px;
  margin-bottom: 10px;
}

.attention-bar__label {
  color: var(--warning);
  font-weight: 600;
  white-space: nowrap;
}

.attention-tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  transition: opacity 0.1s;
}

.attention-tag:hover { opacity: 0.8; }
.attention-tag--danger  { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; }
.attention-tag--warning { background: var(--warning-bg); color: var(--warning); border: 1px solid #fde68a; }
.attention-tag--muted   { background: #f3f4f6; color: var(--text-muted); border: 1px solid var(--border); }

/* 13. CASES TABLE */
.cases-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}

.cases-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.cases-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
  text-align: left;
  white-space: nowrap;
}

.cases-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.cases-table tbody tr:last-child td { border-bottom: none; }

.cases-table tbody tr:hover td { background: #f9fafb; }

.cases-table tbody tr { transition: background 0.08s; }

/* Deadline row highlights */
.cases-table__row--overdue td:first-child { border-left: 3px solid var(--danger); }
.cases-table__row--today   td:first-child { border-left: 3px solid var(--warning); }
.cases-table__row--soon    td:first-child { border-left: 3px solid #fbbf24; }

.cases-table__num {
  font-family: "Courier New", monospace;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.cases-table__title-link {
  font-weight: 500;
  color: var(--text);
  display: block;
}

.cases-table__title-link:hover { color: var(--brand); }

.cases-table__sub {
  font-size: 11px;
  color: var(--text-faint);
}

.cases-table td.text-danger { color: var(--danger); font-weight: 500; }
.cases-table td.text-warning { color: var(--warning); }

/* 14. COMPACT CASE CARDS (юрист — свободные дела) */
.case-cards { display: flex; flex-direction: column; gap: 4px; }

.case-card {
  display: block;
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.1s, box-shadow 0.1s;
}

.case-card:hover {
  border-color: var(--brand);
  color: var(--text);
}

.case-card--overdue { border-left: 3px solid var(--danger); }
.case-card--today   { border-left: 3px solid var(--warning); }
.case-card--soon    { border-left: 3px solid #fbbf24; }

.case-card__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.case-card__num {
  font-family: "Courier New", monospace;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.case-card__title {
  font-weight: 500;
  font-size: 13px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-card__badges {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.case-card__meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* 15. SECTION DIVIDER */
.section-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* 16. SPLIT LAYOUT (карточка дела) */
.case-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.case-breadcrumb__title {
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.case-breadcrumb__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.case-breadcrumb__sep { color: var(--border-strong); }

.case-detail-page {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: calc(100dvh - 40px - 44px);
  min-height: 0;
}

.case-detail-page--comments {
  height: calc((100dvh - 40px - 44px) * 0.7);
  min-height: 420px;
}

.split-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}

.split-layout__aside {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  min-height: 0;
  padding: 12px;
  background: #fafbfc;
}

.split-layout__main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  background: var(--panel);
}

.split-layout__tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  padding: 0 12px;
  flex-shrink: 0;
  background: #fafbfc;
}

.split-layout__tabs-spacer {
  flex: 1;
  min-width: 12px;
}

.split-layout__tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.split-layout__tab-content--comments {
  min-height: 0;
  overflow-y: auto;
}

.split-layout__tab-content--docs {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.split-layout__footer {
  border-top: 1px solid var(--border);
  padding: 8px 12px;
  flex-shrink: 0;
  background: var(--panel);
}

.comment-form {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.comment-form__select,
.comment-form__input {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 10px;
  font-size: 13px;
  outline: none;
  background: #fff;
}

.comment-form__select {
  width: 220px;
  height: 40px;
  padding-right: 30px;
}

.comment-form__input {
  height: 40px;
}

.comment-form__composer {
  min-width: 0;
  display: grid;
  gap: 8px;
  align-content: start;
}

.comment-form__tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.comment-form__hint {
  font-size: 11px;
  color: var(--text-muted);
}

.comment-form__image-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.comment-form__image-item {
  width: 120px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fafbfc;
  padding: 6px;
  display: grid;
  gap: 6px;
}

.comment-form__image-preview {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: calc(var(--radius) - 1px);
  background: #e5e7eb;
}

.comment-form__image-meta {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
  max-height: 32px;
  overflow: hidden;
  word-break: break-word;
}

.comment-form__image-remove {
  padding: 0;
  background: transparent;
  color: var(--danger);
  font-size: 11px;
  font-weight: 600;
  text-align: left;
}

.comment-form__select:focus,
.comment-form__input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(46, 124, 123, 0.12);
}

.comment-form__submit {
  align-self: center;
  height: 40px;
  min-width: 136px;
}

/* 17. TABS */
.tab-link {
  display: inline-block;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 0.1s;
  text-decoration: none;
}

.tab-link:hover { color: var(--text); }

.tab-link--active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 500;
}

.tab-link--archive {
  margin-left: auto;
  margin-bottom: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  background: #fff;
  color: var(--text);
}

.tab-link--archive:hover {
  color: var(--brand);
  border-color: rgba(46, 124, 123, 0.22);
}

.tab-link--archive-disabled {
  color: var(--text-muted);
  border-color: var(--border);
  background: #f4f6f8;
  cursor: default;
}

.tab-link--danger {
  color: #b42318;
  border-color: rgba(180, 35, 24, 0.18);
  background: #fff7f6;
}

.tab-link--danger:hover {
  color: #8f1d14;
  border-color: rgba(180, 35, 24, 0.28);
}

/* 18. META DL (левая панель) */
.section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin: 12px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.section-title:first-child { margin-top: 0; }

.meta-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 10px;
  font-size: 12px;
  align-items: baseline;
}

.meta-dl dt {
  color: var(--text-muted);
  white-space: nowrap;
  font-weight: 400;
}

.meta-dl dd {
  margin: 0;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
}

.aside-description {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 10px;
}

/* 19. ASIDE ACTION FORMS */
.aside-form { margin-top: 8px; }

.aside-form + .aside-form { margin-top: 6px; }

.aside-select-row {
  display: flex;
  gap: 4px;
  align-items: center;
}

.aside-select-row select {
  flex: 1;
  height: 28px;
  padding: 0 6px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  outline: none;
}

.aside-select-row select:focus { border-color: var(--brand); }

.aside-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}

.aside-form--stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.aside-select,
.aside-input,
.aside-textarea,
.aside-multiselect {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  outline: none;
}

.aside-select,
.aside-input {
  height: 28px;
  padding: 0 6px;
}

.aside-textarea,
.aside-multiselect {
  padding: 6px;
}

.aside-multiselect {
  min-height: 90px;
}

.aside-select:focus,
.aside-input:focus,
.aside-textarea:focus,
.aside-multiselect:focus {
  border-color: var(--brand);
}

.aside-note {
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-muted);
}

body.modal-open {
  overflow: hidden;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.confirm-modal[hidden] {
  display: none !important;
}

.confirm-modal__dialog {
  width: min(640px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 6px);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.22);
  padding: 18px;
}

.confirm-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.confirm-modal__header .section-title {
  margin-bottom: 0;
}

.confirm-modal__eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.confirm-modal__close {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.confirm-modal__close:hover {
  background: var(--panel);
  color: var(--text);
}

.confirm-modal__text {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

.confirm-summary {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 10px 14px;
  align-items: start;
}

.confirm-summary dt {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.confirm-summary dd {
  margin: 0;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  word-break: break-word;
}

.confirm-summary__message {
  white-space: pre-wrap;
}

.confirm-summary__attachments {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}

.confirm-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

/* 20. TIMELINE */
.timeline { padding: 0; margin: 0; }

.timeline-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.5;
}

.timeline-item:last-child { border-bottom: none; }

.timeline-item__meta {
  color: var(--text-muted);
  font-size: 11px;
  margin-bottom: 4px;
  display: inline;
}

.timeline-item__notify {
  display: inline;
  margin-left: 8px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 400;
  background: none;
  padding: 0;
  border-radius: 0;
}

.timeline-item__content {
  margin-top: 4px;
  white-space: pre-wrap;
  word-break: break-word;
}

.timeline-item__images {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.timeline-item__image-link {
  display: block;
  cursor: zoom-in;
}

.timeline-item__image {
  display: block;
  width: min(280px, 100%);
  max-height: 280px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  background: #f4f6f8;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 2100;
  background: rgba(15, 23, 42, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.image-viewer[hidden] {
  display: none !important;
}

.image-viewer__dialog {
  width: min(1200px, 100%);
  height: min(92vh, 100%);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: calc(var(--radius) + 8px);
  box-shadow: 0 30px 70px rgba(15, 23, 42, 0.4);
  padding: 16px;
}

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

.image-viewer__title-wrap {
  min-width: 0;
}

.image-viewer__title-wrap .confirm-modal__eyebrow {
  color: rgba(255, 255, 255, 0.65);
}

.image-viewer__title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  line-height: 1.45;
  word-break: break-word;
}

.image-viewer__controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.image-viewer__controls .btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
}

.image-viewer__controls .btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.image-viewer__controls .confirm-modal__close {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.image-viewer__zoom {
  min-width: 52px;
  text-align: center;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 600;
}

.image-viewer__stage {
  overflow: auto;
  border-radius: calc(var(--radius) + 4px);
  background:
    linear-gradient(45deg, rgba(255,255,255,0.03) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.03) 75%, rgba(255,255,255,0.03)),
    linear-gradient(45deg, rgba(255,255,255,0.03) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.03) 75%, rgba(255,255,255,0.03));
  background-position: 0 0, 10px 10px;
  background-size: 20px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.image-viewer__image {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 180px);
  width: auto;
  height: auto;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.35);
  border-radius: calc(var(--radius) + 2px);
}

/* 21. DOCUMENT LIST */
.doc-upload-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.doc-upload-row select {
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  min-width: 140px;
}

.doc-upload-row input[type="file"] {
  font-size: 12px;
  flex: 1;
  min-width: 0;
}

.doc-upload-row__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.archive-progress {
  flex: 1 0 100%;
  display: grid;
  gap: 6px;
  margin-top: 2px;
}

.archive-progress[hidden] {
  display: none !important;
}

.archive-progress__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

.archive-progress__bar {
  height: 8px;
  border-radius: 999px;
  background: #eef2f4;
  border: 1px solid var(--border);
  overflow: hidden;
}

.archive-progress__bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #14b8a6);
  transition: width 0.2s ease;
}

.archive-progress--complete .archive-progress__meta {
  color: var(--success);
}

.archive-progress--complete .archive-progress__bar span {
  background: linear-gradient(90deg, var(--success), #34d399);
}

.archive-progress--error .archive-progress__meta {
  color: #b42318;
}

.archive-progress--error .archive-progress__bar span {
  background: linear-gradient(90deg, #dc2626, #f87171);
}

.docs-workspace {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.docs-workspace--with-preview {
  display: flex;
  flex-direction: column;
}

.docs-workspace__list,
.docs-workspace__preview {
  min-width: 0;
}

.docs-workspace--with-preview .docs-workspace__list {
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.doc-groups { display: flex; flex-direction: column; gap: 12px; }

.doc-group__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.doc-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.doc-archive {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.doc-archive--deleted {
  border-top-color: rgba(180, 35, 24, 0.12);
}

.doc-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  background: var(--panel);
}

.doc-row--active { border-color: var(--brand); background: var(--brand-bg); }

.doc-row__name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.doc-row__meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.doc-row--archived {
  background: #f8fafb;
  border-color: #e5e7eb;
}

.doc-row--deleted {
  background: #fff8f7;
  border-color: #f2c7c3;
}

.doc-row__select {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  flex-shrink: 0;
}

.doc-row__select input {
  width: 14px;
  height: 14px;
}

.doc-row__tag {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.doc-row__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.doc-bulk-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
}

.doc-bulk-actions__toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.doc-type-form {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.doc-type-form select {
  height: 24px;
  padding: 0 4px;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  max-width: 120px;
}

.doc-preview-wrap {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}

.docs-workspace--with-preview .doc-preview-wrap {
  margin-top: 12px;
  position: static;
}

.doc-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: #fafbfc;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.doc-preview-header__name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.doc-preview-header__actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.doc-preview {
  width: 100%;
  height: clamp(960px, 138vh, 1500px);
  border: none;
  display: block;
  background: #fff;
}

.doc-preview--image {
  height: clamp(960px, 138vh, 1500px);
  max-height: none;
  object-fit: contain;
  background: #f6f7f8;
}

.doc-preview-media {
  display: grid;
  gap: 16px;
  padding: 20px;
  background: #f8fafb;
}

.doc-preview-media--audio {
  min-height: 180px;
  align-content: center;
}

.doc-preview-media--video {
  padding: 0;
  background: #000;
}

.doc-preview-media__name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.doc-preview-audio {
  width: 100%;
}

.doc-preview--video {
  height: clamp(560px, 90vh, 960px);
  background: #000;
}

/* 22. FORMS */
.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-grid--two {
  grid-template-columns: 1fr 1fr;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.field input,
.field select {
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  outline: none;
  width: 100%;
}

.field textarea {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  outline: none;
  resize: vertical;
  min-height: 80px;
  width: 100%;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
}

.form-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* 23. AUTH PAGE */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 340px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 28px 28px 24px;
}

.auth-card__logo {
  font-weight: 700;
  font-size: 15px;
  color: var(--brand);
  margin-bottom: 20px;
  display: block;
}

.auth-card__title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.auth-card__hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.auth-card__link {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 12px;
  text-align: center;
}

.auth-card__link:hover { color: var(--brand); }

.auth-error {
  padding: 7px 10px;
  background: var(--danger-bg);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  font-size: 12px;
  color: #991b1b;
  margin-bottom: 12px;
}

/* 24. ADMIN TABLE */
.admin-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
  text-align: left;
  white-space: nowrap;
}

.admin-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 12px;
}

.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td { background: #f9fafb; }

.admin-table__actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.admin-table__actions--user {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-user-actions__top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn--icon {
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn--icon svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.admin-password-form {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.admin-password-form__input {
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 168px;
}

.admin-password-modal {
  max-width: 420px;
}

.admin-password-modal__user {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text);
}

.admin-password-modal__form {
  margin-top: 14px;
}

/* 25. EMPTY STATE */
.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 28px 16px;
  font-size: 12px;
}

/* 26. PAGE HEADER (для форм) */
.page-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.page-header__title {
  font-size: 14px;
  font-weight: 600;
}

.form-wrap {
  max-width: 660px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.maintenance-panel {
  margin-bottom: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.admin-tabs {
  display: flex;
  gap: 4px;
  padding: 0 0 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.admin-subtabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.assignment-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.assignment-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.assignment-card--closed {
  background: #f8fafb;
}

.assignment-card__body {
  min-width: 0;
}

.assignment-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.assignment-card__case {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.assignment-card__case:hover {
  color: var(--brand);
}

.assignment-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.assignment-card__text {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.assignment-card__hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.assignment-card__aside {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 170px;
}

.assignment-card__form {
  display: flex;
  justify-content: flex-end;
}

.assignment-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.assignment-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand);
}

.assignment-check--compact {
  gap: 0;
}

.assignment-check--done {
  color: var(--success);
  cursor: default;
}

.admin-table--assignments td {
  vertical-align: top;
}

.admin-table--assignments {
  table-layout: fixed;
  width: 100%;
}

.admin-table--assignments th,
.admin-table--assignments td {
  overflow-wrap: break-word;
  word-break: normal;
}

.assignment-table__col--case {
  width: 32%;
}

.assignment-table__col--date {
  width: 96px;
}

.assignment-table__col--recipient {
  width: 144px;
}

.assignment-table__col--images {
  width: 112px;
}

.assignment-table__col--action {
  width: 56px;
}

.assignment-table__case-cell {
  min-width: 0;
}

.assignment-table__case-link {
  display: block;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  line-height: 1.45;
}

.assignment-table__case-link:hover {
  color: var(--brand);
}

.assignment-table__date-cell {
  white-space: nowrap;
}

.assignment-table__recipient-cell {
  font-weight: 500;
}

.assignment-table__comment-cell {
  min-width: 0;
}

.assignment-table__comment {
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
  word-break: break-word;
  white-space: normal;
}

.assignment-table__comment--empty {
  color: var(--text-muted);
}

.assignment-table__note,
.assignment-table__closed-at {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.assignment-table__images-cell {
  text-align: center;
}

.assignment-table__images {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}

.assignment-image-link {
  display: inline-flex;
  cursor: zoom-in;
}

.assignment-table__thumb {
  display: block;
  width: 44px;
  height: 44px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  background: #f4f6f8;
}

.assignment-table__more {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.assignment-table__zoom-btn {
  margin-top: 6px;
  min-width: 0;
  padding: 5px 8px;
  font-size: 11px;
}

.assignment-table__action-cell {
  text-align: center;
}

.assignment-table__action-form {
  display: flex;
  align-items: center;
  justify-content: center;
}

.assignment-table__closed {
  display: grid;
  gap: 6px;
}

.assignment-table__closed-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
  font-size: 11px;
  font-weight: 600;
}

.maintenance-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.maintenance-panel__title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.maintenance-panel__hint {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 720px;
}

.maintenance-status {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.maintenance-status--enabled {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
}

.maintenance-status--disabled {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #a7f3d0;
}

.maintenance-panel__actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.maintenance-panel__disable-form {
  margin-top: 8px;
}

/* 27. USER STATUS */
.user-status--active   { color: var(--success); font-weight: 500; font-size: 12px; }
.user-status--blocked  { color: var(--text-faint); font-weight: 500; font-size: 12px; }

/* 28. RESPONSIVE */

/* Desktop/tablet utility classes */
.desktop-only { display: block; }
.mobile-only  { display: none !important; }

/* ── 900px: планшет горизонтально ── */
@media (max-width: 900px) {
  .case-detail-page {
    height: auto;
  }

  .split-layout {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .split-layout__aside {
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-y: visible;
  }

  .split-layout__main {
    overflow: visible;
  }

  .split-layout__tab-content {
    overflow: visible;
  }

  .docs-workspace--with-preview {
    grid-template-columns: 1fr;
  }

  .docs-workspace--with-preview .docs-workspace__list {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .docs-workspace--with-preview .doc-preview-wrap {
    position: static;
  }

  .doc-preview,
  .doc-preview--image,
  .doc-preview--video {
    height: 72vh;
    min-height: 520px;
  }

  .split-layout__footer {
    position: sticky;
    bottom: 0;
    background: var(--panel);
    z-index: 10;
    border-top: 1px solid var(--border);
  }

  .split-layout__tabs {
    flex-wrap: wrap;
  }

  .split-layout__tabs-spacer {
    display: none;
  }

  .tab-link--archive {
    margin-left: 0;
  }

  .doc-bulk-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .doc-bulk-actions__toggle {
    width: 100%;
  }

  .comment-form {
    grid-template-columns: 1fr;
  }

  .comment-form__select,
  .comment-form__input,
  .comment-form__submit {
    width: 100%;
  }

  .comment-form__image-item {
    width: 100px;
  }

  .image-viewer {
    padding: 10px;
  }

  .image-viewer__dialog {
    height: min(96vh, 100%);
    padding: 12px;
  }

  .image-viewer__header {
    flex-direction: column;
  }

  .image-viewer__controls {
    width: 100%;
    justify-content: space-between;
  }

  .form-grid--two {
    grid-template-columns: 1fr;
  }

  .customer-edit-layout {
    grid-template-columns: 1fr;
  }
}

/* ── 640px: планшет вертикально / большой телефон ── */
@media (max-width: 640px) {
  /* Топбар */
  .topbar { height: auto; min-height: 40px; }
  .topbar__inner { flex-wrap: wrap; gap: 4px; padding: 4px 12px; }

  /* Таблица дел — скрыть, показать карточки */
  .desktop-only { display: none !important; }
  .mobile-only  { display: block !important; }

  /* Таблица — оставить только самое важное если всё же показана */
  .cases-table th:nth-child(3),
  .cases-table td:nth-child(3) { display: none; }
  .cases-table th:nth-child(4),
  .cases-table td:nth-child(4) { display: none; }
  .cases-table th:nth-child(6),
  .cases-table td:nth-child(6) { display: none; }

  /* Кнопки — touch-friendly */
  .btn     { height: 40px; padding: 0 14px; font-size: 13px; }
  .btn--sm { height: 32px; padding: 0 10px; font-size: 12px; }
  .qfilter { height: 32px; padding: 0 12px; font-size: 12px; line-height: 32px; }

  /* Фильтры */
  .filter-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .filter-row input,
  .filter-row select { width: 100%; min-width: unset; }
  .filter-row .btn { width: 100%; justify-content: center; }

  /* Фильтры — collapsible */
  .filter-collapsible { display: none; }
  .filter-toggle-cb:checked ~ .filter-collapsible { display: block; }

  /* Admin таблица — скрыть email и телефон */
  .admin-table th:nth-child(2),
  .admin-table td:nth-child(2),
  .admin-table th:nth-child(3),
  .admin-table td:nth-child(3) { display: none; }

  .admin-table__actions { flex-wrap: wrap; gap: 6px; }
  .admin-table__actions > form { width: 100%; }
  .admin-table__actions input[type="text"] { width: 100% !important; }
  .admin-table__actions--user > form { width: auto; }
  .admin-user-actions__top { width: auto; }
  .admin-password-form { width: 100%; }
  .admin-password-form .btn { width: 100%; }

  /* Stat chips — уменьшить gap */
  .stat-chips { gap: 10px; }

  /* Page wrap */
  .page-wrap { padding: 8px 12px 24px; }

  /* Breadcrumb */
  .case-breadcrumb { flex-wrap: wrap; gap: 4px; }
  .case-breadcrumb__actions { width: 100%; justify-content: flex-start; margin-left: 0; }

  .doc-preview-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .doc-preview-header__actions {
    width: 100%;
    justify-content: flex-start;
  }

  .doc-preview,
  .doc-preview--image,
  .doc-preview--video {
    height: 68vh;
    min-height: 420px;
  }

  .maintenance-panel__header,
  .maintenance-panel__actions { flex-direction: column; align-items: stretch; }

  .assignment-card {
    grid-template-columns: 1fr;
  }

  .assignment-card__aside,
  .assignment-card__form {
    justify-content: flex-start;
  }

  .assignment-table__case-cell,
  .assignment-table__recipient-cell,
  .assignment-table__images-cell,
  .assignment-table__action-cell {
    min-width: 0;
  }
}

/* ── 480px: телефон ── */
@media (max-width: 480px) {
  /* Скрыть имя пользователя в топбаре */
  .topbar__user { display: none; }

  /* Auth карточка */
  .auth-card { padding: 20px 16px; }

  /* Документы — перенос кнопок */
  .doc-row { flex-wrap: wrap; gap: 6px; }
  .doc-row__name { width: 100%; margin-bottom: 2px; }
  .doc-row__meta { width: 100%; }
  .doc-row__actions { width: 100%; justify-content: flex-start; }
  .doc-type-form { width: 100%; }
  .doc-type-form form { display: flex; gap: 4px; width: 100%; }
  .doc-type-form select { flex: 1; }

  /* Breadcrumb — компактнее */
  .case-breadcrumb__title { font-size: 12px; }

  /* Внимание-бар */
  .attention-bar { flex-direction: column; align-items: flex-start; }

  /* Aside actions — полная ширина */
  .aside-actions .btn { width: 100%; justify-content: center; }
  .aside-select-row select { font-size: 13px; }
  .confirm-summary {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .confirm-modal__actions {
    flex-direction: column-reverse;
  }
  .confirm-modal__actions .btn {
    width: 100%;
  }
}

/* ── Скрытый чекбокс для toggle фильтров ── */
.filter-toggle-cb { display: none; }
