:root {
  --bg: #f5f7fa; --panel: #ffffff; --panel2: #eef1f6; --line: #dce1ea;
  --text: #1e2733; --muted: #6b7684; --accent: #2f6fed; --accent2: #2559c9;
  --ok: #27ae60; --warn: #e67e22; --danger: #d64545;
  --shadow: 0 1px 3px rgba(20,30,50,.08), 0 6px 20px rgba(20,30,50,.05);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  display: flex; flex-direction: column; height: 100dvh;
}
header {
  padding: 7px 16px; background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px; flex: none; box-shadow: var(--shadow);
}
header h1 { font-size: 15px; margin: 0; font-weight: 600; }
header .sub { color: var(--muted); font-size: 12px; }
header .spacer { margin-left: auto; }
header .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 6px var(--ok); flex: none; }
.hbtn {
  border: 1px solid var(--line); background: var(--panel2); color: var(--text);
  border-radius: 999px; padding: 5px 13px; font: inherit; font-size: 13px; line-height: 1.5; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.hbtn:hover { border-color: var(--accent); color: var(--accent); }
.hbtn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.hbtn.busy { opacity: .7; cursor: progress; }
/* Скрываем «Установить», когда приложение уже запущено как установленное */
@media (display-mode: standalone) { #installBtn { display: none !important; } }
@media (display-mode: minimal-ui) { #installBtn { display: none !important; } }
nav.tabs { display: flex; gap: 6px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); flex: none; flex-wrap: wrap; }
main { flex: 1; overflow: auto; padding: 16px; }
.hidden { display: none !important; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 12px; font-size: 15px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
input, textarea, select {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 12px; font: inherit;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); background: #fff; }
.btn {
  border: none; border-radius: 10px; cursor: pointer; font: inherit;
  padding: 9px 14px; background: var(--accent); color: #fff; font-weight: 600;
}
.btn:hover { background: var(--accent2); }
.btn.sec { background: var(--panel2); color: var(--text); border: 1px solid var(--line); font-weight: 500; }
.btn.sec:hover { border-color: var(--accent); color: var(--accent); }
.btn.danger { background: var(--danger); }
.muted { color: var(--muted); font-size: 13px; }
/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; min-height: 400px; }
@media (max-width: 900px) { .kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .kanban { grid-template-columns: 1fr; } }
/* Split-режим доски задач: слева Артём, справа Доня */
.kanban-split { display: flex; gap: 16px; align-items: flex-start; }
.kanban-split .kboard { flex: 1; min-width: 0; }
.kanban-split .kanban { grid-template-columns: repeat(4, minmax(70px, 1fr)); gap: 8px; min-height: 300px; }
@media (max-width: 900px) { .kanban-split { flex-direction: column; } }
.col { background: var(--panel2); border-radius: 12px; padding: 10px; min-height: 200px; }
.col h3 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -10px -10px 10px; padding: 8px 11px; border-radius: 12px 12px 0 0; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: #fff; }
.col-todo h3 { background: #5b6b7f; }
.col-doing h3 { background: #f5c518; color: #2a2400; }
.col-done h3 { background: #27ae60; }
.col-cancelled h3 { background: #d64545; }
.col-count { background: rgba(255,255,255,.28); border-radius: 20px; padding: 1px 8px; font-size: 11px; font-weight: 700; min-width: 20px; text-align: center; }
.col-todo { box-shadow: inset 0 0 0 1px rgba(91,107,127,.25); }
.col-doing { box-shadow: inset 0 0 0 1px rgba(245,197,24,.35); }
.col-doing h3 .col-count { background: rgba(0,0,0,.16); color: #2a2400; }
.col-done { box-shadow: inset 0 0 0 1px rgba(39,174,96,.25); }
.col-cancelled { box-shadow: inset 0 0 0 1px rgba(214,69,69,.25); }
.card {
  position: relative;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 8px; cursor: grab; box-shadow: var(--shadow);
}
.card { touch-action: none; user-select: none; }
.card-del {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px;
  border-radius: 50%; border: 1px solid var(--line); background: var(--panel);
  color: var(--muted); font-size: 12px; line-height: 1; cursor: pointer;
  display: none; align-items: center; justify-content: center; padding: 0;
}
.card:hover .card-del { display: flex; }
.card-del:hover { color: var(--danger); border-color: var(--danger); }
@media (pointer: coarse) { .card-del { display: flex; } }
.card.dragging { opacity: .5; }
.card-placeholder { border: 2px dashed var(--accent); border-radius: 10px; margin-bottom: 8px; background: rgba(47,111,237,.06); }
.card .title { font-weight: 600; font-size: 14.5px; line-height: 1.35; margin-bottom: 6px; color: var(--text); }
.card .meta { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card .owner-tag { font-weight: 700; font-size: 11px; padding: 2px 8px; border-radius: 999px; letter-spacing: .01em; }
/* Выбор человека */
.who-pick { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.who-pick select { padding: 6px 8px; border-radius: 8px; }
/* Кнопка микрофона */
.mic-btn.rec { background: #ffe9e9 !important; color: #d64545 !important; border-color: #d64545 !important; animation: micpulse 1.1s infinite; }
.mic-btn.busy { opacity: .7; cursor: progress; }
@keyframes micpulse { 0%,100%{ box-shadow: 0 0 0 0 rgba(214,69,69,.4);} 50%{ box-shadow: 0 0 0 6px rgba(214,69,69,0);} }
.card.overdue { border-color: var(--danger); background: #fff5f5; }
.card .prio-high { color: var(--danger); font-weight: 600; }
/* Кнопка «▶️ Выполнить» и бейдж «выполняется» на карточке задачи */
.card .run-badge { color: var(--accent); font-weight: 700; font-size: 11px; }
.card-actions { margin-top: 8px; display: flex; gap: 6px; }
.card-exec {
  border: none; border-radius: 8px; background: var(--accent); color: #fff;
  font: inherit; font-weight: 600; font-size: 12.5px; padding: 5px 10px; cursor: pointer;
}
.card-exec:hover { filter: brightness(1.06); }
.card-exec:disabled { opacity: .6; cursor: progress; }
.col.drag-over { outline: 2px dashed var(--accent); }
/* Calendar */
#tab-calendar { position: relative; }
.cal-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; padding-right: 96px; }
.cal-toolbar #calTitle { min-width: 128px; text-align: center; cursor: pointer; }
.cal-cycle { min-width: 92px; font-weight: 600; }
/* Зум — в самом верхнем правом углу панели календаря (десктоп) */
.cal-zoom { position: absolute; top: 14px; right: 14px; display: flex; gap: 6px; z-index: 3; }
.cal-zoom .btn { padding: 8px 11px; }
/* Форс-перенос строки в тулбаре — активен только на телефоне (см. @media) */
.cal-break { display: none; }
/* Плавающая кнопка «+» (FAB) с меню создания */
.fab-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 12; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
/* FAB — бирюзовый акцент: не совпадает с синим (Доня) и оранжевым (Артём). */
.fab { width: 56px; height: 56px; border-radius: 50%; border: none; background: #10b981; color: #fff; font-size: 30px; line-height: 1; cursor: pointer; box-shadow: 0 4px 16px rgba(16,185,129,.42); transition: transform .15s, background .15s; }
.fab:hover { background: #059669; }
.fab.open { transform: rotate(45deg); }
.fab-menu { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.fab-item { border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 12px; padding: 11px 15px; font: inherit; font-weight: 600; cursor: pointer; box-shadow: var(--shadow); white-space: nowrap; }
.fab-item:hover { border-color: var(--accent); color: var(--accent); }
@supports (padding: env(safe-area-inset-bottom)) {
  .fab-wrap { bottom: calc(20px + env(safe-area-inset-bottom)); right: calc(20px + env(safe-area-inset-right)); }
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head { font-size: 11px; color: var(--muted); text-align: center; padding: 4px; font-weight: 600; }
.cal-day {
  min-height: 90px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px; font-size: 12px;
}
.cal-day.other { opacity: .45; }
.cal-day.today { border-color: var(--accent); }
.cal-day .num { font-weight: 600; margin-bottom: 4px; }
.ev {
  background: #e8f0ff; color: var(--accent); border-radius: 6px;
  padding: 2px 5px; margin-bottom: 2px; font-size: 11px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-quickadd { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
/* Split-режим (Оба): слева Артём, справа Доня */
.split { display: flex; gap: 14px; align-items: flex-start; }
.split > .pane { flex: 1; min-width: 0; }
@media (max-width: 720px) { .split { flex-direction: column; } }
.pane-title { text-align: center; font-weight: 600; font-size: 13px; padding: 5px; border-radius: 8px; margin-bottom: 8px; }
/* Неделя (колонки-дни, события позиционируются внутри своего дня) */
.wk { display: flex; flex-direction: column; }
.wk-head { display: flex; }
.wk-head .wk-gutter-head { width: 50px; flex: none; }
.wk-head .wk-dayhead {
  flex: 1; min-width: 0; text-align: center; font-size: 11px; color: var(--muted);
  font-weight: 600; padding: 4px 0;
}
.wk-head .wk-dayhead.today { color: var(--accent); }
.wk-body { display: flex; position: relative; }
.wk-gutter { width: 50px; flex: none; }
.wk-hourlabel { color: var(--muted); font-size: 10px; text-align: right; padding-right: 4px; border-top: 1px solid var(--line); box-sizing: border-box; }
.wk-day { flex: 1; min-width: 0; position: relative; border-left: 1px solid var(--line); }
.wk-day:last-child { border-right: 1px solid var(--line); }
.wk-hourcell { border-top: 1px solid var(--line); cursor: pointer; box-sizing: border-box; }
.wk-hourcell:hover { background: #eef4ff; }
/* День */
.allday-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.day-grid { display: grid; grid-template-columns: 50px 1fr; gap: 0; position: relative; }
.day-hour { color: var(--muted); font-size: 11px; text-align: right; padding-right: 6px; border-top: 1px solid var(--line); box-sizing: border-box; }
.day-slot { border-top: 1px solid var(--line); border-left: 1px solid var(--line); cursor: pointer; box-sizing: border-box; }
.day-slot:hover { background: #eef4ff; }
/* Событие на шкале (день/неделя) */
.cal-ev {
  position: absolute; color: #fff; border-radius: 6px; padding: 3px 6px; font-size: 12px;
  overflow: hidden; cursor: grab; box-shadow: var(--shadow); touch-action: none;
  z-index: 3; line-height: 1.25;
}
/* День: событие занимает область справа от шкалы времени (50px) */
.day-grid .cal-ev { left: 52px; right: 6px; }
/* Неделя: событие занимает свою колонку-день целиком */
.wk-day .cal-ev { left: 2px; right: 2px; }
.cal-ev b { font-weight: 700; }
.cal-ev.dragging { opacity: .8; cursor: grabbing; z-index: 10; }
/* Свободный слот */
.free-slot {
  position: absolute; left: 52px; right: 6px; background: rgba(39,174,96,.10);
  border: 1px dashed rgba(39,174,96,.5); border-radius: 6px; z-index: 1; cursor: pointer;
  display: flex; align-items: flex-start; justify-content: center; padding-top: 2px;
}
.free-slot span { font-size: 11px; color: var(--ok); font-weight: 600; }
.free-slot:hover { background: rgba(39,174,96,.18); }
/* Задача со сроком на шкале (день/неделя): отличается от события —
   светлый фон, пунктирная рамка цвета владельца, иконка ✓. */
.cal-task {
  position: absolute; border: 1.5px dashed currentColor; border-radius: 6px;
  padding: 2px 6px; font-size: 12px; line-height: 1.25; cursor: pointer;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  z-index: 4; box-shadow: var(--shadow); font-weight: 500;
}
.cal-task b { font-weight: 700; }
.cal-task .cal-task-ic { margin-right: 3px; }
.cal-task:hover { filter: brightness(.97); }
/* День: задача занимает область справа от шкалы времени */
.day-grid .cal-task { left: 52px; right: 6px; }
/* Неделя: задача занимает свою колонку-день */
.wk-day .cal-task { left: 2px; right: 2px; }
/* Счётчик задач на день в месяце */
.daytasks { font-size: 10px; font-weight: 700; color: var(--ok); margin-top: 2px; }
/* Легенда владельцев (режим «Оба») */
.owner-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; font-size: 12px; color: var(--muted); }
.owner-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.owner-legend .lg i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
/* Точки-маркеры дня (компактный месяц на телефоне) — по умолчанию скрыты */
.daydots { display: none; gap: 3px; flex-wrap: wrap; margin-top: 2px; }
.daydots .dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
/* Панель фильтров задач */
.task-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.task-filters label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.task-filters select, .task-filters input[type=date] { padding: 7px 9px; border-radius: 9px; font-size: 13px; }
.task-filters #fReset { padding: 8px 12px; }
/* Метки владельца/привязки на карточках заметок и чек-листов */
.link-tag { display: inline-block; font-size: 11px; color: var(--accent); background: #e8f0ff; border-radius: 6px; padding: 1px 7px; }
.note-meta, .cl-meta { margin-top: 8px; font-size: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
/* Поля владелец/привязка в редакторе заметки */
.link-fields { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 4px; }
.link-fields .fld { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); font-weight: 600; }
.link-fields select { min-width: 150px; }
/* Checklists */
.cl-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; align-items: start; }
.cl-box { background: var(--panel2); border-radius: 12px; padding: 12px; border: 2px solid var(--line); }
.cl-box h3 { margin: 0 0 8px; font-size: 14px; }
.cl-progress { height: 6px; background: var(--line); border-radius: 3px; margin-bottom: 8px; overflow: hidden; }
.cl-progress > div { height: 100%; background: var(--ok); transition: width .2s; }
.tm-cl { margin-top: 4px; }
.tm-cl .cl-item { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.tm-cl .cl-item.done span { text-decoration: line-through; color: var(--muted); }
.cl-item input[type=checkbox] { width: 18px; height: 18px; }
.cl-item.done span { text-decoration: line-through; color: var(--muted); }
/* Notes */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.note-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; cursor: pointer; box-shadow: var(--shadow); min-height: 120px;
}
.note-card.pinned { border-color: var(--accent); }
.note-card h3 { margin: 0 0 6px; font-size: 14px; }
.note-card p { margin: 0; font-size: 13px; color: var(--muted); white-space: pre-wrap; max-height: 80px; overflow: hidden; }
.note-editor { display: flex; flex-direction: column; gap: 8px; }
.note-editor textarea { min-height: 200px; resize: vertical; }
/* Gate */
#gate {
  position: fixed; inset: 0; background: rgba(240,244,250,.96); display: flex;
  align-items: center; justify-content: center; z-index: 20;
}
#gate .card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 26px; width: 340px; max-width: 90vw; box-shadow: var(--shadow); }
#gate h2 { margin: 0 0 6px; font-size: 18px; }
#gate p { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
#gate input { width: 100%; margin-bottom: 12px; }
#gate .err { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 8px; }
#gate button { width: 100%; }
/* Modal */
#modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex;
  align-items: center; justify-content: center; z-index: 15;
}
#modal .box { background: var(--panel); border-radius: 14px; padding: 20px; width: 400px; max-width: 92vw; box-shadow: var(--shadow); }
#modal .box h3 { margin: 0 0 12px; }
#modal .box label { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 4px; }
#modal .box .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
#notifyDeniedModal {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex;
  align-items: center; justify-content: center; z-index: 20;
}
#notifyDeniedModal .box { background: var(--panel); border-radius: 14px; padding: 20px; width: 420px; max-width: 92vw; box-shadow: var(--shadow); }
#notifyDeniedModal .box h3 { margin: 0 0 10px; }
#notifyDeniedModal .box p, #notifyDeniedModal .box ol { margin: 0 0 10px; font-size: 13px; line-height: 1.5; }
#notifyDeniedModal .box ol { padding-left: 20px; }
#notifyDeniedModal .box .hint { font-size: 12px; color: var(--muted); margin: 10px 0 0; }
#notifyDeniedModal .box .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
/* Modal задачи и чек-листа */
#taskModal, #clModal {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex;
  align-items: center; justify-content: center; z-index: 15;
}
#taskModal .box, #clModal .box { background: var(--panel); border-radius: 14px; padding: 20px; width: 420px; max-width: 92vw; box-shadow: var(--shadow); max-height: 90vh; overflow: auto; }
#taskModal .box h3, #clModal .box h3 { margin: 0 0 12px; }
#taskModal .box label, #clModal .box label { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 4px; }
#taskModal .box .actions, #clModal .box .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

/* ---- Мобильная адаптация (телефон / PWA) ---- */
@supports (padding: env(safe-area-inset-top)) {
  header { padding-top: calc(12px + env(safe-area-inset-top)); }
  main { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  /* Шапка — как в чате: один компактный ряд, горизонтальный скролл, кнопки-иконки.
     Заголовок сжимается, кнопки идут сразу за ним и всегда видны. */
  header { flex-wrap: nowrap; gap: 6px; padding: 7px 10px; overflow: hidden; }
  header h1 { font-size: 15px; white-space: nowrap; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  header .sub { display: none; }
  /* Спейсер растягивается — кнопки уходят в правый край шапки */
  header .spacer { display: block; flex: 1 1 auto; margin: 0; min-width: 4px; }
  header .dot { flex: none; }
  header .hbtn { padding: 7px 11px; font-size: 15px; flex: none; }
  header .hbtn .lbl { display: none; }

  /* Вкладки — нижняя навигация как в нативном приложении */
  nav.tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 11;
    gap: 2px; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line); border-bottom: none;
    box-shadow: 0 -2px 14px rgba(20,30,50,.10); overflow: visible; flex-wrap: nowrap;
  }
  nav.tabs .hbtn {
    flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 3px; border: none; background: none;
    border-radius: 12px; padding: 5px 2px; color: var(--muted);
  }
  nav.tabs .hbtn .ic { font-size: 20px; line-height: 1; }
  nav.tabs .hbtn .tl { font-size: 10px; font-weight: 600; white-space: nowrap; }
  nav.tabs .hbtn:hover { color: var(--muted); }
  nav.tabs .hbtn.active { background: none; color: var(--accent); border: none; }

  /* Контент во всю ширину: секции-вкладки без «страничной» рамки, вид даёт содержимое */
  main { padding: 12px 12px calc(80px + env(safe-area-inset-bottom)); }
  main > section.panel { background: transparent; border: none; box-shadow: none; padding: 0; }

  .btn, .hbtn { padding: 11px 14px; }
  input, textarea, select { padding: 11px 12px; font-size: 16px; }

  /* Тулбар календаря — две аккуратные строки во всю ширину.
     Ряд 1: ◀ [дата по центру] ▶  (перенос форсирует .cal-break).
     Ряд 2 одной строкой: [День] [Оба] [Слоты] [−] [+]. */
  .cal-toolbar { gap: 8px 6px; padding-right: 0; align-items: center; }
  .cal-toolbar .btn { padding: 8px 10px; font-size: 13px; line-height: 1.15; }
  .cal-toolbar #calPrev { flex: 0 0 auto; }
  .cal-toolbar #calTitle { flex: 1 1 auto; width: auto; min-width: 0; text-align: center; font-size: 16px; font-weight: 700; }
  .cal-toolbar #calNext { flex: 0 0 auto; }
  /* Разрыв строки: все элементы после него уходят на второй ряд */
  .cal-break { display: block; flex: 0 0 100%; width: 100%; height: 0; margin: 0; padding: 0; }
  .cal-toolbar #calCycle { flex: 0 0 auto; min-width: 54px; font-weight: 600; }
  .cal-toolbar .who-pick { flex: 0 0 auto; margin-left: 0; }
  .cal-toolbar .who-pick select { min-width: 0; padding: 7px 8px; font-size: 13px; }
  /* «Слоты» — компактнее, чтобы весь ряд помещался в одну строку */
  .cal-toolbar #calSlots { flex: 0 0 auto; padding: 7px 8px; font-size: 12px; }
  /* Зум — компактные квадратные кнопки у правого края второго ряда */
  .cal-zoom { position: static; flex: 0 0 auto; margin-left: auto; top: auto; right: auto; gap: 4px; }
  .cal-zoom .btn { width: 30px; height: 30px; padding: 0; font-size: 13px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }

  /* FAB — над нижней навигацией, с учётом safe-area */
  .fab { width: 52px; height: 52px; font-size: 28px; }
  .fab-wrap { right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); }

  /* Месяц как в Google Calendar: компактная сетка чисел с точками-маркерами */
  .cal-grid { gap: 2px; }
  .cal-day {
    min-height: 46px; padding: 2px; border-radius: 8px;
    display: flex; flex-direction: column; align-items: center;
  }
  .cal-day .num { font-size: 12px; margin-bottom: 2px; }
  .cal-day .ev, .cal-day .muted { display: none; }
  .cal-day .daydots { display: flex; justify-content: center; }

  /* Неделя: горизонтальная прокрутка целиком */
  .wk { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .wk-head, .wk-body { min-width: 360px; }
  .wk-head .wk-gutter-head, .wk-gutter { width: 38px; flex: none; }
  .wk-day, .wk-dayhead { min-width: 46px; }
  .wk-dayhead { font-size: 10px; }
  .cal-ev, .cal-task { font-size: 10px; padding: 2px 4px; }

  /* День */
  .day-grid { grid-template-columns: 42px 1fr; }
  .day-grid .cal-ev, .day-grid .cal-task { left: 44px; }
  .free-slot { left: 44px; }
  .free-slot span { font-size: 10px; }

  /* День «Оба»: две колонки рядом с минимальным зазором по центру.
     Шкала времени показывается только у левой колонки (Артём); у правой
     (Доня) часовой столбец сжат до тонкой полосы, метки времени скрыты. */
  .split { flex-direction: row; gap: 3px; }
  .split > .pane { flex: 1; min-width: 0; width: auto; }
  .split .day-grid { grid-template-columns: 30px 1fr; }
  .split .day-grid .cal-ev, .split .day-grid .cal-task { left: 32px; }
  .split .free-slot { left: 32px; }
  .split .pane-title { font-size: 12px; padding: 4px; }
  .split > .pane:last-child { border-left: 1px solid var(--line); padding-left: 3px; }
  .split > .pane:last-child .day-grid { grid-template-columns: 4px 1fr; }
  .split > .pane:last-child .day-hour { font-size: 0; padding: 0; }
  .split > .pane:last-child .day-grid .cal-ev, .split > .pane:last-child .day-grid .cal-task { left: 6px; }
  .split > .pane:last-child .free-slot { left: 6px; }

  /* Доска задач: 2 колонки на телефоне */
  .kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Фильтры — компактные, по два в ряд, невысокие */
  .task-filters { gap: 6px; margin-bottom: 10px; align-items: stretch; }
  .task-filters label { font-size: 10px; flex: 1 1 44%; gap: 2px; }
  .task-filters select, .task-filters input[type=date] { font-size: 13px; padding: 5px 6px; border-radius: 8px; }
  .task-filters #fReset { flex: 1 1 100%; padding: 7px 10px; font-size: 13px; }
  /* Карточки задач — тонкие горизонтальные строки, заголовок в одну строку */
  .card { padding: 7px 10px; margin-bottom: 6px; }
  .card .title { font-size: 13px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .card .meta { font-size: 11px; }
  .col { padding: 8px; min-height: 140px; }

  /* Чек-листы и заметки — карточки во всю ширину/2 колонки */
  .cl-list { grid-template-columns: 1fr; gap: 12px; }
  .notes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .note-card { min-height: 90px; }
  .row input { min-width: 0; }

  /* Модалки — bottom sheet во всю ширину */
  #modal .box, #taskModal .box, #clModal .box, #finBdModal .box { width: 100%; max-width: 100%; max-height: 88vh; overflow: auto; border-radius: 16px 16px 0 0; }
  #modal, #taskModal, #clModal, #finBdModal { align-items: flex-end; }
}
/* Крупнее области касания на тач-устройствах */
@media (pointer: coarse) {
  .cl-item input[type=checkbox] { width: 22px; height: 22px; }
  .card { padding: 12px 14px; }
}

/* Финансы */
.fin-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.fin-toolbar strong { min-width: 140px; text-align: center; font-size: 15px; }
.fin-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.fin-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.fin-card .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.fin-card.ok strong { color: var(--ok); }
.fin-card.warn strong { color: var(--danger); }
.fin-list { display: flex; flex-direction: column; gap: 10px; }
.fin-row { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.fin-row.paid { border-color: #b8e6c8; background: #f4fff8; }
.fin-row.partial { border-color: #ffd699; background: #fffbf0; }
.fin-row.overdue { border-color: #f5c2c2; background: #fff8f8; }
.fin-row.soon { border-color: #ffe0a3; }
.fin-row.variable { border-style: dashed; }
.fin-row-main { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: flex-start; }
.fin-title { font-weight: 600; font-size: 14px; flex: 1 1 200px; }
.fin-owner, .fin-cat { font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 6px; margin-left: 6px; background: #e8f0ff; color: var(--accent); }
.fin-cat { background: #f0f0f0; color: var(--muted); }
.fin-nums { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 13px; }
.fin-amt { font-weight: 600; }
.fin-due { color: var(--muted); }
.fin-paid { color: var(--ok); font-weight: 600; }
.fin-partial { color: #c67600; font-weight: 600; font-size: 12px; }
.fin-remain { color: var(--danger); font-size: 12px; }
.fin-breakdown { margin-top: 8px; font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.fin-breakdown-btn { font-size: 11px; padding: 2px 8px; }
.fin-pay-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fin-partial-in { width: 110px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.fin-bd-list { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow: auto; }
.fin-bd-row { display: grid; grid-template-columns: 1fr 90px 90px; gap: 8px; align-items: center; font-size: 13px; }
.fin-bd-row .fin-bd-name { font-weight: 500; }
.fin-bd-row input { width: 100%; box-sizing: border-box; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.fin-bd-total { margin-top: 10px; font-size: 13px; }
#finBdModal {
  position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
#finBdModal .box { background: var(--panel); border-radius: 14px; padding: 20px; width: 440px; max-width: 92vw; box-shadow: var(--shadow); max-height: 90vh; overflow: auto; }
#finBdModal .box h3 { margin: 0 0 12px; }
#finBdModal .box .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.fin-transfer-limit { margin-top: 6px; font-size: 12px; color: #2f6fed; font-weight: 500; }
.fin-transfer-limit.muted { color: var(--muted); font-weight: 400; }
.fin-transfer-hint { font-size: 11px; margin-left: 6px; }
.fin-transfer-edit { font-size: 11px; padding: 2px 8px; margin-left: 6px; }
.fin-amt-in, .fin-date-in { width: 110px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.fin-hint { font-size: 12px; color: var(--muted); margin-top: 16px; }
.fin-bank-paste { margin-bottom: 12px; padding: 12px; }
.fin-bank-paste label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.fin-bank-paste textarea { width: 100%; box-sizing: border-box; padding: 8px; border-radius: 8px; border: 1px solid var(--line); font: inherit; }
.fin-bank-msg { font-size: 13px; color: var(--ok); margin-left: 8px; }
.fin-toggle-paste { margin-bottom: 10px; }
.fin-tinkoff-status { font-size: 12px; color: var(--muted); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fin-tinkoff-status.ok { color: var(--ok); }
.fin-tinkoff-status.err { color: var(--err, #c44); }
.fin-tinkoff-auth-title { margin: 0 0 6px; }
.fin-tinkoff-auth-hint { margin: 0 0 10px; font-size: 12px; }
#finTinkoffAuth label { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 4px; }
#finTinkoffAuth input { width: 100%; box-sizing: border-box; padding: 8px; border-radius: 8px; border: 1px solid var(--line); font: inherit; margin-bottom: 4px; }
.muted { color: var(--muted); }
.err { color: var(--danger); }
