/* ============================================================
   Панель отделки 3 этажа — стили (mobile-first, светлая/тёмная тема)
   ============================================================ */

:root {
  --bg: #eef1f6;
  --bg-elev: #ffffff;
  --bg-elev2: #f5f7fb;
  --line: #d7dce6;
  --line-strong: #c2c9d6;
  --text: #1a2130;
  --text-dim: #5c6577;
  --text-faint: #8a93a5;
  --accent: #3b6ef5;
  --accent-ink: #ffffff;
  --not: #9aa3b4;
  --wip: #f0a020;
  --done: #2ea36b;
  --danger: #e5484d;
  --chip: #eaeef6;
  --shadow: 0 6px 24px rgba(20, 30, 60, .12);
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1420;
    --bg-elev: #171d2b;
    --bg-elev2: #1e2536;
    --line: #2a3242;
    --line-strong: #3a4356;
    --text: #e8ecf4;
    --text-dim: #a4adbf;
    --text-faint: #727d92;
    --accent: #5b8bff;
    --accent-ink: #0a0f1a;
    --not: #5c6579;
    --wip: #e6a02a;
    --done: #35b877;
    --danger: #f0575c;
    --chip: #232b3c;
    --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  }
}
:root[data-theme="dark"] {
  --bg: #0f1420; --bg-elev: #171d2b; --bg-elev2: #1e2536;
  --line: #2a3242; --line-strong: #3a4356;
  --text: #e8ecf4; --text-dim: #a4adbf; --text-faint: #727d92;
  --accent: #5b8bff; --accent-ink: #0a0f1a;
  --not: #5c6579; --wip: #e6a02a; --done: #35b877; --danger: #f0575c;
  --chip: #232b3c; --shadow: 0 10px 30px rgba(0,0,0,.45);
}
:root[data-theme="light"] {
  --bg: #eef1f6; --bg-elev: #ffffff; --bg-elev2: #f5f7fb;
  --line: #d7dce6; --line-strong: #c2c9d6;
  --text: #1a2130; --text-dim: #5c6577; --text-faint: #8a93a5;
  --accent: #3b6ef5; --accent-ink: #ffffff;
  --not: #9aa3b4; --wip: #f0a020; --done: #2ea36b; --danger: #e5484d;
  --chip: #eaeef6; --shadow: 0 6px 24px rgba(20,30,60,.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  padding-bottom: calc(24px + var(--safe-b));
  overflow-x: hidden;
}
button, select, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ---- Верхняя панель ---- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
}
.topbar__title { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 auto; }
.topbar__floor {
  font-weight: 800; font-size: 13px; letter-spacing: .5px;
  color: var(--accent-ink); background: var(--accent);
  padding: 6px 8px; border-radius: 9px; white-space: nowrap; flex: 0 0 auto;
}
.topbar__meta { display: flex; flex-direction: column; min-width: 0; }
.topbar__meta strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__meta span { font-size: 11.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.rolepick { display: flex; flex-direction: column; align-items: flex-start; }
.rolepick__label { font-size: 9px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-faint); }
.rolepick__select {
  background: var(--bg-elev2); border: 1px solid var(--line-strong);
  border-radius: 9px; padding: 5px 8px; font-size: 13px; font-weight: 600;
  max-width: 132px;
}
.iconbtn {
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--bg-elev2); border: 1px solid var(--line-strong);
  font-size: 17px; line-height: 1; display: grid; place-items: center;
}
.iconbtn:active { transform: scale(.94); }
.iconbtn--bell { position: relative; font-size: 15px; }
.notif-badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--danger); color: #fff;
  font-size: 10.5px; font-weight: 800; line-height: 17px; text-align: center;
}

