/* Polaris Design — оформление в дизайн-системе Realty AI.
   Индиго-минимализм, Manrope, слоистые мягкие тени.
   Тема своя (светлая/тёмная), под тему Telegram намеренно не подстраиваемся. */

/* ── Manrope, локально: без внешних запросов ─────────────────────── */
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/fonts/manrope-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/fonts/manrope-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

/* ── Токены ──────────────────────────────────────────────────────── */
:root {
  --bg: #f5f7fc;
  --card: #ffffff;
  --soft: #eff2f9;
  --text: #0b1220;
  --muted: #5b6b86;
  --border: #e6ebf4;
  --input-bg: #ffffff;
  --input-border: #dde4f0;
  --primary: #4f46e5;
  --primary-2: #4338ca;
  --primary-soft: #eef0fe;
  --accent: #7c5cf6;
  --accent-soft: #f3effe;
  --ring: rgba(79, 70, 229, 0.22);
  --danger: #dc2626;
  --danger-soft: #fdecea;
  --ok: #16a34a;
  --ok-soft: #e8f6ed;
  --warn: #d97706;
  --warn-soft: #fdf1e0;
  --shadow: 0 1px 2px rgba(16, 24, 64, .05), 0 4px 12px rgba(28, 35, 84, .06),
            0 14px 34px rgba(28, 35, 84, .07);
  --shadow-lg: 0 2px 6px rgba(16, 24, 64, .06), 0 12px 28px rgba(28, 35, 84, .12),
               0 32px 68px rgba(28, 35, 84, .16);
  --grad: linear-gradient(135deg, #6d70f9 0%, #4f46e5 48%, #4630c9 100%);
  --grad-hero: radial-gradient(150% 140% at 0% 0%, #818cf8 0%, #4f46e5 42%, #4029c2 78%, #341fa3 100%);
  --r-card: 18px;
  --r-lg: 22px;
  --r-btn: 12px;
  /* Отступы под системные панели. В полноэкранном режиме шапка Telegram
     лежит поверх страницы, и её высоту знает только сам Telegram —
     приложение проставляет эти значения при запуске и при повороте. */
  --tg-top: 0px;
  --tg-bottom: 0px;
}

:root[data-theme="dark"] {
  --bg: #070b16;
  --card: #111726;
  --soft: #18202f;
  --text: #e9eefb;
  --muted: #93a1bd;
  --border: #212b41;
  --input-bg: #0c1322;
  --input-border: #283450;
  --primary: #818cf8;
  --primary-2: #6366f1;
  --primary-soft: #1b2340;
  --accent: #a78bfa;
  --accent-soft: #221b3f;
  --ring: rgba(129, 140, 248, .32);
  --danger: #f87171;
  --danger-soft: #3a1d1d;
  --ok: #4ade80;
  --ok-soft: #14301f;
  --warn: #fbbf24;
  --warn-soft: #33260c;
  --shadow: 0 1px 3px rgba(0, 0, 0, .32), 0 6px 18px rgba(0, 0, 0, .4),
            0 16px 44px rgba(0, 0, 0, .46);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, .46), 0 16px 36px rgba(0, 0, 0, .52),
               0 36px 76px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; touch-action: manipulation; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: Manrope, -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI",
    Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

#root {
  min-height: 100vh;
  /* Сверху — место под шапку Telegram в полноэкранном режиме,
     снизу — под нижнюю панель: она есть у всех ролей. */
  padding-top: var(--tg-top);
  padding-bottom: calc(84px + max(env(safe-area-inset-bottom, 0px), var(--tg-bottom)));
  max-width: 560px;
  margin: 0 auto;
  -webkit-user-select: none;
  user-select: none;
}
.boot { display: grid; place-items: center; min-height: 70vh; color: var(--muted); }

/* Копировать разрешаем там, где это правда нужно. */
.sel, .sel * { -webkit-user-select: text; user-select: text; }

/* Спрятанная половина формы: показывается по переключателю. */
.veiled { display: none; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.screen { animation: fade-up .13s ease-out; }

/* Обновление, которого никто не просил, не должно моргать экраном. */
.no-anim .screen { animation: none; }

/* Кому анимации мешают — тому их не показываем. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ── Бренд ───────────────────────────────────────────────────────── */
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 6px;
}
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px; flex: 0 0 auto;
  background: var(--grad);
  display: grid; place-items: center;
  box-shadow: 0 8px 20px rgba(79, 70, 229, .38);
}
.brand-mark svg { width: 19px; height: 19px; display: block; }
.brand-name {
  font-size: 18px; font-weight: 800; letter-spacing: -0.03em;
}
.brand-name span { color: var(--primary); }
.brand-spacer { flex: 1; }

