/* MM — дизайн-система. Чёрный, графит, белый; золото — только акцент. */
:root {
  --ink: #121212;
  --graphite: #18191c;
  --graphite-2: #232428;
  --graphite-3: #303136;
  --paper: #f5f4f0;
  --surface: #ffffff;
  --line: #e4e1da;
  --line-strong: #cfcac0;
  --muted: #6c6b68;
  --muted-2: #9a9893;
  --gold: #b08d4a;
  --gold-strong: #8f6f33;
  --gold-soft: #f4ecdc;
  --ok: #2e7650;
  --ok-soft: #e5f1ea;
  --warn: #9a6512;
  --warn-soft: #f8eedb;
  --bad: #a93a30;
  --bad-soft: #f7e3e0;
  --info-soft: #ebeef3;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(18, 18, 18, .05), 0 4px 16px rgba(18, 18, 18, .04);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--paper); }
a { color: inherit; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { color: var(--gold-strong); }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 650; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0 0 1em; }
img, svg { max-width: 100%; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.pre { white-space: pre-line; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* ---------- Логотип ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.logo:hover { color: inherit; }
.logo-mark { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--gold); color: var(--gold); font-weight: 700; letter-spacing: .04em; font-size: 14px; border-radius: 2px; }
.logo-text { font-weight: 600; letter-spacing: .14em; font-size: 12px; text-transform: uppercase; }

/* ---------- Кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 8px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-weight: 550; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; }
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn:focus-visible, .input:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--graphite-3); color: #fff; border-color: var(--graphite-3); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--gold-strong); border-color: var(--gold-strong); color: #fff; }
.btn-danger { color: var(--bad); border-color: #e2c3bf; }
.btn-danger:hover { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--gold-strong); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
form.inline { display: inline; margin: 0; }

/* ---------- Каркас CRM ---------- */
.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { background: var(--graphite); color: #d9d7d2; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 12px 28px; }
.sidebar .logo { padding: 4px 10px 18px; color: #fff; }
.nav-group { margin-top: 14px; }
.nav-title { padding: 0 10px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: #85837e; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); text-decoration: none; color: #d9d7d2; font-size: 14px; border-left: 2px solid transparent; }
.nav a:hover { background: var(--graphite-2); color: #fff; }
.nav a.active { background: var(--graphite-2); color: #fff; border-left-color: var(--gold); }
.nav a .icon { color: #8f8d87; }
.nav a.active .icon { color: var(--gold); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 28px; background: rgba(255,255,255,.94); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.menu-toggle { display: none; }
.content { padding: 24px 28px 48px; max-width: 1480px; width: 100%; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { text-decoration: none; color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { color: var(--muted-2); }
.page-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.page-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* Пользователь и уведомления */
.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 340px; max-width: calc(100vw - 32px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0,0,0,.12); padding: 8px; z-index: 50; }
.dropdown-menu a, .dropdown-menu button.menu-item { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: var(--radius-sm); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; color: var(--ink); }
.dropdown-menu a:hover, .dropdown-menu button.menu-item:hover { background: var(--paper); }
.bell { position: relative; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); }
.bell .count { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--gold); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: var(--gold); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.user-chip .who { line-height: 1.15; font-size: 13px; }
.user-chip .who small { display: block; color: var(--muted); font-size: 11px; }
.note-item { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.note-item:last-child { border-bottom: 0; }

/* ---------- Сообщения ---------- */
.messages { display: grid; gap: 8px; margin-bottom: 16px; }
.alert { padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); }
.alert-success { background: var(--ok-soft); border-color: #c6e0d1; color: #1f5137; }
.alert-error { background: var(--bad-soft); border-color: #ebc7c2; color: #7c2820; }
.alert-warning { background: var(--warn-soft); border-color: #ead6b1; color: #6e4a0e; }
.alert-info { background: var(--info-soft); border-color: #d5dbe5; }

/* ---------- Панели ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 15px; }
.panel-head .actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.panel-body { padding: 16px 18px; }
.panel-body.flush { padding: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.panels > .wide { grid-column: 1 / -1; }
.fields { display: grid; grid-template-columns: minmax(140px, 38%) 1fr; gap: 8px 16px; margin: 0; }
.fields dt { color: var(--muted); font-size: 13px; }
.fields dd { margin: 0; word-break: break-word; }

/* KPI */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 20px; }
.panel-body .stats { margin-bottom: 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; display: block; color: var(--ink); }
.stat .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat .value { font-size: 24px; font-weight: 650; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.bad .value { color: var(--bad); }
.stat.warn .value { color: var(--warn); }
.stat.ok .value { color: var(--ok); }
.stat.accent { border-top: 2px solid var(--gold); }
a.stat:hover { border-color: var(--line-strong); color: var(--ink); }

/* ---------- Таблицы ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: #faf9f6; white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fbfaf7; }
.table th a { text-decoration: none; color: inherit; }
.table th a.active { color: var(--ink); }
.table td a.row-link { font-weight: 550; text-decoration: none; }
.table td a.row-link:hover { text-decoration: underline; }
.table tfoot td { font-weight: 650; background: #faf9f6; }
.table-compact td, .table-compact th { padding: 7px 10px; }
.table td.num, .table th.num { text-align: right; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--info-soft); color: #3b4352; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.muted { background: #efeeea; color: #57565a; }
.badge.gold { background: var(--gold-soft); color: var(--gold-strong); }

/* ---------- Фильтры и пагинация ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.toolbar .field { margin: 0; min-width: 160px; }
.toolbar .search { flex: 1 1 240px; }
.toolbar label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 4px; font-weight: 500; }
.table-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.pagination { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 34px; height: 32px; display: grid; place-items: center; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); background: var(--surface); }
.pagination span.current { background: var(--ink); color: #fff; border-color: var(--ink); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .icon { width: 32px; height: 32px; color: var(--muted-2); margin-bottom: 8px; }

/* ---------- Формы ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field .req { color: var(--gold-strong); }
.input { width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; font: inherit; color: var(--ink); }
.input:focus { border-color: var(--ink); outline: none; }
textarea.input { min-height: 90px; resize: vertical; }
.checkbox { width: 18px; height: 18px; accent-color: var(--ink); vertical-align: middle; }
.check-field { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.check-field > label { margin: 0; font-weight: 500; }
.check-field .help { flex-basis: 100%; }
.checklist { list-style: none; margin: 0; max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 10px; }
.checklist label { font-weight: 400; display: flex; gap: 8px; align-items: center; padding: 3px 0; }
.help { font-size: 12px; color: var(--muted); margin-top: 4px; }
.errorlist { list-style: none; padding: 0; margin: 4px 0 0; color: var(--bad); font-size: 13px; }
.field.has-error .input { border-color: var(--bad); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 8px; }
.formset-table td { padding: 6px; }
.formset-table .input { min-height: 34px; padding: 5px 8px; min-width: 80px; }
.form-errors { margin-bottom: 14px; }

/* Лимиты */
meter { width: 100%; height: 10px; }
.limit-bar { display: grid; gap: 4px; min-width: 160px; }

/* Диалог подтверждения */
dialog.confirm { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; max-width: 440px; width: calc(100% - 32px); box-shadow: 0 24px 64px rgba(0,0,0,.25); }
dialog.confirm::backdrop { background: rgba(18,18,18,.45); }

/* История и комментарии */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.timeline li:last-child { border-bottom: 0; }
.timeline .meta { color: var(--muted); }
.changes { margin: 4px 0 0; padding-left: 16px; color: var(--muted); }
.comment { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fcfbf8; }
.comment.internal { border-left: 3px solid var(--gold); }
.comment + .comment { margin-top: 10px; }

/* Вход */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side { background: var(--graphite); color: #e7e5e0; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side .logo { color: #fff; }
.auth-side h2 { font-size: 30px; font-weight: 600; color: #fff; max-width: 420px; line-height: 1.25; }
.auth-side .gold-line { width: 56px; height: 2px; background: var(--gold); margin: 18px 0; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; background: var(--paper); }
.auth-card { width: 100%; max-width: 400px; }

/* Печатные документы */
.doc-page { background: #fff; max-width: 860px; margin: 24px auto; padding: 48px 56px; border: 1px solid var(--line); }
.doc-page h1 { font-size: 22px; }
.doc-page table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 13px; }
.doc-page th, .doc-page td { border: 1px solid #999; padding: 6px 8px; }
.doc-page .parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; font-size: 13px; }
.doc-toolbar { max-width: 860px; margin: 16px auto 0; display: flex; gap: 8px; flex-wrap: wrap; }
@media print {
  .no-print, .sidebar, .topbar { display: none !important; }
  body { background: #fff; }
  .doc-page { border: 0; margin: 0; padding: 0; max-width: none; }
  .app { display: block; }
}

/* ---------- Адаптивность CRM ---------- */
@media (max-width: 1100px) {
  .panels, .grid-2 { grid-template-columns: minmax(0, 1fr); }  /* широкие таблицы прокручиваются внутри, а не всю страницу */
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .content { padding: 18px 16px 40px; }
  .user-chip .who { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}
@media (max-width: 600px) {
  .grid-3 { grid-template-columns: 1fr; }
  .fields { grid-template-columns: 1fr; gap: 2px; }
  .fields dd { margin-bottom: 8px; }
  .page-actions { margin-left: 0; width: 100%; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat .value { font-size: 19px; }
  .toolbar .field { min-width: 100%; }
  .doc-page { padding: 20px; }
  .doc-page .parties { grid-template-columns: 1fr; }
}

/* ================= Публичный сайт ================= */
.site { background: #fff; }
.site-header { position: sticky; top: 0; z-index: 30; background: rgba(18,18,18,.97); color: #fff; }
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 72px; position: relative; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.site-nav { display: flex; gap: 22px; margin-left: auto; align-items: center; }
.site-nav a { color: #d8d6d0; text-decoration: none; font-size: 14px; }
.site-nav a:hover, .site-nav a.active { color: #fff; }
.site-nav .btn { color: #fff; }
.site-burger { display: none; margin-left: auto; background: none; border: 1px solid #444; color: #fff; border-radius: var(--radius-sm); width: 42px; height: 38px; cursor: pointer; }
.hero { background: var(--ink); color: #fff; padding: 96px 0 104px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -120px; top: -120px; width: 480px; height: 480px; border: 1px solid rgba(176,141,74,.35); border-radius: 50%; pointer-events: none; }
.eyebrow { text-transform: uppercase; letter-spacing: .18em; font-size: 12px; color: var(--gold); font-weight: 600; }
.hero h1 { font-size: clamp(34px, 5vw, 58px); line-height: 1.05; font-weight: 650; letter-spacing: -.025em; max-width: 860px; margin: 18px 0 22px; }
.hero p.lead { font-size: 19px; color: #c9c7c1; max-width: 680px; }
.hero .cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 32px; }
.hero .btn, .page-hero .btn { min-height: 48px; padding: 12px 22px; font-size: 15px; }
.btn-outline-light { background: transparent; color: #fff; border-color: #55534f; }
.btn-outline-light:hover { border-color: #fff; color: #fff; }
.section { padding: 84px 0; }
.section.alt { background: var(--paper); }
.section.dark { background: var(--graphite); color: #e9e7e2; }
.section-head { max-width: 760px; margin-bottom: 40px; }
.section-head h2 { font-size: clamp(26px, 3vw, 38px); letter-spacing: -.02em; font-weight: 650; margin-top: 10px; }
.section-head p { color: var(--muted); font-size: 17px; }
.section.dark .section-head p { color: #b5b3ad; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--ink); transition: border-color .15s; }
a.card:hover { border-color: var(--gold); color: var(--ink); }
.card h3 { font-size: 18px; margin: 0; }
.card p { color: var(--muted); margin: 0; }
.card .more { margin-top: auto; font-weight: 600; font-size: 14px; color: var(--gold-strong); }
.card .tag { align-self: flex-start; }
.steps { counter-reset: step; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px 20px; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: step; border-top: 1px solid var(--line-strong); padding-top: 18px; }
.steps li::before { content: counter(step, decimal-leading-zero); display: block; color: var(--gold); font-weight: 700; letter-spacing: .08em; margin-bottom: 8px; }
.steps li strong { display: block; margin-bottom: 4px; }
.steps li span { color: var(--muted); font-size: 14px; }
.section.dark .steps li { border-color: #3a3a3e; }
.section.dark .steps li span { color: #a9a7a1; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.checks li { padding-left: 28px; position: relative; }
.checks li::before { content: ""; position: absolute; left: 4px; top: 8px; width: 12px; height: 6px; border-left: 2px solid var(--gold); border-bottom: 2px solid var(--gold); transform: rotate(-45deg); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.compare .card { border-top: 2px solid var(--gold); }
.cta-band { background: var(--ink); color: #fff; border-radius: var(--radius); padding: 44px; display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.cta-band h2 { margin: 0; font-size: 28px; }
.cta-band p { color: #c3c1bb; margin: 6px 0 0; }
.cta-band .btn { margin-left: auto; }
.page-hero { background: var(--ink); color: #fff; padding: 64px 0 56px; }
.page-hero h1 { font-size: clamp(30px, 4vw, 46px); letter-spacing: -.02em; margin-top: 12px; max-width: 900px; }
.page-hero p { color: #c9c7c1; font-size: 18px; max-width: 760px; }
.prose { max-width: 780px; }
.prose h2 { margin-top: 36px; font-size: 22px; }
.service-block + .service-block { margin-top: 32px; }
.site-footer { background: var(--graphite); color: #b9b7b1; padding: 56px 0 32px; font-size: 14px; }
.site-footer .cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.site-footer a { color: #d8d6d0; text-decoration: none; }
.site-footer a:hover { color: #fff; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.site-footer h3 { color: #fff; font-size: 13px; text-transform: uppercase; letter-spacing: .12em; }
.site-footer .bottom { border-top: 1px solid #333; margin-top: 36px; padding-top: 18px; display: flex; gap: 16px; flex-wrap: wrap; }
.lead-form { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); color: var(--ink); }
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.price-note { padding: 14px 16px; border-left: 2px solid var(--gold); background: var(--gold-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

@media (max-width: 960px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .steps { grid-template-columns: 1fr 1fr; }
  .split, .compare { grid-template-columns: 1fr; gap: 28px; }
  .site-footer .cols { grid-template-columns: 1fr; }
  .site-burger { display: inline-grid; place-items: center; }
  .site-nav { display: none; position: absolute; top: 72px; left: 0; right: 0; background: var(--ink); flex-direction: column; align-items: stretch; padding: 12px 24px 20px; gap: 4px; border-top: 1px solid #2c2c2c; }
  body.site-nav-open .site-nav { display: flex; }
  .site-nav a { padding: 10px 0; font-size: 16px; }
}
@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  .cards, .steps { grid-template-columns: 1fr; }
  .hero { padding: 64px 0 72px; }
  .section { padding: 56px 0; }
  .cta-band { padding: 28px 22px; }
  .cta-band .btn { margin-left: 0; }
  .lead-form { padding: 20px; }
}

/* Знак чисел: минус (недостача) — красный, плюс — зелёный */
.t-neg { color: var(--bad); font-weight: 600; }
.t-pos { color: var(--ok); font-weight: 600; }
.t-warn { color: var(--warn); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted, #6b6b6b); margin: 0; padding: 0; list-style: none; }
.legend b { color: var(--text, inherit); }
.lead { font-size: 15px; line-height: 1.5; margin: 0 0 4px; }
.select-search { min-width: 220px; width: 100%; }
.combo-list { position: fixed; z-index: 1000; max-height: 320px; max-width: min(560px, calc(100vw - 16px)); overflow-y: auto;
  background: var(--surface, #fff); border: 1px solid var(--line, #ddd); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.combo-item { padding: 7px 10px; cursor: pointer; font-size: 14px; line-height: 1.3; }
.combo-item.active { background: var(--gold-soft); }
.combo-item.selected { font-weight: 600; }
.combo-empty { padding: 8px 10px; color: var(--muted, #888); font-size: 13px; }
@media (max-width: 760px) { .select-search, .combo-item { font-size: 16px; } }
.review-split > .review-photos { margin-bottom: 16px; }
.review-split > .review-main { min-width: 0; }
.photo-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.photo-tools .btn.active { background: var(--gold-soft); border-color: var(--gold); }
.photo-sep { width: 8px; }
.photo-stage { height: 60vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper);
  cursor: grab; user-select: none; }
.photo-stage.dragging { cursor: grabbing; }
.photo-stage img { display: block; width: 100%; max-width: none; height: auto; }
table[data-line-totals] td, table[data-line-totals] th { padding-left: 6px; padding-right: 6px; }
table[data-line-totals] input[name$="-unit"] { min-width: 48px; width: 56px; }
table[data-line-totals] input[name$="-qty_doc"], table[data-line-totals] input[name$="-price_doc"] { min-width: 72px; width: 84px; }
table[data-line-totals] input[name$="-name"] { min-width: 110px; }
table[data-line-totals] .select-search { min-width: 160px; }
table[data-line-totals] thead th:last-child { width: 1%; font-size: 0; }  /* «Удалить» — только галочка */
table[data-line-totals] thead th:last-child::after { content: "✕"; font-size: 12px; }
.formset-table .line-sum { white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; vertical-align: middle; }
.formset-table .line-sum.sum-bad { background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.formset-table tr.line-deleted td { opacity: .45; }
.formset-table tfoot th { text-align: left; white-space: nowrap; font-variant-numeric: tabular-nums; border-top: 2px solid var(--line-strong); }
.formset-table tfoot th.num { text-align: right; }
.formset-table tfoot .totals-doc td { font-size: 13px; color: var(--muted); }
.formset-table tfoot .totals-doc b { color: var(--ink); }
.input-sm { padding: 4px 8px; font-size: 13px; min-height: 0; }
.issues-table td { vertical-align: middle; }
.issues-table input[name="resolution"] { min-width: 160px; width: 100%; }
.issue-status { white-space: nowrap; }
.status-select { width: auto; font-weight: 600; border-radius: 999px; }
.status-select.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-soft); }
.status-select.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-soft); }
.status-select.bad { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-soft); }
.status-select.muted { background: #efeeea; color: #57565a; border-color: #efeeea; }
.issue-saved { margin-left: 6px; }
.ok-text { color: var(--ok); }
.bad-text { color: var(--bad); }
@media (max-width: 760px) { .input-sm { font-size: 16px; } .issue-status { white-space: normal; } }
.photo-attach { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
@media (min-width: 1000px) {
  .review-split { display: grid; grid-template-columns: minmax(0, 7fr) minmax(340px, 4fr); gap: 16px; align-items: start; }
  .review-split > .review-photos { grid-column: 2; grid-row: 1; position: sticky; top: 12px; margin: 0;
    display: flex; flex-direction: column; max-height: calc(100vh - 24px); }
  .review-split > .review-main { grid-column: 1; grid-row: 1; }
  .review-photos > .panel-body, .review-photos .photo-viewer { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .review-split .photo-stage { flex: 1; min-height: 240px; height: auto; }
}
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.photo-grid img { width: 100%; height: auto; border: 1px solid var(--line, #ddd); border-radius: 8px; background: #fff; }
.assistant-examples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; }
.assistant-examples .btn { white-space: normal; text-align: left; height: auto; }
tr[hidden] { display: none; }
/* Меню: сворачиваемые группы и вкладки связанных страниц */
details.nav-group > summary.nav-title { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.nav-group > summary.nav-title::-webkit-details-marker { display: none; }
details.nav-group > summary.nav-title::after { content: "▾"; font-size: 10px; opacity: .6; transition: transform .15s; }
details.nav-group:not([open]) > summary.nav-title::after { transform: rotate(-90deg); }
.page-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line, #e3e1dc); margin: 0 0 16px; }
.page-tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted, #6b6a66); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 14px; }
.page-tabs a:hover { color: inherit; }
.page-tabs a.active { color: inherit; border-bottom-color: var(--gold); font-weight: 600; }
/* Цветная метка клиента */
.cchip { display: inline-block; min-width: 26px; padding: 1px 6px; margin-right: 6px; border-radius: 4px; background: var(--cc, #475569); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .03em; text-align: center; vertical-align: 1px; line-height: 16px; }
.cchip.lg { font-size: 13px; padding: 2px 8px; line-height: 20px; }
/* «Работаю с…» */
.work-ctx-btn { display: inline-flex; align-items: center; gap: 4px; max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; list-style: none; }
.work-ctx-btn::-webkit-details-marker { display: none; }
.work-ctx-menu { min-width: 280px; max-height: 70vh; overflow-y: auto; }
.work-ctx-menu .input { margin: 6px 8px; width: calc(100% - 16px); }
.work-ctx-menu .menu-item { display: flex; align-items: center; width: 100%; text-align: left; }
.work-ctx-menu .menu-item.active { font-weight: 700; background: var(--gold-soft, #f6efd9); }
.work-ctx-menu [hidden] { display: none; }
.work-ctx-note { margin-bottom: 12px; }
@media (max-width: 700px) { .work-ctx-btn { max-width: 150px; } }
/* Очередь работ */
.queue-n { display: inline-block; min-width: 28px; padding: 2px 8px; border-radius: 12px; background: var(--warn-soft, #fdf1d8); color: var(--warn, #9a6200); font-weight: 700; text-decoration: none; text-align: center; }
.queue-n:hover { filter: brightness(.95); }
a.stat:hover { box-shadow: 0 0 0 2px var(--gold-soft, #f1e6c8); }
.tab-count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--paper, #f3f2ee); font-size: 12px; text-align: center; }
.page-tabs a.active .tab-count { background: var(--gold-soft, #f1e6c8); }
.multi-client { display: flex; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--line, #eee); }
.queue-table td:first-child { min-width: 240px; }
.queue-table th { white-space: normal; min-width: 90px; }