/* ---- Панель уведомлений ---- */
.notif-panel {
  position: fixed; top: 64px; right: 10px; z-index: 70;
  width: min(360px, calc(100vw - 20px)); max-height: 70vh; overflow-y: auto;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px;
}
.notif-panel[hidden] { display: none; }
.notif-panel__title { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-dim); margin: 2px 4px 10px; }
.notif-item {
  display: block; width: 100%; text-align: left;
  background: var(--bg-elev2); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 11px; margin-bottom: 7px;
}
.notif-item:hover { border-color: var(--accent); }
.notif-item__head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.notif-item__room { font-size: 12.5px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-item__count { flex: 0 0 auto; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 800; border-radius: 8px; padding: 1px 6px; }
.notif-item__preview { font-size: 12px; color: var(--text-dim); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-item__when { font-size: 11px; color: var(--text-faint); margin-top: 2px; }

/* ---- Дашборд ---- */
.dash { padding: 12px 14px 4px; display: grid; gap: 12px; }
.dash__row { display: grid; gap: 12px; grid-template-columns: 1fr; }
.card {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
}
.kpi { display: flex; align-items: center; gap: 14px; }
.donut { flex: 0 0 auto; }
.kpi__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; flex: 1; min-width: 0; }
.kpi__cell { background: var(--bg-elev2); border-radius: 10px; padding: 8px 10px; min-width: 0; overflow: hidden; }
.kpi__num { font-size: 18px; font-weight: 800; line-height: 1.1; white-space: nowrap; }
.kpi__lbl { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.dot--not { background: var(--not); }
.dot--wip { background: var(--wip); }
.dot--done { background: var(--done); }

.card__title { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-dim); margin: 0 0 10px; }
.card__count {
  display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 8px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 800;
}

/* ---- Отстают от графика ---- */
.dash__row > .card { min-width: 0; } /* карточки дашборда не должны распираться контентом */
.late { display: grid; gap: 7px; min-width: 0; }
.late-item {
  display: block; width: 100%; text-align: left;
  min-width: 0; overflow: hidden;
  background: var(--bg-elev2); border: 1px solid var(--line);
  border-left: 3px solid var(--danger);
  border-radius: 10px; padding: 8px 10px;
}
.late-item:hover { border-color: var(--danger); }
.late-item__top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; min-width: 0; }
.late-item__room { flex: 1 1 auto; }
.late-item__room { font-size: 12.5px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.late-item__days { flex: 0 0 auto; color: var(--danger); font-size: 12.5px; font-weight: 800; }
.late-item__stages { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zonebars { display: grid; gap: 9px; }
.zonebar { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; }
.zonebar__name { font-size: 12.5px; }
.zonebar__pct { font-size: 12px; font-weight: 700; color: var(--text-dim); }
.zonebar__track { grid-column: 1 / -1; height: 7px; border-radius: 5px; background: var(--bg-elev2); overflow: hidden; }
.zonebar__fill { height: 100%; border-radius: 5px; }

.feed { display: grid; gap: 8px; }
.feed__item { font-size: 12.5px; color: var(--text-dim); display: flex; gap: 8px; }
.feed__item b { color: var(--text); font-weight: 600; }
.feed__when { color: var(--text-faint); white-space: nowrap; }

/* ---- Вкладки ---- */
.tabs {
  position: sticky; top: 61px; z-index: 20;
  display: flex; gap: 4px; padding: 8px 14px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.tab {
  flex: 1; padding: 9px 10px; border-radius: 10px; border: 1px solid transparent;
  background: transparent; color: var(--text-dim); font-weight: 600; font-size: 13.5px;
}
.tab.is-active { background: var(--bg-elev); color: var(--text); border-color: var(--line); box-shadow: var(--shadow); }

/* ---- Контейнер вида ---- */
.view { padding: 14px; }

/* ---- Легенда ---- */
.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; font-size: 12px; color: var(--text-dim); margin-bottom: 12px; }
.legend__item { display: flex; align-items: center; gap: 6px; }
.legend__sw { width: 14px; height: 14px; border-radius: 4px; }

/* ---- Вид: План этажа (реальная подложка + индикаторы) ---- */
.planr { position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.planr__scroll { overflow: auto; max-height: 78vh; -webkit-overflow-scrolling: touch; cursor: grab; }
.planr__scroll.is-dragging { cursor: grabbing; user-select: none; }
.planr__scroll.is-dragging .pin { pointer-events: none; }
.planr__inner { position: relative; min-width: 100%; }
.planr__img { width: 100%; height: auto; display: block; user-select: none; -webkit-user-drag: none; }
.planr__ctl { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 6px; z-index: 5; }
.planr__ctl .iconbtn { box-shadow: var(--shadow); background: var(--bg-elev); }

.pin {
  position: absolute; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 34px; padding: 2px 5px; border-radius: 9px;
  background: var(--pc, var(--not)); color: #fff;
  border: 1.5px solid rgba(255,255,255,.85);
  box-shadow: 0 1px 5px rgba(0,0,0,.4);
  cursor: pointer; line-height: 1.05; z-index: 2;
}
.pin:hover { z-index: 4; transform: translate(-50%, -50%) scale(1.12); }
.pin:active { transform: translate(-50%, -50%) scale(1.02); }
.pin__num { font-size: 8.5px; font-weight: 700; opacity: .92; letter-spacing: .2px; }
.pin__pct { font-size: 11px; font-weight: 800; }
.pin--done .pin__pct::after { content: ' ✓'; font-size: 9px; }
.pin--late {
  box-shadow: 0 0 0 2px var(--danger), 0 3px 8px rgba(0,0,0,.28);
  animation: latePulse 1.6s ease-in-out infinite;
}
@keyframes latePulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--danger), 0 3px 8px rgba(0,0,0,.28); }
  50%      { box-shadow: 0 0 0 5px rgba(229,72,77,.45), 0 3px 8px rgba(0,0,0,.28); }
}
.pin__unread {
  position: absolute; top: -7px; right: -7px;
  min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px;
  background: var(--danger); color: #fff; border: 1.5px solid #fff;
  font-size: 9px; font-weight: 800; line-height: 13px; text-align: center;
}
@media (max-width: 759px) {
  .pin { min-width: 30px; padding: 1px 4px; }
  .pin__num { font-size: 7.5px; }
  .pin__pct { font-size: 10px; }
}