/* ── Шапка экрана ────────────────────────────────────────────────── */
.head { padding: 2px 16px 10px; }
.head h1 {
  margin: 0; font-size: 25px; font-weight: 800; letter-spacing: -0.035em;
}
.head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* ── Переключатель вкладок ───────────────────────────────────────── */
.seg {
  display: flex; gap: 3px; margin: 12px 16px 0;
  background: var(--soft); border-radius: 13px; padding: 3px;
  border: 1px solid var(--border);
}
.seg button {
  flex: 1; border: 0; background: transparent; color: var(--muted);
  font: inherit; font-weight: 700; font-size: 13.5px;
  padding: 8px 6px; border-radius: 10px; cursor: pointer;
  transition: color .13s, background .13s;
}
.seg button.on {
  background: var(--card); color: var(--text);
  box-shadow: 0 1px 2px rgba(16, 24, 64, .06), 0 3px 10px rgba(28, 35, 84, .08);
}

/* ── Поиск ───────────────────────────────────────────────────────── */
.search-wrap { position: relative; margin: 10px 16px 0; }
.search-wrap svg {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--muted); pointer-events: none;
}
.search {
  width: 100%; padding: 12px 14px 12px 38px;
  border: 1px solid var(--input-border); border-radius: var(--r-btn);
  font: inherit; font-size: 14.5px;
  background: var(--input-bg); color: var(--text);
  transition: border-color .13s, box-shadow .13s;
}
.search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.search::placeholder { color: var(--muted); }

/* ── Раскладка ───────────────────────────────────────────────────── */
.wrap { padding: 0 16px; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-card); box-shadow: var(--shadow);
  padding: 14px; width: 100%; text-align: left;
  font: inherit; color: inherit; display: block; cursor: pointer;
  transition: transform .13s, box-shadow .13s;
}
.card:active { transform: scale(.985); box-shadow: var(--shadow-lg); }

.sec {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-card); box-shadow: var(--shadow); padding: 15px;
}
.sec + .sec { margin-top: 10px; }
.sec h3 {
  margin: 0 0 11px; font-size: 11.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
}

/* Заголовок над группой карточек — вне рамки блока. */
.sec-title {
  margin: 16px 2px 8px; font-size: 11.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
}

.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.bold { font-weight: 750; }
.mt { margin-top: 12px; }
.mt6 { margin-top: 6px; }
.gap6 { display: flex; flex-wrap: wrap; gap: 6px; }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grow { flex: 1; min-width: 0; }

.empty { padding: 56px 28px; text-align: center; color: var(--muted); }
.empty .ic {
  width: 62px; height: 62px; border-radius: 20px; margin: 0 auto 14px;
  background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center;
}
.empty .ic svg { width: 28px; height: 28px; }
.empty .t { font-size: 16px; font-weight: 750; color: var(--text); margin-bottom: 5px; }

