/* ═══════════════════════════════════════════════════════════════════════
   «Ася, не забудь!» — весёлая тема по мотивам логотипа:
   сочный фиолетовый + солнечно-жёлтый, белые «пухлые» карточки, крупные
   скругления, мягкие цветные тени, круглый шрифт Nunito.
   Все компоненты используют эти токены, поэтому перекрашивается весь сайт разом.
   ═══════════════════════════════════════════════════════════════════════ */
:root {
  color-scheme: light;
  --page:      #efe9ff;   /* лавандовый фон */
  --surface:   #ffffff;
  --text-1:    #241a54;   /* глубокие фиолетовые чернила */
  --text-2:    #5f5690;
  --muted:     #9a93bd;
  --grid:      #ece7fb;
  --axis:      #cdc4ee;
  --border:    rgba(60,30,120,.13);
  --wash:      rgba(109,40,224,.06);

  /* смысловые цвета = палитра логотипа */
  --series-1:  #6d28e0;   /* фиолетовый — основной акцент, ссылки, «сделать» */
  --series-2:  #ff5a3c;   /* коралл (красная точка) — «обещание», «сегодня» */
  --series-3:  #12b886;   /* зелёный — «ответить» */
  --good:      #12b886;
  --warning:   #ff9f1a;   /* янтарь — «проследить» */
  --critical:  #ff4d4f;
  --ok-text:   #0a9d6e;

  /* жёлтый — «прикольный» акцент кнопок */
  --yellow:    #ffce2b;
  --yellow-d:  #f0ad00;
  --yellow-ink:#3a2472;
  --purple-d:  #5b21b6;
  --purple-soft: #efe8ff;

  --radius:    16px;
  --shadow:    0 2px 0 rgba(76,29,149,.03), 0 14px 30px rgba(76,29,149,.10);
  --shadow-sm: 0 1px 0 rgba(76,29,149,.04), 0 6px 16px rgba(76,29,149,.08);
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page:#160f38; --surface:#221a49;
    --text-1:#fff; --text-2:#d3ccf3; --muted:#9b93ca;
    --grid:#2e2663; --axis:#40357e;
    --border:rgba(255,255,255,.12); --wash:rgba(255,255,255,.06);
    --series-1:#8b5cf6; --series-2:#ff6a4d; --series-3:#1fce97;
    --good:#1fce97; --warning:#ffb03a; --critical:#ff6368; --ok-text:#2fe0a6;
    --yellow:#ffd23f; --yellow-d:#e0a800; --yellow-ink:#241a54; --purple-d:#3a1d8a;
    --purple-soft:#2c2260;
    --shadow:0 2px 0 rgba(0,0,0,.25), 0 16px 34px rgba(0,0,0,.45);
    --shadow-sm:0 6px 16px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page:#160f38; --surface:#221a49;
  --text-1:#fff; --text-2:#d3ccf3; --muted:#9b93ca;
  --grid:#2e2663; --axis:#40357e;
  --border:rgba(255,255,255,.12); --wash:rgba(255,255,255,.06);
  --series-1:#8b5cf6; --series-2:#ff6a4d; --series-3:#1fce97;
  --good:#1fce97; --warning:#ffb03a; --critical:#ff6368; --ok-text:#2fe0a6;
  --yellow:#ffd23f; --yellow-d:#e0a800; --yellow-ink:#241a54; --purple-d:#3a1d8a;
  --purple-soft:#2c2260;
  --shadow:0 2px 0 rgba(0,0,0,.25), 0 16px 34px rgba(0,0,0,.45);
  --shadow-sm:0 6px 16px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 15% -8%, color-mix(in oklab, var(--series-1) 22%, transparent), transparent 60%),
    radial-gradient(900px 460px at 100% 0%, color-mix(in oklab, var(--yellow) 20%, transparent), transparent 55%),
    var(--page);
  background-attachment: fixed;
  color: var(--text-1);
  font: 15px/1.55 "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3 { margin: 0; font-weight: 900; letter-spacing: -.01em; }
