/* Аренда СОТА — оболочка, модалки, формы и свои элементы управления.
   Тема виджетов — desk.css (эталон интерфейса владельца). Цвета — переменными на :root. */
:root {
    --l: #e2eaec; --s2: #f4f8f9; --ink: #24373f; --ink2: #536771; --mut: #8a99a1;
    --acc: #0f9e88; --acc-s: #d9f3ee; --acc-d: #0b7d6b;
    --good: #2aa87c; --bad: #e07a5f; --warn: #dd9333; --tel: #0e7490;
    --bg: #eef3f4;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: Manrope, 'DejaVu Sans', system-ui, sans-serif; font-size: 14px; color: var(--ink);
       background: var(--bg); }
a { color: var(--acc-d); }
.num { font-variant-numeric: tabular-nums; }
.mut { color: var(--mut); }

/* ── шапка ─────────────────────────────────────────────────────────── */
.top { display: flex; align-items: center; gap: 4px; background: #fff; border-bottom: 1px solid var(--l);
       padding: 6px 16px; position: sticky; top: 0; z-index: 20; }
.logo { font-weight: 800; font-size: 15px; margin-right: 14px; white-space: nowrap; color: var(--ink);
        text-decoration: none; }
.logo b { color: var(--acc); }
.top nav { display: flex; gap: 2px; flex-wrap: wrap; }
.top nav a { text-decoration: none; color: var(--ink2); font-weight: 700; font-size: 13px; padding: 5px 11px;
             border-radius: 999px; white-space: nowrap; }