/* ── Метки ───────────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3.5px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 750; white-space: nowrap;
}
.chip.design      { background: var(--primary-soft); color: var(--primary); }
.chip.await_draft { background: var(--warn-soft); color: var(--warn); }
.chip.drafting    { background: var(--accent-soft); color: var(--accent); }
.chip.done        { background: var(--ok-soft); color: var(--ok); }
.chip.cancelled   { background: var(--soft); color: var(--muted); }
.chip.warn        { background: var(--danger-soft); color: var(--danger); }
.chip.plain       { background: var(--soft); color: var(--muted); border: 1px solid var(--border); }
.chip.mine        { background: var(--grad); color: #fff; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.dot.free { background: var(--ok); }
.dot.busy { background: var(--warn); }
.dot.loaded, .dot.overdue { background: var(--danger); }

/* ── Карточка объекта ────────────────────────────────────────────── */
.o-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.o-code {
  font-size: 12px; font-weight: 800; color: var(--muted);
  letter-spacing: .05em; font-variant-numeric: tabular-nums;
}
.o-client { font-size: 17px; font-weight: 750; margin: 3px 0 3px; letter-spacing: -.02em; }
.o-meta { color: var(--muted); font-size: 13px; }
.o-stages { margin-top: 11px; display: flex; flex-direction: column; gap: 5px; }
.o-stage { display: flex; gap: 8px; font-size: 12.5px; align-items: baseline; }
.o-stage .lbl { color: var(--muted); min-width: 54px; flex: 0 0 auto; font-weight: 650; }
.o-stage .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o-stage.cur .who { font-weight: 700; }
.o-foot {
  margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; font-size: 12.5px;
}

/* Полоса выполнения этапов */
.prog { display: flex; gap: 4px; margin-top: 10px; }
.prog i {
  height: 4px; flex: 1; border-radius: 999px; background: var(--soft);
  display: block; overflow: hidden;
}
.prog i.on { background: var(--grad); }
.prog i.half { background: linear-gradient(90deg, var(--primary) 50%, var(--soft) 50%); }

/* ── Главная ─────────────────────────────────────────────────────── */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.tile {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-card); box-shadow: var(--shadow); padding: 13px 14px;
}
.tile .n {
  font-size: 26px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.tile .l { font-size: 12px; color: var(--muted); margin-top: 1px; }
/* Плитка с суммой, а не со счётчиком: «128 140 000 сум» в половину ширины
   26-м кеглем ломалось пополам, и «сум» уезжало на вторую строку. */
.tile.money .n { font-size: 18px; white-space: nowrap; }
.tile.bad .n { color: var(--danger); }
.tile.warn .n { color: var(--warn); }
.tile.ok .n { color: var(--ok); }

/* Строка «горит сейчас» — вся строка кликабельна, ведёт в объект. */
.hot {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: transparent; border: 0; padding: 10px 0;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.hot + .hot { border-top: 1px solid var(--border); }
.hot:active { opacity: .55; }
.hot .nm { font-weight: 700; font-size: 14px; }

/* Загрузка человека: полоса, а не только слово «занят». */
.lrow { display: flex; align-items: center; gap: 11px; padding: 10px 0; }
.lrow + .lrow { border-top: 1px solid var(--border); }
.lrow .nm { font-weight: 650; font-size: 14px; }
.lrow .pc {
  font-size: 13px; font-weight: 800; color: var(--muted); flex: 0 0 auto;
  font-variant-numeric: tabular-nums; min-width: 38px; text-align: right;
}
.bar {
  height: 6px; border-radius: 999px; background: var(--soft);
  overflow: hidden; margin: 5px 0 4px;
}
.bar i { display: block; height: 100%; border-radius: 999px; background: var(--grad); }
.bar.bad i { background: var(--danger); }
.ava.bad { background: var(--danger-soft); color: var(--danger); }

/* ── Деньги ──────────────────────────────────────────────────────── */
.monthbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-btn); padding: 5px 6px; box-shadow: var(--shadow);
}
.monthbar .mname {
  flex: 1; text-align: center; font-weight: 750; font-size: 15px;
  text-transform: capitalize;
}
.mbtn {
  width: 36px; height: 36px; border-radius: 10px; border: 0; flex: 0 0 auto;
  background: var(--soft); color: var(--primary); cursor: pointer;
  display: grid; place-items: center; transition: transform .11s;
}
.mbtn:active { transform: scale(.9); }