/* ---- Вид: Плитки ---- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filters select, .filters input {
  background: var(--bg-elev); border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 8px 10px; font-size: 13px;
}
.filters input { flex: 1; min-width: 140px; }
.zonegroup { margin-bottom: 18px; }
.zonegroup__head { display: flex; align-items: baseline; gap: 8px; margin: 0 2px 10px; }
.zonegroup__name { font-size: 14px; font-weight: 700; }
.zonegroup__meta { font-size: 12px; color: var(--text-dim); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.rcard {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px; display: grid; gap: 8px; text-align: left;
  border-left: 4px solid var(--not);
}
.rcard:active { transform: scale(.985); }
.rcard__top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.rcard__num { font-weight: 800; font-size: 15px; }
.rcard__pct { font-weight: 800; font-size: 15px; }
.rcard__name { font-size: 12.5px; color: var(--text-dim); line-height: 1.3; min-height: 2.6em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rcard__foot { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--text-faint); }
.bar { height: 6px; border-radius: 4px; background: var(--bg-elev2); overflow: hidden; }
.bar__fill { height: 100%; border-radius: 4px; }
.badge { display: inline-flex; align-items: center; gap: 4px; }

/* ---- Вид: Таблица ---- */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-elev); }
table.matrix { border-collapse: collapse; width: 100%; font-size: 12.5px; min-width: 620px; }
.matrix th, .matrix td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
.matrix thead th { position: sticky; top: 0; background: var(--bg-elev2); z-index: 2; font-size: 11px; color: var(--text-dim); }
.matrix th.rowhead, .matrix td.rowhead { text-align: left; position: sticky; left: 0; background: var(--bg-elev); z-index: 1; }
.matrix td.rowhead { cursor: pointer; }
.matrix tbody tr:hover td { background: var(--bg-elev2); }
.matrix .num { font-weight: 700; }
.matrix .rname { color: var(--text-dim); font-size: 11.5px; }
.cellbox { display: inline-block; width: 15px; height: 15px; border-radius: 4px; }
.cell--not { background: var(--bg-elev2); border: 1px solid var(--line-strong); }
.cell--wip { background: var(--wip); }
.cell--done { background: var(--done); }
.cell--na { color: var(--text-faint); }
.matrix .pctcell { font-weight: 800; }
.matrix .latecell { color: var(--danger); font-weight: 800; }
.matrix .latecell--ok { color: var(--text-faint); font-weight: 400; }

