/* Vetteria CRM. Фирменные цвета: #078585 (тёмно-бирюзовый), #BCCF17 (ярко-зелёный). */
:root {
  --brand: #078585;
  --brand-strong: #056b6b;
  --brand-soft: #e3f2f2;
  --lime: #bccf17;
  --lime-soft: #f4f8d6;
  --bg: #f4f6f6;
  --surface: #ffffff;
  --surface-2: #f8fafa;
  --line: #dde4e4;
  --line-strong: #c6d1d1;
  --text: #1c2a2a;
  --text-2: #5c6e6e;
  --ok: #1d8a4e;
  --ok-soft: #e2f4ea;
  --warn: #a86a00;
  --warn-soft: #fdf1d8;
  --danger: #c0392b;
  --danger-soft: #fbe5e2;
  --shadow: 0 1px 2px rgba(16, 40, 40, .06), 0 4px 16px rgba(16, 40, 40, .06);
  --radius: 10px;
  --font: "Museo Sans Cyrl", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #22a3a3; --brand-strong: #3bbcbc; --brand-soft: #123535; --lime: #bccf17; --lime-soft: #2b3010;
    --bg: #0f1717; --surface: #162121; --surface-2: #1b2828; --line: #263737; --line-strong: #345050;
    --text: #e6eeee; --text-2: #97abab; --ok: #4cc382; --ok-soft: #12301f; --warn: #e3a840; --warn-soft: #33270e;
    --danger: #ef7466; --danger-soft: #3a1815; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #22a3a3; --brand-strong: #3bbcbc; --brand-soft: #123535; --lime: #bccf17; --lime-soft: #2b3010;
  --bg: #0f1717; --surface: #162121; --surface-2: #1b2828; --line: #263737; --line-strong: #345050;
  --text: #e6eeee; --text-2: #97abab; --ok: #4cc382; --ok-soft: #12301f; --warn: #e3a840; --warn-soft: #33270e;
  --danger: #ef7466; --danger-soft: #3a1815; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.45 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; font-weight: 700; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; } h4 { font-size: 14px; }
p { margin: 0 0 .7em; }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.muted { color: var(--text-2); } .small { font-size: 12.5px; } .big { font-size: 17px; }
.grow { flex: 1; } .right { text-align: right; } .nowrap { white-space: nowrap; } .pre { white-space: pre-wrap; }
.gap-top { margin-top: 18px; } .pad { padding: 10px; } .indent { margin-left: 26px; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--text-2); gap: 12px; }
.icon { flex: none; vertical-align: middle; }