.total-tile { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
/* Суммы здесь в сотнях миллионов: без nowrap «50 205 000 сум» ломалось
   пополам и подпись сползала. Шрифт мельче — ради того же. */
.total-tile .n { font-size: 22px; white-space: nowrap; }
.total-tile .l { margin-top: 0; text-align: right; }

/* Строка операции: приход зелёный, расход красный, крестик — удалить. */
.oprow { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.oprow + .oprow { border-top: 1px solid var(--border); }
.oprow .nm { font-weight: 700; font-size: 14px; }
.oprow.tap {
  width: 100%; background: transparent; border: 0; text-align: left;
  font: inherit; color: inherit; cursor: pointer;
}
.oprow.tap:active { opacity: .55; }
.amt {
  font-weight: 800; font-size: 14px; white-space: nowrap; flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}
.amt.income { color: var(--ok); }
.amt.outcome { color: var(--danger); }
.opdel {
  width: 30px; height: 30px; border-radius: 9px; border: 0; flex: 0 0 auto;
  background: transparent; color: var(--muted); font-size: 14px; cursor: pointer;
  transition: background .13s, color .13s;
}
.opdel:active { background: var(--danger-soft); color: var(--danger); }
.kv .v.over { color: var(--warn); }

/* ── Пары «ключ — значение» ──────────────────────────────────────── */
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 14px; }
.kv .k { color: var(--muted); flex: 0 0 auto; }
.kv .v { text-align: right; font-weight: 650; min-width: 0; }
.kv + .kv { border-top: 1px solid var(--border); }
.kv a.v { color: var(--primary); text-decoration: none; }
.kv .v.big { font-size: 17px; font-weight: 800; letter-spacing: -.02em; }

/* ── Люди ────────────────────────────────────────────────────────── */
.person { display: flex; align-items: center; gap: 10px; padding: 9px 0; }
.person + .person { border-top: 1px solid var(--border); }
.ava {
  width: 34px; height: 34px; border-radius: 11px; flex: 0 0 auto;
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
  background: var(--primary-soft); color: var(--primary);
}
.ava.ok { background: var(--ok-soft); color: var(--ok); }
.person .nm { font-weight: 650; }
.person .st { font-size: 11.5px; }
.person .st.ok { color: var(--ok); font-weight: 750; }
.person .st.wait { color: var(--muted); }

/* ── История ─────────────────────────────────────────────────────── */
.tl { display: flex; flex-direction: column; }
.tl-i { display: flex; gap: 10px; padding: 7px 0; font-size: 13px; }
.tl-i .bul {
  width: 7px; height: 7px; border-radius: 50%; background: var(--border);
  flex: 0 0 auto; margin-top: 6px;
}
.tl-i:first-child .bul { background: var(--primary); }
.tl-i .tx { flex: 1; min-width: 0; }
.tl-i .at { color: var(--muted); font-size: 11.5px; white-space: nowrap; }

/* ── Кнопки ──────────────────────────────────────────────────────── */
/* Значок без явных размеров браузер считает картинкой 300×150 и растягивает
   кнопку под себя — из-за этого «Дизайнер» и «Чертёжник» занимали пол-экрана.
   Здесь общий размер для всех кнопок; где нужен другой (панель внизу,
   круглая кнопка, логотип), он задан отдельно и перебивает это правило. */
button svg { width: 18px; height: 18px; flex: 0 0 auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 48px; padding: 12px 16px;
  border: 1px solid transparent; border-radius: var(--r-btn);
  font: inherit; font-size: 15px; font-weight: 750; letter-spacing: -.01em;
  cursor: pointer; transition: transform .13s, box-shadow .13s, opacity .13s;
  background: var(--grad); color: #fff;
  box-shadow: 0 10px 24px rgba(79, 70, 229, .34);
}
.btn:active { transform: scale(.97); }
.btn.ghost {
  background: var(--soft); color: var(--text);
  border-color: var(--border); box-shadow: none;
}
.btn.soft { background: var(--primary-soft); color: var(--primary); box-shadow: none; }
.btn.danger { background: var(--danger-soft); color: var(--danger); box-shadow: none; }
.btn.link { background: transparent; color: var(--primary); box-shadow: none; min-height: 44px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.sm { min-height: 40px; padding: 8px 13px; font-size: 13px; width: auto; border-radius: 11px; }
.btns { display: flex; flex-direction: column; gap: 9px; margin-top: 14px; }
/* Приглашения — действие нечастое: три кнопки во всю ширину съедали экран. */
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }

.fab {
  position: fixed; right: 16px; z-index: 30;
  bottom: calc(88px + max(env(safe-area-inset-bottom, 0px), var(--tg-bottom)));
  width: auto; min-height: 52px; padding: 14px 20px; border: 0; border-radius: 999px;
  background: var(--grad); color: #fff; font: inherit; font-weight: 750; font-size: 15px;
  display: inline-flex; align-items: center; gap: 8px;
  box-shadow: 0 12px 30px rgba(79, 70, 229, .45); cursor: pointer;
  transition: transform .13s;
}
.fab:active { transform: scale(.95); }
.fab svg { width: 18px; height: 18px; }

/* Липкая полоса действий в формах */
.sticky-bar {
  position: sticky; bottom: 0; z-index: 10;
  margin: 16px -16px 0;
  padding: 12px 16px calc(12px + max(env(safe-area-inset-bottom, 0px), var(--tg-bottom)));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-top: 1px solid var(--border);
}

/* ── Нижняя навигация ────────────────────────────────────────────── */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: space-around; align-items: stretch;
  max-width: 560px; margin: 0 auto;
  background: color-mix(in srgb, var(--card) 82%, transparent);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-top: 1px solid var(--border);
  padding: 7px 6px calc(8px + max(env(safe-area-inset-bottom, 0px), var(--tg-bottom)));
}
.nav button {
  flex: 1; border: 0; background: transparent; color: var(--muted);
  font: inherit; cursor: pointer; position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 2px 4px; transition: color .15s;
}
.nav button.on { color: var(--primary); }
.nav .pill {
  width: 46px; height: 28px; border-radius: 999px;
  display: grid; place-items: center; transition: background .15s;
}
.nav button.on .pill { background: var(--primary-soft); }
.nav .pill svg { width: 20px; height: 20px; }
.nav .lbl { font-size: 10.5px; font-weight: 750; letter-spacing: -.01em; }
.nav .badge {
  position: absolute; top: -1px; right: 50%; transform: translateX(24px);
  background: var(--danger); color: #fff; border-radius: 999px;
  font-size: 9.5px; font-weight: 800; padding: 1px 5px; min-width: 16px; text-align: center;
}