h2 { font-size: 16px; }
.muted { color: var(--muted); font-size: 12.5px; }
button,input,select,textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--series-1); font-weight: 700; }

/* ───────────── вход ───────────── */
.login {
  position: fixed; inset: 0; display: grid; place-items: center; z-index: 60; padding: 24px;
  background:
    radial-gradient(700px 480px at 20% 10%, color-mix(in oklab, var(--yellow) 30%, transparent), transparent 60%),
    linear-gradient(160deg, #7c3aed, #6d28e0 55%, #4c1d95);
}
.login-card {
  width: 100%; max-width: 360px; background: var(--surface);
  border: 0; border-radius: 26px; padding: 30px 28px; box-shadow: 0 20px 60px rgba(30,10,80,.4);
  display: grid; gap: 8px;
}
.login-logo { width: 96px; height: 96px; object-fit: contain; margin: 0 auto 6px; display: block;
  filter: drop-shadow(0 8px 16px rgba(109,40,224,.35)); }
.login-card h1 { font-size: 24px; text-align: center; }
.login-card > p.muted { text-align: center; margin: 0 0 12px; }
.login-card label { font-size: 12.5px; color: var(--text-2); font-weight: 700; }
.login-card input {
  padding: 12px 14px; border-radius: 14px; border: 2px solid var(--border); background: var(--page);
  font-weight: 600;
}
.login-card input:focus-visible { outline: none; border-color: var(--series-1);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--series-1) 20%, transparent); }
.login-card button {
  margin-top: 10px; padding: 13px 16px; border: 0; border-radius: 16px;
  background: linear-gradient(#7c3aed, #6d28e0); color: #fff; font-weight: 900; font-size: 15px;
  box-shadow: 0 4px 0 var(--purple-d), 0 10px 20px rgba(109,40,224,.4);
  transition: transform .08s ease, box-shadow .08s ease;
}
.login-card button:hover { transform: translateY(-1px); }
.login-card button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--purple-d); }
.login-err { font-size: 12.5px; color: var(--critical); font-weight: 700; display: flex; align-items: center; gap: 6px; }