/* ---------- Кнопки и поля ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
  white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s; text-decoration: none !important; }
.btn:hover { border-color: var(--brand); background: var(--surface-2); }
.btn:focus-visible, .input:focus, .btn-plain:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.danger { color: var(--danger); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon-only { width: 36px; padding: 0; } .btn.icon-only.sm { width: 28px; height: 28px; }
.btn.block { width: 100%; }
.btn-plain { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.input { width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface);
  color: var(--text); font: inherit; }
textarea.input { height: auto; padding: 8px 10px; resize: vertical; }
select.input { padding-right: 6px; }
.input.sm { height: 30px; font-size: 13px; }
.input.short { max-width: 140px; }
.input.bad, .field.invalid .input { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.input:disabled { background: var(--surface-2); color: var(--text-2); }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field-hint { font-size: 12px; color: var(--text-2); }
.field-error { font-size: 12px; color: var(--danger); }
.req { color: var(--danger); margin-left: 2px; }
.check-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; cursor: pointer; }
.check-row input { width: 16px; height: 16px; accent-color: var(--brand); }
input[type=checkbox] { accent-color: var(--brand); }
.inline-field { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; }
.inline-field .input { width: 150px; }

.badge { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: 99px; background: var(--surface-2);
  border: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; vertical-align: middle; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.accent { background: var(--lime-soft); color: #5d6608; border-color: transparent; }
:root[data-theme="dark"] .badge.accent { color: var(--lime); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge.accent { color: var(--lime); } }
.badge.muted-badge { background: transparent; }
.bad { color: var(--danger); font-weight: 700; }

.alert { padding: 10px 12px; border-radius: 8px; margin: 10px 0; border: 1px solid; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.alert.error { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.alert.warn { background: var(--warn-soft); border-color: transparent; }
.alert.info { background: var(--brand-soft); border-color: transparent; }

/* ---------- Вход ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 600px at 10% -10%, var(--brand-soft), transparent), var(--bg); }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 28px; display: flex; flex-direction: column; gap: 12px; }
.auth-card h1 { font-size: 20px; margin: 6px 0 0; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.brand b { color: var(--brand); }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800;
  box-shadow: inset -6px -6px 0 -3px var(--lime); }
.brand.big { font-size: 20px; }

/* ---------- Оболочка ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: 240px; flex: none; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; padding: 16px 12px; z-index: 30; }
.side .brand { padding: 0 8px 16px; }
.side nav { flex: 1; overflow: auto; min-height: 0; margin: 0 -4px; padding: 0 4px; }
.nav-group { margin-bottom: 10px; }
.nav-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); padding: 0 10px 4px; font-weight: 700; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--text); font-weight: 500; }
.side nav a:hover { background: var(--surface-2); text-decoration: none; }
.side nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.side-foot { padding: 8px 10px 0; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { height: 60px; display: flex; align-items: center; gap: 8px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20; }
.burger { display: none; }
.content { padding: 20px 24px 40px; }
.nav-back { display: none; }

.gsearch { position: relative; display: flex; align-items: center; gap: 8px; width: min(460px, 100%); color: var(--text-2); }
.gsearch .input { background: var(--surface-2); }
.dropdown { position: absolute; top: calc(100% + 6px); right: 0; min-width: 220px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); padding: 6px; z-index: 50; }
.gs-drop { left: 0; right: auto; width: 100%; max-height: 70vh; overflow: auto; }
.gs-head { font-size: 11px; text-transform: uppercase; color: var(--text-2); font-weight: 700; padding: 8px 8px 2px; }
.gs-item, .dd-item { display: flex; justify-content: space-between; gap: 10px; width: 100%; padding: 8px; border-radius: 6px; color: var(--text); align-items: center; }
.gs-item:hover, .dd-item:hover { background: var(--surface-2); text-decoration: none; }
.dd-item { justify-content: flex-start; }
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; padding: 4px 6px; border-radius: 8px; }
.user-btn:hover { background: var(--surface-2); }
.user-text { display: flex; flex-direction: column; line-height: 1.2; max-width: 200px; }
.user-text b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: inline-grid; place-items: center;
  font-weight: 700; font-size: 13px; object-fit: cover; flex: none; }
.avatar.xl { width: 56px; height: 56px; font-size: 18px; }
.avatar.xxl { width: 84px; height: 84px; font-size: 26px; }

.bell { position: relative; }
.bell .btn { position: relative; }
.bell-count { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.bell-drop { width: 360px; max-width: calc(100vw - 24px); }
.bell-drop header { display: flex; align-items: center; padding: 4px 6px 8px; }
.bell-list { max-height: 60vh; overflow: auto; }
.bell-item { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 8px 10px; border-radius: 8px; }
.bell-item:hover { background: var(--surface-2); }
.bell-item.unread { background: var(--brand-soft); }

.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 8px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand);
  border-radius: 10px; box-shadow: var(--shadow); padding: 10px 8px 10px 12px; animation: slidein .2s ease-out; }
.toast.error { border-left-color: var(--danger); } .toast.ok { border-left-color: var(--ok); } .toast.notice { border-left-color: var(--lime); }
.toast-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
@keyframes slidein { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Страницы ---------- */
.page { max-width: 1500px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.page.narrow { max-width: 980px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card-head { align-items: flex-start; }
.title-block { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.section-head h3 { margin: 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 14px; }
.card-grid .span2 { grid-column: 1 / -1; }
.empty-page { text-align: center; padding: 40px; }
.empty-block { text-align: center; padding: 24px; color: var(--text-2); }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px; }
.toolbar .input { width: auto; min-width: 150px; }
.search-box { display: flex; align-items: center; gap: 8px; flex: 1 1 280px; color: var(--text-2); }
.search-box .input { flex: 1; width: 100%; }
.table-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 32px; }
.zoom { display: inline-flex; align-items: center; gap: 2px; }

.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; box-shadow: var(--shadow); max-height: calc(100vh - 230px); }
.table-wrap.loading { opacity: .6; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { position: sticky; top: 0; background: var(--surface-2); font-size: 12.5px; font-weight: 700; color: var(--text-2); white-space: nowrap; z-index: 1; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover, .table th.sorted { color: var(--brand); }
.table td.clip { max-width: 360px; min-width: 200px; }
.table td.clip .cell { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.table td.strong { font-weight: 600; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.check, .table th.check { width: 36px; padding-right: 0; }
.table tr.clickable { cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.picked { background: var(--brand-soft) !important; }
.table tr.inactive td { color: var(--text-2); }
.table tr.warnrow td { background: var(--warn-soft); }
.table td.empty { text-align: center; color: var(--text-2); padding: 28px; }
.table.compact th, .table.compact td { padding: 6px 8px; font-size: 13px; }
.card .table th { position: static; }
.table td { max-width: 420px; overflow-wrap: anywhere; }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.pager select { width: auto; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: none; font: inherit; font-weight: 600; color: var(--text-2); padding: 10px 14px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-count { margin-left: 6px; font-size: 12px; background: var(--surface-2); border-radius: 99px; padding: 0 7px; }

.props { display: grid; grid-template-columns: minmax(130px, 38%) 1fr; gap: 6px 14px; margin: 0; }
.props dt { color: var(--text-2); font-size: 13px; }
.props dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Главная ---------- */
.hello { display: flex; align-items: center; gap: 16px; }
.hello h1 { margin: 0; }
.widgets { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; align-items: start; }
.widget h3 { margin-bottom: 12px; }
.stats { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.stat { flex: 1; min-width: 90px; background: var(--surface-2); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; color: var(--text); }
.stat:hover { text-decoration: none; }
a.stat:hover { background: var(--brand-soft); }
.stat b { font-size: 24px; color: var(--brand); }
.stat span { font-size: 12.5px; color: var(--text-2); }
.stat.warn b { color: var(--warn); }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 0; }
.note-new { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; margin-bottom: 10px; }
.note { background: var(--lime-soft); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.note p { margin: 0; }
.note-foot { display: flex; align-items: center; }

/* ---------- Формы ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-section h2 { margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; align-items: start; }
.sub-card { border: 1px dashed var(--line-strong); border-radius: 10px; padding: 12px; margin: 10px 0; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.sub-card-head { display: flex; align-items: center; }
.sub-fields { margin-top: 10px; }
.custom-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.type-choice p { margin-bottom: 12px; }
.choice-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.choice { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; cursor: pointer; text-align: left; font: inherit; color: var(--brand); }
.choice b { color: var(--text); font-size: 16px; }
.choice:hover { border-color: var(--brand); }
.list-input { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.li-row { display: flex; gap: 4px; width: 100%; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; }

.ms { position: relative; }
.ms-box { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; height: auto; min-height: 36px; padding: 4px 30px 4px 8px; cursor: pointer; position: relative; }
.ms-arrow { position: absolute; right: 8px; top: 9px; color: var(--text-2); }
.ms .placeholder { color: var(--text-2); }
.ms-drop { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 6px; z-index: 60; display: flex; flex-direction: column; gap: 6px; }
.ms-list { max-height: 240px; overflow: auto; }
.ms-opt { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; width: 100%; }
label.ms-opt { justify-content: flex-start; }
.ms-opt:hover { background: var(--surface-2); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.chip { display: inline-flex; align-items: center; gap: 2px; background: var(--brand-soft); color: var(--brand); border-radius: 6px; padding: 2px 4px 2px 8px; font-size: 13px; font-weight: 600; }
.chip button { border: 0; background: none; color: inherit; cursor: pointer; display: grid; place-items: center; padding: 2px; border-radius: 4px; }
.chip button:hover { background: rgba(0,0,0,.08); }

.file-field { display: flex; }
.file-chip { display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); max-width: 100%; }
.file-chip a:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.extra-add { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; }

/* ---------- Модальные окна ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(10, 25, 25, .45); display: grid; place-items: center; padding: 16px; z-index: 80; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 14px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); animation: pop .18s ease-out; }
.modal.wide { width: min(860px, 100%); } .modal.xwide { width: min(1100px, 100%); }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 10px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; flex: 1; }
.modal-body { padding: 16px 20px; overflow: auto; }
.modal-foot { display: flex; gap: 8px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; justify-content: flex-end; }
.col-list { list-style: none; padding: 0; margin: 0; }
.col-list li { display: flex; align-items: center; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid var(--line); }
.col-list li.off { opacity: .6; }
.col-list .row-actions { margin: 0; }
.secret { background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 8px; padding: 12px; font-size: 15px; overflow-wrap: anywhere; display: flex; flex-direction: column; gap: 4px; }

/* ---------- Карточка клиента ---------- */
.comments { display: flex; flex-direction: column; gap: 10px; }
.comment-new { display: flex; gap: 8px; align-items: flex-end; }
.comment { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.comment.boss { border-color: var(--lime); background: var(--lime-soft); }
.comment header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.comment p { margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--surface-2); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.kpi span { font-size: 12.5px; color: var(--text-2); }
.kpi b { font-size: 18px; font-variant-numeric: tabular-nums; }
.kpi.bad b { color: var(--danger); }
.bars { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(100px, 38%) 1fr auto; gap: 8px; align-items: center; font-size: 13px; }
.bar-track { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--brand); border-radius: 5px; }
.bar-value { font-variant-numeric: tabular-nums; font-weight: 600; }
.contract-status { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.role-card .perm-list { list-style: none; margin: 0 0 8px; padding: 0; font-size: 13px; }
.role-card .perm-list li { display: flex; gap: 6px; align-items: center; padding: 2px 0; color: var(--text-2); }
.perm-group { margin-top: 14px; }
.user-card { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 10px; }
.profile-top { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }

/* ---------- Телефоны и планшеты ---------- */
@media (max-width: 960px) {
  .side { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .shell.navopen .side { transform: none; }
  .shell.navopen .nav-back { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 25; }
  .burger { display: inline-flex; }
  .user-text { display: none; }
  .content { padding: 14px 12px 32px; }
  .top { padding: 0 10px; }
  .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-grid { grid-template-columns: 1fr; }
  .table-wrap { max-height: none; }
}
@media (max-width: 640px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .toolbar .input, .inline-field .input { min-width: 0; width: 100%; }
  .toolbar > * { flex: 1 1 100%; }
  .inline-field { flex: 1 1 45%; }
  .gsearch .input::placeholder { color: transparent; }
  .props { grid-template-columns: 1fr; gap: 0 0; }
  .props dd { margin-bottom: 8px; }
  .extra-add { grid-template-columns: 1fr; }
  .hello .avatar { display: none; }
  .comment-new { flex-direction: column; align-items: stretch; }
  .head-actions { width: 100%; }
}

/* Широкие таблицы внутри карточек прокручиваются, а не растягивают страницу */
.content, .page, .card-grid > * { min-width: 0; }
.card { overflow-x: auto; }
.card:has(.ms), .card:has(.gsearch), .form-section { overflow: visible; }

/* ---------- Этап 2: цены, сроки годности, бронь ---------- */
.trend { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; font-variant-numeric: tabular-nums; }
.trend.up { color: var(--ok); }
.trend.down { color: var(--danger); }
.table.expiry tr.grp td { cursor: pointer; font-weight: 700; user-select: none; }
.table.expiry tr.g1 td { background: var(--brand-soft); color: var(--brand); }
.table.expiry tr.g2 td { background: var(--surface-2); padding-left: 24px; }
.table.expiry tr.g3 td { padding-left: 40px; color: var(--text-2); font-weight: 600; }
.table.expiry tr.grp:hover td { filter: brightness(.97); }
.table td.wrap50 .cell, .table td.wrap50 { max-width: 50ch; }
.sphere-cell { display: inline-flex; flex-wrap: wrap; gap: 3px; min-height: 22px; align-items: center; }
.sphere-cell.editable { cursor: pointer; border-radius: 6px; padding: 1px 3px; }
.sphere-cell.editable:hover { background: var(--brand-soft); }
.booking-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.input.readonly { display: flex; align-items: center; background: var(--surface-2); }
.input.qty, .qty { width: 90px; text-align: right; }
.picker-inline { min-width: 220px; flex: 1 1 220px; }
.picker-list { max-height: 58vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.picker-list.loading { opacity: .6; }
.picker-group { position: sticky; top: 0; background: var(--surface-2); padding: 6px 12px; font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--text-2); z-index: 1; }
.picker-row { display: grid; grid-template-columns: 22px 1fr 120px 150px 96px; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.picker-row:hover { background: var(--surface-2); }
.picker-row.on { background: var(--brand-soft); }
.picker-name { display: flex; flex-direction: column; min-width: 0; }
.picker-num { text-align: right; line-height: 1.3; }
@media (max-width: 640px) {
  .picker-row { grid-template-columns: 22px 1fr 90px; }
  .picker-row .picker-num:first-of-type { display: none; }
  .picker-row .qty { grid-column: 2 / -1; justify-self: end; }
}
.modal { max-width: 100%; min-width: 0; }
.modal-body { min-width: 0; }
.modal-back { grid-template-columns: minmax(0, auto); }
.table.expiry td:first-child { min-width: 200px; }
.table.expiry td:nth-child(5) { white-space: nowrap; }

/* ---------- Этап 3: заказы, задолженность ---------- */
.status-menu { position: relative; display: inline-block; }
.status-menu > .badge { cursor: pointer; gap: 4px; }
.status-drop { position: fixed; right: auto; top: auto; min-width: 230px; z-index: 60; padding: 4px; }
.status-drop .dd-item { font-size: 13px; }
.seg { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.row-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.credit-line { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 12px; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; }
.strike { text-decoration: line-through; }
.row-bad td { background: var(--danger-soft); }
.row-pay td { background: var(--ok-soft); }
.scroll-x { overflow-x: auto; max-width: 100%; }
.stat-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.stat-row .stat b { font-size: 17px; }
.order-lines tfoot td, .table tfoot td { border-top: 2px solid var(--line); font-weight: 500; }
.ok { color: var(--ok); }
.table td.minw, .table th.minw { min-width: 180px; }
.table td.minw-s, .table th.minw-s { min-width: 120px; }
.plain-list li.two-line { align-items: center; }
.plain-list li.two-line .grow { min-width: 0; }
.plain-list li.two-line .badge { flex-shrink: 0; max-width: 45%; white-space: normal; text-align: center; }
.scroll-x > .table { min-width: 760px; }
.scroll-x > .table td.num, .scroll-x > .table th.num { white-space: nowrap; }
.table th.name-col { min-width: 210px; }

/* ---------- Этап 4: воронка, планы, выезды, задачи ---------- */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; min-height: 60vh; }
.kanban.loading { opacity: .6; }
.kcol { flex: 1 1 0; min-width: 180px; max-width: 340px; background: var(--surface-2); border-radius: var(--radius); padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 200px; border: 2px dashed transparent; }
.kcol.over { border-color: var(--brand); background: var(--brand-soft); }
.kcol.final { flex-grow: .8; }
.khead { display: flex; align-items: center; gap: 6px; padding: 2px 4px; }
.khead b { font-size: 14px; }
.ksum { padding: 0 4px; margin-top: -4px; }
.kdrop { padding: 18px 8px; text-align: center; border: 1px dashed var(--line); border-radius: 8px; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px; box-shadow: var(--shadow); cursor: grab; display: flex; flex-direction: column; gap: 3px; }
.kcard:hover { border-color: var(--brand); }
.kcard.stale { border-left: 4px solid var(--danger); }
.kcard.dragging { opacity: .4; }
.kcard-top { display: flex; gap: 6px; align-items: flex-start; justify-content: space-between; }
.kcard-top b { overflow-wrap: anywhere; }
.kcomment { color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; border-left: 2px solid var(--line); padding-left: 6px; }
.kfoot { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.kfoot .right { text-align: right; }
.page-wide { max-width: none; }
.lead-box { position: relative; }
.lead-hits { left: 0; right: auto; width: 100%; top: calc(100% + 4px); }
.gap-top-s { margin-top: 6px; }
.progress { display: inline-block; vertical-align: middle; width: 90px; height: 7px; border-radius: 9px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--line); }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 9px; }
.progress.ok > span { background: var(--ok); }
.progress.warn > span { background: var(--warn); }
.plan-line { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.plan-line > :first-child { min-width: 90px; }
.plan-line .progress { flex: 1; width: auto; }
.plan-w { padding: 6px 0; border-bottom: 1px solid var(--line); }
.plan-w:last-of-type { border-bottom: 0; }
.plan-table .subtotal td { background: var(--surface-2); font-weight: 500; }
.plan-table input.narrow { width: 64px; }
.plan-table input.wide-qty { width: 160px; }
.plan-table th.cur, .plan-table td.cur { background: var(--lime-soft); }
.visits-table td { vertical-align: top; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 99px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
.chip.on { background: var(--brand); border-color: transparent; color: #fff; }
.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.task-list li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.task-list li:last-child { border-bottom: 0; }
.task-list input[type=checkbox] { margin-top: 3px; width: 17px; height: 17px; }
.task-list .task-title { font-weight: 500; }
.task-list li.done .task-title { text-decoration: line-through; color: var(--text-2); }
.task-list li.overdue .task-title { color: var(--danger); }
.funnel-w td { padding: 4px 6px; }
@media (max-width: 640px) { .kcol { flex: 0 0 84vw; max-width: none; } }
.widget h3.w-head { display: flex; align-items: center; gap: 8px; }

/* ---------- Этапы 5–6: отчёты, база знаний, акции, фирменный стиль ---------- */
.brand-logo { max-height: 34px; max-width: 160px; object-fit: contain; }
.brand.big .brand-logo { max-height: 64px; max-width: 240px; }
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.type-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px; text-align: left; background: var(--surface); color: var(--text); }
.type-card:hover { border-color: var(--brand); background: var(--brand-soft); }
.chip:disabled { opacity: .5; cursor: default; }
.report-result { display: flex; flex-direction: column; gap: 14px; }
.rtable th, .rtable td { white-space: nowrap; }
.rtable th.sticky, .rtable td.sticky { position: sticky; left: 0; background: var(--surface); z-index: 1; white-space: normal; min-width: 200px; }
.rtable thead th.sticky { background: var(--surface-2); }
.rtable .grp-head { text-align: center; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--text-2); }
.rtable td.strong { font-weight: 600; }
.rtable tr.subtotal td { background: var(--surface-2); font-weight: 600; }
.rtable .row-hide { opacity: 0; }
.rtable tr:hover .row-hide { opacity: .7; }
.chart h3 { margin-bottom: 12px; }
.bar-chart { display: flex; align-items: flex-end; gap: 8px; overflow-x: auto; padding-top: 8px; min-height: 190px; }
.bc-col { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 54px; flex: 1; }
.bc-bar { width: 70%; max-width: 46px; background: var(--brand); border-radius: 6px 6px 0 0; }
.bc-bar.neg { background: var(--danger); }
.bc-bar.zero { background: var(--line); border-radius: 0; }
.bc-val { color: var(--text-2); white-space: nowrap; }
.bc-label { color: var(--text-2); text-align: center; white-space: nowrap; }
.funnel-chart { display: flex; flex-direction: column; gap: 6px; }
.fc-row { display: grid; grid-template-columns: minmax(120px, 220px) 1fr 70px; align-items: center; gap: 10px; }
.fc-bar-wrap { display: flex; justify-content: center; }
.fc-bar { display: block; height: 26px; background: linear-gradient(90deg, var(--brand), var(--brand-strong)); border-radius: 6px; }
.fc-val { text-align: right; }
.gantt .g-grid { display: flex; flex-direction: column; gap: 4px; overflow-x: auto; }
.g-row { display: grid; grid-template-columns: 220px 1fr; align-items: center; gap: 10px; min-width: 620px; }
.g-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-track { position: relative; height: 18px; background: var(--surface-2); border-radius: 4px; }
.g-head .g-track { background: none; height: 16px; }
.g-tick { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.g-seg { position: absolute; top: 2px; bottom: 2px; background: var(--danger); border-radius: 3px; opacity: .85; }
.cat-bars { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.cat-bar { display: grid; grid-template-columns: 180px 1fr 120px; gap: 10px; align-items: center; padding: 3px 6px; border-radius: 6px; color: var(--text); text-align: left; }
.cat-bar.on, .cat-bar:hover { background: var(--brand-soft); }
.cat-bar .bar { height: 8px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.cat-bar .bar > span { display: block; height: 100%; background: var(--brand); }
.cat-bar b { text-align: right; }
.kb-progress { display: flex; align-items: center; gap: 8px; }
.kb-list { display: flex; flex-direction: column; gap: 10px; }
.kb-item { padding: 14px 16px; }
.kb-item.read { border-left: 4px solid var(--ok); }
.kb-head { display: flex; gap: 10px; align-items: flex-start; }
.kb-check input { width: 20px; height: 20px; margin-top: 2px; }
.kb-text { margin-top: 8px; color: var(--text); }
.kb-text .link { color: var(--brand); }
.kb-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.file-list { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-direction: column; gap: 4px; }
.file-list li { display: flex; align-items: center; gap: 6px; }
.kb-ring { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.ring { --p: 0; width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: radial-gradient(closest-side, var(--surface) 72%, transparent 73%), conic-gradient(var(--brand) calc(var(--p) * 1%), var(--surface-2) 0); }
.gift-row td { background: var(--ok-soft); }
.promo-box div { margin-top: 2px; }
.code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; overflow-x: auto; white-space: pre; }
.alert.warn { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 8px 12px; }
th.sortable { cursor: pointer; }
@media (max-width: 640px) {
  .fc-row { grid-template-columns: 1fr 50px; } .fc-row .fc-bar-wrap { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
  .cat-bar { grid-template-columns: 1fr 90px; } .cat-bar .bar { display: none; }
}
.promo-box { flex-direction: column; align-items: flex-start; }
/* ---------- 0.7: состояние на дату ---------- */
.kpi span.bad { color: var(--danger); font-weight: 600; }
.kpis.dim { opacity: .6; }
.date-step { display: flex; align-items: center; gap: 4px; }
.date-step .input { min-width: 150px; }
@media (max-width: 640px) {
  .toolbar > .date-step { flex: 1 1 100%; }
  .date-step .input { flex: 1; }
  .hide-sm { display: none; }
}
