/* Оформление CRM Revolta. Ориентир — системный интерфейс Apple (iOS / macOS):
   сгруппированные списки с врезкой, строки в 44 пункта, крупный заголовок,
   съезжающий в панель при прокрутке, снизу — полоса вкладок, листы снизу.
   Цвета — системные iOS, светлая и тёмная тема по настройке устройства.
   Никаких библиотек и иконочных шрифтов.

   Мобильное и настольное — одна разметка: до 900 пикселей работает полоса
   вкладок снизу, шире — боковое меню слева. Отдельной вёрстки под телефон нет
   сознательно: две вёрстки расходятся через месяц. */

/* ---------- цвета ---------- */
:root {
  color-scheme: light dark;

  --blue: #007aff;
  --green: #34c759;
  --red: #ff3b30;
  --orange: #ff9500;
  --purple: #5856d6;
  --gray: #8e8e93;

  --bg: #f2f2f7;              /* systemGroupedBackground */
  --card: #ffffff;            /* secondarySystemGroupedBackground */
  --card-2: #f2f2f7;          /* вложенная плашка внутри карточки */
  --bar: rgba(249, 249, 249, .82);

  --label: #000000;
  --label-2: rgba(60, 60, 67, .6);
  --label-3: rgba(60, 60, 67, .3);
  --separator: rgba(60, 60, 67, .29);
  --fill: rgba(120, 120, 128, .12);
  --fill-2: rgba(120, 120, 128, .16);
  --tap: rgba(0, 0, 0, .045);

  --tint-blue: rgba(0, 122, 255, .12);
  --tint-green: rgba(52, 199, 89, .14);
  --tint-red: rgba(255, 59, 48, .12);
  --tint-orange: rgba(255, 149, 0, .16);
  --orange-ink: #b25e00;

  --r-card: 12px;
  --r-ctl: 10px;
  --shadow-sheet: 0 -2px 40px rgba(0, 0, 0, .18);
  --shadow-pop: 0 10px 40px rgba(0, 0, 0, .16), 0 2px 8px rgba(0, 0, 0, .08);
  --spring: cubic-bezier(.32, .72, 0, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --blue: #0a84ff;
    --green: #30d158;
    --red: #ff453a;
    --orange: #ff9f0a;
    --purple: #5e5ce6;
    --gray: #98989d;

    --bg: #000000;
    --card: #1c1c1e;
    --card-2: #2c2c2e;
    --bar: rgba(30, 30, 32, .8);

    --label: #ffffff;
    --label-2: rgba(235, 235, 245, .6);
    --label-3: rgba(235, 235, 245, .3);
    --separator: rgba(84, 84, 88, .65);
    --fill: rgba(120, 120, 128, .24);
    --fill-2: rgba(120, 120, 128, .32);
    --tap: rgba(255, 255, 255, .06);

    --tint-blue: rgba(10, 132, 255, .22);
    --tint-green: rgba(48, 209, 88, .2);
    --tint-red: rgba(255, 69, 58, .2);
    --tint-orange: rgba(255, 159, 10, .22);
    --orange-ink: #ffb340;
    --shadow-pop: 0 10px 40px rgba(0, 0, 0, .5);
  }
}

/* ---------- основа ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--label);
  /* SF Pro на Apple, Segoe UI Variable на Windows — системный шрифт и там и там.
     Сглаживание не трогаем: -webkit-font-smoothing выключает ClearType в Chrome
     под Windows, и текст становится мутным. */
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
@media (min-width: 900px) { body { font-size: 15px; } }

