@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; }
/* Скрытое остаётся скрытым, даже если у элемента задан свой display. */
[hidden] { display: none !important; }
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: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  background: var(--green-soft);
  color: var(--green);
}
/* Все значки папок нарисованы одной толщиной линии; залитая деталь берёт тот
   же цвет с прозрачностью, поэтому набор читается как один. */
.folder-icon svg .icon-line { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.folder-icon svg .icon-fill { fill: currentColor; opacity: 0.16; stroke: none; }
.folder-icon--catalog { background: var(--green-soft); color: var(--green); }
.folder-icon--leaflet { background: var(--amber-soft); color: var(--amber); }
.folder-icon--photo { background: var(--blue-soft); color: var(--blue); }
.folder-icon--video { background: #efe7f4; color: #6b4f8f; }
.folder-icon--audio { background: #e0f0ef; color: #2f6f74; }
.folder-icon--plan { background: #e8eee9; color: #4a6350; }
.folder-icon--doc { background: #eceff2; color: #55636f; }
.folder-icon--folder { background: #eef1ec; color: var(--forest); }
.folder-card:hover .folder-icon { transform: scale(1.04); }
.folder-icon { transition: transform 140ms ease; }
.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; }
.preview-box .pdf-frame { aspect-ratio: 3 / 4; min-height: 70vh; background: #fff; border: 1px solid var(--line-soft); }
.preview-fallback { margin: 12px 0 0; color: var(--muted); font-size: 13px; }

/* ---------- Вход ---------- */
.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 { gap: 8px; flex-wrap: wrap; }
.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 .toolbar-search select {
  min-height: 34px; max-width: 220px; border: 1px solid var(--line); border-radius: 999px;
  padding: 0 30px 0 14px; background: var(--surface); font-size: 13px; font-weight: 600; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%236c7772' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 10px;
}
.toolbar .toolbar-search select:hover { border-color: #bac5bf; }
.toolbar-reset {
  display: inline-flex; min-height: 34px; align-items: center; border: 1px solid var(--line);
  border-radius: 999px; padding: 0 12px; background: var(--surface); color: var(--muted);
  font-size: 13px; text-decoration: none;
}
.toolbar-reset:hover { border-color: #bac5bf; color: var(--ink); }
.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%; }
  .toolbar .toolbar-search select { flex: 1 1 160px; max-width: none; }
}

/* ---------- Папки материалов: плитка со своим действием ---------- */
.folder-card { position: relative; display: block; padding: 0; }
.folder-card-link {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  color: inherit;
  text-decoration: none;
  border-radius: 12px;
}
.folder-card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  opacity: 0;
  transition: opacity 120ms ease;
}
.folder-card:hover .folder-card-actions,
.folder-card:focus-within .folder-card-actions { opacity: 1; }
.folder-card-actions form { margin: 0; }
.folder-card-link > span:last-child { min-width: 0; }
/* Место под значки действий резервируется только там, где они есть. */
.folder-card:has(.folder-card-actions) .folder-card-link > span:last-child { padding-right: 64px; }
.folder-delete-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; border-top: 1px solid var(--line-soft); padding-top: 14px; font-size: 12px; color: var(--muted); }
.folder-delete-row form { margin: 0; }
@media (hover: none) { .folder-card-actions { opacity: 1; } }
/* Переход по значку-карандашу: панель не липнет к краю и заметна. */
#folder-settings { scroll-margin-top: 20px; }
#folder-settings:target { border-color: var(--green); box-shadow: 0 0 0 3px rgba(47, 122, 100, 0.16); }

/* ---------- Каталог материалов: плитки с обложками ---------- */
.material-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(216px, 1fr));
  gap: 16px;
  padding: 4px 20px 20px;
}
.material-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}
.material-card:hover { border-color: #b9d4c9; box-shadow: 0 8px 22px rgba(31, 47, 41, 0.1); transform: translateY(-1px); }
.material-card-open { display: block; text-decoration: none; color: inherit; }
.material-cover {
  display: grid;
  place-items: center;
  aspect-ratio: 3 / 4;
  max-height: 260px;
  overflow: hidden;
  background: #eef1ec;
  border-bottom: 1px solid var(--line-soft);
}
.material-cover img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
/* Обложка документа вписывается целиком, на светлом поле — ничего не срезается. */
.material-cover--fit { background: #fff; min-height: 110px; max-height: 300px; }
/* Пропорции заданы точно — рамка подстраивается под кадр, обрезки нет. */
.material-cover--exact { aspect-ratio: auto; max-height: 320px; }
.material-cover--exact img { object-fit: contain; object-position: center; }
.material-cover--fit img { object-fit: contain; object-position: center; }
.material-cover--blank { aspect-ratio: 16 / 10; background: linear-gradient(160deg, #eef3ef, #e2eae5); }
.material-cover--blank b { font-size: 24px; font-weight: 800; color: var(--green); letter-spacing: 0.04em; }
.material-cover--video b, .material-cover--audio b { font-size: 30px; }
.material-card-body { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 8px; flex: 1; }
.material-card-body strong { font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.material-card-body small { color: var(--muted); font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.material-card-body .material-meta { margin-top: auto; padding-top: 6px; font-variant-numeric: tabular-nums; }
.material-card-actions { display: flex; justify-content: flex-end; gap: 6px; padding: 0 12px 12px; }

/* ---------- Загрузка и автообновление ---------- */
#upload-status { display: block; min-height: 16px; font-variant-numeric: tabular-nums; }
.refresh-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  border: 1px solid var(--amber);
  border-radius: 10px;
  background: var(--amber-soft);
  padding: 10px 14px;
  color: #7a5011;
  font-size: 13px;
  font-weight: 600;
}
@media (max-width: 800px) {
  .material-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding-inline: 14px; }
  .material-cover { max-height: 200px; }
}

/* ---------- Зона загрузки файлов и папок ---------- */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border: 1.5px dashed #c6d3cb;
  border-radius: 12px;
  background: #fafbf9;
  padding: 20px 16px 18px;
  text-align: center;
  transition: border-color 140ms ease, background 140ms ease;
}
.dropzone--over { border-color: var(--green); background: var(--green-soft); }
.dropzone-icon { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 14px; background: var(--green-soft); color: var(--green); }
.dropzone-icon svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.dropzone--over .dropzone-icon { background: #fff; }
.dropzone strong { font-size: 14px; }
.dropzone > small { color: var(--muted); font-size: 11px; line-height: 1.45; max-width: 34ch; }
.dropzone-field { width: 100%; margin-top: 6px; }
.dropzone-field > span { display: none; }
.dropzone-field input[type=file] { border: 1px solid var(--line); border-radius: 9px; background: var(--surface); padding: 8px 10px; font-size: 12px; }
.dropzone-pickers { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 6px; }
.dropzone-pickers .dropzone-field { width: auto; margin-top: 0; }
.dropzone-pickers label.secondary-button { cursor: pointer; }
@media (max-width: 800px) {
  .preview-box .pdf-frame { min-height: 60vh; }
  .preview-fallback { font-size: 14px; }
}

/* ---------- Окна действий ---------- */
.modal { border: 0; padding: 0; background: transparent; max-width: min(560px, 94vw); width: 100%; }
.modal::backdrop { background: rgba(23, 42, 36, 0.45); backdrop-filter: blur(2px); }
.modal-card { border-radius: 16px; background: var(--surface); box-shadow: 0 24px 60px rgba(23, 42, 36, 0.28); overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line-soft); }
.modal-head h2 { margin: 0; font-size: 17px; letter-spacing: -0.01em; }
.modal-close { border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font-size: 22px; line-height: 1; padding: 2px 8px 5px; }
.modal-close:hover { background: #f1f4f1; color: var(--ink); }
.modal-body { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px; max-height: min(66vh, 620px); overflow-y: auto; }
.modal-hint { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px 18px; border-top: 1px solid var(--line-soft); background: #fbfcfa; }
@media (max-width: 800px) {
  .modal { max-width: 100vw; }
  .modal-card { border-radius: 16px 16px 0 0; }
  .modal-foot .primary-button, .modal-foot .secondary-button { flex: 1; }
}

/* ---------- Перетаскивание на страницу ---------- */
.materials-page { position: relative; }
.drop-veil {
  position: absolute;
  inset: -8px;
  z-index: 5;
  display: grid;
  place-items: center;
  border: 2px dashed var(--green);
  border-radius: 16px;
  background: rgba(226, 240, 234, 0.92);
}
.drop-veil span { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--green); font-size: 15px; }
.drop-veil svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Плавающая панель загрузки ---------- */
.upload-tray {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  width: min(360px, calc(100vw - 32px));
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 18px 44px rgba(23, 42, 36, 0.18);
  overflow: hidden;
}
.upload-tray-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px 10px; }
.upload-tray-head strong { font-size: 13px; }
.upload-tray-head button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 4px 3px; }
.upload-tray .progress-bar { margin: 0 14px; }
.upload-tray-status { margin: 8px 14px 14px; color: var(--muted); font-size: 12px; line-height: 1.45; font-variant-numeric: tabular-nums; }
@media (max-width: 800px) { .upload-tray { right: 12px; bottom: 12px; } }

/* ---------- Настройки: разделы вместо простыни полей ---------- */
.settings-form { max-width: 820px; }
.settings-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; padding: 12px 0 4px; background: linear-gradient(to top, var(--canvas) 70%, transparent); }

/* ---------- Обложка папки: мозаика из того, что внутри ---------- */
.folder-cover {
  display: grid;
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  gap: 2px;
  border-radius: 12px;
  overflow: hidden;
  background: #eef1ec;
}
.folder-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.folder-cover--1 { grid-template-columns: 1fr; }
.folder-cover--2 { grid-template-columns: 1fr 1fr; }
.folder-cover--3 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.folder-cover--3 img:first-child { grid-row: span 2; }
.folder-cover--4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.folder-card:hover .folder-cover { transform: scale(1.04); }
.folder-cover { transition: transform 140ms ease; }

/* Кадр видео помечается знаком воспроизведения. */
.material-cover { position: relative; }
.material-play {
  position: absolute;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  background: rgba(23, 42, 36, 0.62);
  color: #fff;
  font-size: 16px;
  padding-left: 3px;
  backdrop-filter: blur(2px);
}

/* Поле номера и кнопка проверки стоят в одну строку. */
.check-row { display: flex; align-items: flex-end; gap: 12px; }
.check-row .field { flex: 1; }
.check-row .primary-button { min-height: 52px; white-space: nowrap; }
@media (max-width: 800px) {
  .check-row { flex-direction: column; align-items: stretch; }
  .check-row .primary-button { width: 100%; }
}

/* ---------- Листание материалов ---------- */
.pager-button { min-width: 42px; padding: 0 12px; font-size: 16px; }
.pager-button[aria-disabled="true"] { opacity: 0.4; cursor: default; pointer-events: none; }
.pager-count { align-self: center; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Масштаб просмотра ---------- */
.preview-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.preview-meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.zoom-bar { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-soft); border-radius: 10px; padding: 4px; background: #fafbf9; }
.zoom-bar .secondary-button { border-color: transparent; background: transparent; }
.zoom-bar .secondary-button:hover { border-color: var(--line); background: var(--surface); }
.zoom-value { min-width: 66px; text-align: center; color: var(--ink); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.preview-box--scroll { overflow: auto; max-height: 80vh; }
.preview-box--scroll .pdf-frame { min-height: 0; max-width: none; }
.preview-box--scroll img.zoom-image { display: block; width: 100%; height: auto; border-radius: 10px; }
@media (max-width: 800px) {
  .preview-tools { justify-content: flex-start; }
  .zoom-value { min-width: 58px; }
}

/* ---------- Панорамный тур ---------- */
.tour-frame { position: relative; width: 100%; height: clamp(380px, calc(100vh - 268px), 920px); background: #0f1a16; overflow: hidden; }
.tour-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.tour-frame:fullscreen { height: 100vh; width: 100vw; }
.tour-frame.is-max { position: fixed; inset: 0; z-index: 60; width: 100vw; height: 100vh; max-height: none; }
body.has-max { overflow: hidden; }
.tour-exit {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  width: 40px; height: 40px; border: 0; border-radius: 12px;
  background: rgba(15, 26, 22, 0.66); color: #fff; font-size: 17px; line-height: 1;
  cursor: pointer; backdrop-filter: blur(6px);
}
.tour-exit:hover { background: rgba(23, 58, 50, 0.92); }
.tour-frame:-webkit-full-screen { height: 100vh; width: 100vw; }
.tour-link { display: inline-block; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); padding: 2px 8px; font-size: 12px; overflow-wrap: anywhere; }
@media (max-width: 800px) { .tour-frame { height: clamp(320px, calc(100vh - 300px), 620px); } }
@supports (height: 100dvh) {
  .tour-frame { height: clamp(380px, calc(100dvh - 268px), 920px); }
  @media (max-width: 800px) { .tour-frame { height: clamp(320px, calc(100dvh - 300px), 620px); } }
}
/* Длинный пункт меню переносится на вторую строку, а не обрезается. */
.main-nav a span { line-height: 1.25; }

/* ---------- Дорожка стадий клиента ---------- */
.stage-wrap { padding-top: 14px; padding-bottom: 4px; }
.stage-track { display: flex; margin: 0; padding: 0; list-style: none; gap: 4px; counter-reset: stage; }
.stage-track li {
  position: relative; display: flex; flex: 1; min-width: 0; flex-direction: column;
  align-items: center; gap: 7px; text-align: center;
}
/* Соединительная черта идёт за кружком, от центра к центру соседей. */
.stage-track li::before {
  content: ""; position: absolute; top: 13px; left: -50%; width: 100%; height: 2px;
  background: var(--line); z-index: 0;
}
.stage-track li:first-child::before { display: none; }
.stage-track li.done::before, .stage-track li.current::before { background: var(--green); }
.stage-dot {
  position: relative; z-index: 1; display: grid; width: 26px; height: 26px; place-items: center;
  border: 2px solid var(--line); border-radius: 50%; background: var(--surface);
  color: var(--muted); font-size: 11px; font-weight: 800;
}
.stage-track li b { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: -0.01em; }
.stage-track li.done .stage-dot { border-color: var(--green); background: var(--green); color: #fff; }
.stage-track li.done b { color: var(--ink); }
.stage-track li.current .stage-dot { border-color: var(--green); background: var(--green-soft); color: var(--green); box-shadow: 0 0 0 4px rgba(47, 122, 100, 0.12); }
.stage-track li.current b { color: var(--green); }
.stage-track--closed .stage-dot, .stage-track--closed li::before { filter: grayscale(1); opacity: 0.75; }
.stage-closed { margin: 12px 0 0; color: var(--muted); font-size: 12px; }

/* ---------- Следующий шаг ---------- */
.plan-line { margin: 0 0 10px; font-size: 13px; }
.plan-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.plan-form input[type="date"] { min-height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: var(--surface); font-size: 13px; }
.plan-form input[type="text"] { flex: 1 1 150px; min-height: 36px; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: var(--surface); font-size: 13px; }
@media (max-width: 520px) { .stage-track li b { font-size: 10px; } }


/* ---------- Подборка материалов клиенту ---------- */
.share-ready { margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.share-ready p { margin: 0 0 8px; font-size: 13px; font-weight: 600; }
.share-ready .tour-link { display: block; margin-bottom: 10px; }
.share-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.share-list li { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; font-size: 13px; }
.share-list li.dead { opacity: 0.55; }
.share-list-main { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.share-list-main small { color: var(--muted); font-size: 11px; }
.share-list-actions { display: flex; flex: 0 0 auto; gap: 10px; align-items: center; }
.pick-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line-soft); cursor: pointer; font-size: 13px; }
.pick-row:last-child { border-bottom: 0; }
.pick-row:hover { background: #fafbf9; }
.pick-row span { flex: 1; min-width: 0; font-weight: 600; }
.pick-row small { color: var(--muted); font-size: 11px; }
.pick-row input { width: 16px; height: 16px; accent-color: var(--forest); }

/* ---------- Страница подборки для клиента ---------- */
.share-page { background: var(--canvas); color: var(--ink); }
.share-header { max-width: 1100px; margin: 0 auto; padding: 36px 20px 20px; }
.share-logo { width: min(210px, 60%); height: auto; }
.share-header h1 { margin: 20px 0 8px; font-size: clamp(24px, 4vw, 34px); font-weight: 750; letter-spacing: -0.035em; }
.share-header p { margin: 0; max-width: 62ch; color: var(--muted); font-size: 14px; }
.share-agent {
  display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin-top: 18px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 10px 16px; font-size: 13px;
}
.share-agent span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.share-agent a { font-weight: 700; text-decoration: none; }
.share-main { max-width: 1100px; margin: 0 auto; padding: 10px 20px 40px; }
.share-section { margin-top: 26px; }
.share-section h2 { margin: 0 0 14px; font-size: 15px; font-weight: 750; }
.share-tour { position: relative; height: clamp(320px, 56vh, 620px); border-radius: 14px; overflow: hidden; background: #0f1a16; }
.share-tour iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.share-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.share-card { display: flex; flex-direction: column; border: 1px solid var(--line-soft); border-radius: 14px; background: var(--surface); overflow: hidden; box-shadow: var(--shadow); }
.share-cover { display: block; aspect-ratio: 4 / 3; background: #eef1e8; }
.share-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.share-noimg { display: grid; width: 100%; height: 100%; place-items: center; color: var(--forest); font-size: 30px; }
.share-body { display: flex; flex: 1; flex-direction: column; gap: 4px; padding: 14px 16px 16px; }
.share-body h3 { margin: 0; font-size: 14px; font-weight: 700; }
.share-body small { color: var(--muted); font-size: 11px; }
.share-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 12px; }
.share-button {
  display: inline-flex; min-height: 36px; flex: 1; align-items: center; justify-content: center;
  border: 1px solid var(--forest); border-radius: 9px; background: var(--forest); color: #fff;
  font-size: 13px; font-weight: 700; text-decoration: none;
}
.share-button--ghost { border-color: var(--line); background: var(--surface); color: var(--ink); }
.share-empty { margin: 30px 0; color: var(--muted); }
.share-footer { max-width: 1100px; margin: 0 auto; padding: 0 20px 36px; color: var(--muted); font-size: 12px; }
@media (max-width: 600px) { .share-header { padding-top: 24px; } .share-grid { grid-template-columns: 1fr 1fr; gap: 12px; } }

/* Галочка с пояснением в диалогах настроек.
   Имя своё: класс .check-row уже занят строкой проверки телефона. */
.toggle-row { display: flex; gap: 10px; align-items: flex-start; margin-top: 4px; cursor: pointer; }
.toggle-row input[type="checkbox"] { width: 16px; height: 16px; margin-top: 2px; flex: 0 0 auto; accent-color: var(--forest); }
.toggle-row > span { display: flex; flex-direction: column; gap: 3px; font-size: 13px; font-weight: 600; }
.toggle-row small { color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.4; }

/* ---------- Запись на визит ---------- */
.pick-kind { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.kind-card {
  display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; cursor: pointer; background: var(--surface);
  transition: border-color 120ms ease, background 120ms ease;
}
.kind-card:hover { border-color: #bac5bf; }
.kind-card input { margin-top: 2px; accent-color: var(--forest); }
.kind-card span { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.kind-card strong { font-size: 13px; }
.kind-card small { color: var(--muted); font-size: 11px; line-height: 1.35; }
.kind-card:has(input:checked) { border-color: var(--green); background: var(--green-soft); }
td .muted { color: var(--muted); }
@media (max-width: 600px) { .pick-kind { grid-template-columns: 1fr; } }
