/* Простой CRM Prime Mall. Светлая тема, акцент — золото логотипа. Телефон — основной экран. */
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("fonts/manrope-cyrillic-d0354d.e58febde317b.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("fonts/manrope-latin-bcbadc.938c6e8019b6.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #f4f2ee; --card: #fff; --ink: #1d1c1a; --muted: #6b665d; --line: #e5e0d6; --line-2: #d6cfc2;
  --dark: #111112; --gold: #c9a26a; --gold-ink: #7d5f2c; --gold-bg: #f6eedf;
  --red: #b4342a; --red-bg: #fbeae8; --green: #24704a; --green-bg: #e5f3ea; --blue: #2b5c95; --blue-bg: #e7eef8;
  --amber: #8a5a00; --amber-bg: #fdf0d5; --grey-bg: #eeebe5;
  --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --nav-h: 60px; --top-h: 56px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.45 var(--font); font-variant-numeric: tabular-nums; }
a { color: var(--blue); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 22px; font-weight: 800; }
h2 { font-size: 17px; font-weight: 700; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
/* 16px в полях: иначе iPhone увеличивает страницу при вводе */
input, select, textarea { font-size: 16px; }
:focus-visible { outline: 3px solid rgba(201,162,106,.65); outline-offset: 2px; }
.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; }
.right { text-align: right; }
[hidden] { display: none !important; }