/* ── Формы ───────────────────────────────────────────────────────── */
.field { margin-bottom: 13px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block; font-size: 12.5px; font-weight: 700;
  color: var(--muted); margin-bottom: 6px;
}
.field label .req { color: var(--danger); }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px 13px;
  border: 1px solid var(--input-border); border-radius: var(--r-btn);
  background: var(--input-bg); color: var(--text);
  font: inherit; font-size: 15px;
  transition: border-color .13s, box-shadow .13s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring);
}
.field input.bad, .field textarea.bad { border-color: var(--danger); }
.field textarea { min-height: 84px; resize: vertical; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint-line { font-size: 12px; color: var(--muted); margin-top: 6px; }
.hint-line b { color: var(--text); font-weight: 750; }
.err { color: var(--danger); font-size: 12.5px; margin-top: 6px; font-weight: 650; }

.suffix { position: relative; }
.suffix input { padding-right: 52px; }
.suffix .sfx {
  position: absolute; right: 13px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 13px; font-weight: 700; pointer-events: none;
}

/* Итоговая сумма */
.total {
  margin-top: 12px; padding: 13px 14px; border-radius: var(--r-btn);
  background: var(--primary-soft); border: 1px solid transparent;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.total .l { font-size: 12.5px; font-weight: 700; color: var(--primary); }
.total .v {
  font-size: 19px; font-weight: 800; color: var(--primary);
  letter-spacing: -.03em; font-variant-numeric: tabular-nums;
}
.total.bad { background: var(--danger-soft); }
.total.bad .l, .total.bad .v { color: var(--danger); }

/* Комнаты */
.room-add { display: flex; flex-wrap: wrap; gap: 6px; }
.room-add button {
  border: 1px dashed var(--input-border); background: transparent; color: var(--muted);
  border-radius: 999px; padding: 7px 13px; font: inherit; font-size: 13px;
  font-weight: 650; cursor: pointer; transition: all .13s;
}
.room-add button:active { transform: scale(.95); }
.room-add button.on {
  border-style: solid; border-color: var(--primary);
  background: var(--primary-soft); color: var(--primary);
}
.room { display: flex; align-items: center; gap: 8px; padding: 9px 0; }
.room + .room { border-top: 1px solid var(--border); }
.room .nm { flex: 1; min-width: 0; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room .cnt {
  min-width: 26px; text-align: center; font-weight: 800;
  font-variant-numeric: tabular-nums; font-size: 15px;
}
.step {
  width: 34px; height: 34px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--soft); color: var(--primary); font-size: 19px; line-height: 1;
  cursor: pointer; flex: 0 0 auto; display: grid; place-items: center;
  transition: transform .11s;
}
.step:active { transform: scale(.9); }
.step.del { color: var(--danger); font-size: 15px; }

/* Выбор исполнителей */
.pick { display: flex; align-items: center; gap: 11px; padding: 11px 0; cursor: pointer; }
.pick + .pick { border-top: 1px solid var(--border); }
.pick .box {
  width: 23px; height: 23px; border-radius: 7px; border: 1.5px solid var(--input-border);
  flex: 0 0 auto; display: grid; place-items: center;
  font-size: 13px; color: transparent; transition: all .13s;
}
.pick.on .box { background: var(--grad); border-color: transparent; color: #fff; }
.pick .info { flex: 1; min-width: 0; }
.pick .nm { font-weight: 700; }
.pick .ld { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-top: 2px; }

/* Сроки */
.days { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.days button {
  border: 1px solid var(--input-border); background: var(--card); color: var(--text);
  border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 13px;
  font-weight: 650; cursor: pointer; transition: all .13s;
}
.days button.on { background: var(--grad); color: #fff; border-color: transparent; }

/* Переключатель */
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.toggle + .toggle { border-top: 1px solid var(--border); }
.toggle .tl { flex: 1; min-width: 0; }
.toggle .tt { font-weight: 650; font-size: 14.5px; }
.toggle .td { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sw {
  width: 50px; height: 30px; border-radius: 999px; border: 0; flex: 0 0 auto;
  background: var(--border); cursor: pointer; position: relative; transition: background .16s;
}
.sw::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .28); transition: transform .16s;
}
.sw.on { background: var(--primary); }
.sw.on::after { transform: translateX(20px); }

/* ── Приглашение ─────────────────────────────────────────────────── */
.qr {
  background: #fff; border-radius: var(--r-lg); padding: 16px;
  display: grid; place-items: center; margin: 0 auto; max-width: 250px;
  box-shadow: var(--shadow);
}
.qr svg, .qr img { width: 100%; height: auto; display: block; }
.qr svg path { fill: #0b1220; }
.code-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 29px; font-weight: 800; letter-spacing: .2em; text-align: center;
  padding: 15px; margin-top: 13px; color: var(--text);
  background: var(--soft); border: 1px solid var(--border); border-radius: var(--r-card);
}

.staff-item { display: flex; align-items: center; gap: 11px; padding: 11px 0; }
.staff-item + .staff-item { border-top: 1px solid var(--border); }
.staff-item .info { flex: 1; min-width: 0; }
.staff-item .nm { font-weight: 700; }
.staff-item.off .nm { color: var(--muted); text-decoration: line-through; }

/* ── Скелетоны ───────────────────────────────────────────────────── */
.sk {
  border-radius: var(--r-card); background: var(--border);
  position: relative; overflow: hidden;
}
.sk::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--card) 70%, transparent), transparent);
  transform: translateX(-100%); animation: shim 1.3s infinite;
}
@keyframes shim { to { transform: translateX(100%); } }

.spin {
  width: 17px; height: 17px; border-radius: 50%; display: inline-block;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  animation: sp .7s linear infinite;
}
.btn.ghost .spin, .btn.soft .spin { border-color: var(--ring); border-top-color: var(--primary); }
@keyframes sp { to { transform: rotate(360deg); } }

/* ── Всплывающее сообщение ───────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; z-index: 90;
  bottom: calc(104px + max(env(safe-area-inset-bottom, 0px), var(--tg-bottom)));
  transform: translateX(-50%);
  background: #0b1220; color: #fff; padding: 11px 18px;
  border-radius: 999px; font-size: 14px; font-weight: 650;
  max-width: 88vw; text-align: center; box-shadow: var(--shadow-lg);
  animation: fade-up .15s ease-out;
}
:root[data-theme="dark"] .toast { background: #232c42; }