/* ---- Окно помещения (модальное, по центру экрана) ---- */
/* Атрибут hidden должен побеждать display:flex/block ниже. */
.sheet[hidden], .sheet-overlay[hidden] { display: none; }
.sheet-overlay { position: fixed; inset: 0; background: rgba(6,10,20,.55); z-index: 40; }
.sheet {
  position: fixed; z-index: 50; background: var(--bg-elev);
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(620px, calc(100vw - 24px));
  max-height: min(88vh, 900px);
  border-radius: 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  animation: modalIn .18s ease;
  overflow-x: hidden;
}
.sheet__big { flex: 0 0 auto; }
@keyframes modalIn {
  from { opacity: 0; transform: translate(-50%, -48%) scale(.97); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.sheet__grip { display: none; }
.sheet__head { display: flex; align-items: flex-start; gap: 10px; padding: 6px 16px 12px; border-bottom: 1px solid var(--line); }
.sheet__titles { flex: 1; min-width: 0; }
.sheet__num { font-size: 20px; font-weight: 800; }
.sheet__name { font-size: 13px; color: var(--text-dim); }
.sheet__sub { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }
.sheet__big { text-align: right; }
.sheet__pct { font-size: 26px; font-weight: 800; line-height: 1; }
.sheet__close { border: none; background: var(--bg-elev2); border-radius: 9px; width: 34px; height: 34px; font-size: 18px; }
.sheet__body { overflow-y: auto; padding: 14px 16px 20px; -webkit-overflow-scrolling: touch; }
.sect { margin-bottom: 20px; }
.sect__title { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-dim); margin: 0 0 10px; }
.sect__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.sect__head .sect__title { margin: 0; }
.btn--sm { padding: 5px 10px; font-size: 12px; }

/* ---- График производства работ (мини-Гант) ---- */
.gantt { display: grid; gap: 6px; }
.gantt__row { display: grid; grid-template-columns: 96px 1fr 74px; gap: 8px; align-items: center; }
.gantt__name { font-size: 11.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt__track { position: relative; height: 14px; background: var(--bg-elev2); border-radius: 5px; overflow: hidden; }
.gantt__bar { position: absolute; top: 2px; bottom: 2px; border-radius: 4px; min-width: 4px; }
.gantt__today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); opacity: .85; z-index: 1; }
.gantt__dates { font-size: 10.5px; color: var(--text-faint); text-align: right; white-space: nowrap; }
.gantt__dates.is-overdue { color: var(--danger); font-weight: 700; }
.gantt__legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 11px; color: var(--text-dim); }
.gantt__legend-item { display: inline-flex; align-items: center; gap: 5px; }
.gantt__sw { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.gantt__legend-today { color: var(--accent); font-weight: 700; }

.ganttedit { display: grid; gap: 7px; }
.ganttedit__row { display: grid; grid-template-columns: minmax(90px, 1fr) auto auto auto; gap: 6px; align-items: center; }
.ganttedit__name { font-size: 12px; }
.ganttedit__dash { color: var(--text-faint); }
.ganttedit__row input[type="date"] {
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--bg-elev2); padding: 5px 6px; font-size: 12px; max-width: 128px;
}