/* --- Верхняя панель --- */
.top { position: sticky; top: 0; z-index: 30; background: var(--dark); color: #f3efe7; height: var(--top-h); }
.top__row { max-width: 1240px; margin: 0 auto; height: 100%; display: flex; align-items: center; gap: 18px; padding: 0 16px; }
.logo { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 800; letter-spacing: .02em; white-space: nowrap; }
.logo img { width: 34px; height: 34px; border-radius: 50%; }
.logo span small { color: var(--gold); font-weight: 700; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tabs a { color: #cfc8bb; text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 600; white-space: nowrap; }
.tabs a:hover { color: #fff; background: rgba(255,255,255,.06); }
.tabs a.on { color: #111; background: var(--gold); }
.me { position: relative; margin-left: auto; }
.me summary { list-style: none; cursor: pointer; width: 38px; height: 38px; border-radius: 50%; background: #2a2926; color: var(--gold);
  display: grid; place-items: center; font-weight: 800; }
.me summary::-webkit-details-marker { display: none; }
.me__menu { position: absolute; right: 0; top: 46px; min-width: 220px; background: var(--card); color: var(--ink); border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0,0,0,.18); padding: 6px; z-index: 40; }
.me__menu a, .me__menu button { display: block; width: 100%; text-align: left; padding: 11px 12px; border: 0; background: none; border-radius: 8px;
  color: var(--ink); text-decoration: none; cursor: pointer; }
.me__menu a:hover, .me__menu button:hover { background: var(--bg); }
.me__who { padding: 10px 12px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }

/* --- Нижняя панель (телефон) --- */
.bottomnav { display: none; }
@media (max-width: 760px) {
  .tabs { display: none; }
  .bottomnav { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--nav-h);
    color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600; }
  .bottomnav a.on { color: var(--gold-ink); }
  .bottomnav svg { width: 24px; height: 24px; }
  body { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); font-size: 16px; }
  body.typing .bottomnav, body.typing .fab { display: none; }
}

/* --- Страница --- */
.page { max-width: 1240px; margin: 0 auto; padding: 18px 16px 40px; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.head h1 { margin-right: auto; }
.head .count { color: var(--muted); font-weight: 600; font-size: 15px; margin-left: 6px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.search { flex: 1 1 260px; position: relative; }
.search input { width: 100%; height: 44px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--card); padding: 0 12px 0 38px; }
.search svg { position: absolute; left: 11px; top: 12px; width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 6px; margin-bottom: 8px; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--card); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; cursor: pointer; }
.chip b { font-weight: 800; color: var(--muted); }
.chip.on { background: var(--dark); border-color: var(--dark); color: #fff; }
.chip.on b { color: var(--gold); }
.chip.alert { border-color: #e7b3ad; color: var(--red); }
.chip.alert.on { background: var(--red); border-color: var(--red); color: #fff; }
.chip.alert.on b { color: #fff; }
.desk-only { }
@media (max-width: 760px) { .desk-only { display: none !important; } }

/* --- Кнопки --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink); font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #b9b0a0; }
.btn--main { background: var(--dark); border-color: var(--dark); color: #fff; }
.btn--main:hover { background: #2a2926; }
.btn--gold { background: var(--gold); border-color: var(--gold); color: #1a1408; }
.btn--danger { color: var(--red); }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn--block { width: 100%; }
.btn[disabled], .btn.htmx-request { opacity: .6; pointer-events: none; }
.iconbtn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); text-decoration: none; position: relative; z-index: 2; flex: 0 0 auto; }
.iconbtn svg { width: 20px; height: 20px; }
.iconbtn--tg { color: #229ed9; }
.fab { display: none; }
@media (max-width: 760px) {
  .fab { display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 25;
    width: 56px; height: 56px; border-radius: 50%; background: var(--gold); color: #1a1408; box-shadow: 0 6px 18px rgba(0,0,0,.22); border: 0; }
  .fab svg { width: 26px; height: 26px; }
  .head .btn--add { display: none; }
  .page { padding-bottom: 96px; }
}

/* --- Список: таблица на компьютере, карточки на телефоне (одна разметка, CSS-сетка) --- */
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.row { display: grid; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); position: relative; min-height: 56px; }
.row:first-child { border-top: 0; }
.row--head { min-height: 0; padding-top: 10px; padding-bottom: 10px; font-size: 13px; font-weight: 700; color: var(--muted); background: #faf8f4;
  border-radius: var(--radius) var(--radius) 0 0; }
.row--head a.sort { color: inherit; text-decoration: none; }
.row--head a.sort:hover { color: var(--ink); }
.row:not(.row--head):hover { background: #fcfbf8; }
.row .title { font-weight: 700; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.row .title::after { content: ""; position: absolute; inset: 0; } /* вся строка открывает карточку */
.row .sub { font-size: 13px; color: var(--muted); }
.cell { min-width: 0; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .act { position: relative; z-index: 2; display: flex; gap: 8px; justify-content: flex-end; }
.row.saved { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: var(--gold-bg); } to { background: transparent; } }
.empty { padding: 36px 18px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 6px; }
.more { padding: 12px; text-align: center; border-top: 1px solid var(--line); }

/* Сделки */
.deals .row { grid-template-columns: minmax(140px,1.3fr) minmax(120px,1.1fr) 118px minmax(128px,1.5fr) 156px 120px 108px 76px; }
.deals.no-resp .row { grid-template-columns: minmax(150px,1.3fr) minmax(130px,1.2fr) 118px minmax(160px,1.6fr) 156px 110px 76px; }
/* Арендаторы */
.brands .row { grid-template-columns: minmax(170px,1.4fr) 150px minmax(140px,1fr) 170px 120px 90px; }
/* Площади */
.spaces .row { grid-template-columns: minmax(120px,1fr) 70px 90px 150px 110px minmax(130px,1.2fr) 80px 110px; }
/* Вознаграждение */
.fees .row { grid-template-columns: 110px minmax(150px,1.3fr) minmax(140px,1.2fr) 130px 150px 120px 130px; }
/* Сотрудники */
.staff .row { grid-template-columns: minmax(200px,1.5fr) 1fr 1fr; }

@media (max-width: 1100px) {  /* списки карточками: на планшете столбцы таблицы не помещаются */
  .list { background: transparent; border: 0; box-shadow: none; }
  .row--head { display: none; }
  .row { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; padding: 12px 12px 12px 14px;
    box-shadow: var(--shadow); gap: 4px 10px; }
  .row:first-child { border-top: 1px solid var(--line); }
  .row .title { font-size: 16px; }
  .m-hide { display: none; }
  .deals .row, .deals.no-resp .row { grid-template-columns: minmax(0,1fr) auto; grid-template-areas: "brand stage" "step step" "when call"; }
  .deals .c-brand { grid-area: brand; } .deals .c-stage { grid-area: stage; } .deals .c-step { grid-area: step; }
  .deals .c-when { grid-area: when; display: flex; flex-wrap: wrap; gap: 0 8px; align-items: baseline; min-width: 0; }
  .deals .c-when .date { padding: 11px 0; margin: -11px 0; }  /* палец попадает в дату: 44 px по высоте */
  .deals .c-call { grid-area: call; align-self: end; justify-self: end; }
  .brands .row { grid-template-columns: 1fr auto; grid-template-areas: "brand act" "need act"; }
  .brands .c-brand { grid-area: brand; } .brands .c-need { grid-area: need; } .brands .c-act { grid-area: act; }
  .spaces .row { grid-template-columns: 1fr auto; grid-template-areas: "place status" "size act"; }
  .spaces .c-place { grid-area: place; } .spaces .c-size { grid-area: size; } .spaces .c-status { grid-area: status; justify-self: end; }
  .spaces .c-act { grid-area: act; }
  .staff .row { grid-template-columns: 1fr; }
  .fees .row { grid-template-columns: 1fr auto; grid-template-areas: "brand fee" "info paid"; }
  .fees .c-brand { grid-area: brand; } .fees .c-fee { grid-area: fee; text-align: right; } .fees .c-info { grid-area: info; } .fees .c-paid { grid-area: paid; }
}

/* Этапы и статусы */
.stage { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 700; border: 0;
  white-space: nowrap; position: relative; z-index: 2; cursor: pointer; }
.stage--new { background: var(--grey-bg); color: #4a463f; }
.stage--showing { background: var(--blue-bg); color: var(--blue); }
.stage--talks { background: var(--amber-bg); color: var(--amber); }
.stage--signed { background: var(--green-bg); color: var(--green); }
.stage--lost { background: #f1efeb; color: #625d54; }
.status--free { background: var(--green-bg); color: var(--green); cursor: default; }
.status--taken { background: var(--grey-bg); color: #5d584f; cursor: default; }
.date { font-weight: 700; white-space: nowrap; position: relative; z-index: 2; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.date--late { color: var(--red); }
.date--today { color: var(--gold-ink); }
.date--none { color: var(--muted); font-weight: 600; }
.paid { color: var(--green); font-weight: 700; white-space: nowrap; }

/* --- Итоги --- */
.totals { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; margin-bottom: 14px; }
.total { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.total span { display: block; font-size: 13px; color: var(--muted); font-weight: 600; }
.total b { display: block; font-size: 20px; font-weight: 800; margin-top: 2px; }
.total b + b { font-size: 15px; margin-top: 0; }
.total--wait { border-color: #e4cd9f; background: #fffaf0; }
@media (max-width: 760px) { .totals { grid-template-columns: 1fr; } .totals .total:not(.total--wait) { display: none; } .totals.open .total { display: block; } }

/* --- Формы и карточка --- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px; }
.form { display: grid; gap: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 14px; font-weight: 700; }
.field .req { color: var(--red); }
.field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea {
  width: 100%; min-height: 48px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; padding: 10px 12px; }
.field textarea { min-height: 80px; resize: vertical; }
.field .hint { font-size: 13px; color: var(--muted); }
.field .err, .form-error { color: var(--red); font-size: 14px; font-weight: 600; }
.form-error { background: var(--red-bg); border-radius: 10px; padding: 10px 12px; }
.warn { background: var(--amber-bg); border-radius: 10px; padding: 10px 12px; display: grid; gap: 8px; }
.warn ul { padding-left: 18px; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--red); }
details.more-fields > summary { cursor: pointer; font-weight: 700; color: var(--gold-ink); padding: 6px 0; list-style: none; }
details.more-fields > summary::before { content: "＋ "; }
details.more-fields[open] > summary::before { content: "－ "; }
details.more-fields > .form { margin-top: 10px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.actions .spacer { flex: 1; }
@media (max-width: 760px) {
  .sticky-save { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); background: var(--bg); padding: 10px 0; margin: 0 -2px; z-index: 5; }
  body.typing .sticky-save { bottom: 0; }
  .sticky-save .btn--main { flex: 1; }
}
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: grid; place-items: center; min-height: 48px; padding: 0 8px; border-radius: 10px; border: 1px solid var(--line-2); background: #fff;
  font-weight: 700; font-size: 14px; text-align: center; cursor: pointer; }
.seg input:checked + span { background: var(--dark); border-color: var(--dark); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid rgba(201,162,106,.65); outline-offset: 2px; }
.seg--stage input[value=signed]:checked + span { background: var(--green); border-color: var(--green); }
.seg--sm span { min-height: 40px; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.quick button { height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; font-weight: 600; font-size: 14px; cursor: pointer; }
.quick button.on { background: var(--gold-bg); border-color: var(--gold); }
.linkbtn { background: none; border: 0; padding: 4px 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 14px; }
.confirm { background: var(--green-bg); border-radius: 10px; padding: 12px; display: grid; gap: 10px; }
.confirm p { font-weight: 600; color: #1f4d35; }

/* Карточка сделки/арендатора */
.profile { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.profile h1 { overflow-wrap: anywhere; }
.profile .meta { color: var(--muted); font-size: 14px; margin-top: 4px; }
.profile .contact { display: flex; gap: 8px; margin-left: auto; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.history li { border-left: 3px solid var(--line-2); padding-left: 12px; }
.history li.k-comment { border-color: var(--gold); }
.history li.k-stage { border-color: var(--blue); }
.history .when { font-size: 13px; color: var(--muted); }
.history p { white-space: pre-line; overflow-wrap: anywhere; }
.comment { display: flex; gap: 8px; }
.comment input { flex: 1; min-height: 48px; border: 1px solid var(--line-2); border-radius: 10px; padding: 0 12px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-weight: 600; margin-bottom: 10px; }

/* Подсказки при вводе арендатора / объекта / помещения */
.ac { position: relative; }
.ac__list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; background: #fff; border: 1px solid var(--line-2); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.14); max-height: 320px; overflow-y: auto; }
.ac__list:empty { display: none; }
.ac__item { display: block; width: 100%; text-align: left; border: 0; background: #fff; padding: 10px 12px; min-height: 48px; cursor: pointer; border-top: 1px solid var(--line); }
.ac__item:first-child { border-top: 0; }
.ac__item:hover, .ac__item:focus { background: var(--bg); }
.ac__item small { display: block; color: var(--muted); font-size: 13px; }
.ac__item--new { color: var(--gold-ink); font-weight: 700; }
.ac__note { padding: 10px 12px; font-size: 14px; color: var(--amber); background: var(--amber-bg); border-radius: 10px; }
.picked { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 6px 6px 12px; border-radius: 10px; background: var(--gold-bg); font-weight: 700; }
.picked span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.picked small { display: block; font-weight: 500; color: var(--muted); }

/* Всплывающее окно: на телефоне — снизу, на компьютере — по центру */
dialog.sheet { border: 0; padding: 0; width: min(560px, 100%); max-height: 92dvh; overflow-y: auto; border-radius: 16px; background: var(--card); color: var(--ink);
  box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog.sheet::backdrop { background: rgba(17,17,18,.45); }
.sheet__head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); z-index: 2; }
.sheet__head h2 { flex: 1; min-width: 0; }
.sheet__body { padding: 16px; }  /* прокручивается само окно: так «Сохранить» прилипает к низу экрана */
@media (max-width: 760px) {
  dialog.sheet { margin: auto 0 0; width: 100%; max-width: 100%; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); }
}

/* Сообщения */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 60; display: grid; gap: 8px; width: min(520px, calc(100% - 24px)); }
@media (max-width: 760px) { .toasts { bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom)); } }
.toast { display: flex; align-items: center; gap: 12px; background: var(--dark); color: #fff; border-radius: 12px; padding: 12px 14px; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-weight: 600; }
.toast span { flex: 1; }
.toast button { background: none; border: 0; color: var(--gold); font-weight: 800; cursor: pointer; padding: 6px; }
.toast--error { background: var(--red); }
.toast--error button { color: #fff; }
.messages { display: grid; gap: 8px; margin-bottom: 12px; }
.msg { background: var(--green-bg); color: #1f4d35; border-radius: 10px; padding: 10px 12px; font-weight: 600; }
.msg--error { background: var(--red-bg); color: var(--red); }

/* Вход */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: var(--dark); }
.login__card { width: min(400px, 100%); background: var(--card); border-radius: 18px; padding: 28px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.login__brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.login__brand img { width: 52px; height: 52px; border-radius: 50%; }
.login__brand b { display: block; font-size: 18px; }
.login__brand span { color: var(--muted); font-size: 14px; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.check { display: flex; gap: 10px; align-items: center; font-weight: 600; min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; }
.ac__static { border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.m-only { display: none; }
@media (max-width: 1100px) { .m-only { display: initial; } }
.stale { color: var(--amber); }
.group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 12px 14px; background: #faf8f4; border-top: 1px solid var(--line); font-size: 14px; }
.group a.gname { font-weight: 800; font-size: 15px; color: var(--ink); text-decoration: none; }
.group a.gname:hover { text-decoration: underline; }
@media (max-width: 1100px) { .group { background: transparent; border: 0; padding: 14px 2px 6px; } }
.summary { color: var(--muted); font-size: 14px; margin: -6px 0 12px; }
.summary b { color: var(--ink); }
.foot { padding: 12px 14px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.foot b { color: var(--ink); }
@media (max-width: 760px) { .foot { border: 0; padding: 6px 2px; } }
.more-menu { position: relative; }
.more-menu summary { list-style: none; }
.more-menu summary::-webkit-details-marker { display: none; }
.more-menu .me__menu { top: 50px; }
.table-plain { width: 100%; border-collapse: collapse; font-size: 14px; }
.table-plain th, .table-plain td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table-plain th { color: var(--muted); font-weight: 700; background: #faf8f4; }
.scroll-x { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.scroll-x select { min-height: 36px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 6px; background: #fff; font-size: 14px; }
.stats { display: flex; flex-wrap: wrap; gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.stat b { font-size: 20px; display: block; }
.stat span { color: var(--muted); font-size: 13px; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.grow { flex: 1 1 auto; min-width: 0; }
a.plain { color: inherit; text-decoration: none; }
a.plain:hover { text-decoration: underline; }
/* В окне кнопка «Сохранить» прилипает к нижнему краю самого окна */
dialog.sheet .sticky-save { position: sticky; bottom: 0; background: var(--card); padding: 12px 0 4px; margin: 0; z-index: 3;
  border-top: 1px solid var(--line); }
dialog.sheet .sticky-save .btn--main { flex: 1; }
.area-filter input { padding-left: 12px; }
.area-filter { flex: 0 1 220px; }
/* Сообщения не перехватывают нажатия (кроме своих кнопок) и на телефоне не закрывают кнопку «+» */
.toasts { pointer-events: none; }
.toast, .toast button { pointer-events: auto; }
@media (max-width: 760px) { .toasts { bottom: calc(var(--nav-h) + 84px + env(safe-area-inset-bottom)); } }
.fab svg, .iconbtn svg, .btn svg { pointer-events: none; }
/* Кнопки и ссылки в строке — над растянутой ссылкой «открыть карточку» */
.row button, .row a:not(.title), .row select, .row input { position: relative; z-index: 2; }

/* Поле комментария сжимается на узком экране (иначе страница сделки шире телефона) */
.comment input { min-width: 0; }
/* «Мои / Все» — переключатель внутри формы поиска */
.chip input[type=radio] { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
label.chip { cursor: pointer; position: relative; }
.chip:has(input:checked) { background: var(--dark); border-color: var(--dark); color: #fff; }
.chip:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }
/* Сопоставление столбцов при загрузке Excel: больше столбцов на экране */
.table-plain select { max-width: 150px; }
.table-plain th, .table-plain td { max-width: 180px; }
/* Заявки с сайта */
.notice { display: block; margin-bottom: 12px; padding: 12px 14px; border-radius: 10px; background: var(--gold-bg); color: var(--gold-ink);
  font-weight: 700; text-decoration: none; }
.notice:hover { text-decoration: underline; }
.badge { display: inline-block; min-width: 22px; padding: 0 6px; border-radius: 999px; background: var(--red); color: #fff; font-size: 12px;
  text-align: center; }
.me summary { position: relative; }
.me .dot { position: absolute; top: 0; right: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--red); border: 2px solid var(--dark); }
.leads { display: grid; gap: 12px; }
.lead__head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.lead__head .stage { cursor: default; }
.lead__title { margin: 10px 0 6px; font-size: 18px; overflow-wrap: anywhere; }
.lead__facts { display: grid; gap: 6px; margin: 0; }
.lead__facts div { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px; }
.lead__facts dt { color: var(--muted); font-size: 14px; }
.lead__facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) { .lead__facts div { grid-template-columns: 1fr; gap: 0; } }
.lead__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.stats-box summary { cursor: pointer; font-weight: 700; }
