@font-face {
  font-family: "Caveat";
  font-style: normal;
  font-weight: 600;
  font-display: block;
  src: url("/static/fonts/caveat-cyrillic-600-normal.woff2") format("woff2");
}

:root {
  --ink: #1e2b27;
  --muted: #6c7772;
  --line: #dfe4df;
  --line-soft: #e9ede9;
  --surface: #ffffff;
  --canvas: #f2f4f0;
  --forest: #173a32;
  --forest-2: #244d43;
  --green: #2f7a64;
  --green-soft: #e2f0ea;
  --amber: #b47a20;
  --amber-soft: #f8ecd8;
  --red: #b9483a;
  --red-soft: #f9e7e3;
  --blue: #456a88;
  --blue-soft: #e8eff4;
  --shadow: 0 12px 36px rgba(31, 47, 41, 0.08);
  --sidebar-width: 238px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: var(--green); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid rgba(47, 122, 100, 0.28);
  outline-offset: 2px;
}

/* ---------- Каркас ---------- */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 24px 16px 18px;
  background: var(--forest);
  color: #fff;
  overflow-y: auto;
}
.brand { display: flex; flex-direction: column; gap: 8px; padding: 0 8px 24px; }
.brand-logo { width: min(185px, 100%); height: auto; }
.brand small {
  color: #5dd9bd;
  font-family: "Caveat", "Segoe Script", cursive;
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
}
.main-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-caption {
  padding: 10px 12px 6px;
  color: rgba(255, 255, 255, 0.38);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.main-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 9px;
  padding: 9px 12px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease;
}
.main-nav a i { width: 18px; font-style: normal; text-align: center; opacity: 0.7; }
.main-nav a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.main-nav a.active { background: rgba(255, 255, 255, 0.13); color: #fff; }
.nav-badge {
  margin-left: auto;
  border-radius: 999px;
  background: #e6a23c;
  color: #1e2b27;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 800;
}
.sidebar-spacer { flex: 1; }
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.11);
  padding: 16px 8px 0;
}
.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: #eef1e8;
  color: var(--forest);
  font-size: 12px;
  font-weight: 800;
}
.sidebar-user-identity { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.sidebar-user-identity strong { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-identity small { margin-top: 2px; color: rgba(255, 255, 255, 0.48); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-signout {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  padding: 6px 8px;
  cursor: pointer;
  font-size: 16px;
}
.sidebar-signout:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.sidebar-user form { margin: 0; }

.main-content {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: 26px 30px 48px;
  max-width: 1280px;
}
.main-content--wide { max-width: none; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.topbar-heading { min-width: 0; }
.topbar h1 { margin: 0; font-size: clamp(24px, 2vw, 31px); font-weight: 750; letter-spacing: -0.035em; }
.topbar p { margin: 6px 0 0; color: var(--muted); font-size: 13px; max-width: 70ch; }
.topbar-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.menu-toggle { display: none; }
.bell {
  position: relative;
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  padding: 0 12px;
  text-decoration: none;
  font-size: 16px;
}
.bell b {
  position: absolute;
  top: -6px;
  right: -6px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  padding: 1px 6px;
  font-size: 10px;
}

/* ---------- Сообщения ---------- */
.flash { margin-bottom: 18px; border-radius: 10px; padding: 12px 16px; font-size: 13px; font-weight: 600; }
.flash-ok { background: var(--green-soft); color: var(--green); }
.flash-error { background: var(--red-soft); color: var(--red); }
.flash-warn { background: var(--amber-soft); color: var(--amber); }

/* ---------- Кнопки ---------- */
.primary-button, .secondary-button, .danger-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 9px;
  padding: 0 15px;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  transition: transform 120ms ease, background 150ms ease, border-color 150ms ease;
}
.primary-button { border: 1px solid var(--forest); background: var(--forest); color: #fff; box-shadow: 0 7px 15px rgba(23, 58, 50, 0.13); }
.primary-button:hover { background: var(--forest-2); }
.secondary-button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.secondary-button:hover { border-color: #bac5bf; background: #fafbf9; }
.danger-button { border: 1px solid #e6bcb4; background: var(--surface); color: var(--red); }
.danger-button:hover { background: var(--red-soft); }
.primary-button:active, .secondary-button:active, .danger-button:active { transform: translateY(1px); }
.primary-button:disabled, .secondary-button:disabled, .danger-button:disabled { cursor: not-allowed; opacity: 0.55; }
.button-small { min-height: 32px; padding: 0 11px; font-size: 12px; border-radius: 8px; }
.text-button { border: 0; padding: 3px 0; background: transparent; color: var(--green); cursor: pointer; font-size: 12px; font-weight: 700; }
.text-button:hover { color: var(--forest); }
.inline-form { display: inline; margin: 0; }
.actions-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.actions-row form { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.actions-row textarea { min-width: 260px; }

/* ---------- Сетки, панели, показатели ---------- */
.page-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; }
.page-column { display: flex; min-width: 0; flex-direction: column; gap: 18px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi-card, .panel { border: 1px solid var(--line-soft); background: var(--surface); box-shadow: 0 1px 0 rgba(34, 50, 44, 0.02); }
.kpi-card {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "title value" "detail value";
  align-items: center;
  column-gap: 10px;
  row-gap: 2px;
  border-radius: 12px;
  padding: 9px 12px;
  color: inherit;
  text-decoration: none;
}
.interactive-kpi { cursor: pointer; transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease; }
.interactive-kpi:hover { border-color: #b9d4c9; box-shadow: 0 6px 18px rgba(31, 47, 41, 0.1); transform: translateY(-1px); }
.kpi-topline { grid-area: title; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; }
.kpi-card > strong { grid-area: value; font-size: 22px; letter-spacing: -0.04em; text-align: right; }
.kpi-card > small { grid-area: detail; color: var(--muted); font-size: 10px; line-height: 1.2; }
.kpi-warn > strong { color: var(--amber); }
.kpi-alert > strong { color: var(--red); }
.panel { overflow: hidden; border-radius: 12px; margin-bottom: 18px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px 14px; }
.panel-heading h2 { margin: 0; font-size: 15px; letter-spacing: -0.01em; }
.panel-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.panel-body { padding: 0 20px 20px; }
.panel-body p { line-height: 1.55; }
.empty-state { padding: 28px 20px; color: var(--muted); font-size: 13px; text-align: center; }

/* ---------- Таблицы ---------- */
.table-wrap { min-width: 0; max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  padding: 9px 10px;
  background: #fafbf9;
  color: #78837d;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.055em;
  text-align: left;
  text-transform: uppercase;
}
td { border-bottom: 1px solid var(--line-soft); padding: 11px 10px; vertical-align: middle; font-size: 12px; overflow-wrap: break-word; }
.nowrap { white-space: nowrap; }
.file-actions--inline { flex-direction: column; align-items: flex-end; flex-wrap: nowrap; gap: 4px; }
td > strong, td > small { display: block; }
td > strong + small { margin-top: 3px; color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: #fbfcfa; }
td a { font-weight: 700; text-decoration: none; }
td a:hover { text-decoration: underline; }
.num { text-align: right; white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-overdue td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.row-soon td:first-child { box-shadow: inset 3px 0 0 var(--amber); }

/* ---------- Статусы ---------- */
.status-pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 5px 8px; font-size: 10px; font-weight: 750; white-space: nowrap; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pending { background: var(--amber-soft); color: var(--amber); }
.status-confirmed { background: var(--green-soft); color: var(--green); }
.status-meeting { background: var(--blue-soft); color: var(--blue); }
.status-contract { background: #e3e6f5; color: #4a4f8a; }
.status-paid { background: #173a32; color: #cfeee2; }
.status-rejected { background: var(--red-soft); color: var(--red); }
.status-expired { background: #edf0ee; color: #66706c; }
.status-cancelled { background: #edf0ee; color: #66706c; }
.status-active { background: var(--green-soft); color: var(--green); }
.status-off { background: #edf0ee; color: #66706c; }

/* ---------- Формы ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  padding: 10px 12px;
  color: var(--ink);
  font-size: 14px;
}
.field textarea { resize: vertical; min-height: 72px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--green); outline: 0; box-shadow: 0 0 0 3px rgba(47, 122, 100, 0.16); }
.field small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field-grid .field--full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.checkbox input { width: 16px; height: 16px; }

/* ---------- Проверка номера ---------- */
.check-hero { padding: 22px 20px 20px; }
.check-hero .field input { font-size: 22px; letter-spacing: 0.04em; padding: 14px 16px; font-variant-numeric: tabular-nums; }
.check-result { margin-top: 14px; border-radius: 12px; padding: 16px 18px; font-size: 14px; line-height: 1.5; }
.check-result:empty { display: none; }
.check-result h3 { margin: 0 0 4px; font-size: 16px; }
.check-result p { margin: 4px 0 0; }
.check-result small { color: var(--muted); }
.check-loading { background: #f5f7f4; color: var(--muted); }
.check-free { background: var(--green-soft); color: #1f5a48; }
.check-mine_active, .check-mine_deal { background: var(--blue-soft); color: #2f4f69; }
.check-other_active, .check-other_deal, .check-own { background: var(--red-soft); color: #7d2f24; }
.check-invalid, .check-error, .check-limit { background: var(--amber-soft); color: #7a5011; }
.check-result .status-pill { margin-top: 8px; }

/* ---------- Карточка фиксации ---------- */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 18px; padding: 0 20px 18px; }
.detail-grid div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.detail-grid dt, .detail-grid > div > span:first-child { color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: 0.05em; text-transform: uppercase; }
.detail-grid strong { font-size: 14px; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0 20px 18px; }
.timeline li { position: relative; padding: 10px 0 10px 22px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.timeline li:last-child { border-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 16px; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.timeline li.kind-rejected::before, .timeline li.kind-cancelled::before, .timeline li.kind-expired::before { background: var(--red); }
.timeline li.kind-comment::before { background: var(--blue); }
.timeline small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.timeline .note { display: block; margin-top: 4px; white-space: pre-wrap; }
.deadline-note { padding: 0 20px 18px; font-size: 13px; }
.deadline-note.soon { color: var(--amber); font-weight: 700; }
.deadline-note.over { color: var(--red); font-weight: 700; }
.wait-badge { font-weight: 800; }
.wait-badge.over { color: var(--red); }

/* ---------- Материалы ---------- */
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-bottom: 18px; }
.folder-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface);
  padding: 14px;
  color: inherit;
  text-decoration: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}
.folder-card:hover { border-color: #b9d4c9; box-shadow: 0 6px 18px rgba(31, 47, 41, 0.1); transform: translateY(-1px); }
.folder-icon { display: grid; width: 40px; height: 40px; flex: 0 0 auto; place-items: center; border-radius: 10px; background: var(--green-soft); color: var(--green); font-size: 18px; }
.folder-card strong { display: block; font-size: 14px; }
.folder-card small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.folder-card .count { margin-top: 6px; font-size: 11px; color: var(--green); font-weight: 700; }
.file-list { display: flex; flex-direction: column; }
.file-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line-soft); }
.file-thumb { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 9px; background: #f2f4f0; color: var(--muted); font-size: 11px; font-weight: 800; overflow: hidden; }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-row strong { display: block; font-size: 13px; overflow-wrap: anywhere; }
.file-row small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.file-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.file-actions form { margin: 0; }
.progress-bar { height: 6px; border-radius: 999px; background: #e6eae5; overflow: hidden; margin-top: 10px; }
.progress-bar i { display: block; height: 100%; width: 0; background: var(--green); transition: width 120ms linear; }
.upload-picked { color: var(--muted); font-size: 12px; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 7px; color: var(--muted); font-size: 11px; }
.breadcrumbs a { font-weight: 750; text-decoration: none; }
.preview-box { padding: 0 20px 20px; }
.preview-box video, .preview-box audio, .preview-box img { max-width: 100%; border-radius: 10px; }
.preview-box iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 10px; }

/* ---------- Вход ---------- */
.signin-screen { display: flex; min-height: 100vh; align-items: center; justify-content: center; background: var(--canvas); padding: 24px; }
.signin-card { overflow: hidden; width: 100%; max-width: 420px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.signin-brandbar { display: flex; flex-direction: column; gap: 8px; background: var(--forest); padding: 26px 32px 22px; }
.signin-logo { display: block; width: 100%; max-width: 208px; height: auto; }
.signin-script { color: #5dd9bd; font-family: "Caveat", "Segoe Script", cursive; font-size: 26px; font-weight: 600; line-height: 1; }
.signin-body { padding: 26px 32px 30px; }
.signin-title { margin: 0 0 20px; font-size: 19px; font-weight: 700; line-height: 1.25; }
.signin-form { display: flex; flex-direction: column; gap: 16px; }
.signin-form .primary-button { width: 100%; }
.signin-hint { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.signin-error { margin: 0; border-radius: 9px; background: var(--red-soft); color: var(--red); padding: 10px 12px; font-size: 13px; font-weight: 600; }

/* ---------- Временный пароль ---------- */
.issued-password { margin: 0 0 18px; border: 1px solid var(--amber); border-radius: 12px; background: var(--amber-soft); padding: 16px 18px; }
.issued-password-head { margin-bottom: 10px; color: var(--amber); font-size: 12px; font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase; }
.issued-password code { border: 1px solid var(--line); border-radius: 6px; background: var(--surface); padding: 4px 10px; font-size: 15px; font-weight: 700; letter-spacing: 0.04em; }
.issued-password p { margin: 8px 0 0; font-size: 13px; }

/* ---------- Регламент, журнал ---------- */
.prose { padding: 0 20px 22px; max-width: 78ch; line-height: 1.6; font-size: 14px; }
.prose h3 { margin: 18px 0 6px; font-size: 15px; }
.prose ol, .prose ul { padding-left: 22px; }
.prose li { margin: 4px 0; }
.release { padding: 0 20px 16px; }
.release h3 { margin: 0 0 4px; font-size: 15px; }
.release .date { color: var(--muted); font-size: 12px; }
.release h4 { margin: 10px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.release ul { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.5; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 0 20px 14px; }
.toolbar a { display: inline-flex; min-height: 30px; align-items: center; border: 1px solid var(--line); border-radius: 999px; padding: 0 12px; font-size: 12px; font-weight: 700; color: var(--ink); text-decoration: none; background: var(--surface); }
.toolbar a.active { background: var(--forest); border-color: var(--forest); color: #fff; }
.toolbar .result-count { margin-left: auto; color: var(--muted); font-size: 12px; }
.notif { display: flex; gap: 12px; align-items: flex-start; padding: 12px 20px; border-top: 1px solid var(--line-soft); font-size: 13px; }
.notif.unread { background: #f6faf8; }
.notif small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.notif a { text-decoration: none; }

/* ---------- Адаптив ---------- */
@media (max-width: 1100px) {
  .page-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  .sidebar { transform: translateX(-100%); transition: transform 160ms ease; width: min(280px, 85vw); }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.3); }
  .main-content { margin-left: 0; padding: 16px 16px 40px; }
  .menu-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 6px 10px; margin-bottom: 8px; cursor: pointer; }
  .topbar { flex-direction: column; gap: 12px; }
  .topbar-actions { justify-content: flex-start; }
  .field-grid { grid-template-columns: 1fr; }
  .file-row { grid-template-columns: 44px minmax(0, 1fr); }
  .file-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}

/* ---------- Значки действий в строках (как в ERP) ---------- */
.row-action-icons { display: inline-flex; gap: 4px; align-items: center; justify-content: flex-end; flex-wrap: nowrap; }
.row-action-icon {
  display: inline-flex;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0;
  background: #fff;
  color: var(--forest);
  cursor: pointer;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease;
}
.row-action-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.row-action-icon:hover, .row-action-icon:focus-visible { border-color: var(--green); background: var(--green-soft); outline: 0; }
.row-action-icon--danger { border-color: #dfc7c3; color: var(--red); }
.row-action-icon--danger:hover, .row-action-icon--danger:focus-visible { border-color: var(--red); background: var(--red-soft); }
.row-action-icon--primary { border-color: var(--forest); background: var(--forest); color: #fff; }
.row-action-icon--primary:hover, .row-action-icon--primary:focus-visible { background: var(--forest-2); border-color: var(--forest-2); }
td .row-action-icons { white-space: nowrap; }
.file-actions .row-action-icons { gap: 6px; }

/* Кнопки с текстом и значком */
.primary-button svg, .secondary-button svg, .danger-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

/* ---------- Подвижные колонки (как в ERP): ручка — полоса в заголовке ---------- */
.resizable-columns thead th { position: relative; }
.resizable-columns thead th::after {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 1; width: 8px;
  cursor: col-resize; content: ""; transition: background 120ms ease;
}
.resizable-columns thead th:hover::after {
  background: linear-gradient(to right, transparent 3px, rgba(47, 122, 100, 0.45) 3px, rgba(47, 122, 100, 0.45) 5px, transparent 5px);
}
.resizable-columns.columns-resizing { user-select: none; }
.resizable-columns.columns-resizing * { cursor: col-resize !important; }
.resizable-columns.columns-resizing thead th::after {
  background: linear-gradient(to right, transparent 3px, var(--green) 3px, var(--green) 5px, transparent 5px);
}
.search-input { min-height: 42px; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; width: 220px; background: var(--surface); }

/* ---------- Реестры на телефоне: строка таблицы становится карточкой ---------- */
@media (max-width: 800px) {
  .topbar-actions { width: 100%; justify-content: flex-start; }
  .topbar-actions .inline-form { flex: 1 1 100%; }
  .topbar-actions .search-input { width: 100%; }
  .topbar-actions .primary-button, .topbar-actions .secondary-button { flex: 1 1 auto; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi-card > strong { font-size: 19px; }
  .toolbar { padding-inline: 14px; }
  .toolbar .result-count { flex-basis: 100%; margin-left: 0; }

  .table-wrap[data-table] { overflow: visible; }
  .table-wrap[data-table] table, .table-wrap[data-table] tbody, .table-wrap[data-table] tr, .table-wrap[data-table] td { display: block; width: 100%; }
  .table-wrap[data-table] thead { display: none; }
  .table-wrap[data-table] tr { padding: 10px 14px; border-top: 1px solid var(--line-soft); }
  .table-wrap[data-table] tbody tr:first-child { border-top: 0; }
  .table-wrap[data-table] td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border: 0; padding: 4px 0; text-align: right; font-size: 13px; }
  .table-wrap[data-table] td[data-label]::before { content: attr(data-label); flex: 0 0 38%; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: 0.05em; text-transform: uppercase; text-align: left; }
  .table-wrap[data-table] td:not([data-label]) { justify-content: flex-end; }
  .table-wrap[data-table] td > strong, .table-wrap[data-table] td > small { display: inline; }
  .table-wrap[data-table] td > strong + small { display: block; margin-top: 2px; }
  .table-wrap[data-table] td.num { text-align: right; }
  .table-wrap[data-table] .row-overdue, .table-wrap[data-table] .row-soon { box-shadow: none; }
  .table-wrap[data-table] .row-overdue td:first-child, .table-wrap[data-table] .row-soon td:first-child { box-shadow: none; }
  .table-wrap[data-table] .row-overdue { border-left: 3px solid var(--red); }
  .table-wrap[data-table] .row-soon { border-left: 3px solid var(--amber); }
  .table-wrap[data-table] td.row-primary { display: block; text-align: left; padding-bottom: 6px; }
  .table-wrap[data-table] td.row-primary::before { display: none; }
  .table-wrap[data-table] td.row-primary > strong { display: block; font-size: 15px; }
  .table-wrap[data-table] td.row-primary > small { display: block; }
  .file-row { grid-template-columns: 44px minmax(0, 1fr); }
  .file-actions { grid-column: 2; justify-content: flex-start; }
  .main-content { padding-bottom: 32px; }
}
@media (max-width: 800px) {
  .table-wrap[data-table] td[data-label] { flex-wrap: wrap; }
  .table-wrap[data-table] td[data-label] > strong + small { flex-basis: 100%; margin-top: 0; }
}

/* ---------- Широкие экраны: реестр не растягивается на всю ширину ---------- */
.main-content--wide { max-width: 1440px; }
.toolbar { padding: 14px 20px; border-bottom: 1px solid var(--line-soft); }
.toolbar .toolbar-search { margin-left: auto; display: flex; align-items: center; }
.toolbar .toolbar-search input { min-height: 34px; width: 240px; border: 1px solid var(--line); border-radius: 999px; padding: 0 14px; background: var(--surface); font-size: 13px; }
.toolbar .result-count { margin-left: 0; }
.toolbar .toolbar-search + .result-count { margin-left: 12px; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px 20px 44px; color: var(--muted); font-size: 14px; text-align: center; max-width: 46ch; margin: 0 auto; line-height: 1.5; }
.empty-state strong { color: var(--ink); font-size: 16px; }
.empty-state .empty-icon { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 12px; background: var(--green-soft); color: var(--green); margin-bottom: 4px; }
.empty-state .empty-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.empty-state .primary-button, .empty-state .secondary-button { margin-top: 8px; }
.own-clients-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.own-clients-grid details { border-top: 1px solid var(--line-soft); padding: 12px 20px 16px; }
.own-clients-grid summary { cursor: pointer; font-weight: 700; font-size: 13px; list-style: none; display: flex; justify-content: space-between; }
.own-clients-grid summary::after { content: "+"; color: var(--muted); }
.own-clients-grid details[open] summary::after { content: "–"; }
.own-clients-grid details .form-stack { margin-top: 12px; }
@media (max-width: 1100px) { .own-clients-grid { grid-template-columns: 1fr; } .toolbar .toolbar-search { margin-left: 0; width: 100%; } .toolbar .toolbar-search input { width: 100%; } }