/* ───────────── каркас ───────────── */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; background: color-mix(in oklab, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand .dot {
  width: 26px; height: 26px; border-radius: 9px; flex: none;
  background: linear-gradient(#ffd85a, var(--yellow)); box-shadow: 0 3px 8px rgba(240,173,0,.5);
  position: relative;
}
.brand .dot::after { /* красная точка-«уведомление», как на логотипе */
  content: ""; position: absolute; top: -3px; right: -3px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--series-2); border: 2px solid var(--surface);
}
.brand strong { font-size: 17px; font-weight: 900; }
.brand-sub { padding-left: 2px; }
.topbar-actions { margin-left: auto; display: flex; gap: 7px; align-items: center; }

.tabs { display: flex; gap: 4px; margin-left: 14px; }
.tab {
  border: 0; background: transparent; color: var(--text-2); padding: 8px 14px; border-radius: 999px;
  font-size: 14px; font-weight: 800; display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { background: var(--wash); color: var(--text-1); }
.tab.on { background: var(--series-1); color: #fff; box-shadow: 0 4px 12px rgba(109,40,224,.35); }
.tab-badge {
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: var(--series-2);
  color: #fff; font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center;
}
.tab.on .tab-badge { background: #fff; color: var(--series-1); }

.ghost {
  background: var(--surface); border: 2px solid var(--border); border-radius: 12px;
  padding: 7px 12px; color: var(--text-2); font-weight: 700;
}
.ghost:hover { background: var(--wash); color: var(--text-1); border-color: var(--axis); }
.ghost.small { padding: 5px 10px; font-size: 12.5px; }
#theme-toggle { display: grid; place-items: center; width: 36px; height: 34px; padding: 0; }

/* жёлтая «пухлая» кнопка действия */
.sync-btn {
  display: inline-flex; align-items: center; gap: 7px; border: 0; border-radius: 14px;
  background: linear-gradient(#ffd85a, var(--yellow)); color: var(--yellow-ink);
  font-weight: 900; font-size: 13.5px; padding: 9px 15px;
  box-shadow: 0 4px 0 var(--yellow-d), 0 8px 16px rgba(240,173,0,.32);
  transition: transform .08s ease, box-shadow .08s ease;
}
.sync-btn:hover:not(:disabled) { transform: translateY(-1px); }
.sync-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--yellow-d); }
.sync-btn:focus-visible { outline: 3px solid color-mix(in oklab, var(--series-1) 45%, transparent); outline-offset: 2px; }
.sync-btn:disabled { cursor: default; opacity: .8; }
.sync-btn.busy .sync-ico { animation: sync-spin 1s linear infinite; }
@keyframes sync-spin { to { transform: rotate(360deg); } }

/* строка статуса разбора */
.manual-status {
  margin: 12px 20px 0; border-radius: 14px; padding: 11px 15px; font-size: 13.5px; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}
.manual-status.run  { background: color-mix(in oklab, var(--series-1) 12%, var(--surface)); color: var(--text-1); box-shadow: inset 4px 0 0 var(--series-1); }
.manual-status.done { background: color-mix(in oklab, var(--good) 15%, var(--surface)); color: var(--ok-text); box-shadow: inset 4px 0 0 var(--good); }
.manual-status.err  { background: color-mix(in oklab, var(--critical) 13%, var(--surface)); color: var(--critical); box-shadow: inset 4px 0 0 var(--critical); }
.manual-status.run::before {
  content: ""; width: 14px; height: 14px; flex: none; border-radius: 50%;
  border: 3px solid color-mix(in oklab, var(--series-1) 30%, transparent);
  border-top-color: var(--series-1); animation: sync-spin .8s linear infinite;
}

/* баннеры */
.banner {
  margin: 14px 20px 0; border-radius: 16px; padding: 13px 16px; font-size: 13.5px; font-weight: 600;
  display: flex; gap: 11px; align-items: flex-start;
  background: color-mix(in oklab, var(--warning) 16%, var(--surface));
  border: 2px solid color-mix(in oklab, var(--warning) 45%, transparent); color: var(--text-1);
  box-shadow: var(--shadow-sm);
}
.banner.crit { background: color-mix(in oklab, var(--critical) 12%, var(--surface));
  border-color: color-mix(in oklab, var(--critical) 50%, transparent); }
.banner b { font-weight: 900; }
.banner .b-ico { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--warning); color: #3a2472; font-weight: 900; font-size: 15px; }
.banner.crit .b-ico { background: var(--critical); color: #fff; }
.banner code { background: var(--wash); padding: 2px 7px; border-radius: 7px; font-size: 12.5px; font-weight: 700; }

/* ───────────── общий раздел ───────────── */
.view { padding: 18px 20px 60px; max-width: 1200px; margin: 0 auto; }
.view-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.view-head h2 { font-size: 22px; margin: 0 0 2px; }
.view-head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi {
  background: var(--surface); border: 0; border-radius: 20px; padding: 16px 18px; display: grid; gap: 2px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--series-1); }
.kpi.alert::before { background: var(--critical); }
.kpi.today::before { background: var(--series-2); }
.kpi .k-value { font-size: 34px; font-weight: 900; letter-spacing: -.02em; line-height: 1.1; }
.kpi .k-label { font-size: 12.5px; color: var(--text-2); font-weight: 700; }
.kpi.alert .k-value { color: var(--critical); }
.kpi.today .k-value { color: var(--series-2); }

/* фильтры */
.tfilters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.tfilters select {
  padding: 9px 13px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface);
  font-weight: 700; color: var(--text-2);
}
.tfilters select:hover { border-color: var(--axis); }
.tfilters select.on { border-color: var(--series-1); color: var(--text-1);
  background: color-mix(in oklab, var(--series-1) 12%, var(--surface)); }
.chip {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; padding: 9px 14px;
  border: 2px solid var(--border); border-radius: 12px; color: var(--text-2); cursor: pointer; user-select: none; font-weight: 700;
}
.chip:hover { background: var(--wash); }
.chip:has(input:checked) { border-color: var(--series-1);
  background: color-mix(in oklab, var(--series-1) 13%, transparent); color: var(--text-1); }
.chip input { accent-color: var(--series-1); width: 16px; height: 16px; }

/* раскладка: календарь + список */
.tasks-layout { display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: 20px; align-items: start; }
.tasks-cal-wrap { position: sticky; top: 80px; display: grid; gap: 12px; }
.mini-cal { background: var(--surface); border: 0; border-radius: 20px; padding: 14px; box-shadow: var(--shadow-sm); }
.cal-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-title { font-size: 14px; font-weight: 900; text-transform: capitalize; }
.cal-nav { width: 30px; height: 30px; border: 0; border-radius: 10px; background: var(--wash); color: var(--text-2); font-size: 16px; line-height: 1; }
.cal-nav:hover { background: color-mix(in oklab, var(--series-1) 16%, var(--surface)); color: var(--series-1); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-wd span { text-align: center; font-size: 11px; color: var(--muted); font-weight: 800; padding: 2px 0 5px; }
.cal-day { position: relative; aspect-ratio: 1; border: 0; border-radius: 10px; background: transparent;
  color: var(--text-2); font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-day.oob { color: color-mix(in oklab, var(--muted) 45%, transparent); }
.cal-day.has { color: var(--text-1); font-weight: 800; }
.cal-day.has:hover { background: var(--wash); }
.cal-day.on { background: var(--series-1); color: #fff; box-shadow: 0 3px 10px rgba(109,40,224,.4); }
.cal-day.is-today { box-shadow: inset 0 0 0 2px var(--axis); }
.cal-count { position: absolute; top: 0; right: 1px; min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: 999px; background: var(--series-1); color: #fff; font-size: 9px; font-weight: 800; line-height: 15px; text-align: center; }
.cal-day.has.overdue { color: var(--critical); }
.cal-day.has.overdue .cal-count { background: var(--critical); }
.cal-day.on .cal-count { background: #fff; color: var(--series-1); }

.tasks-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.tq { border: 2px solid var(--border); border-radius: 13px; padding: 9px 11px; background: var(--surface);
  color: var(--text-2); font-size: 12px; font-weight: 700; text-align: left; display: flex; align-items: baseline; gap: 6px; }
.tq b { font-size: 16px; color: var(--text-1); font-weight: 900; font-variant-numeric: tabular-nums; }
.tq:hover { border-color: var(--axis); transform: translateY(-1px); }
.tq.on { border-color: var(--series-1); background: color-mix(in oklab, var(--series-1) 12%, var(--surface)); color: var(--text-1); }
.tq.overdue b { color: var(--critical); }
.tq.overdue.on { border-color: var(--critical); background: color-mix(in oklab, var(--critical) 12%, var(--surface)); }

/* бакеты */
.tg { margin-bottom: 22px; }
.tg-head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.tg-name { font-size: 12.5px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); }
.tg-count { font-size: 11px; color: #fff; background: var(--series-1); border-radius: 999px; padding: 2px 9px; font-weight: 800; }
.tg-overdue .tg-name { color: var(--critical); }
.tg-overdue .tg-count { background: var(--critical); }
.tg-clear { margin-left: auto; border: 2px solid var(--border); background: var(--surface); color: var(--text-2);
  border-radius: 10px; padding: 6px 11px; font-size: 12px; font-weight: 700; }
.tg-clear:hover { border-color: var(--axis); color: var(--text-1); }

/* карточка задачи */
.task {
  display: flex; gap: 12px; align-items: flex-start; background: var(--surface);
  border: 0; border-left: 6px solid var(--axis); border-radius: 16px; padding: 14px 16px; margin-bottom: 10px;
  box-shadow: var(--shadow-sm); transition: transform .1s ease, box-shadow .1s ease;
}
.task:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.task.k-promise { border-left-color: var(--series-2); }
.task.k-todo { border-left-color: var(--series-1); }
.task.k-reply { border-left-color: var(--series-3); }
.task.k-followup { border-left-color: var(--warning); }
.task.done { opacity: .58; }
.task.done .task-title { text-decoration: line-through; }
.task-check { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 2.5px solid var(--border);
  background: var(--surface); color: var(--text-2); font-size: 15px; line-height: 1; transition: all .1s ease; }
.task-check:hover { border-color: var(--good); color: #fff; background: var(--good); transform: scale(1.08); }
.task-main { flex: 1; min-width: 0; }
.task-title { font-size: 15px; font-weight: 800; color: var(--text-1); line-height: 1.35; }
.task-detail { font-size: 13px; color: var(--text-2); margin-top: 3px; line-height: 1.5; }
.task-quote { font-size: 12.5px; color: var(--muted); margin-top: 6px; padding: 4px 10px;
  border-left: 3px solid var(--grid); font-style: italic; background: var(--wash); border-radius: 0 8px 8px 0; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 9px; font-size: 12px; color: var(--muted); font-weight: 600; }
.task-kind { font-weight: 900; text-transform: lowercase; }
.task.k-promise .task-kind { color: var(--series-2); }
.task.k-todo .task-kind { color: var(--series-1); }
.task.k-reply .task-kind { color: var(--series-3); }
.task.k-followup .task-kind { color: var(--warning); }
.task-due { padding: 2px 9px; border-radius: 999px; background: var(--wash); font-weight: 700; }
.task-due.overdue { color: #fff; background: var(--critical); }
.task-due.today { color: var(--yellow-ink); background: color-mix(in oklab, var(--series-2) 22%, var(--surface)); }
.task-for b { color: var(--text-2); font-weight: 800; }
.task-link { border: 0; background: none; color: var(--series-1); cursor: pointer; font-size: 12px; padding: 0; text-decoration: none; font-weight: 800; }
.task-link:hover { text-decoration: underline; }
.task-edit { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0; font-weight: 700; }
.task-edit:hover { color: var(--text-1); text-decoration: underline; }
.tasks-empty { color: var(--text-2); padding: 46px 18px; text-align: center; font-weight: 600;
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-sm); }
.tasks-empty code { background: var(--wash); padding: 2px 7px; border-radius: 7px; font-weight: 800; }

/* ───────────── большой календарь ───────────── */
.bcal-head { display: flex; align-items: center; justify-content: center; gap: 12px; position: relative; margin-bottom: 14px; }
.bcal-nav { width: 38px; height: 36px; border: 0; border-radius: 12px; background: var(--surface); color: var(--series-1);
  font-size: 17px; box-shadow: var(--shadow-sm); }
.bcal-nav:hover { background: color-mix(in oklab, var(--series-1) 14%, var(--surface)); }
.bcal-month { font-weight: 900; font-size: 18px; min-width: 200px; text-align: center; text-transform: capitalize; }
.bcal-today { position: absolute; right: 0; top: 0; border: 0; border-radius: 12px; background: var(--surface);
  color: var(--series-1); padding: 8px 14px; font-size: 12.5px; font-weight: 800; box-shadow: var(--shadow-sm); }
.bcal-today:hover { background: color-mix(in oklab, var(--series-1) 14%, var(--surface)); }
.bcal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; }
.bcal-wd { margin-bottom: 4px; }
.bcal-wd span { text-align: center; font-size: 12px; font-weight: 800; color: var(--muted); padding: 4px 0; }
.bcal-day { position: relative; min-height: 112px; background: var(--surface); border: 0; border-radius: 16px;
  padding: 7px 7px 8px; display: flex; flex-direction: column; gap: 4px; overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform .1s ease; }
.bcal-day:hover { transform: translateY(-2px); }
.bcal-day.oob { background: color-mix(in oklab, var(--surface) 55%, transparent); box-shadow: none; }
.bcal-day.oob .bcal-num { color: var(--axis); }
.bcal-num { font-weight: 900; font-size: 13px; color: var(--text-2); align-self: flex-start; line-height: 1; padding: 2px; }
.bcal-day.today { box-shadow: 0 0 0 2.5px var(--series-1), var(--shadow-sm); }
.bcal-day.today .bcal-num { background: var(--series-1); color: #fff; min-width: 23px; height: 23px; border-radius: 50%;
  display: inline-grid; place-items: center; padding: 0 5px; }
.bcal-chips { display: flex; flex-direction: column; gap: 3px; }
.bchip { display: flex; align-items: baseline; gap: 5px; width: 100%; text-align: left; padding: 4px 8px;
  border-radius: 9px; border: 0; font-size: 12px; font-weight: 700; cursor: pointer; overflow: hidden; color: var(--text-1); }
.bchip-n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bchip.k-promise { background: color-mix(in oklab, var(--series-2) 20%, var(--surface)); box-shadow: inset 3px 0 0 var(--series-2); }
.bchip.k-todo { background: color-mix(in oklab, var(--series-1) 18%, var(--surface)); box-shadow: inset 3px 0 0 var(--series-1); }
.bchip.k-reply { background: color-mix(in oklab, var(--series-3) 18%, var(--surface)); box-shadow: inset 3px 0 0 var(--series-3); }
.bchip.k-followup { background: color-mix(in oklab, var(--warning) 20%, var(--surface)); box-shadow: inset 3px 0 0 var(--warning); }
.bchip.done { opacity: .5; text-decoration: line-through; }
.bcal-overdue { margin-bottom: 16px; }

/* ───────────── чаты ───────────── */
.chats-list { display: grid; gap: 10px; }
.chat-row { display: flex; align-items: center; gap: 13px; background: var(--surface); border: 0; border-radius: 18px;
  padding: 13px 16px; cursor: pointer; box-shadow: var(--shadow-sm); transition: transform .1s ease, box-shadow .1s ease; }
.chat-row:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.chat-av { flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(#8b5cf6, var(--series-1)); color: #fff; font-weight: 900; font-size: 18px;
  box-shadow: 0 4px 10px rgba(109,40,224,.35); }
.chat-main { flex: 1; min-width: 0; }
.chat-name { font-weight: 800; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; font-weight: 600; }
.chat-tags { display: flex; gap: 7px; align-items: center; flex: none; }
.chat-tag { font-size: 11.5px; padding: 3px 10px; border-radius: 999px; border: 0; background: var(--wash); color: var(--text-2); font-weight: 700; }
.chat-tag.tasks { color: #fff; background: var(--series-1); }
.chat-tag.off { color: var(--muted); background: var(--wash); }
.chat-go { flex: none; color: var(--muted); font-size: 22px; font-weight: 900; }

/* ───────────── модалки ───────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(30,10,80,.5); -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px); z-index: 75; display: grid; place-items: center; padding: 20px; overflow: auto; }
.modal-card { width: min(500px, 94vw); background: var(--surface); border: 0; border-radius: 24px;
  box-shadow: 0 24px 70px rgba(30,10,80,.45); padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head strong { font-size: 18px; font-weight: 900; }
.modal-card label { font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: -5px; }
.modal-card input, .modal-card select, .modal-card textarea {
  padding: 11px 13px; border: 2px solid var(--border); border-radius: 13px; background: var(--page);
  color: var(--text-1); font: inherit; font-size: 13.5px; font-weight: 600;
}
.modal-card :is(input,select,textarea):focus-visible { outline: none; border-color: var(--series-1);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--series-1) 18%, transparent); }
.modal-row { display: flex; gap: 8px; flex-wrap: wrap; }
.modal-row > * { flex: 1 1 140px; min-width: 0; }
.modal-card textarea { resize: vertical; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* лента сообщений чата */
.chat-card { width: min(640px, 96vw); max-height: 86vh; }
.chat-log { overflow: auto; display: flex; flex-direction: column; gap: 9px; padding: 6px 2px 2px; }
.clog-msg { display: flex; flex-direction: column; gap: 2px; max-width: 88%; align-self: flex-start;
  background: var(--wash); border: 0; border-radius: 16px 16px 16px 5px; padding: 9px 13px; }
.clog-msg.me { align-self: flex-end; border-radius: 16px 16px 5px 16px;
  background: color-mix(in oklab, var(--series-1) 16%, var(--surface)); }
.clog-top { display: flex; align-items: baseline; gap: 8px; }
.clog-who { font-size: 12px; font-weight: 900; color: var(--text-2); }
.clog-msg.me .clog-who { color: var(--series-1); }
.clog-time { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; margin-left: auto; font-weight: 600; }
.clog-text { font-size: 14px; color: var(--text-1); white-space: pre-wrap; word-break: break-word; line-height: 1.45; font-weight: 600; }
.clog-reply { font-size: 11.5px; color: var(--muted); border-left: 2px solid var(--grid); padding-left: 7px; }
.clog-empty { color: var(--text-2); text-align: center; padding: 30px 10px; font-weight: 600; }

/* попап действий */
.pop { position: fixed; z-index: 80; width: 240px; background: var(--surface); border: 0; border-radius: 16px;
  box-shadow: 0 20px 50px rgba(30,10,80,.4); padding: 8px; display: flex; flex-direction: column; gap: 3px; }
.pop button { text-align: left; border: 0; background: transparent; color: var(--text-2); padding: 9px 11px;
  border-radius: 11px; font-size: 13.5px; font-weight: 700; }
.pop button:hover { background: var(--wash); color: var(--text-1); }
.pop .danger:hover { color: var(--critical); }

/* ───────────── нижняя панель (мобильное) ───────────── */
.bottomnav { display: none; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }

@media (max-width: 760px) {
  .tasks-layout { grid-template-columns: 1fr; }
  .tasks-cal-wrap { position: static; }
}
@media (max-width: 640px) {
  .tabs { display: none; }
  .brand-sub { display: none; }
  .topbar { padding: 10px 13px; gap: 8px; }
  .view { padding: 14px 13px 88px; }
  #app { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  input, select, textarea { font-size: 16px !important; }  /* iOS не зумит поля */
  .kpis { grid-template-columns: 1fr 1fr; }
  .bcal-day { min-height: 60px; border-radius: 13px; }
  .bcal-num { font-size: 12px; }
  .bcal-grid { gap: 5px; }
  .bcal-month { min-width: 130px; font-size: 15px; }
  .bcal-today { position: static; }
  .bcal-count-m { align-self: center; margin-top: auto; font-size: 13px; font-weight: 900; color: var(--series-1); }

  .bottomnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: color-mix(in oklab, var(--surface) 90%, transparent);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border-top: 1px solid var(--border); padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 18px rgba(30,10,80,.10); }
  .bn-tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; background: transparent;
    border: 0; padding: 7px 4px; border-radius: 14px; color: var(--muted); font-size: 11px; font-weight: 800;
    position: relative; -webkit-tap-highlight-color: transparent; }
  .bn-tab svg { width: 24px; height: 24px; }
  .bn-tab.on { color: var(--series-1); }
  .bn-tab.on svg { transform: translateY(-1px) scale(1.06); }
  .bn-badge { position: absolute; top: 1px; left: 50%; margin-left: 6px; min-width: 17px; height: 17px; padding: 0 4px;
    border-radius: 999px; background: var(--series-2); color: #fff; font-size: 10px; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center; }

  .modal-backdrop { place-items: end stretch; padding: 0; }
  .modal-card { width: 100%; border-radius: 24px 24px 0 0; animation: sheet-up .26s cubic-bezier(.2,.8,.2,1); }
  .chat-card { max-height: 90vh; }
}