.stage { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 7px; background: var(--bg-elev); }
.stage__mark { width: 24px; height: 24px; border-radius: 7px; flex: 0 0 auto; display: grid; place-items: center; font-size: 14px; font-weight: 700; border: 1px solid var(--line-strong); background: var(--bg-elev2); color: var(--text-faint); }
.stage--wip .stage__mark { background: var(--wip); border-color: var(--wip); color: #3a2600; }
.stage--done .stage__mark { background: var(--done); border-color: var(--done); color: #052a17; }
.stage__name { flex: 1; font-size: 13.5px; }
.stage__state { font-size: 11.5px; color: var(--text-faint); }
.stage.is-locked { opacity: .8; }
.stage.is-actionable { cursor: pointer; }
.stage.is-actionable:active { transform: scale(.99); }
.stage__del {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 7px;
  border: none; background: transparent; color: var(--text-faint);
  font-size: 15px; line-height: 1;
}
.stage__del:hover { background: rgba(229,72,77,.12); color: var(--danger); }
.addstage { width: 100%; margin-top: 2px; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--bg-elev2); border: 1px solid var(--line); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo__cap { position: absolute; left: 0; right: 0; bottom: 0; font-size: 10px; padding: 2px 5px; background: linear-gradient(transparent, rgba(0,0,0,.7)); color: #fff; }
.photo__del { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 6px; border: none; background: rgba(0,0,0,.55); color: #fff; font-size: 13px; }
.addphoto { border: 1.5px dashed var(--line-strong); border-radius: 10px; background: var(--bg-elev2); color: var(--text-dim); display: grid; place-items: center; aspect-ratio: 1; font-size: 12px; text-align: center; padding: 6px; }

.comment { border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; margin-bottom: 8px; background: var(--bg-elev); }
.comment__head { display: flex; align-items: center; gap: 7px; font-size: 12px; margin-bottom: 4px; }
.comment__author { font-weight: 700; }
.comment__when { color: var(--text-faint); margin-left: auto; }
.comment__text { font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }
.comment__del { border: none; background: transparent; color: var(--danger); font-size: 11px; padding: 2px 4px; }
.rtag { font-size: 9.5px; text-transform: uppercase; letter-spacing: .4px; padding: 2px 6px; border-radius: 6px; background: var(--chip); color: var(--text-dim); font-weight: 700; }
.rtag--admin { background: rgba(91,139,255,.18); color: var(--accent); }
.rtag--foreman { background: rgba(46,163,107,.18); color: var(--done); }
.rtag--observer { background: rgba(240,160,32,.18); color: var(--wip); }
.rtag--new { background: var(--danger); color: #fff; }
.comment--new { border-color: var(--danger); background: rgba(229,72,77,.05); }
.unread-chip {
  display: inline-block; margin-left: 6px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 800; border-radius: 7px; padding: 1px 5px;
}

.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; resize: vertical; min-height: 40px; max-height: 140px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 9px 11px; background: var(--bg-elev2); font-size: 13.5px; }
.btn { border: none; border-radius: 10px; padding: 10px 14px; font-weight: 700; font-size: 13.5px; background: var(--accent); color: var(--accent-ink); }
.btn:disabled { opacity: .5; }
.btn--ghost { background: var(--bg-elev2); color: var(--text); border: 1px solid var(--line-strong); }
.hint { font-size: 12px; color: var(--text-faint); padding: 8px 0; }
.empty { text-align: center; color: var(--text-faint); padding: 26px 10px; font-size: 13px; }

/* ---- Проект «Стяжка ВС»: участки-полигоны (обводка отрезками) ---- */
.vspoly-layer {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  z-index: 5; pointer-events: none; overflow: visible;
}
.vspoly { pointer-events: auto; cursor: pointer; }
.vspoly:hover { filter: brightness(1.08); }
.vslabel {
  position: absolute; transform: translate(-50%, -50%); z-index: 6;
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,.92); border: 1px solid rgba(0,0,0,.35);
  border-radius: 6px; padding: 1px 6px; cursor: pointer;
  font-size: 9.5px; font-weight: 700; color: #1a2130; white-space: nowrap;
  max-width: 160px; overflow: hidden; text-overflow: ellipsis;
}
.vslabel:hover { z-index: 8; }
.vslabel--problem { background: #dc2626; color: #fff; border-color: #7f1212; }
.vslabel .pin__unread { position: static; margin-left: 2px; }
.vsghost-line {
  fill: rgba(59,110,245,.18); stroke: var(--accent); stroke-width: 2;
  vector-effect: non-scaling-stroke; pointer-events: none;
}
.vsghost-preview {
  stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 6 5;
  vector-effect: non-scaling-stroke; pointer-events: none;
}
.vsvertex {
  position: absolute; transform: translate(-50%, -50%); z-index: 9;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); border: 1.5px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.4); pointer-events: none;
}
.vsvertex--first {
  width: 15px; height: 15px; background: #fff; border: 3px solid var(--accent);
  pointer-events: auto; cursor: pointer;
}
.planr__scroll.draw-mode { cursor: crosshair; touch-action: none; }
.planr__scroll.draw-mode .planr__img { pointer-events: none; }
.planr__scroll.draw-mode .vspoly { pointer-events: none; }
.planr__scroll.draw-mode .vslabel { pointer-events: none; }

/* ---- Перетаскивание видов работ ---- */
.stage__grip {
  flex: 0 0 auto; cursor: grab; touch-action: none;
  color: var(--text-faint); font-size: 14px; padding: 2px 3px;
  user-select: none;
}
.stage__grip:active { cursor: grabbing; }
.stage--dragging { opacity: .85; box-shadow: var(--shadow); border-color: var(--accent); position: relative; z-index: 5; }

/* ---- Вход (серверный режим) ---- */
.auth {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: grid; place-items: center; padding: 16px;
}
.auth__card {
  width: min(400px, 100%);
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow);
  padding: 26px 24px; display: grid; gap: 12px;
}
.auth__logo {
  justify-self: start; font-weight: 800; font-size: 13px; letter-spacing: .5px;
  color: var(--accent-ink); background: var(--accent);
  padding: 6px 9px; border-radius: 9px;
}
.auth__title { margin: 2px 0 0; font-size: 19px; }
.auth__sub { margin: 0; font-size: 13px; color: var(--text-dim); }
.auth__field { display: grid; gap: 5px; }
.auth__label { font-size: 11.5px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .4px; }
.auth__input {
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--bg-elev2); padding: 10px 12px; font-size: 14px; width: 100%;
}
.auth__submit { margin-top: 4px; padding: 12px; font-size: 14.5px; }
.auth__error {
  background: rgba(229,72,77,.1); border: 1px solid var(--danger);
  color: var(--danger); border-radius: 10px; padding: 8px 11px; font-size: 13px;
}

