/* ЭЛИДОМ · ЛК собственника — мобильный адаптивный интерфейс.
   Дизайн-система на CSS-переменных, тёмная/светлая тема, интеграция темы
   Telegram (переменные --tg-* переопределяются из env.js). Без зависимостей. */

:root {
  --brand: #1f6feb;
  --brand-600: #1a5fd0;
  --ok: #1f9d55;
  --warn: #c98a00;
  --danger: #d9432f;

  --bg: #f2f4f7;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --text: #16202c;
  --muted: #6a7684;
  --line: #e6e9ef;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 6px 20px rgba(16, 24, 40, .05);

  --radius: 16px;
  --radius-sm: 10px;
  --bar-h: 56px;
  --tab-h: 62px;
  --maxw: 640px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Тёмная тема — по атрибуту (мессенджер/тумблер) и по системной настройке */
:root[data-theme="dark"] {
  --bg: #0f141a; --surface: #171e27; --surface-2: #1e2732;
  --text: #e8edf3; --muted: #93a1b1; --line: #263140;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141a; --surface: #171e27; --surface-2: #1e2732;
    --text: #e8edf3; --muted: #93a1b1; --line: #263140;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, "Montserrat", system-ui, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 15px; line-height: 1.4;
  overscroll-behavior-y: none;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
button, input { font: inherit; }

/* ── Каркас ─────────────────────────────────────────────────────────────── */
.app { max-width: var(--maxw); margin: 0 auto; min-height: 100%; position: relative; }

.app-bar {
  position: sticky; top: 0; z-index: 20;
  height: calc(var(--bar-h) + var(--safe-top)); padding-top: var(--safe-top);
  display: flex; align-items: center; gap: 6px; padding-inline: 8px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.app-bar h1 { flex: 1; font-size: 17px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.app-bar-spacer { flex: 0 0 0; }
.icon-btn {
  border: 0; background: transparent; color: var(--text);
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
}
.icon-btn:active { background: var(--surface-2); }

/* `hidden` обязан побеждать собственный `display` кнопки.
   Браузерное правило [hidden] { display: none } — это обычный стиль, и `display: grid` выше
   его перебивает: скрытая кнопка продолжала показываться. Так и вышло со стрелкой «Назад» —
   на главной код честно ставил `back.hidden = true` (см. setHeader в js/views/owner.js), а
   стрелка оставалась на экране и вела в историю браузера, то есть из приложения наружу. */
.icon-btn[hidden] { display: none; }

.view {
  min-height: calc(100vh - var(--bar-h) - var(--tab-h));
  padding-bottom: calc(var(--tab-h) + var(--safe-bottom) + 12px);
}
.wrap { padding: 14px 14px 4px; display: flex; flex-direction: column; gap: 14px; }

/* ── Нижняя навигация ───────────────────────────────────────────────────── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  max-width: var(--maxw); margin: 0 auto;
  height: calc(var(--tab-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(150%) blur(10px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 11px; font-weight: 600;
}
.tabbar a.active { color: var(--brand); }
.tabbar a:active { opacity: .6; }

/* ── Главная ────────────────────────────────────────────────────────────── */
.greeting { display: flex; align-items: center; gap: 12px; }
.greeting-id { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.greeting-id:active { opacity: .7; }
.greeting-info { flex: 1; min-width: 0; }
.request-btn { flex: none; align-self: flex-start; gap: 4px; white-space: nowrap; }
.request-btn .ic { width: 16px; height: 16px; }
.greeting-name { font-size: 18px; font-weight: 700; }
.greeting-sub { color: var(--muted); font-size: 13px; }
.ok-text { color: var(--ok); }
.muted-text { color: var(--muted); }

.avatar {
  width: 46px; height: 46px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--brand), #7aa2ff);
}
.avatar.lg { width: 64px; height: 64px; font-size: 24px; }
.avatar.sm { width: 42px; height: 42px; font-size: 15px; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  position: relative;
  background: var(--surface); border-radius: var(--radius); padding: 14px;
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.stat-ic { position: absolute; top: 12px; right: 12px; color: var(--muted); opacity: .55; }
.stat-ic .ic { width: 22px; height: 22px; }
.stat-value { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.stat-label { font-size: 13px; margin-top: 2px; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat-breakdown { margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }
.stat-breakdown div { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; }
.stat-breakdown span { color: var(--muted); }
.stat-breakdown b { font-weight: 700; }
.stat.ok .stat-value { color: var(--ok); }
.stat.warn .stat-value { color: var(--warn); }
.stat.danger .stat-value { color: var(--danger); }

.quick { display: flex; gap: 10px; }
.quick .quick-btn { flex: 1; }
.quick-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: var(--radius-sm); padding: 12px 6px; display: flex; flex-direction: column;
  align-items: center; gap: 6px; font-size: 12px; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow);
}
.quick-btn:active { transform: scale(.97); }
.quick-btn .ic { color: var(--brand); }

.section-title { font-size: 14px; font-weight: 700; color: var(--muted); margin-top: 4px; }

/* Широкая плитка «Лента событий» под 4 плитками.
   Светло-зелёная: оттенок замешивается на --ok поверх --surface, поэтому
   в тёмной теме тон приглушается сам. Первая строка — запасная для
   вебвью без color-mix. */
.feed-tile {
  display: flex; align-items: center; gap: 12px; padding: 16px 14px;
  background: #eaf7ee;
  background: color-mix(in srgb, var(--ok) 12%, var(--surface));
  border: 1px solid #c8e6d2;
  border-color: color-mix(in srgb, var(--ok) 28%, var(--line));
  border-radius: var(--radius);
  box-shadow: var(--shadow); font-weight: 700; font-size: 15px;
}
.feed-tile:active {
  background: #dcf0e3;
  background: color-mix(in srgb, var(--ok) 20%, var(--surface));
}
.feed-tile .ic { color: var(--ok); }
.feed-tile-label { flex: 1; }
.feed-tile > .ic:last-child { color: var(--muted); }

.feed-link {
  display: inline-flex; align-items: center; gap: 4px; align-self: center;
  color: var(--brand); font-size: 14px; font-weight: 600; padding: 6px 4px; margin-top: 2px;
}
.feed-link .ic { width: 16px; height: 16px; }

/* ── Списки / строки ────────────────────────────────────────────────────── */
.list { display: flex; flex-direction: column; gap: 8px; }
.list.menu { gap: 6px; }
.row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px; box-shadow: var(--shadow);
}
.row.link:active { background: var(--surface-2); }
.row-ic {
  width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--brand);
}
.row-ic.tone-ok { color: var(--ok); }
.row-ic.tone-warn { color: var(--warn); }
.row-ic.tone-danger { color: var(--danger); }
.row-ic.tone-muted { color: var(--muted); }
.row-ic.tone-info { color: var(--brand); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-weight: 600; }
.row-sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.row-end small { color: var(--muted); font-weight: 500; }

/* ── Карточки объектов ──────────────────────────────────────────────────── */
.cards { gap: 12px; }
.card {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.card.link:active { transform: scale(.99); }
.card-photo {
  height: 150px; background-size: cover; background-position: center; background-color: var(--surface-2);
  position: relative; display: flex; align-items: flex-start; gap: 6px; padding: 10px;
}
.card-body { padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.card-title { font-weight: 700; font-size: 16px; }
.card-addr { color: var(--muted); font-size: 13px; }
.card-meta { font-size: 13px; color: var(--muted); }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.price { font-weight: 800; font-size: 17px; }
.price small { color: var(--muted); font-weight: 600; font-size: 12px; }

.chip {
  font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 999px;
  background: rgba(0,0,0,.55); color: #fff; backdrop-filter: blur(2px);
}
.chip.ok { background: var(--ok); }
.chip.warn { background: var(--warn); }
.chip.danger { background: var(--danger); }
.chip.muted { background: rgba(0,0,0,.45); }
.chip.room { background: #8b5cf6; }

.badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.badge.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.badge.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.badge.danger { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.badge.info { background: color-mix(in srgb, var(--brand) 15%, transparent); color: var(--brand); }
.rating { color: var(--warn); font-size: 12px; font-weight: 700; }

/* ── Карточка объекта: hero + под-вкладки ───────────────────────────────── */
.hero {
  height: 200px; border-radius: var(--radius); overflow: hidden; position: relative;
  background-size: cover; background-position: center; background-color: var(--surface-2);
  display: flex; align-items: flex-end;
}
.hero-grad { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.72), rgba(0,0,0,0) 60%); }
.hero-info { position: relative; padding: 14px; color: #fff; display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }

/* Действия на постере, справа внизу: слайдшоу, рекламное видео, 3D-тур.
   Не absolute, а сосед .hero-info в той же flex-строке — тогда длинный
   адрес не заезжает под кнопки, а ужимается. */
.hero-actions { position: relative; padding: 14px; display: flex; gap: 8px; flex: 0 0 auto; }
.hero-act {
  width: 38px; height: 38px; padding: 0; border: 0; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .45); color: #fff; cursor: pointer;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.hero-act:active { background: rgba(0, 0, 0, .68); transform: scale(.94); }
.hero-act .ic { width: 20px; height: 20px; }

/* Слайдшоу по фото квартиры */
.lightbox {
  position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .94);
  display: flex; align-items: center; justify-content: center;
  padding-top: var(--safe-top); padding-bottom: var(--safe-bottom);
}
.lb-img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.lb-counter {
  position: absolute; top: calc(12px + var(--safe-top)); left: 50%; transform: translateX(-50%);
  color: #fff; font-size: 13px; font-weight: 600; opacity: .85;
}
.lb-close, .lb-nav {
  position: absolute; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer;
}
.lb-close { top: calc(10px + var(--safe-top)); right: 12px; }
.lb-close .ic { transform: rotate(45deg); }
.lb-nav.prev { left: 10px; top: 50%; margin-top: -20px; }
.lb-nav.next { right: 10px; top: 50%; margin-top: -20px; }
.lb-close:active, .lb-nav:active { background: rgba(255, 255, 255, .28); }
.hero-title { font-size: 20px; font-weight: 800; }
.hero-addr { font-size: 13px; opacity: .92; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { font-size: 12px; font-weight: 600; padding: 6px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }

.subtabs {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none;
}
.subtabs::-webkit-scrollbar { display: none; }
.subtabs a {
  flex: none; font-size: 13px; font-weight: 600; color: var(--muted);
  padding: 8px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
}
.subtabs a.active { color: #fff; background: var(--brand); border-color: var(--brand); }

.card-flat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.para { margin: 0 0 8px; }
.mini-title { font-size: 13px; font-weight: 700; color: var(--muted); margin: 10px 0 6px; }
.kv { margin-top: 10px; border-top: 1px solid var(--line); }
.kv-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv-row span { color: var(--muted); }

/* ── Счётчики ───────────────────────────────────────────────────────────── */
.meter-card { display: flex; flex-direction: column; gap: 4px; }
.meter-card .kv { margin-top: 6px; }
.meter-awaiting {
  display: flex; align-items: center; gap: 8px; margin-top: 4px;
  background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn);
  border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px; font-weight: 600;
}
.meter-awaiting .ic { width: 18px; height: 18px; }
.meter-note-head { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.hint { font-weight: 500; color: var(--muted); }
.hist-badges { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; align-items: center; flex: none; max-width: 50%; }
.row-pending { background: color-mix(in srgb, var(--danger) 7%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); }
.await-dot { color: var(--danger); font-size: 10px; vertical-align: 1px; }
.link-btn {
  border: 0; background: transparent; color: var(--brand); cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; padding: 4px;
}
.link-btn .ic { width: 15px; height: 15px; }
.histRow-photo { color: var(--muted); }
.row-sub .ic { display: inline-block; width: 13px; height: 13px; vertical-align: -2px; }

/* ── Кнопки ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 12px; padding: 10px 14px; font-weight: 700; cursor: pointer;
  background: var(--brand); color: #fff;
}
.btn:active { background: var(--brand-600); }
.btn.sm { padding: 7px 11px; font-size: 13px; border-radius: 10px; }
.btn.ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn.block { width: 100%; margin-top: 8px; }

/* ── Профиль ────────────────────────────────────────────────────────────── */
.profile-head { display: flex; align-items: center; gap: 14px; padding: 4px 0 6px; }
.profile-name { font-size: 19px; font-weight: 800; }

/* ── Чат ────────────────────────────────────────────────────────────────── */
.chat-screen { display: flex; flex-direction: column; height: calc(100vh - var(--bar-h) - var(--tab-h) - var(--safe-top)); }
.chat-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 78%; padding: 9px 12px; border-radius: 16px; box-shadow: var(--shadow); }
.bubble-text { font-size: 14px; }
.bubble-time { font-size: 10px; color: var(--muted); margin-top: 3px; text-align: right; }
.bubble.them { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.bubble.me { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 5px; }
.bubble.me .bubble-time { color: rgba(255,255,255,.75); }
.chat-input {
  display: flex; gap: 8px; padding: 10px 12px calc(10px + var(--safe-bottom));
  border-top: 1px solid var(--line); background: var(--surface);
}
.chat-input input {
  flex: 1; border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  border-radius: 999px; padding: 11px 16px; outline: none;
}
.chat-input button { border: 0; background: var(--brand); color: #fff; width: 44px; border-radius: 50%; display: grid; place-items: center; }

.dot-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }

/* ── Окно расчётов / баланс ─────────────────────────────────────────────── */
.stat.link { display: block; }
.stat.link .stat-label { display: inline-flex; align-items: center; gap: 2px; }
.stat.link .stat-label .ic { width: 15px; height: 15px; color: var(--muted); }

.balance-total {
  background: linear-gradient(135deg, var(--brand), #4d8bff); color: #fff;
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.balance-total-label { font-size: 13px; opacity: .9; }
.balance-total-value { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.balance-total-sub { font-size: 12px; opacity: .85; margin-top: 2px; }

/* Переключатель разделов (квартиры / счётчики): переносится на второй ряд */
.obj-switch { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 0 4px; }
.obj-chip {
  flex: 1 1 104px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-width: 104px; padding: 10px 12px; cursor: pointer; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--text); box-shadow: var(--shadow);
}
.obj-chip-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.obj-chip.active { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; }
.obj-chip-title { font-size: 13px; font-weight: 600; white-space: nowrap; }
.obj-chip-bal { font-size: 15px; font-weight: 800; color: var(--brand); }
.obj-chip-sub { font-size: 12px; font-weight: 600; color: var(--muted); }
.obj-chip.active .obj-chip-bal { color: var(--brand); }

.settle { display: flex; flex-direction: column; gap: 10px; }
.settle-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.settle-expected { display: flex; flex-direction: column; align-items: flex-end; text-align: right; flex: none; max-width: 48%; }
.settle-expected-label { font-size: 11px; color: var(--muted); line-height: 1.2; }
.settle-expected-amount { font-size: 16px; font-weight: 800; color: var(--ok); margin-top: 2px; }
.settle-expected-after { font-size: 11px; color: var(--muted); margin-top: 1px; }
.settle-title { font-weight: 700; font-size: 16px; }
.settle-balance {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm);
}
.settle-balance span { color: var(--muted); font-size: 13px; }
.settle-balance b { font-size: 18px; font-weight: 800; }
.settle .btn .ic { width: 18px; height: 18px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.settle-note { font-size: 13px; color: var(--muted); background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.settle-list { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 8px; }
.wd { display: flex; align-items: center; gap: 10px; }
.wd-ic { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--brand); }
.wd-ic.tone-ok { color: var(--ok); }
.wd-ic.tone-warn { color: var(--warn); }
.wd-ic.tone-info { color: var(--brand); }
.wd-ic.tone-muted { color: var(--muted); }

/* ── Квитанции: сводка по текущему периоду ──────────────────────────────── */
.receipt-summary { border-radius: var(--radius); padding: 14px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.receipt-summary.warn { background: color-mix(in srgb, var(--warn) 10%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 30%, var(--line)); }
.receipt-summary.ok { background: color-mix(in srgb, var(--ok) 10%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 30%, var(--line)); }
.rs-period { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.rs-grid { display: flex; gap: 10px; }
.rs-cell { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.rs-cell span { font-size: 12px; color: var(--muted); }
.rs-cell b { font-size: 17px; font-weight: 800; }
.rs-note { margin-top: 8px; font-size: 12px; color: var(--muted); }
.receipt-includes { font-size: 13px; color: var(--muted); margin: 8px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }

/* ── Лента событий (истории с подэтапами) ───────────────────────────────── */
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.fchip {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.fchip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.event-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.event-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.event-date { color: var(--muted); font-size: 12px; margin-left: auto; }
.event-status { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.event-apt { display: flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.event-apt .ic { width: 14px; height: 14px; }
.event-title { font-weight: 700; font-size: 16px; margin-top: 6px; }
.event-expand {
  margin-top: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--brand);
  border-radius: 10px; padding: 8px 12px; font-size: 13px; font-weight: 600; cursor: pointer; width: 100%;
}
.event-expand:active { transform: scale(.99); }

.event-timeline { margin: 12px 0 2px; padding-left: 6px; }
.subev { position: relative; display: flex; gap: 12px; padding: 0 0 14px 14px; border-left: 2px solid var(--line); }
.subev:last-child { border-left-color: transparent; padding-bottom: 2px; }
.subev-dot { position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--surface); }
.subev-body { flex: 1; min-width: 0; }
.subev-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.subev-date { color: var(--muted); font-size: 11px; }
.subev-title { font-size: 14px; margin-top: 3px; }

/* Шильдики типов событий */
.ev-badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.ev-badge.sm { font-size: 10px; padding: 2px 7px; }
.ev-acceptance { background: color-mix(in srgb, #1f6feb 15%, transparent); color: #1f6feb; }
.ev-rental     { background: color-mix(in srgb, #8b5cf6 16%, transparent); color: #8b5cf6; }
.ev-service    { background: color-mix(in srgb, #0ea5a4 16%, transparent); color: #0ea5a4; }
.ev-technical  { background: color-mix(in srgb, #c98a00 18%, transparent); color: #c98a00; }
.ev-financial  { background: color-mix(in srgb, #1f9d55 16%, transparent); color: #1f9d55; }
.ev-contract   { background: color-mix(in srgb, #64748b 18%, transparent); color: #64748b; }

/* ── Арендатор ──────────────────────────────────────────────────────────── */
.pay-hero {
  display: block; background: linear-gradient(135deg, var(--brand), #4d8bff); color: #fff;
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.pay-hero:active { filter: brightness(.97); }
.pay-hero-label { font-size: 13px; opacity: .9; }
.pay-hero-value { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.pay-hero-sub { font-size: 12px; opacity: .85; margin-top: 2px; }

.banner-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; cursor: pointer; text-align: left;
  background: color-mix(in srgb, var(--warn) 12%, var(--surface)); color: var(--text);
  border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--line)); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow);
}
.banner-btn > span { flex: 1; }
.banner-btn .ic { color: var(--warn); }

.meter-banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.meter-banner.warn { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 30%, var(--line)); }
.meter-banner.ok { background: color-mix(in srgb, var(--ok) 10%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 30%, var(--line)); }
.meter-banner .ic { color: var(--brand); flex: none; }

.info-note {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--brand) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--brand) 25%, var(--line));
  font-size: 13px; color: var(--text); box-shadow: var(--shadow);
}
.info-note .ic { color: var(--brand); flex: none; margin-top: 1px; }
.chip-mini { display: inline-block; font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); vertical-align: 1px; }

.contract-card { display: flex; flex-direction: column; gap: 10px; }
.contract-no { font-size: 15px; font-weight: 800; margin: 1px 0 2px; }

/* Админ-перелинковка кабинетов (в меню «Ещё») */
.admin-switch { margin-top: 8px; }
.admin-switch .row-ic { color: var(--brand); }
.admin-note { font-size: 12px; color: var(--muted); margin: 6px 2px 2px; }
.contract-actions { display: flex; gap: 10px; }
.contract-actions .btn { flex: 1; }
.contract-actions .btn.block { flex: 1 1 100%; }

.ul { margin: 6px 0; padding-left: 18px; }
.ul li { margin: 3px 0; font-size: 14px; }
.kv-row.total { border-bottom: 0; padding-top: 10px; }
.kv-row.total b { font-size: 17px; }
.row-sub.due { color: var(--warn); font-weight: 600; margin: 6px 0; }

/* ── Управляющий: редактирование ────────────────────────────────────────── */
.edit-hint {
  display: flex; align-items: flex-start; gap: 8px; font-size: 12px; color: var(--muted);
  background: color-mix(in srgb, var(--brand) 7%, var(--surface)); border: 1px dashed color-mix(in srgb, var(--brand) 30%, var(--line));
  border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 10px;
}
.edit-hint .ic { color: var(--brand); flex: none; width: 16px; height: 16px; margin-top: 1px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.vis-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 11px; color: var(--muted); }
.vis-chip {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  border-radius: 999px; padding: 2px 10px; font-size: 11px; font-weight: 700; cursor: pointer;
}
.vis-chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.owner-found { font-size: 13px; padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 10px; }
.owner-found.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--text); border: 1px solid color-mix(in srgb, var(--ok) 30%, var(--line)); }
.owner-found.muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.chk { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 8px 0; cursor: pointer; }
.chk input { width: 18px; height: 18px; }
.field select { width: 100%; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: 12px; padding: 12px 14px; outline: none; font: inherit; font-size: 15px; }

.filters-row { display: flex; gap: 10px; }
.fld { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fld > span { font-size: 12px; color: var(--muted); }
.fld select {
  width: 100%; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 12px; padding: 10px 12px; outline: none; font: inherit; font-size: 14px;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236a7684' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px;
}
.fld select:focus { border-color: var(--brand); }
.fld-input {
  width: 100%; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 12px; padding: 10px 12px; outline: none; font: inherit; font-size: 14px;
}
.fld-input:focus { border-color: var(--brand); }
.combo { position: relative; }
.combo .fld-input { padding-right: 34px; }
.combo-clear {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  width: 24px; height: 24px; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--surface-2); color: var(--muted); font-size: 18px; line-height: 1;
  display: grid; place-items: center; padding: 0;
}
.combo-clear:hover { background: var(--line); color: var(--text); }
.combo-clear[hidden] { display: none; }

.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; padding: 6px 0; }
.pager .pg {
  min-width: 34px; height: 34px; padding: 0 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 10px; font-weight: 700; font-size: 14px; cursor: pointer;
}
.pager .pg.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager .pg[disabled] { opacity: .4; pointer-events: none; }
.pager .pg-dots { color: var(--muted); padding: 0 2px; }

/* ── Модальное окно ─────────────────────────────────────────────────────── */
body.modal-open { overflow: hidden; }
.modal-overlay {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(8, 12, 18, .5); backdrop-filter: blur(2px); animation: fade .15s ease;
}
.modal {
  width: 100%; max-width: var(--maxw); background: var(--surface);
  border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + var(--safe-bottom));
  box-shadow: 0 -8px 40px rgba(0,0,0,.35); animation: slideUp .22s ease;
}
.modal-head { margin-bottom: 12px; }
.modal-title { font-size: 18px; font-weight: 800; }
.modal-sub { color: var(--muted); font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field > span { font-size: 13px; color: var(--muted); }
.field input, .field textarea {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  border-radius: 12px; padding: 12px 14px; outline: none; font-size: 15px;
  font-family: inherit; resize: vertical;
}
.field input:focus, .field textarea:focus { border-color: var(--brand); }
.field input[type="file"] { padding: 9px 12px; }
.modal-actions { display: flex; gap: 10px; margin-top: 4px; }
.modal-actions .btn { flex: 1; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

@media (min-width: 560px) {
  .modal-overlay { align-items: center; }
  .modal { border-radius: 20px; margin: 0 12px; }
}

/* ── Состояния ──────────────────────────────────────────────────────────── */
.state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 60px 20px; color: var(--muted); text-align: center; }
.state-emoji { font-size: 40px; }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.ic { display: block; }

/* планшет / широкий экран — карточки в 2 колонки */
@media (min-width: 560px) {
  .cards { display: grid; grid-template-columns: 1fr 1fr; }
}

/* ── Поле вложений (фото + видео-ссылка) ────────────────────────────────── */
.media-field { margin: 10px 0; }
.media-label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.media-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.media-grid:not(:empty) { margin-bottom: 8px; }
.media-thumb { position: relative; width: 72px; height: 72px; border-radius: var(--radius-sm); background: var(--surface-2) center/cover no-repeat; border: 1px solid var(--line); }
.media-rm { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: none; background: var(--danger); color: #fff; font-size: 15px; line-height: 1; cursor: pointer; box-shadow: var(--shadow); }
.media-add { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border: 1px dashed var(--line); border-radius: var(--radius-sm); color: var(--brand); font-size: 14px; font-weight: 600; cursor: pointer; }
.media-add:active { background: var(--surface-2); }
.media-video { display: block; margin-top: 10px; }

/* ── Плитка комнаты (обложка) ───────────────────────────────────────────── */
.card-photo { height: 120px; background: var(--surface-2) center/cover no-repeat; border-radius: var(--radius) var(--radius) 0 0; }

/* ── Фотографии: миниатюры + слайд-шоу (лайтбокс) ───────────────────────── */
.photo-strip { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.photo-thumb { width: 84px; height: 84px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2) center/cover no-repeat; cursor: pointer; padding: 0; }
.photo-thumb:active { opacity: .85; }
.photo-add { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border: 1px dashed var(--line); border-radius: var(--radius-sm); color: var(--brand); font-size: 14px; font-weight: 600; cursor: pointer; margin-top: 4px; }
.photo-add:active { background: var(--surface-2); }
.room-photos { margin-bottom: 12px; }
.room-photos-label { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 14px; color: var(--text); text-decoration: none; }
.room-photos-label .ic { width: 16px; height: 16px; color: var(--muted); }

.lb-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; }
.lb-img { max-width: 92vw; max-height: 82vh; border-radius: 8px; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: none; background: rgba(255,255,255,.15); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.lb-prev { left: 12px; } .lb-next { right: 12px; }
.lb-close { position: absolute; top: 14px; right: 16px; width: 40px; height: 40px; border-radius: 50%; border: none; background: rgba(255,255,255,.15); color: #fff; font-size: 22px; line-height: 1; cursor: pointer; }
.lb-count { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 14px; background: rgba(0,0,0,.5); padding: 4px 12px; border-radius: 999px; }

/* ── История показаний/начислений (модалка, 3 столбца) ──────────────────── */
.hist-filter { display: flex; gap: 10px; margin: 4px 0 10px; }
.hist-filter .fld { flex: 1; }
.hist-table-wrap { max-height: 52vh; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.hist-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.hist-table th { position: sticky; top: 0; background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 12.5px; text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.hist-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.hist-table tbody tr:last-child td, .hist-table tr:last-child td { border-bottom: none; }
.hist-val { font-weight: 600; white-space: nowrap; }
.hist-photo { width: 44px; text-align: center; color: var(--brand); }
.hist-photo .ic { display: inline-block; }
.hist-tag { font-size: 11px; font-weight: 600; color: var(--warn); border: 1px solid var(--warn); border-radius: 999px; padding: 0 6px; margin-left: 4px; }
.hist-opening { background: color-mix(in srgb, var(--warn) 8%, transparent); }
.hist-opening .hist-tag { color: var(--brand); border-color: var(--brand); }
.hist-empty { text-align: center; color: var(--muted); padding: 16px; }
.hist-num { background: none; border: none; padding: 0; font: inherit; color: var(--brand); font-weight: 700; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.hist-num.sm-link { font-size: 12.5px; font-weight: 600; }
.mini-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }

/* ── Профиль арендатора: сегменты + слоты документов ────────────────────── */
.seg { display: flex; gap: 6px; background: var(--surface-2); border-radius: var(--radius-sm); padding: 4px; margin: 6px 0 10px; }
.seg.sm { margin: 6px 0; }
.seg-btn { flex: 1; border: none; background: none; padding: 9px 8px; border-radius: calc(var(--radius-sm) - 2px); font: inherit; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.seg-btn.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.doc-slots { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 6px; }
.doc-slot { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.doc-slot.filled { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.doc-slot-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.doc-slot-label { font-size: 13.5px; font-weight: 600; }
.doc-slot-label .req { color: var(--danger); }
.doc-thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.doc-thumb { position: relative; width: 72px; height: 72px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2) center/cover no-repeat; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.doc-file { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 9px; color: var(--muted); text-align: center; padding: 2px; line-height: 1.1; }
.doc-file .ic { width: 20px; height: 20px; }
.doc-rm { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: none; background: var(--danger); color: #fff; font-size: 14px; line-height: 1; cursor: pointer; }
.doc-rm.rel { position: static; }
.doc-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 72px; height: 72px; border: 1px dashed var(--line); border-radius: var(--radius-sm); color: var(--brand); font-size: 10px; cursor: pointer; }
.resident-card .seg { margin: 6px 0; }
.fld-label-row { display: flex; align-items: center; gap: 6px; }
.hint-q { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--brand); background: none; color: var(--brand); font-size: 12px; font-weight: 700; line-height: 1; cursor: pointer; padding: 0; }
.email-row { display: flex; gap: 8px; align-items: stretch; }
.email-row .fld-input { flex: 1; }
.email-row .btn { flex: none; white-space: nowrap; }
.field-hint { font-size: 12.5px; color: var(--muted); background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 10px; margin-top: 6px; }
.util-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; }
.util-grid .chk { margin: 4px 0; font-size: 13.5px; }

/* ── Форма договора: аккордеон + подразделы ─────────────────────────────── */
.acc { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 8px; background: var(--surface); overflow: hidden; }
.acc-head { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 13px 14px; background: var(--surface-2); border: none; cursor: pointer; color: var(--text); font-weight: 700; font-size: 14px; letter-spacing: .02em; text-transform: uppercase; }
.acc-ic { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--brand); color: var(--brand); display: flex; align-items: center; justify-content: center; font-size: 18px; line-height: 1; flex: none; }
.acc-body { padding: 12px 14px; }
.cf-sub { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin: 10px 0; }
.cf-sub-title { font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 6px; }
.cf-inst { border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 8px; }
.cf-inst:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.cf-inst-h { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.cf-inline { display: flex; gap: 8px; align-items: center; margin: 4px 0; }
.cf-inline .fld-input { flex: 1; }
.cf-phone-actions { display: flex; flex-wrap: wrap; gap: 14px; margin: 2px 0 8px; }
.link-btn { background: none; border: none; padding: 0; color: var(--brand); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.link-btn .ic { width: 16px; height: 16px; }
.link-btn.danger { color: var(--danger); }
.cf-toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; cursor: pointer; }
.cf-toggle input { display: none; }
.cf-switch { position: relative; width: 44px; height: 24px; border-radius: 999px; background: var(--line); transition: background .2s; flex: none; }
.cf-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--shadow); transition: transform .2s; }
.cf-toggle input:checked + .cf-switch { background: var(--brand); }
.cf-toggle input:checked + .cf-switch::after { transform: translateX(20px); }
.cf-summary { font-size: 12.5px; color: var(--text); background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; margin: 10px 0; font-weight: 600; }
.take-list { max-height: 54vh; overflow-y: auto; }
.take-row { display: grid; grid-template-columns: 28px 1fr 1fr; gap: 8px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.take-chk { width: 20px; height: 20px; margin-top: 4px; }
.take-lbl { font-size: 11px; color: var(--muted); }
.take-val { font-size: 13px; }
.cf-section { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 8px; background: var(--surface); overflow: hidden; }
.cf-section-h { padding: 13px 14px; background: var(--surface-2); font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: .02em; }
.cf-section-b { padding: 12px 14px; }
.cf-bal-wrap { margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 8px; }
.cf-bal { font-size: 12.5px; padding: 3px 0; font-weight: 600; }
.cf-bal.ok { color: var(--ok); }
.cf-bal.warn { color: var(--warn); }

/* под-вкладки (Текущий договор / Архив) */
.subtabs.inner { margin-bottom: 10px; }
.subtabs.inner a { cursor: pointer; }

/* ── Карточка подписанного договора (read-only, шильды, мелкий шрифт) ────── */
.cc { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 14px; box-shadow: var(--shadow); font-size: 13px; }
.cc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.cc-title { font-size: 15px; font-weight: 700; }
.cc-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cc-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.cc-chip { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.cc-chip.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.cc-chip.info { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }
.cc-block { margin: 12px 0; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.cc-h { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 6px; }
.cc-client { font-size: 12.5px; line-height: 1.5; margin-top: 6px; }
.cc-reg { font-size: 12px; color: var(--muted); margin-top: 3px; }
.cc-sub2 { font-size: 12px; color: var(--muted); margin-top: 6px; }
.cc-grid { display: grid; grid-template-columns: 1fr; gap: 0; margin: 10px 0; }
.cc-row { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.cc-row:last-child { border-bottom: none; }
.cc-k { color: var(--muted); flex: none; }
.cc-v { text-align: right; font-weight: 600; }
.cc-tags { font-size: 12px; color: var(--muted); margin: 6px 0; }
.cc-agr { font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 10px; margin: 6px 0; }
.cc-lock { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ok); margin: 10px 0; }
.cc-lock .ic { width: 16px; height: 16px; }
.cc-lock.warn { color: var(--warn); }
@media (min-width: 480px) { .cc-grid { grid-template-columns: 1fr 1fr; gap: 0 18px; } }
.cc-head-r { display: flex; align-items: center; gap: 6px; }
.settle-head-r { display: flex; align-items: center; gap: 6px; }
.badge.draft { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.cf-mt { margin-top: 12px; }

/* меню договора (⋮) */
.cmenu { position: relative; }
.cmenu-btn { width: 30px; height: 30px; border: none; background: none; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; border-radius: 8px; }
.cmenu-btn:active { background: var(--surface-2); }
.cmenu-list { display: none; position: absolute; right: 0; top: 34px; z-index: 30; min-width: 172px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); overflow: hidden; }
.cmenu.open .cmenu-list { display: block; }
.cmenu-item { display: block; width: 100%; text-align: left; padding: 11px 14px; background: none; border: none; font: inherit; font-size: 14px; color: var(--text); cursor: pointer; }
.cmenu-item:active { background: var(--surface-2); }
.cmenu-item.danger { color: var(--danger); }
.cmenu-item + .cmenu-item { border-top: 1px solid var(--line); }