button, input, select, textarea { font: inherit; color: inherit; margin: 0; }
button { background: none; border: 0; padding: 0; cursor: pointer; color: var(--blue); }
a { color: var(--blue); text-decoration: none; }
svg.i { width: 1.4em; height: 1.4em; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
svg.i.solid { fill: currentColor; stroke: none; }

/* ---------- каркас ---------- */
.root { display: flex; min-height: 100vh; }
.column { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pane {
  flex: 1; min-width: 0;
  padding: 0 16px calc(96px + var(--safe-b));
}
@media (min-width: 900px) {
  /* Колонка не растягивается на всю ширину монитора: строка в 1600 пикселей
     читается плохо, а взгляд теряет левый край. */
  .pane { padding: 0 32px 64px; max-width: 860px; width: 100%; }
}

/* ---------- панель заголовка ---------- */
/* Крупный заголовок живёт в потоке страницы, а в панели лежит его двойник —
   он проявляется, когда крупный уезжает под верх. Так же ведёт себя навигация
   в системных приложениях. */
.navbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 8px;
  height: calc(44px + var(--safe-t));
  padding: var(--safe-t) 8px 0;
  background: var(--bar);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  transition: background .2s ease;
}
.navbar::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 0.5px;
  background: var(--separator); opacity: 0; transition: opacity .2s ease;
}
.navbar.scrolled::after { opacity: 1; }
.nav-title {
  flex: 1; text-align: center; font-size: 17px; font-weight: 600; letter-spacing: -.02em;
  opacity: 0; transform: translateY(6px); transition: opacity .2s ease, transform .2s ease;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.navbar.scrolled .nav-title { opacity: 1; transform: none; }
.nav-side { display: flex; align-items: center; gap: 4px; min-width: 44px; }
.nav-right { justify-content: flex-end; }
.nav-btn {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  color: var(--blue); font-size: 17px;
}
.nav-btn:active { background: var(--fill); }
.nav-btn.text { width: auto; padding: 0 10px; border-radius: 8px; }
@media (min-width: 900px) {
  /* На широком экране «ещё» не нужно: бэкап и выход лежат в боковом меню. */
  .nav-left { display: none; }
  .navbar { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .navbar.scrolled { background: var(--bar); backdrop-filter: saturate(180%) blur(20px); }
}

/* Крупный заголовок */
.lt { padding: 4px 0 10px; }
.lt h1 { margin: 0; font-size: 34px; line-height: 1.12; font-weight: 700; letter-spacing: -.032em; }
.lt .lt-sub { color: var(--label-2); font-size: 15px; margin-top: 4px; }
@media (min-width: 900px) {
  .lt { padding: 10px 0 14px; }
  .lt h1 { font-size: 30px; }
  .lt .lt-sub { font-size: 14px; }
}

/* ---------- боковое меню (широкий экран) ---------- */
.sidebar { display: none; }
@media (min-width: 900px) {
  .sidebar {
    position: sticky; top: 0; align-self: flex-start;
    display: flex; flex-direction: column; gap: 18px;
    width: 244px; height: 100vh; padding: 20px 12px 16px;
    background: var(--bg);
    border-right: 0.5px solid var(--separator);
  }
  .brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
  .brand img { border-radius: 7px; }
  .brand-name { font-weight: 600; letter-spacing: -.01em; }
  .brand-sub { color: var(--label-2); font-size: 12px; }
  .side-nav { display: flex; flex-direction: column; gap: 2px; }
  .side-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 10px; border-radius: 8px; color: var(--label); font-weight: 500;
  }
  .side-nav a svg { color: var(--blue); }
  .side-nav a:hover { background: var(--fill); }
  .side-nav a.on { background: var(--blue); color: #fff; }
  .side-nav a.on svg { color: #fff; }
  .side-nav .count {
    margin-left: auto; font-size: 12px; color: var(--label-2);
    background: var(--fill); border-radius: 99px; padding: 1px 7px; min-width: 22px; text-align: center;
  }
  .side-nav a.on .count { background: rgba(255, 255, 255, .25); color: #fff; }
  .side-nav .count.hot { background: var(--red); color: #fff; }
  .side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 0 4px; }
  .side-links { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
  .link { color: var(--blue); font-size: 13px; }
  .link:hover { text-decoration: underline; }
  .sync { color: var(--label-3); font-size: 11px; min-height: 14px; }
}

/* ---------- полоса вкладок (телефон) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; padding-bottom: var(--safe-b);
  background: var(--bar);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--separator);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 0 6px; color: var(--gray); font-size: 10px; font-weight: 500; position: relative;
}
.tabbar a svg { width: 26px; height: 26px; }
.tabbar a.on { color: var(--blue); }
.tabbar .dot {
  position: absolute; top: 4px; left: 50%; margin-left: 6px;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px;
  background: var(--red); color: #fff; font-size: 11px; line-height: 17px; text-align: center;
}
@media (min-width: 900px) { .tabbar { display: none; } }

/* ---------- сгруппированные списки ---------- */
.group { margin: 0 0 22px; }
.group-head {
  display: flex; align-items: baseline; gap: 8px;
  padding: 0 16px 7px; color: var(--label-2); font-size: 13px;
}
.group-head .g-title { font-weight: 400; }
.group-head .g-count { color: var(--label-3); }
.group-head .g-act { margin-left: auto; font-size: 13px; color: var(--blue); }
.group-note { padding: 7px 16px 0; color: var(--label-2); font-size: 13px; }

.rows { background: var(--card); border-radius: var(--r-card); overflow: hidden; }
.row {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 10px 16px; background: var(--card);
}
.row + .row::before {
  content: ''; position: absolute; left: 16px; right: 0; top: 0; height: 0.5px; background: var(--separator);
}
.row.inset + .row::before { left: 56px; }
.row.tappable { cursor: pointer; text-align: left; width: 100%; }
.row.tappable:active { background: var(--tap); }
@media (hover: hover) { .row.tappable:hover { background: var(--tap); } }
.row .r-main { min-width: 0; flex: 1; }
.row .r-title { font-size: 17px; overflow-wrap: anywhere; }
.row .r-sub { color: var(--label-2); font-size: 13px; margin-top: 1px; }
.row .r-right { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--label-2); text-align: right; }
.row .r-value { color: var(--label-2); font-variant-numeric: tabular-nums; }
.row .chev { color: var(--label-3); width: 18px; height: 18px; flex: none; stroke-width: 2.4; }
.row.empty { color: var(--label-2); justify-content: center; font-size: 15px; padding: 16px; }
@media (min-width: 900px) {
  .row .r-title { font-size: 15px; }
  .row { min-height: 40px; }
}

/* ---------- крупные числа ---------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 22px; }
.stat { background: var(--card); border-radius: var(--r-card); padding: 13px 15px 14px; }
.stat .s-k { color: var(--label-2); font-size: 13px; }
.stat .s-v { font-size: 26px; font-weight: 600; letter-spacing: -.03em; margin-top: 3px; font-variant-numeric: tabular-nums; }
.stat .s-n { color: var(--label-3); font-size: 12px; margin-top: 2px; }
.stat.wide { grid-column: 1 / -1; }
.stat.alert .s-v { color: var(--red); }
.stat.long .s-v { font-size: 20px; letter-spacing: -.02em; }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); } .stat .s-v { font-size: 24px; } }

/* ---------- сегменты ---------- */
.seg {
  display: flex; gap: 2px; padding: 2px; margin: 0 0 18px;
  background: var(--fill); border-radius: 9px;
}
.seg button {
  flex: 1; padding: 6px 10px; border-radius: 7px; font-size: 13px; font-weight: 500;
  color: var(--label); transition: background .18s ease;
}
.seg button.on { background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
@media (prefers-color-scheme: dark) { .seg button.on { background: #636366; } }
@media (min-width: 900px) { .seg { max-width: 340px; } }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--r-ctl); font-size: 15px; font-weight: 500;
  color: var(--blue); background: var(--fill); transition: filter .15s ease, background .15s ease;
}
.btn:active { filter: brightness(.92); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-tinted { background: var(--tint-blue); color: var(--blue); }
.btn-danger { background: var(--tint-red); color: var(--red); }
.btn-plain { background: none; padding: 6px 8px; }
.btn.wide { width: 100%; }
.btn.big { padding: 13px 16px; font-size: 17px; border-radius: 12px; }
.btn.small { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.btn-row .btn { flex: 1 1 auto; }

/* ---------- значки состояния ---------- */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 99px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  background: var(--fill); color: var(--label-2);
}
.badge.paying { background: var(--tint-green); color: var(--green); }
.badge.negotiating { background: var(--tint-blue); color: var(--blue); }
.badge.lead { background: var(--tint-orange); color: var(--orange-ink); }
.badge.paused { background: var(--tint-orange); color: var(--orange-ink); }
.badge.alert { background: var(--tint-red); color: var(--red); }
.badge.left, .badge.lost { background: var(--fill); color: var(--label-3); }

/* ---------- дела ---------- */
.task { padding-left: 12px; }
.tick {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  border: 1.6px solid var(--label-3); display: grid; place-items: center;
  transition: transform .15s var(--spring), background .15s ease, border-color .15s ease;
}
.tick:active { transform: scale(.86); }
.tick svg { width: 15px; height: 15px; stroke: #fff; stroke-width: 2.6; opacity: 0; }
.tick.on { background: var(--green); border-color: var(--green); }
.tick.on svg { opacity: 1; }
.task.late .r-sub { color: var(--red); }
.task.done { opacity: .45; }
.task.done .r-title { text-decoration: line-through; }
.task-acts { display: flex; gap: 4px; align-items: center; }
@media (min-width: 900px) {
  .task-acts { opacity: 0; transition: opacity .12s ease; }
  .task:hover .task-acts, .task:focus-within .task-acts { opacity: 1; }
}

/* Смахивание строки влево: под ней открываются действия. Только для касаний —
   на мыши те же кнопки показываются по наведению. */
.swipe { position: relative; overflow: hidden; background: var(--card); }
.swipe-back {
  position: absolute; inset: 0 0 0 auto; display: flex; align-items: stretch;
}
.swipe-back button {
  width: 74px; display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 500;
}
.swipe-back .s-snooze { background: var(--orange); }
.swipe-back .s-del { background: var(--red); }
.swipe-front { position: relative; background: var(--card); transition: transform .28s var(--spring); }
.swipe.dragging .swipe-front { transition: none; }

/* ---------- поля ---------- */
.field { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 7px 16px; background: var(--card); position: relative; }
.field + .field::before, .row + .field::before, .field + .row::before {
  content: ''; position: absolute; left: 16px; right: 0; top: 0; height: 0.5px; background: var(--separator);
}
.field > label { flex: 0 0 44%; max-width: 200px; color: var(--label); font-size: 15px; }
.field > .ctl { flex: 1; min-width: 0; }
.field input, .field select, .field textarea {
  width: 100%; background: none; border: 0; outline: none; padding: 3px 0;
  font-size: 17px; text-align: right; color: var(--label);
}
.field textarea { text-align: left; resize: vertical; min-height: 76px; padding-top: 8px; }
/* text-align-last, а не direction: rtl — иначе стрелка выпадающего списка
   переезжает налево и строка выглядит сломанной. */
.field select { text-align: right; text-align-last: right; }
.field input::placeholder, .field textarea::placeholder { color: var(--label-3); }
.field.stack { flex-direction: column; align-items: stretch; gap: 4px; padding: 10px 16px; }
.field.stack > label { flex: none; max-width: none; color: var(--label-2); font-size: 13px; }
.field.stack input, .field.stack textarea { text-align: left; }
@media (min-width: 900px) { .field input, .field select, .field textarea { font-size: 15px; } .field { min-height: 40px; } }

/* Отдельно стоящее поле (поиск, быстрый ввод) */
.plain-input {
  width: 100%; padding: 10px 14px; border-radius: var(--r-ctl);
  background: var(--card); border: 0.5px solid transparent; outline: none; font-size: 17px;
}
.plain-input:focus { border-color: var(--blue); }
.search {
  display: flex; align-items: center; gap: 8px; margin-bottom: 16px;
  padding: 8px 12px; border-radius: var(--r-ctl); background: var(--fill); color: var(--label-2);
}
.search input { flex: 1; background: none; border: 0; outline: none; font-size: 17px; color: var(--label); }
.search svg { width: 18px; height: 18px; flex: none; }

/* ---------- календарь ---------- */
.months { display: flex; gap: 6px; align-items: flex-end; height: 74px; margin-bottom: 6px; }
.months button { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; height: 100%; }
.months .m-bar { border-radius: 4px 4px 2px 2px; background: var(--fill-2); min-height: 3px; transition: background .2s; }
.months .m-bar.has { background: var(--blue); }
.months .m-bar.future { background: var(--tint-blue); }
.months button.on .m-bar { background: var(--blue); }
.months .m-name { font-size: 10px; color: var(--label-3); text-align: center; }
.months button.on .m-name { color: var(--label); font-weight: 600; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-wd { text-align: center; font-size: 11px; color: var(--label-3); padding-bottom: 4px; }
.cal-day {
  aspect-ratio: 1; max-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border-radius: 9px; font-size: 15px; color: var(--label); position: relative;
}
.cal-day.out { color: var(--label-3); }
.cal-day.today { color: var(--blue); font-weight: 700; }
.cal-day.has { background: var(--fill); }
.cal-day.paid { background: var(--tint-green); }
.cal-day.overdue { background: var(--tint-red); color: var(--red); }
.cal-day .pt { width: 5px; height: 5px; border-radius: 99px; background: var(--label-3); }
.cal-day.paid .pt { background: var(--green); }
.cal-day.expected .pt { background: var(--blue); }
.cal-day.overdue .pt { background: var(--red); }
.cal-day.sel { box-shadow: inset 0 0 0 2px var(--blue); }
.cal-grid { max-width: 460px; margin: 0 auto; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--label-2); font-size: 13px; padding: 12px 4px 0; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 99px; margin-right: 5px; }

/* ---------- таблица платежей ---------- */
.pay-row .r-amount { font-variant-numeric: tabular-nums; font-weight: 500; }
.pay-row .r-amount.dim { color: var(--label-2); font-weight: 400; }

/* ---------- модальный лист ---------- */
.sheet-host {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, .4);
  animation: fade .25s ease;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-height: 94vh; display: flex; flex-direction: column;
  background: var(--bg); border-radius: 14px 14px 0 0;
  box-shadow: var(--shadow-sheet);
  animation: rise .38s var(--spring);
  transition: transform .3s var(--spring);
}
.sheet.dragging { transition: none; }
@keyframes rise { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { .sheet, .sheet-host { animation: none; } }
.sheet-grab { padding: 7px 0 2px; display: grid; place-items: center; flex: none; touch-action: none; }
.sheet-grab i { width: 36px; height: 5px; border-radius: 99px; background: var(--label-3); }
.sheet-bar {
  flex: none; display: flex; align-items: center; gap: 10px; padding: 6px 12px 10px;
  position: relative;
}
.sheet-bar h2 { flex: 1; text-align: center; margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-bar .s-side { min-width: 72px; display: flex; align-items: center; }
.sheet-bar .s-side.right { justify-content: flex-end; }
.sheet-bar button { font-size: 17px; color: var(--blue); padding: 4px 2px; }
.sheet-bar button.strong { font-weight: 600; }
/* -webkit-overflow-scrolling: touch тут не ставим: на iOS он давно не нужен,
   зато в связке с position:fixed мешает полям внутри листа получать фокус. */
.sheet-body { overflow-y: auto; padding: 6px 16px calc(30px + var(--safe-b)); overscroll-behavior: contain; }
@media (min-width: 900px) {
  .sheet-host { align-items: center; padding: 24px; }
  .sheet { width: min(680px, 100%); max-height: 88vh; border-radius: 14px; animation: pop .28s var(--spring); }
  @keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } }
  .sheet-grab { display: none; }
}

/* Ошибка сохранения видна, где бы ни был человек на длинной карточке. */
.err-line.sticky {
  position: sticky; top: 0; z-index: 3; margin: 0 0 12px; padding: 9px 14px;
  border-radius: var(--r-ctl); background: var(--tint-red); color: var(--red);
}

/* Свёрнутые блоки карточки: заголовок — строка со стрелкой, как в настройках. */
.fold { margin: 0 0 22px; }
.fold > summary { list-style: none; cursor: pointer; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary .r-title { font-weight: 500; }
.fold > summary .chev { transition: transform .2s ease; }
.fold[open] > summary .chev { transform: rotate(90deg); }
.fold-body { margin-top: 18px; }

/* ---------- всплывающее сообщение ---------- */
.toast-host { position: fixed; left: 0; right: 0; bottom: calc(74px + var(--safe-b)); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
@media (min-width: 900px) { .toast-host { bottom: 24px; } }
.toast {
  padding: 10px 18px; border-radius: 99px; background: rgba(28, 28, 30, .94); color: #fff;
  font-size: 14px; box-shadow: var(--shadow-pop); animation: toast-in .3s var(--spring);
  max-width: min(90vw, 420px); text-align: center;
}
.toast.err { background: var(--red); }
@keyframes toast-in { from { transform: translateY(14px); opacity: 0; } }

/* ---------- подсказка над днём ---------- */
.tip {
  position: fixed; z-index: 70; pointer-events: none; max-width: 260px;
  padding: 9px 12px; border-radius: 10px; background: rgba(28, 28, 30, .96); color: #fff;
  font-size: 12.5px; line-height: 1.4; box-shadow: var(--shadow-pop);
}
.tip .t-row { display: flex; justify-content: space-between; gap: 12px; }
.tip .t-dim { color: rgba(255, 255, 255, .6); }

/* ---------- страница входа ---------- */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login { width: min(340px, 100%); text-align: center; }
.login-icon { border-radius: 18px; box-shadow: var(--shadow-pop); }
.login h1 { margin: 18px 0 2px; font-size: 28px; font-weight: 700; letter-spacing: -.03em; }
.login-sub { margin: 0 0 26px; color: var(--label-2); font-size: 15px; }
.login-form { display: flex; flex-direction: column; gap: 10px; }
.login-input {
  width: 100%; padding: 14px 16px; border-radius: 12px; font-size: 17px;
  background: var(--card); border: 0.5px solid var(--separator); outline: none; text-align: center;
}
.login-input:focus { border-color: var(--blue); }
.login-err { color: var(--red); font-size: 14px; min-height: 20px; margin-top: 12px; }
.login-note { color: var(--label-3); font-size: 13px; line-height: 1.4; margin: 4px 0 0; }

/* ---------- мелочи ---------- */
.hint { color: var(--label-2); font-size: 13px; padding: 8px 16px 0; line-height: 1.4; }
.spacer { flex: 1; }
.nowrap { white-space: nowrap; }
/* Поле логина на странице входа: менеджеру паролей нужно видеть его в форме,
   человеку — нет. display:none часть менеджеров пропускает, поэтому уводим
   поле за край экрана. */
.offscreen { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.money-plus { color: var(--green); }
.err-line { color: var(--red); font-size: 13px; padding: 8px 16px 0; min-height: 18px; }

/* ---------- добавка: составные узлы ---------- */

/* Быстрый ввод дела. Пока поле не в фокусе, видна одна строка — экран не занят
   формой, которой пользуются раз в день. */
.composer .more { display: none; }
.composer:focus-within .more { display: block; }
.composer .more .field { border-top: 0; }

/* Разделители внутри списка со смахиваемыми строками: обычное правило
   .row + .row до них не достаёт, строки завёрнуты в .swipe. */
.rows > .swipe + .swipe .swipe-front::before,
.rows > .swipe + .row::before,
.rows > .row + .swipe .swipe-front::before {
  content: ''; position: absolute; left: 50px; right: 0; top: 0; height: 0.5px; background: var(--separator);
}
.rows > .swipe + .swipe .pay-row::before { left: 16px; }
/* Что показывать у строки — решает ширина, а не наличие мыши: узкое окно на
   ноутбуке ведёт себя как телефон, и кнопки в строке там просто не помещаются. */
@media (max-width: 899px) { .task-acts { display: none; } }
@media (min-width: 900px) { .swipe-back { display: none; } }

.row.tappable { color: var(--label); }
a.row.tappable { color: var(--label); }

/* Поиск: крестик очистки */
.search button { color: var(--label-3); font-size: 15px; padding: 0 2px; }

/* ==========================================================================
   Узлы CRM Revolta
   ========================================================================== */

/* ---------- значки цветом ---------- */
.badge.blue { background: var(--tint-blue); color: var(--blue); }
.badge.green { background: var(--tint-green); color: var(--green); }
.badge.orange { background: var(--tint-orange); color: var(--orange-ink); }
.badge.red { background: var(--tint-red); color: var(--red); }
.badge.purple { background: rgba(88, 86, 214, .14); color: var(--purple); }
.badge.gray { background: var(--fill); color: var(--label-2); }
.red { color: var(--red); } .green { color: var(--green); } .orange { color: var(--orange-ink); }
.dim { color: var(--label-2); } .dim3 { color: var(--label-3); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- чипы ---------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.chips.scroll::-webkit-scrollbar { display: none; }
@media (min-width: 900px) { .chips.scroll { margin: 0; padding: 0; flex-wrap: wrap; } }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 99px; font-size: 13px; font-weight: 500;
  background: var(--fill); color: var(--label); border: 0; white-space: nowrap;
}
.chip.on { background: var(--blue); color: #fff; }
.chip .c-n { color: var(--label-2); font-weight: 400; }
.chip.on .c-n { color: rgba(255, 255, 255, .8); }
.chip.red { color: var(--red); }
.chip.red.on { background: var(--red); color: #fff; }
button.chip:active { filter: brightness(.9); }
.bar-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 14px; }
.bar-tools .seg { margin: 0; flex: 1 1 260px; }
.bar-tools .search { margin: 0; flex: 1 1 220px; }
.bar-tools select.plain-input { flex: 0 1 220px; padding: 8px 12px; font-size: 15px; }

/* ---------- аватары ---------- */
.ava {
  flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  font-size: 10px; font-weight: 600; color: #fff; background: var(--gray);
}
.ava.big { width: 36px; height: 36px; font-size: 14px; }
.ava.c0 { background: #007aff; } .ava.c1 { background: #34c759; } .ava.c2 { background: #ff9500; }
.ava.c3 { background: #af52de; } .ava.c4 { background: #ff2d55; } .ava.c5 { background: #32ade6; }
.ava.c6 { background: #a2845e; } .ava.c7 { background: #5856d6; }
.avas { display: inline-flex; }
.avas .ava + .ava { margin-left: -6px; box-shadow: 0 0 0 2px var(--card); }

/* ---------- доска ---------- */
.pane.wide { max-width: none; }
.board {
  display: flex; gap: 10px; align-items: flex-start;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
  margin: 0 -16px; padding: 2px 16px 12px; scrollbar-width: thin;
}
.k-col {
  flex: 0 0 82vw; max-width: 340px; scroll-snap-align: start; scroll-margin-left: 16px;
  background: var(--fill); border-radius: var(--r-card); padding: 8px;
  min-height: 140px; transition: background .15s ease, box-shadow .15s ease;
}
@media (min-width: 900px) {
  .board { margin: 0; padding: 2px 0 12px; scroll-snap-type: none; }
  .k-col { flex: 1 0 200px; max-width: 300px; }
}
.k-col.over { background: var(--tint-blue); box-shadow: inset 0 0 0 2px var(--blue); }
.k-col.debt { background: var(--tint-red); }
.k-col.renew { background: var(--tint-orange); }
.k-head { padding: 4px 6px 8px; }
.k-title { display: flex; align-items: baseline; gap: 6px; font-size: 15px; }
.k-title b { font-weight: 600; letter-spacing: -.01em; }
.k-count { color: var(--label-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.k-sum { color: var(--label-2); font-size: 13px; margin-top: 1px; font-variant-numeric: tabular-nums; }
.k-col.debt .k-sum { color: var(--red); font-weight: 600; }
.k-cards { display: flex; flex-direction: column; gap: 6px; min-height: 50px; }
.k-empty { color: var(--label-3); font-size: 13px; text-align: center; padding: 18px 0; border: 1px dashed var(--separator); border-radius: 10px; }
.k-card {
  position: relative; display: block; width: 100%; text-align: left; color: var(--label);
  background: var(--card); border-radius: 10px; padding: 9px 11px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
  transition: box-shadow .15s ease, opacity .15s ease, transform .15s var(--spring);
  cursor: pointer;
}
.k-card:active { transform: scale(.985); }
@media (hover: hover) { .k-card:hover { box-shadow: 0 2px 10px rgba(0, 0, 0, .12); } }
.k-card.hot { box-shadow: inset 3px 0 0 var(--red), 0 1px 2px rgba(0, 0, 0, .06); }
.k-card.warn { box-shadow: inset 3px 0 0 var(--orange), 0 1px 2px rgba(0, 0, 0, .06); }
.k-card[draggable=true] { cursor: grab; }
.k-card.lifting { opacity: .35; }
.k-top { display: flex; align-items: center; gap: 6px; color: var(--label-3); font-size: 12px; }
.k-top .k-no { font-weight: 600; color: var(--label-2); font-variant-numeric: tabular-nums; }
.k-top .avas { margin-left: auto; }
.k-name { font-size: 15px; font-weight: 600; letter-spacing: -.01em; overflow-wrap: anywhere; line-height: 1.25; margin-top: 2px; }
.k-client { color: var(--label-2); font-size: 13px; margin-top: 1px; overflow-wrap: anywhere; }
.k-line { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 13px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.k-line .spacer { flex: 1; }
.k-line b { font-weight: 600; color: var(--label); }
.k-prog { height: 4px; border-radius: 99px; background: var(--fill-2); overflow: hidden; margin-top: 7px; }
.k-prog > i { display: block; height: 100%; background: var(--blue); border-radius: 99px; }
.k-card.hot .k-prog > i { background: var(--red); }
.k-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.k-flags .badge + .badge { margin-left: 0; }
.k-acts { display: flex; gap: 6px; margin-top: 8px; }
.k-acts .btn { flex: 1; padding: 6px 8px; font-size: 13px; border-radius: 8px; }
.col-jump { margin: 0 0 10px; }
.drafts { margin: 0 0 12px; }
.board-note { color: var(--label-3); font-size: 12px; margin: 2px 2px 14px; line-height: 1.4; }

/* ---------- карточки задач ---------- */
.t-card .k-name { font-weight: 500; }
.t-run { color: var(--green); font-weight: 600; }
.t-pause { color: var(--orange-ink); }

/* ---------- плашка таймера (как Live Activity) ---------- */
.tpill {
  position: fixed; z-index: 45; left: 10px; right: 10px; bottom: calc(58px + var(--safe-b));
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-radius: 18px;
  background: rgba(28, 28, 30, .95); color: #fff; box-shadow: var(--shadow-pop);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); animation: toast-in .35s var(--spring);
}
.tpill .tp-main { flex: 1; min-width: 0; cursor: pointer; }
.tpill .tp-title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpill .tp-sub { font-size: 12px; color: rgba(255, 255, 255, .6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpill .tp-time { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; color: #30d158; }
.tpill .tp-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .16); color: #fff; flex: none; }
.tpill .tp-btn svg { width: 20px; height: 20px; }
.tpill.ask { background: #c96f00; }
.tpill.ask .tp-sub { color: rgba(255, 255, 255, .9); }
.tpill .tp-text { background: rgba(255, 255, 255, .22); color: #fff; padding: 9px 12px; font-size: 14px; font-weight: 600; border-radius: 10px; flex: none; }
.pane.has-pill { padding-bottom: calc(170px + var(--safe-b)); }
@media (min-width: 900px) {
  .tpill { left: auto; right: 24px; bottom: 24px; width: 400px; }
  .pane.has-pill { padding-bottom: 120px; }
}

/* ---------- большой таймер в задаче ---------- */
.timer-big { background: var(--card); border-radius: var(--r-card); padding: 16px; text-align: center; margin-bottom: 22px; }
.timer-big .tb-v { font-size: 44px; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.05; }
.timer-big .tb-v.run { color: var(--green); }
.timer-big .tb-k { color: var(--label-2); font-size: 13px; margin-top: 4px; }
.timer-big .btn-row { margin: 14px 0 0; }

/* ---------- шапка карточки ---------- */
.c-head { text-align: center; margin: 0 0 16px; }
.c-no { color: var(--label-2); font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.c-title { font-size: 24px; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; margin-top: 2px; overflow-wrap: anywhere; }
.c-sub { color: var(--label-2); font-size: 15px; margin-top: 3px; }
.c-badges { margin-top: 8px; display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; }

/* Круглые действия под шапкой */
.quick { display: flex; gap: 8px; margin: 0 0 22px; }
.quick > * {
  flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 11px 4px 10px; border-radius: var(--r-card); background: var(--card); color: var(--blue); font-size: 12px; text-align: center;
}
.quick > *:active { background: var(--tap); }
.quick svg { width: 22px; height: 22px; }
.quick .danger { color: var(--red); }
@media (hover: hover) { .quick > *:hover { background: var(--tap); } }

/* Строки «ключ — значение» */
.kv .r-right { color: var(--label-2); max-width: 62%; overflow-wrap: anywhere; }
.kv.money .r-right { color: var(--label); font-variant-numeric: tabular-nums; }
.kv .r-right b { color: var(--label); font-weight: 600; }
.row .r-sub.red { color: var(--red); }
.row .r-title .badge { vertical-align: 1px; margin-left: 4px; }
.row .lead-ic { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--fill); color: var(--blue); }
.row .lead-ic svg { width: 18px; height: 18px; }
.row.compact { min-height: 38px; padding-top: 7px; padding-bottom: 7px; }
.text-block { background: var(--card); border-radius: var(--r-card); padding: 12px 16px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.45; }

/* ---------- уведомления ---------- */
.notif { align-items: flex-start; }
.notif .n-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--blue); margin-top: 6px; }
.notif.read .n-dot { background: transparent; }
.bell-dot {
  position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px;
  background: var(--red); color: #fff; font-size: 11px; line-height: 17px; text-align: center; font-weight: 600;
}
.nav-btn { position: relative; }

/* ---------- календарь оплат ---------- */
.mcal { background: var(--card); border-radius: var(--r-card); padding: 10px 8px 12px; margin-bottom: 22px; }
.mcal-head { display: flex; align-items: center; gap: 8px; padding: 0 6px 10px; }
.mcal-head b { flex: 1; font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.mcal-head button { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; }
.mcal-head button:active { background: var(--fill); }
.mcal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.mcal-wd { text-align: center; font-size: 11px; color: var(--label-3); padding-bottom: 2px; }
.mcal-day {
  min-height: 58px; border-radius: 9px; padding: 4px 2px; display: flex; flex-direction: column; align-items: center; gap: 1px;
  color: var(--label); background: none; border: 0; font: inherit; cursor: pointer; min-width: 0;
}
.mcal-day .d-n { font-size: 14px; font-weight: 500; line-height: 20px; min-width: 22px; }
.mcal-day .d-exp, .mcal-day .d-got { font-size: 10px; font-variant-numeric: tabular-nums; line-height: 1.25; white-space: nowrap; overflow: hidden; max-width: 100%; }
.mcal-day .d-exp { color: var(--blue); }
.mcal-day .d-exp.late { color: var(--red); }
.mcal-day .d-got { color: var(--green); }
.mcal-day .d-prom { width: 5px; height: 5px; border-radius: 50%; background: var(--purple); }
.mcal-day.out { opacity: .35; }
.mcal-day.off .d-n { color: var(--red); }
.mcal-day.today .d-n { color: #fff; background: var(--red); border-radius: 99px; }
.mcal-day.sel { background: var(--tint-blue); }
@media (min-width: 900px) { .mcal-day { min-height: 72px; } .mcal-day .d-exp, .mcal-day .d-got { font-size: 11px; } }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--label-2); font-size: 12px; padding: 10px 6px 0; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 99px; margin-right: 5px; vertical-align: 1px; }

/* ---------- отчёты: полосы ---------- */
.rbar { margin-top: 6px; height: 6px; border-radius: 99px; background: var(--fill); overflow: hidden; display: flex; }
.rbar i { display: block; height: 100%; background: var(--blue); }
.rbar i.p { background: var(--orange); opacity: .75; }

/* ---------- поля: добавки ---------- */
.row.check { cursor: pointer; }
.row.check input { width: 20px; height: 20px; accent-color: var(--blue); flex: none; margin: 0; }
.field .inline-btn { flex: none; font-size: 15px; color: var(--blue); padding: 4px 0 4px 8px; }
.form-foot { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 10px; }
.quick-dates { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 16px 10px; background: var(--card); position: relative; }
.quick-dates::before { content: ''; position: absolute; left: 16px; right: 0; top: 0; height: .5px; background: var(--separator); }
.split { padding: 8px 16px; background: var(--card); position: relative; display: flex; gap: 8px; align-items: center; }
.split + .split::before { content: ''; position: absolute; left: 16px; right: 0; top: 0; height: .5px; background: var(--separator); }
.split select, .split input { background: var(--fill); border: 0; border-radius: 8px; padding: 8px 10px; font-size: 15px; outline: none; }
.split select { flex: 1; min-width: 0; }
.split input { width: 120px; flex: none; text-align: right; }
.split button { color: var(--red); font-size: 20px; width: 28px; flex: none; }
.cat-list { max-height: 320px; overflow-y: auto; }
.cat-list .row.check.sub { padding-left: 36px; }
.cat-picked { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px; background: var(--card); }
.cat-picked .chip { background: var(--tint-blue); color: var(--blue); }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .02em; }

/* ---------- пустые состояния и подсказки ---------- */
.empty-big { text-align: center; color: var(--label-2); padding: 48px 20px; }
.empty-big svg { width: 44px; height: 44px; color: var(--label-3); margin-bottom: 8px; }
.empty-big b { display: block; color: var(--label); font-size: 17px; margin-bottom: 4px; }
.note-box { margin: 0 0 18px; padding: 11px 14px; border-radius: var(--r-ctl); background: var(--tint-blue); color: var(--label); font-size: 14px; line-height: 1.4; }
.note-box.orange { background: var(--tint-orange); }
.note-box.red { background: var(--tint-red); }
.note-box b { font-weight: 600; }
.note-box .btn { margin-top: 8px; }
.demo-bar {
  margin: 8px 0 14px; padding: 9px 14px; border-radius: var(--r-ctl); background: var(--tint-orange);
  color: var(--orange-ink); font-size: 13px; line-height: 1.4; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.demo-bar button { color: inherit; text-decoration: underline; font-size: 13px; }
.loading { color: var(--label-3); text-align: center; padding: 20px; font-size: 14px; }

/* ---------- комментарии ---------- */
.cm { padding: 10px 16px; background: var(--card); position: relative; }
.cm + .cm::before { content: ''; position: absolute; left: 16px; right: 0; top: 0; height: .5px; background: var(--separator); }
.cm-head { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--label-2); }
.cm-head b { color: var(--label); font-weight: 600; }
.cm-text { font-size: 15px; margin-top: 3px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cm.rework { background: var(--tint-red); }

/* ---------- страница входа: выбор роли в демо ---------- */
.login .rows { text-align: left; margin-top: 6px; }
.login .row .r-sub { font-size: 12px; }

/* ---------- широкий экран ---------- */
@media (min-width: 1200px) {
  .pane.cols { max-width: 1180px; }
  .cols-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 24px; align-items: start; }
}

/* Кнопка таймера в строке задачи: ▶ начать / ⏸ пауза */
.tbtn {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  transition: transform .15s var(--spring);
}
.tbtn:active { transform: scale(.86); }
.tbtn svg { width: 15px; height: 15px; }
.tbtn.play { background: var(--tint-green); color: var(--green); }
.tbtn.play svg { margin-left: 2px; }
.tbtn.pause { background: var(--tint-orange); color: var(--orange-ink); }
.tbtn.pause svg { stroke-width: 3.2; }

/* Сегменты на радиокнопках (формы) */
.seg input:checked + .seg-btn { background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* Кнопка «+» в строке инструментов — только на широком экране; на телефоне есть «+» в шапке. */
@media (max-width: 899px) { .bar-tools .desk { display: none; } }