.user-chip {
  font-size: 12px; font-weight: 700; color: var(--text-dim);
  background: var(--chip); border-radius: 9px; padding: 7px 10px;
  white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis;
}

/* ---- Пользователи (модалка админа) ---- */
.umodal-overlay {
  position: fixed; inset: 0; z-index: 90; background: rgba(6,10,20,.55);
  display: grid; place-items: center; padding: 14px;
}
.umodal {
  width: min(560px, 100%); max-height: 86vh; overflow-y: auto;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow); padding: 16px;
}
.umodal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.umodal__title { margin: 0; font-size: 17px; }
.urow {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; margin-bottom: 8px;
  flex-wrap: wrap;
}
.urow__info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.urow__name { font-weight: 700; font-size: 13.5px; }
.urow__email { color: var(--text-dim); font-size: 12.5px; }
.urow__actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn--danger { color: var(--danger); border-color: var(--danger); }
.ucreate { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; display: grid; gap: 10px; }
.ucreate__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 520px) { .ucreate__grid { grid-template-columns: 1fr; } }

/* ---- Проект «ЖК»: матрица секции × этажи ---- */
.zk-scroll { padding: 6px; }
table.zk { border-collapse: collapse; width: 100%; min-width: 760px; }
.zk th, .zk td { border: 1px solid var(--line); padding: 3px; text-align: center; }
.zk thead th { background: var(--bg-elev2); font-size: 13px; font-weight: 800; padding: 8px 4px; position: sticky; top: 0; z-index: 2; }
.zk__corner { font-size: 10.5px !important; color: var(--text-dim); font-weight: 600 !important; }
.zk__floor { background: var(--bg-elev2); font-size: 12px; white-space: nowrap; padding: 4px 8px !important; position: sticky; left: 0; z-index: 1; }
.zkcell {
  width: 100%; min-width: 62px; height: 40px; border: none; border-radius: 6px;
  font-size: 12px; font-weight: 700; cursor: pointer; position: relative;
  border: 1px solid var(--line-strong);
}
.zkcell:hover { filter: brightness(1.06); box-shadow: 0 0 0 2px var(--accent); z-index: 3; }
.zkcell--off {
  background: repeating-linear-gradient(45deg, #c8c8c8, #c8c8c8 4px, #e6e6e6 4px, #e6e6e6 8px) !important;
  color: #666 !important;
}
.zkcell .pin__unread { top: -6px; right: -6px; }
.zk__totals th, .zk__totals td { background: var(--bg-elev2); font-weight: 800; font-size: 12.5px; padding: 7px 4px; }

.zk-title { font-size: 17px; font-weight: 800; margin: 18px 2px 10px; }
.zk-title:first-child { margin-top: 2px; }

/* кровля ЖК: подложка-план + полигоны секций */
.zkroof-wrap { max-width: 820px; }
.zkroof-wrap2 { position: relative; }
.zkroof-img { width: 100%; height: auto; display: block; background: #fff; border-radius: 6px; }
.zkroof-layer {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  pointer-events: none; overflow: visible;
}
.zkroof-layer .vspoly { pointer-events: auto; }
.zkroof-done { background: #12a348; color: #fff; border-color: #0c6b30; }
.zkroof-wrap2.draw-mode { cursor: crosshair; touch-action: none; }
.zkroof-wrap2.draw-mode .zkroof-img { pointer-events: none; }
.zkroof-wrap2.draw-mode .vspoly { pointer-events: none; }
.zkroof-wrap2.draw-mode .vslabel { pointer-events: none; }

/* ---- Лайтбокс (полноэкранный просмотр фото) ---- */
.lightbox {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(4, 7, 14, .92);
  display: flex; align-items: center; justify-content: center;
}
.lightbox__img {
  max-width: 94vw; max-height: 84vh;
  object-fit: contain; border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0,0,0,.6);
}
.lightbox__close {
  position: absolute; top: 12px; right: 14px; z-index: 2;
  width: 42px; height: 42px; border-radius: 12px; border: none;
  background: rgba(255,255,255,.12); color: #fff; font-size: 24px;
}
.lightbox__close:hover { background: rgba(255,255,255,.25); }
.lightbox__nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 46px; height: 64px; border: none; border-radius: 12px;
  background: rgba(255,255,255,.12); color: #fff; font-size: 34px; line-height: 1;
}
.lightbox__nav:hover { background: rgba(255,255,255,.25); }
.lightbox__nav--prev { left: 10px; }
.lightbox__nav--next { right: 10px; }
.lightbox__bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: linear-gradient(transparent, rgba(0,0,0,.75));
  text-align: center; color: #fff;
}
.lightbox__caption { font-size: 15px; font-weight: 600; }
.lightbox__meta { font-size: 12px; color: rgba(255,255,255,.7); margin-top: 3px; }
.photo img { cursor: zoom-in; }

/* ---- Десктоп ---- */
@media (min-width: 760px) {
  .dash { grid-template-columns: 1fr; max-width: 1200px; margin: 0 auto; }
  .dash__row { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
  .tabs { top: 61px; max-width: 1200px; margin: 0 auto; }
  .view { max-width: 1200px; margin: 0 auto; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}
@media (max-width: 759px) {
  .kpi__grid { grid-template-columns: repeat(3, 1fr); }
  .tabs { top: 61px; }
}