.top nav a:hover { background: var(--s2); }
.top nav a.on { background: var(--acc); color: #fff; }
.who { margin-left: auto; font-size: 12.5px; color: var(--ink2); white-space: nowrap; }
.who a { margin-left: 8px; color: var(--mut); }
main.page { padding: 12px 16px 30px; max-width: 1680px; margin: 0 auto; }
.page-h { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.page-h h1 { font-size: 18px; margin: 0; }

/* ── кнопки ───────────────────────────────────────────────────────── */
.btn { border: 1.5px solid var(--l); background: #fff; color: var(--ink2); font: inherit; font-size: 12.5px;
       font-weight: 700; border-radius: 999px; padding: 5px 13px; cursor: pointer; white-space: nowrap;
       text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.btn:hover { border-color: var(--acc); color: var(--acc-d); }
.btn.pri { background: var(--acc); border-color: var(--acc); color: #fff; }
.btn.pri:hover { background: var(--acc-d); color: #fff; }
.btn.danger { color: #b4432b; }
.btn.danger:hover { border-color: #e07a5f; }
.btn.sm { font-size: 11.5px; padding: 2px 9px; }
.btn:disabled { opacity: .55; cursor: default; }

/* ── модалка ──────────────────────────────────────────────────────── */
.ov { position: fixed; inset: 0; background: rgba(15, 26, 42, .42); display: flex; align-items: flex-start;
      justify-content: center; padding: 4vh 12px; z-index: 50; overflow-y: auto; }
.ov[hidden] { display: none; }
.modal { background: #fff; border-radius: 14px; width: min(96vw, 560px); box-shadow: 0 24px 70px rgba(0,0,0,.28); }
.modal.modal-wide { width: min(96vw, 900px); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--l); }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-head .sub { font-size: 12px; color: var(--mut); }
.modal-head .x { margin-left: auto; border: 0; background: none; font-size: 22px; line-height: 1; color: var(--mut);
                 cursor: pointer; padding: 0 4px; }
.modal-body { padding: 12px 16px 14px; }
.modal-2col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 290px); gap: 16px; align-items: start; }
.modal-side { border-left: 1px solid var(--l); padding-left: 14px; font-size: 12.5px; }
.modal-foot { display: flex; gap: 6px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--l); }
.modal-foot .sp { flex: 1; }
@media (max-width: 760px) {
    .modal-2col { grid-template-columns: 1fr; }
    .modal-side { border-left: 0; border-top: 1px solid var(--l); padding-left: 0; padding-top: 10px; }
}
.sec { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--mut);
       margin: 12px 0 4px; display: flex; align-items: center; gap: 8px; }
.sec:first-child { margin-top: 0; }
.sec .btn { margin-left: auto; text-transform: none; letter-spacing: 0; }

/* справка «метка: значение» — табличкой по ширине содержимого */
.kv { display: inline-grid; grid-template-columns: auto auto; gap: 2px 12px; font-size: 12.5px; }
.kv > div { display: contents; }
.kv span { color: var(--mut); white-space: nowrap; }
.kv b { font-weight: 700; white-space: nowrap; }
.side-box { background: var(--s2); border-radius: 9px; padding: 7px 10px; margin-bottom: 8px; }
.side-box.warn { background: #fdf3e3; }
.side-box.good { background: #e9f8f0; }
.side-big { font-size: 19px; font-weight: 800; }

/* ── формы ────────────────────────────────────────────────────────── */
.fg { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 14px; }
.fg .wide { grid-column: 1 / -1; }
.fg3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 7px 12px; }
.fld { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fld > label { font-size: 11px; font-weight: 700; color: var(--ink2); }
.fld > label i { font-style: normal; font-weight: 400; color: var(--mut); }
.inp { border: 1.5px solid var(--l); border-radius: 8px; padding: 5px 9px; font: inherit; font-size: 13px;
       color: var(--ink); background: #fff; min-width: 0; width: 100%; }
.inp:focus { outline: none; border-color: var(--acc); }
textarea.inp { resize: vertical; min-height: 52px; }
.inp.short { width: 120px; }
.inp.err { border-color: var(--bad); }

/* выпадающий список проекта (нативный <select> запрещён эталоном) */
.sel { position: relative; min-width: 0; }
.sel > button { width: 100%; display: flex; align-items: center; gap: 6px; text-align: left; border: 1.5px solid var(--l);
                border-radius: 8px; padding: 5px 9px; font: inherit; font-size: 13px; color: var(--ink);
                background: #fff; cursor: pointer; min-height: 31px; }
.sel > button span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel > button span.ph { color: var(--mut); }
.sel > button::after { content: '▾'; color: var(--mut); font-size: 11px; }
.sel.open > button, .sel > button:focus { outline: none; border-color: var(--acc); }
.sel-list { position: absolute; left: 0; top: calc(100% + 3px); z-index: 70; background: #fff; border: 1px solid var(--l);
            border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.16); min-width: 100%; max-width: 420px;
            padding: 4px; display: none; }
.sel.open .sel-list { display: block; }
.sel-list .find { width: 100%; border: 1px solid var(--l); border-radius: 7px; padding: 4px 8px; font: inherit;
                  font-size: 12.5px; margin-bottom: 3px; }
.sel-list .find:focus { outline: none; border-color: var(--acc); }
.sel-opts { max-height: 260px; overflow-y: auto; }
.sel-opts div { padding: 4px 8px; border-radius: 6px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.sel-opts div i { font-style: normal; color: var(--mut); font-size: 11.5px; margin-left: 6px; }
.sel-opts div:hover, .sel-opts div.hi { background: var(--acc-s); }
.sel-opts div.on { font-weight: 700; color: var(--acc-d); }
.sel-opts .none { color: var(--mut); cursor: default; }

/* переключатель (вместо checkbox) */
.tg { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12.5px; user-select: none;
      border: 0; background: none; padding: 2px 0; font-family: inherit; color: var(--ink); text-align: left; }
.tg i { flex: none; position: relative; width: 30px; height: 17px; border-radius: 999px; background: #cfd9dc;
        transition: background .15s; }
.tg i::after { content: ''; position: absolute; left: 2px; top: 2px; width: 13px; height: 13px; border-radius: 50%;
               background: #fff; transition: transform .15s; }
.tg.on i { background: var(--acc); }
.tg.on i::after { transform: translateX(13px); }

/* чипы множественного выбора (роли участника) */
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chips button { border: 1.5px solid var(--l); background: #fff; border-radius: 999px; padding: 3px 10px; font: inherit;
                font-size: 12px; font-weight: 700; color: var(--ink2); cursor: pointer; }
.chips button.on { background: var(--acc); border-color: var(--acc); color: #fff; }

/* степпер (вместо input[type=number]) */
.stp { display: inline-flex; align-items: center; gap: 3px; }
.stp button { width: 26px; height: 29px; border: 1.5px solid var(--l); background: #fff; border-radius: 7px;
              font-size: 14px; font-weight: 700; color: var(--ink2); cursor: pointer; padding: 0; font-family: inherit; }
.stp button:hover { border-color: var(--acc); color: var(--acc); }
.stp .inp { width: 48px; text-align: center; padding: 5px 2px; }

/* календарь (вместо input[type=date]) */
.dt { position: relative; }
.cal { position: absolute; top: calc(100% + 3px); left: 0; z-index: 70; background: #fff; border: 1px solid var(--l);
       border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.16); padding: 7px; width: 232px; font-size: 12px; }
.cal-h { display: flex; align-items: center; justify-content: space-between; font-weight: 700; margin-bottom: 4px; }
.cal-h button { border: 0; background: var(--s2); border-radius: 6px; width: 24px; height: 22px; cursor: pointer;
                font-family: inherit; }
.cal-g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-g span { color: var(--mut); font-size: 10.5px; font-weight: 700; }
.cal-g button { border: 0; background: none; border-radius: 6px; padding: 4px 0; cursor: pointer; font: inherit;
                font-size: 12px; }
.cal-g button:hover { background: var(--acc-s); }
.cal-g button.on { background: var(--acc); color: #fff; }
.cal-g button.td { box-shadow: inset 0 0 0 1.5px var(--acc); }
.cal-f { display: flex; justify-content: space-between; margin-top: 5px; }
.cal-f button { border: 0; background: none; color: var(--acc-d); font: inherit; font-size: 11.5px; font-weight: 700;
                cursor: pointer; }

/* строки списков внутри карточек */
.mini-tbl { width: 100%; border-collapse: collapse; }
.mini-tbl td { font-size: 12.5px; padding: 3px 7px; background: var(--s2); border-top: 2px solid #fff;
               white-space: nowrap; vertical-align: middle; }
.mini-tbl td:first-child { border-radius: 7px 0 0 7px; }
.mini-tbl td:last-child { border-radius: 0 7px 7px 0; }
.mini-tbl td.r { text-align: right; }
.mini-tbl td.wrap { white-space: normal; }
.mini-tbl tr.lnk { cursor: pointer; }
.mini-tbl tr.lnk:hover td { background: var(--acc-s); }
.mini-tbl .x { border: 0; background: none; color: var(--mut); cursor: pointer; font-size: 15px; padding: 0 3px; }
.mini-tbl .x:hover { color: var(--bad); }
.addrow { display: grid; gap: 6px; align-items: end; margin-top: 5px; }
.empty { font-size: 12px; color: var(--mut); padding: 3px 2px; }

.tag { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
       background: var(--s2); color: var(--ink2); white-space: nowrap; }
.tag.warn { background: #fdf3e3; color: #b45309; }
.tag.acc { background: var(--acc-s); color: var(--acc-d); }
.tel { color: var(--tel); font-weight: 700; white-space: nowrap; text-decoration: none; }

/* всплывающее сообщение */
#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
         padding: 8px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; z-index: 90; opacity: 0;
         transition: opacity .2s; pointer-events: none; }
#toast.show { opacity: 1; }
#toast.err { background: #b4432b; }

/* вход */
.login { max-width: 340px; margin: 12vh auto; background: #fff; border-radius: 14px; padding: 22px 22px 18px;
         box-shadow: 0 10px 40px rgba(0,0,0,.08); }
.login h1 { font-size: 20px; margin: 0 0 4px; }
.login .fld { margin-top: 10px; }
.login .btn { margin-top: 14px; width: 100%; justify-content: center; padding: 8px; }
.login .error { color: #b4432b; font-size: 12.5px; margin-top: 8px; }

/* метки в ячейке — по ширине текста, столбиком */
.w-tbl td .stack > .tag { width: fit-content; }
/* в правой колонке-справке (290 px) строки переносятся, иначе таблица вылезает за край */
.modal-side .mini-tbl td { white-space: normal; }
.modal-side .mini-tbl td.r { white-space: nowrap; }
.mini-tbl td .sm { display: block; font-size: 11px; color: var(--mut); white-space: normal; }
/* страховка: если таблица всё же шире виджета — прокрутка внутри, а не обрезка колонки */
.w [data-role="body"] { min-width: 0; overflow-x: auto; }

/* свободная ширина таблицы — в последнюю колонку: остальные колонки стоят плотно (владелец 20.11) */
.w-tbl th.fill, .w-tbl td.fill { width: 100%; }

/* группы длинного списка: шапка со сводкой, клик — свернуть/развернуть */
.w-tbl tr.grp-h td { background: #e6eef0; cursor: pointer; padding: 6px 9px; border-top: 6px solid #fff; }
.w-tbl tr.grp-h:first-child td { border-top: 0; }
.w-tbl tr.grp-h:hover td { background: var(--acc-s); }
.grp-line { display: flex; align-items: baseline; gap: 10px; font-size: 13px; }
.grp-line .mut { font-size: 12px; }
.grp-ar { display: inline-block; width: 12px; color: var(--mut); transition: transform .15s; }
tr.grp-h.open .grp-ar { transform: rotate(90deg); }
.grp-sum { margin-left: auto; font-weight: 800; }
.grp-sum i { font-style: normal; font-weight: 400; color: var(--mut); font-size: 11.5px; }

/* фильтр выпадающей кнопкой, список сеткой «к квадрату» (эталон: widgets/filtr_vypadayushiy.html) */
.dd { display: inline-block; position: relative; vertical-align: top; }
.dd-trig { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 12.5px; font-weight: 700;
           padding: 5px 10px; border-radius: 999px; border: 1.5px solid var(--l); background: #fff; color: var(--ink);
           cursor: pointer; white-space: nowrap; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.dd-trig::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dd-c, #94a3b8); flex: none; }
.dd-trig::after { content: "▾"; font-size: 11px; color: var(--mut); }
.dd-trig.set { border-color: var(--acc); }
.dd.open > .dd-trig { border-color: var(--acc); }
.dd > .dd-row { display: none; position: absolute; top: calc(100% + 4px); left: 0; z-index: 60; background: #fff;
                border: 1px solid var(--l); border-radius: 12px; box-shadow: 0 12px 30px rgba(36,55,63,.18);
                padding: 7px; gap: 5px; width: max-content; max-width: min(640px, 92vw); }
.dd.r > .dd-row { left: auto; right: 0; }
.dd.open > .dd-row { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(104px, max-content)); }
.dd-row > button { font: inherit; font-size: 12.5px; font-weight: 700; padding: 7px 11px; border-radius: 9px; cursor: pointer;
                   white-space: nowrap; text-align: center; border: 1px solid transparent; background: var(--dd-bg, #f1f5f7);
                   color: var(--dd-c, #40535c); }
.dd-row > button.on { border-color: var(--dd-c, var(--acc)); box-shadow: inset 0 0 0 1px var(--dd-c, var(--acc)); }
.dd-row:not(.dd .dd-row) { display: none; }   /* до обёртки скриптом ряд не мигает */
[data-k="wait"] { --dd-c: #b45309; --dd-bg: #fff3dc; }
[data-k="me"] { --dd-c: #0f766e; --dd-bg: #e3f5f2; }

/* выпадающий список с группами (помещения по собственнику) */
.sel-opts .g { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--mut);
               padding: 7px 8px 2px; cursor: default; }
.sel-opts .g:hover { background: none; }
.sel-opts .g + div:not(.g) { margin-top: 0; }

/* доли собственников: доля, сумма ему, отметки (импорт таблицы 20.11) */
.own-tbl tr.h td { background: none; font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--mut); padding: 2px 7px; }
.own-tbl .inp { padding: 2px 6px; text-align: right; }
.own-tbl .stack-tg { display: flex; flex-direction: column; gap: 2px; }
.own-tbl .stack-tg .tg { font-size: 11.5px; gap: 6px; white-space: nowrap; }
.own-tbl .stack-tg .tg i { width: 24px; height: 14px; }
.own-tbl .stack-tg .tg i::after { width: 10px; height: 10px; }
.own-tbl .stack-tg .tg.on i::after { transform: translateX(10px); }
.nw { white-space: nowrap; }
