:root {
  --bg: #fafafa;
  --card: #ffffff;
  --text: #0a0a0b;
  --muted: rgba(10,10,11,.56);
  --muted-2: rgba(10,10,11,.4);
  --border: rgba(10,10,11,.09);
  --border-strong: rgba(10,10,11,.16);

  --brand: #6e28f7;
  --brand-600: #5a1ad6;
  --brand-50: #f3edff;
  --brand-100: #e7dbff;

  --blue: #375af4;
  --blue-bg: #eaefff;
  --green: #16a34a;
  --green-bg: #e8f7ee;
  --red: #e5484d;
  --red-bg: #fdecec;
  --amber: #ffc607;

  --shadow: 0 1px 3px rgba(10,10,11,.05), 0 1px 2px rgba(10,10,11,.04);
  --shadow-md: 0 8px 28px rgba(10,10,11,.09);
  --radius: 16px;

  /* Liquid glass */
  --glass: rgba(255,255,255,.55);
  --glass-strong: rgba(255,255,255,.7);
  --glass-border: rgba(255,255,255,.3);
  --glass-blur: saturate(180%) blur(20px);
  --glass-shadow: 0 8px 30px rgba(10,10,11,.1), inset 0 1px 0 rgba(255,255,255,.7);

  /* Цвет фиолетовых акцентов текста в календаре (тема-зависимый: в тёмной — светлее). */
  --cal-accent-text: var(--brand);

  --sans: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --display: 'Unbounded', 'Manrope', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
/* Анимированный дефолтный фон: размытые цветные пятна, плавающие через transform.
   Только transform анимируется → GPU-композитор, без перерисовки кадров. */
.bg-mesh {
  position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background: var(--bg);
}
.bg-mesh .blob {
  position: absolute; width: 44vw; height: 44vw; border-radius: 50%;
  filter: blur(72px); opacity: .66; will-change: transform;
}
/* Отрицательные animation-delay → при загрузке страницы пятна сразу в «середине»
   своих траекторий и рассинхронизированы, без заметного синхронного старта из центра. */
.blob.b1 { background: #6e28f7; top: -12%; left: -10%; animation: blobA 19s ease-in-out infinite; animation-delay: -7s; }
.blob.b2 { background: #375af4; top: -8%; right: -12%; animation: blobB 23s ease-in-out infinite; animation-delay: -13s; }
.blob.b3 { background: #2dd4bf; bottom: -14%; left: -8%; animation: blobC 21s ease-in-out infinite; animation-delay: -4s; }
.blob.b4 { background: #ffb020; bottom: -12%; right: -10%; animation: blobD 22s ease-in-out infinite; animation-delay: -17s; }
.blob.b5 { background: #e0488f; top: 28%; left: 36%; width: 38vw; height: 38vw; opacity: .58; animation: blobE 25s ease-in-out infinite; animation-delay: -10s; }
.blob.b6 { background: #6366f1; top: 2%; left: 30%; width: 32vw; height: 32vw; opacity: .56; animation: blobF 18s ease-in-out infinite; animation-delay: -2s; }
@keyframes blobA { 0%,100% { transform: translate(0,0) scale(1) rotate(0deg); } 33% { transform: translate(16vw,12vh) scale(1.22) rotate(8deg); } 66% { transform: translate(7vw,20vh) scale(.92) rotate(-6deg); } }
@keyframes blobB { 0%,100% { transform: translate(0,0) scale(1) rotate(0deg); } 33% { transform: translate(-15vw,14vh) scale(1.18) rotate(-9deg); } 66% { transform: translate(-6vw,4vh) scale(.9) rotate(7deg); } }
@keyframes blobC { 0%,100% { transform: translate(0,0) scale(1) rotate(0deg); } 33% { transform: translate(15vw,-12vh) scale(1.25) rotate(10deg); } 66% { transform: translate(4vw,-3vh) scale(.88) rotate(-5deg); } }
@keyframes blobD { 0%,100% { transform: translate(0,0) scale(1) rotate(0deg); } 33% { transform: translate(-16vw,-11vh) scale(1.16) rotate(-7deg); } 66% { transform: translate(-5vw,-2vh) scale(.95) rotate(9deg); } }
@keyframes blobE { 0%,100% { transform: translate(0,0) scale(1) rotate(0deg); } 33% { transform: translate(-18vw,-13vh) scale(1.3) rotate(12deg); } 66% { transform: translate(8vw,10vh) scale(.85) rotate(-8deg); } }
@keyframes blobF { 0%,100% { transform: translate(0,0) scale(1) rotate(0deg); } 33% { transform: translate(13vw,18vh) scale(1.2) rotate(-10deg); } 66% { transform: translate(-7vw,6vh) scale(.9) rotate(6deg); } }
/* Уважаем системную настройку «уменьшить движение» — пятна замирают. */
@media (prefers-reduced-motion: reduce) { .bg-mesh .blob { animation: none; } }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: none; }

.layout { display: flex; min-height: 100vh; }

/* ───────── Sidebar (светлый) ───────── */
.sidebar {
  width: 256px; background: var(--glass); color: var(--text); flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  border-right: 1px solid var(--glass-border);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 20px 20px 18px; }
.brand-mark {
  position: relative; width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0;
  display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 14px;
  color: #fff; background: linear-gradient(135deg, #7c3aff, #6e28f7);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 6px 18px rgba(110,40,247,.35);
}
.brand-badge {
  position: absolute; top: -5px; right: -5px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; display: grid; place-items: center; line-height: 1;
  background: var(--red); color: #fff; font-family: var(--mono); font-weight: 700; font-size: 9.5px;
  box-shadow: 0 2px 6px rgba(229,72,77,.5);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-family: var(--display); font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -.2px; }
.brand:hover .brand-name { color: var(--brand); }
.brand-sub { font-size: 11px; font-weight: 500; color: var(--muted); margin-top: 3px; }

.nav { padding: 10px 12px; flex: 1; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; margin: 2px 0;
  border-radius: 10px; color: rgba(10,10,11,.7); font-weight: 600; font-size: 14px;
}
.nav a:hover { background: rgba(10,10,11,.045); color: var(--text); }
.nav a.active { background: var(--brand-50); color: var(--brand); }
.nav a .ico { width: 18px; text-align: center; }
.nav a .pill {
  margin-left: auto; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700;
  font-family: var(--mono); padding: 1px 7px; border-radius: 999px; min-width: 20px; text-align: center;
}
.nav .group-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .7px; font-weight: 700;
  color: var(--muted-2); padding: 16px 12px 6px;
}
.sidebar .foot { padding: 14px 20px; font-size: 11.5px; color: var(--muted-2); border-top: 1px solid var(--border); font-family: var(--mono); }

/* ───────── Main ───────── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: rgba(255,255,255,.5);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border); padding: 14px 32px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-family: var(--display); font-size: 20px; margin: 0; font-weight: 600; letter-spacing: -.4px; }
.crumb { color: var(--muted); font-size: 13px; margin-top: 3px; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.content { padding: 28px 32px; max-width: 1260px; width: 100%; }
.page-actions { display: flex; gap: 10px; }

/* Чип пользователя */
.user-chip { display: flex; align-items: center; gap: 10px; padding-left: 16px; border-left: 1px solid var(--border); }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--brand-50); color: var(--brand);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-name { font-weight: 700; font-size: 13px; }
.user-role { font-size: 11px; color: var(--muted); }
.user-role.is-admin { color: var(--brand); font-weight: 700; }
.user-logout { margin-left: 4px; width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center; color: var(--muted); font-size: 16px; }
.user-logout:hover { background: var(--red-bg); color: var(--red); border-color: #f3c6c6; }

/* ───────── Buttons ───────── */
.btn {
  position: relative;
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 11px;
  border: 1px solid var(--glass-border); background: var(--glass-strong); color: var(--text);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 1px 2px rgba(10,10,11,.05);
  font-family: var(--sans); font-weight: 600; font-size: 13.5px; cursor: pointer; transition: .14s;
}
.btn:hover { background: #fff; transform: translateY(-1px); }
.btn-primary {
  background: linear-gradient(135deg, #7c3aff, #6e28f7); border-color: transparent; color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 6px 18px rgba(110,40,247,.35);
}
.btn-primary:hover { background: linear-gradient(135deg, #6e28f7, #5a1ad6); }
.btn-danger { background: rgba(255,255,255,.6); border-color: #f0cccd; color: var(--red); }
.btn-danger:hover { background: var(--red-bg); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; color: var(--muted); }
.btn-ghost:hover { background: rgba(10,10,11,.05); transform: none; }
.btn-block { width: 100%; justify-content: center; padding: 11px; }
/* «Змейка» бежит по контуру кнопки во время загрузки (SVG-обводка). */
.btn.loading { pointer-events: none; }
/* Полупрозрачная заливка кнопки «Обновить» — чтобы фиолетовый блик был контрастнее. */
#refreshBtn { background: rgba(255, 255, 255, 0.28); }
#refreshBtn:hover { background: rgba(255, 255, 255, 0.42); }
/* Покрываем border-box кнопки (а не padding-box), чтобы блик шёл вплотную по контуру. */
.run-border {
  position: absolute; top: -1px; left: -1px;
  width: calc(100% + 2px); height: calc(100% + 2px);
  overflow: visible; pointer-events: none; opacity: 0; transition: opacity .15s;
}
.btn.loading .run-border { opacity: 1; filter: drop-shadow(0 0 3px rgba(110,40,247,.55)); }
.run-border rect {
  fill: none; stroke: url(#runGrad); stroke-width: 2; stroke-linecap: round;
  stroke-dasharray: 28 72;          /* блик 28% по длине пути + хвост-пробел */
  animation: runDash 1.15s linear infinite;
}
@keyframes runDash { to { stroke-dashoffset: -100; } }   /* бежит по периметру */

/* ───────── Cards (стекло) ───────── */
.card {
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
.card-pad { padding: 20px 22px; }
.card-head { padding: 16px 22px; border-bottom: 1px solid var(--glass-border); display: flex; align-items: center; justify-content: space-between; }
.card-head h2 { font-size: 15px; margin: 0; font-weight: 700; letter-spacing: -.2px; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
.section-title { font-family: var(--display); font-size: 16px; font-weight: 600; margin: 28px 0 14px; display: flex; align-items: center; gap: 10px; }

/* ───────── Лента ───────── */
.feed-col { min-width: 0; position: relative; }   /* контейнер для конфети */

/* ───────────────── Тулбар ленты: статус-сегмент + поповеры + пилюли ───────── */
.feed-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
/* Статус-сегмент (взаимоисключающий выбор) */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--glass-strong); border: 1px solid var(--glass-border); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
.seg-item { padding: 6px 13px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; line-height: 1.4; }
.seg-item:hover { color: var(--text); }
.seg-item.active { background: var(--text); color: #fff; box-shadow: 0 1px 4px rgba(10,10,11,.18); }
.seg-crit { color: var(--red); }
.seg-crit.active { background: var(--red); }
/* Инструменты справа: компактные кнопки-поповеры */
.feed-tools { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.fbtn { position: relative; }
.fbtn > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px; border-radius: 10px; border: 1px solid var(--glass-border);
  background: var(--glass-strong); color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap;
}
.fbtn > summary::-webkit-details-marker { display: none; }
.fbtn > summary svg { width: 15px; height: 15px; display: block; flex-shrink: 0; }
.fbtn > summary:hover { background: #fff; color: var(--text); }
.fbtn > summary.has-active { background: var(--brand-50); border-color: color-mix(in srgb, var(--brand) 30%, transparent); color: var(--brand); }
.fbtn[open] > summary { background: #fff; color: var(--text); border-color: var(--border-strong); }
.fbtn-badge { background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; }
/* Панель поповера — абсолютная, у верха ленты (не обрезается). */
.fbtn-pop {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; min-width: 190px;
  background: #fff; border: 1px solid var(--border-strong); border-radius: 14px; padding: 10px;
  box-shadow: 0 16px 40px rgba(10,10,11,.18); display: flex; flex-direction: column; gap: 3px;
}
.fbtn-label { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 2px 6px 6px; }
.fbtn-chips { display: flex; flex-wrap: wrap; gap: 6px; max-width: 244px; }
.fbtn-opt { display: flex; justify-content: space-between; padding: 8px 10px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: var(--text); }
.fbtn-opt:hover { background: rgba(110,40,247,.08); color: var(--brand); }
.fbtn-opt.active { background: var(--brand-50); color: var(--brand); }
.fbtn-opt.active::after { content: "✓"; }
.fbtn-clear { display: block; margin-top: 4px; padding: 8px 10px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--red); }
.fbtn-clear:hover { background: var(--red-bg); }
.fbtn-icon { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid var(--glass-border); background: var(--glass-strong); color: var(--muted); cursor: pointer; }
.fbtn-icon svg { width: 16px; height: 16px; }
.fbtn-icon:hover { background: #fff; color: var(--text); }
.fbtn-icon.active { background: var(--brand-50); border-color: color-mix(in srgb, var(--brand) 30%, transparent); color: var(--brand); }
/* Активные настройки — removable-пилюли (только когда что-то выбрано). */
.active-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.pill-x { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text); background: var(--glass-strong); border: 1px solid var(--glass-border); border-radius: 999px; padding: 4px 10px; }
.pill-x:hover { background: #fff; }
.pill-x .px { color: var(--muted); font-size: 11px; }
.pill-x:hover .px { color: var(--red); }

/* Базовый чип (используется в поповере типов и на других страницах). */
.chip { padding: 7px 15px; border-radius: 999px; background: var(--glass-strong); border: 1px solid var(--glass-border); color: var(--muted); font-weight: 600; font-size: 13px; font-family: inherit; line-height: 1.5; cursor: pointer; -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); box-shadow: inset 0 1px 0 rgba(255,255,255,.7); }
.chip:hover { background: #fff; }
.chip.active { background: var(--text); border-color: var(--text); color: #fff; box-shadow: none; }
/* Чипы фильтра по типам каналов — стекло, при активации заливаются цветом типа */
.chip-type.active {
  background: color-mix(in srgb, var(--chip) 26%, rgba(255,255,255,.5));
  border-color: color-mix(in srgb, var(--chip) 55%, transparent);
  color: color-mix(in srgb, var(--chip) 72%, #0a0a0b);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
}

.day-label { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted-2); font-weight: 700; margin: 13px 2px 6px; }
.day-label:first-child { margin-top: 0; }

.note {
  display: flex; gap: 10px; background: rgba(255,255,255,.62); border: 1px solid var(--glass-border);
  border-radius: 12px; padding: 8px 12px; margin-bottom: 6px;
  box-shadow: 0 2px 10px rgba(10,10,11,.05), inset 0 1px 0 rgba(255,255,255,.6);
  /* без backdrop-filter: их может быть сотни, блюр тут — лишняя нагрузка на скролл */
  position: relative;
  transition: opacity .15s, box-shadow .14s, transform .14s, background .14s;
}
/* Мягкий градиент цвета канала слева направо, сходящий на нет (заменяет полоску). */
.note::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; border-radius: inherit;
  background: linear-gradient(90deg, color-mix(in srgb, var(--ch, transparent) 12%, transparent), transparent 58%);
}
.note.unread::before {
  background: linear-gradient(90deg, color-mix(in srgb, var(--ch, transparent) 20%, transparent), transparent 62%);
}
.note:not(.unread) { opacity: .5; }
/* Плавное исчезновение карточки, ставшей прочитанной во вкладке «Непрочитанные». */
.note.removing { opacity: 0 !important; transform: translateX(12px); pointer-events: none; }
/* Мгновенное схлопывание при оптимистичной отметке (узел остаётся в DOM до подтверждения). */
.note.collapsing {
  opacity: 0; overflow: hidden; pointer-events: none;
  margin-top: 0 !important; margin-bottom: 0 !important;
  padding-top: 0 !important; padding-bottom: 0 !important; border-width: 0 !important;
  transition: max-height .24s ease, opacity .16s ease, margin .24s ease, padding .24s ease;
}
/* Свайп вправо «прочитано»: при достижении порога подсвечиваем зелёным с галочкой. */
.note.read-ready { box-shadow: inset 4px 0 0 0 var(--green), 0 2px 10px rgba(10,10,11,.06); }
.note.read-ready::after {
  content: "✓"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--green); font-weight: 800; font-size: 17px; z-index: 2; pointer-events: none;
}
.note.clickable { cursor: pointer; }
.note.clickable:hover { background: rgba(255,255,255,.8); box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,.8); transform: translateY(-1px); }
.note-ico {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; font-size: 18px;
  display: inline-flex; align-items: center; justify-content: center; background: var(--brand-50);
}
.ch-slack { background: #f3edff; }
.ch-email { background: var(--blue-bg); }
.ch-messenger { background: var(--green-bg); }
.ch-max { background: #efe7ff; }
/* Telegram: два кружка-аватара со смещением (сзади — чат, спереди — автор). */
.note-ico-tg { position: relative; width: 44px; height: 44px; background: none; border-radius: 0; overflow: visible; flex-shrink: 0; }
.tg-ava { position: absolute; width: 30px; height: 30px; border-radius: 50%; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; color: #fff; box-shadow: 0 0 0 2px var(--surface, #fff); }
.tg-ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tg-ava-back { left: 0; top: 0; background: linear-gradient(135deg, #8e9bb3, #5f6b82); z-index: 1; }
.tg-ava-front { right: 0; bottom: 0; background: linear-gradient(135deg, #7c3aff, #6e28f7); z-index: 2; }
[data-theme="dark"] .tg-ava { box-shadow: 0 0 0 2px var(--bg, #15171c); }
.note-body { flex: 1; min-width: 0; }
/* Шапка карточки. flex-wrap + сжимаемые названия: на узком экране (мобильный,
   карточка с бейджем «упоминание») время раньше выдавливалось за границу карточки
   и наезжало на кнопку «прочитано». Бейджи не сжимаются, время не переносится. */
.note-top { display: flex; align-items: center; gap: 6px; font-size: 12.5px; flex-wrap: wrap; }
.note-src { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-chan { color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-time { color: var(--muted-2); margin-left: auto; white-space: nowrap; font-family: var(--mono); font-size: 11.5px; flex: 0 0 auto; }
.note-title { font-weight: 600; margin-top: 2px; overflow-wrap: anywhere; }
.note-text { color: rgba(10,10,11,.62); font-size: 13px; margin-top: 1px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; word-break: break-word; }
/* Telegram: показываем полный текст серии (сохраняя переносы), до ~12 строк. */
.note-text--full { -webkit-line-clamp: 12; white-space: pre-line; }
.note-author { color: var(--muted-2); font-size: 12px; margin-top: 3px; }
/* Бейджи в шапке карточки: упоминание (заметно) и счётчик свёрнутой серии. */
.note-mention { flex: 0 0 auto; font-size: 10.5px; font-weight: 800; letter-spacing: .2px; color: #fff; background: linear-gradient(135deg, #7c3aff, #6e28f7); padding: 1px 7px; border-radius: 999px; }
.note-count { flex: 0 0 auto; font-size: 10.5px; font-weight: 700; color: var(--muted); background: var(--border); padding: 1px 7px; border-radius: 999px; }
/* Упоминание пользователя — выделяем карточку заметнее обычного непрочитанного. */
.note.is-mention { box-shadow: inset 3px 0 0 0 var(--brand), 0 2px 12px rgba(110,40,247,.16); border-color: color-mix(in srgb, var(--brand) 35%, var(--glass-border)); }
.note.is-mention .note-title { color: var(--brand-600); }
[data-theme="dark"] .note.is-mention .note-title { color: #b39dff; }

/* ───────── Критичные уведомления (словарь маркеров) ───────── */
.note-critical { font-size: 10.5px; font-weight: 800; letter-spacing: .2px; color: #fff; background: var(--red); padding: 1px 7px; border-radius: 999px; }
/* Критичную карточку выделяем красной полосой — заметнее обычного непрочитанного. */
.note.is-critical { box-shadow: inset 3px 0 0 0 var(--red), 0 2px 12px rgba(229,72,77,.16); border-color: color-mix(in srgb, var(--red) 35%, var(--glass-border)); }
.note.is-critical .note-title { color: #b3262b; }
[data-theme="dark"] .note.is-critical .note-title { color: #ff9ea0; }


/* Заголовок группы критичных по триггерному слову */
.marker-group { display: flex; align-items: center; gap: 8px; margin: 16px 2px 8px; }
.marker-group:first-child { margin-top: 4px; }
.marker-group-word { font-weight: 800; font-size: 12px; letter-spacing: .2px; color: #b3262b; background: var(--red-bg); border: 1px solid #f0cccd; padding: 3px 11px; border-radius: 999px; }
.marker-group-count { font-family: var(--mono); font-size: 11.5px; font-weight: 700; color: var(--muted); }
[data-theme="dark"] .marker-group-word { color: #ff9ea0; }

/* Заголовок группы ленты по клиенту */
.client-group { display: flex; align-items: center; gap: 8px; margin: 16px 2px 8px; }
.client-group:first-child { margin-top: 4px; }
.client-group-name { font-weight: 800; font-size: 12.5px; letter-spacing: .2px; color: var(--text); }

/* Страница словаря маркеров */
.markers { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.marker { display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 12px; border-radius: 999px; background: var(--glass-strong); border: 1px solid var(--glass-border); margin: 0; }
.marker-ro { padding: 5px 13px; color: var(--muted); }
.marker-label { font-size: 13px; font-weight: 600; }
.marker-x { width: 18px; height: 18px; border: none; border-radius: 50%; background: rgba(10,10,11,.06); color: var(--muted); font-size: 11px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.marker-x:hover { background: var(--red-bg); color: var(--red); }
.markers-empty { color: var(--muted); font-size: 13px; margin: 14px 0; }
.marker-add { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.marker-add input[type=text] { flex: 1; }
[data-theme="dark"] .marker-x { background: rgba(255,255,255,.08); }

/* Telegram: карточка на «Каналах» и матрица доступа в админке. */
.tg-row { display: flex; flex-direction: column; }
.tg-chat-list { margin: 6px 0 0; padding-left: 18px; color: var(--text); font-size: 13px; }
.tg-chat-list li { margin: 2px 0; }
.tg-access { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tg-users { display: flex; flex-wrap: wrap; gap: 6px 14px; flex: 1; min-width: 0; }
.tg-user { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; white-space: nowrap; }
.tg-user input { width: 16px; height: 16px; accent-color: var(--brand); }
.note-actions { display: flex; align-items: flex-start; flex-shrink: 0; }
.read-mark { color: var(--green); font-size: 12px; font-weight: 700; white-space: nowrap; font-family: var(--mono); }

/* Кольцо «задержи курсор → прочитано» */
.hover-ring { position: fixed; z-index: 60; width: 20px; height: 20px; pointer-events: none; opacity: 0; transition: opacity .12s; filter: drop-shadow(0 1px 2px rgba(10,10,11,.3)); }
.hover-ring.show { opacity: 1; }
.hover-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.hover-ring .ring-bg { fill: none; stroke: rgba(110,40,247,.18); stroke-width: 3.5; }
.hover-ring .ring-fg { fill: none; stroke: var(--brand); stroke-width: 3.5; stroke-linecap: round; }

/* Появление нового уведомления сверху ленты */
@keyframes noteIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.note.note-new { animation: noteIn .45s ease; }
.note.note-new::after {
  content: ""; position: absolute; inset: 0; border-radius: 13px; pointer-events: none;
  box-shadow: 0 0 0 2px rgba(110,40,247,.4); animation: noteFlash 2s ease forwards;
}
@keyframes noteFlash { from { opacity: 1; } to { opacity: 0; } }

/* Плитка ссылок */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); }
.tile { display: flex; flex-direction: column; gap: 7px; padding: 14px 12px; color: var(--text); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.tile:nth-child(4n) { border-right: none; }
.tile:hover { background: var(--brand-50); }
.tile-ico { font-size: 20px; }
.tile-title { font-weight: 600; font-size: 12px; line-height: 1.25; }
.tile-add { color: var(--muted); }
.tile-add .tile-ico { color: var(--brand); }

/* ───────── Подключения ───────── */
.connect-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 8px; }
@media (max-width: 760px) { .connect-grid { grid-template-columns: 1fr; } }
.gcal-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.connect-card { background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 22px; text-align: center; box-shadow: var(--glass-shadow); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); transition: transform .14s; }
.connect-card:hover { transform: translateY(-2px); }
.connect-ico { width: 56px; height: 56px; border-radius: 16px; font-size: 28px; margin: 0 auto 12px; display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,.55); border: 1px solid var(--glass-border); box-shadow: inset 0 1px 0 rgba(255,255,255,.8); }
.connect-title { font-weight: 700; font-size: 16px; }
.connect-tag { color: var(--muted); font-size: 13px; margin: 6px 0 16px; min-height: 38px; }

/* Выбор цвета канала */
.color-pick { width: 36px; height: 28px; padding: 0; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; cursor: pointer; }
.color-pick::-webkit-color-swatch-wrapper { padding: 3px; }
.color-pick::-webkit-color-swatch { border: none; border-radius: 5px; }

/* Инструкция подключения */
.steps { margin: 0; padding-left: 20px; }
.steps li { margin-bottom: 12px; line-height: 1.55; }
code { font-family: var(--mono); font-size: 12.5px; background: var(--brand-50); color: var(--brand-600); padding: 2px 6px; border-radius: 6px; word-break: break-all; }
code.copy { display: block; margin-top: 6px; padding: 9px 11px; background: #0a0a0b; color: #e7dbff; border-radius: 8px; line-height: 1.5; }

/* Источники */
.src-list { padding: 8px 22px; }
.src-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.src-item:last-child { border-bottom: none; }
.src-item input { width: 17px; height: 17px; accent-color: var(--brand); }
.src-name { font-weight: 600; flex: 1; }

/* Активность */
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.activity li:last-child { border-bottom: none; }
.act-kind { display: inline-block; font-family: var(--mono); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; padding: 2px 7px; border-radius: 6px; margin-right: 8px; background: rgba(10,10,11,.06); color: var(--muted); }
.act-sync { background: var(--blue-bg); color: var(--blue); }
.act-mark_read { background: var(--green-bg); color: var(--green); }
.act-connect { background: var(--brand-50); color: var(--brand); }
.act-disconnect { background: var(--red-bg); color: var(--red); }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted-2); font-weight: 700; padding: 11px 22px; border-bottom: 1px solid var(--border); }
td { padding: 13px 22px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafafb; }
.t-strong { font-weight: 700; }
.t-muted { color: var(--muted); font-size: 13px; }
.num { text-align: right; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-gray { background: rgba(10,10,11,.06); color: var(--muted); }
.badge-brand { background: var(--brand-50); color: var(--brand); }

/* Forms */
.form { max-width: 640px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13.5px; }
.field .hint, .hint { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 10px 13px; border: 1px solid var(--glass-border); border-radius: 11px;
  font-size: 14px; font-family: inherit; background: rgba(255,255,255,.65); color: var(--text);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 24px; }

/* ───────── Управление пользователями ───────── */
/* align-items:start → все поля по верху: метки на одной линии, инпуты на одной линии.
   Подсказка под «Логином» висит ниже своего поля и НЕ сдвигает само поле. Кнопка
   получает пустой label-спейсер, чтобы встать ровно на линию инпутов. */
.user-add { display: grid; grid-template-columns: 1fr 1fr 1fr auto auto; gap: 14px; align-items: start; }
.user-add .field { margin-bottom: 0; }
.user-add .spacer { visibility: hidden; }
@media (max-width: 820px) {
  .user-add { grid-template-columns: 1fr; }
  .user-add .spacer { display: none; }
}
.row-actions { display: flex; gap: 6px; align-items: center; }
.row-actions .inline-form { display: inline; }
summary.btn { list-style: none; cursor: pointer; user-select: none; }
summary.btn::-webkit-details-marker { display: none; }
.rowmenu { position: relative; }
.rowmenu[open] > summary.btn { background: var(--brand-50); border-color: color-mix(in srgb, var(--brand) 30%, transparent); color: var(--brand); }
.rowmenu-body {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  display: flex; flex-direction: column; gap: 8px; width: 240px; padding: 12px;
  background: var(--glass-strong); border: 1px solid var(--glass-border); border-radius: 12px;
  box-shadow: var(--shadow-md);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}

/* Flash */
.flash { padding: 12px 16px; border-radius: 11px; margin-bottom: 16px; font-weight: 600; font-size: 13.5px; }
.flash-success { background: var(--green-bg); color: #11703a; }
.flash-error { background: var(--red-bg); color: #b3262b; }
.flash-info { background: var(--blue-bg); color: #1c3aa8; }

/* Login form */
.login-form .field { margin-bottom: 16px; }

/* ═════════ Промо-экран входа (split, на весь экран без скролла) ═════════ */
.auth-body { height: 100vh; overflow: hidden; }
.auth-split {
  height: 100vh; display: grid; grid-template-columns: 1.15fr .85fr;
}

/* ── Левая колонка: промо ── */
.auth-promo { position: relative; display: flex; align-items: center; padding: 5vh 5vw; min-width: 0; }
/* Светлая вуаль под текстом: гасит контраст с бегающим mesh-фоном (особенно сине-голубыми
   пятнами под градиентным «в одном окне»), плавно сходит на нет к центру — коллаж справа
   остаётся на «живом» фоне. */
.auth-promo::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(100deg, rgba(250,250,250,.92) 0%, rgba(250,250,250,.66) 40%, rgba(250,250,250,0) 74%);
}
.auth-promo-inner { position: relative; z-index: 1; width: 100%; max-width: 620px; }
.auth-logo { display: flex; align-items: center; gap: 12px; margin-bottom: clamp(24px, 4.5vh, 44px); }
.auth-logo-mark {
  position: relative; width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 15px;
  color: #fff; background: linear-gradient(135deg, #7c3aff, #6e28f7);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 6px 18px rgba(110,40,247,.35);
}
/* Красный «бейдж уведомления» в углу логотипа — отсылка к главной фиче сервиса. */
.auth-logo-badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px;
  display: grid; place-items: center; line-height: 1;
  background: var(--red); color: #fff; font-family: var(--mono); font-weight: 700; font-size: 10.5px;
  box-shadow: 0 2px 6px rgba(229,72,77,.5);
}
.auth-logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.auth-logo-text b { font-family: var(--display); font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -.2px; }
.auth-logo-text small { font-size: 11px; font-weight: 500; color: var(--muted); margin-top: 3px; }

.auth-headline {
  font-family: var(--display); font-weight: 700; font-size: clamp(30px, 3.4vw, 50px);
  line-height: 1.06; letter-spacing: -1px; margin: 0 0 22px;
}
.auth-headline .grad {
  background: linear-gradient(120deg, #7c3aff, #375af4 60%, #2dd4bf);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.auth-lead { font-size: 16px; line-height: 1.6; color: var(--muted); max-width: 480px; margin: 0 0 22px; }

.auth-feats { list-style: none; padding: 0; margin: 0 0 26px; display: flex; flex-direction: column; gap: 10px; }
.auth-feats li { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 14.5px; }
.auth-feats .ico {
  width: 34px; height: 34px; flex-shrink: 0; display: grid; place-items: center; font-size: 16px;
  border-radius: 10px; background: var(--brand-50); border: 1px solid var(--glass-border);
}

/* «Живой» коллаж интерфейса */
.auth-art { position: relative; height: 216px; max-width: 540px; }
.auth-art .art-card { position: absolute; border-radius: 18px; padding: 14px; animation: artFloat 12s ease-in-out infinite; }
/* Плавное медленное «дыхание» — только вверх-вниз, у каждой карточки своя частота/фаза. */
@keyframes artFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.auth-art .art-feed  { animation-duration: 13s;   animation-delay: -1s; }
.auth-art .art-cal   { animation-duration: 12s;   animation-delay: -5s; }
.auth-art .art-links { animation-duration: 12.5s; animation-delay: -8s; }
@media (prefers-reduced-motion: reduce) { .auth-art .art-card { animation: none; } }
.art-feed { left: 0; top: 0; width: 282px; z-index: 2; }
.art-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.art-card-title { font-weight: 700; font-size: 13.5px; }
.art-pill {
  background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; font-family: var(--mono);
  padding: 1px 8px; border-radius: 999px;
}
.art-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.art-row + .art-row { border-top: 1px solid var(--border); }
.art-row.read { opacity: .5; }
.art-ava {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 9px; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; color: #fff;
}
.art-ava.sl { background: #611f69; } .art-ava.ml { background: #375af4; } .art-ava.tg { background: #2aabee; }
.art-row-body { min-width: 0; flex: 1; }
.art-row-top { font-size: 12.5px; }
.art-row-top b { font-weight: 700; }
.art-row-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.art-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex-shrink: 0; }

/* Календарь — компактный, верхний слой: накладывается и на ссылки, и на правый край ленты. */
.art-cal { left: 263px; top: 39px; z-index: 5; display: flex; align-items: center; gap: 11px; padding: 13px 15px; }
.art-cal-day { font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1; color: var(--brand); }
.art-cal-mon { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.art-cal-evt { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.art-cal-tick { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex-shrink: 0; }

/* Быстрые ссылки — короткий список: фавикон-чип + название + «↗», фирменный цвет = ссылка. */
.art-links { left: 274px; top: 96px; z-index: 4; width: 184px; }
.art-link { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.art-link + .art-link { border-top: 1px solid var(--border); }
.art-link-fav {
  width: 26px; height: 26px; flex-shrink: 0; border-radius: 8px; display: grid; place-items: center;
  font-weight: 700; font-size: 12px; color: #fff;
}
.art-link-fav.cr { background: #375af4; } .art-link-fav.wk { background: #e0488f; }
.art-link-name { flex: 1; font-size: 12.5px; font-weight: 600; color: var(--brand); }
.art-link-go { color: var(--brand); font-weight: 700; font-size: 13px; }

/* ── Правая колонка: форма ── */
.auth-form-col {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: 6vh 4vw; background: rgba(255,255,255,.28);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border-left: 1px solid var(--glass-border);
}
.auth-card {
  width: 100%; max-width: 360px; background: var(--glass-strong); border: 1px solid var(--glass-border);
  border-radius: 24px; padding: 34px 30px;
  box-shadow: 0 20px 60px rgba(10,10,11,.16), inset 0 1px 0 rgba(255,255,255,.8);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
.auth-card-head { margin-bottom: 22px; }
.auth-card-head h2 { font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: -.4px; margin: 0 0 8px; }
.auth-card-head p { color: var(--muted); font-size: 13.5px; margin: 0; line-height: 1.5; }
.auth-help { text-align: center; color: var(--muted); font-size: 12.5px; margin: 18px 0 0; }
.auth-foot { font-size: 11.5px; color: var(--muted-2); font-family: var(--mono); }

/* Узкий экран: прячем промо, центрируем форму (всё ещё без скролла) */
@media (max-width: 880px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-promo { display: none; }
  .auth-form-col { border-left: none; background: transparent; }
}

/* ═════════ Рабочий стол (полноэкранный дашборд) ═════════ */
.glass {
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: 20px;
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
body.desk { height: 100vh; overflow: hidden; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
body.desk::before { content: none; }   /* фон берём из .desk-bg (фото) или .bg-mesh */
/* Контент ограничен по ширине и центрирован; фон (.desk-bg) остаётся на весь экран. */
.desk-top, .desk-grid { width: 100%; max-width: 1600px; margin-inline: auto; }
.desk-bg {
  position: fixed; inset: 0; z-index: -1; background-color: var(--bg);
  background-size: cover; background-position: center;
}
.desk-bg.has-photo::after {   /* лёгкая вуаль для контраста панелей */
  content: ""; position: absolute; inset: 0; background: rgba(250,250,250,.18);
}

/* Верхняя полоса */
.desk-top { flex: 0 0 auto; display: flex; align-items: stretch; justify-content: space-between; gap: 16px; position: relative; z-index: 40; }
.greet { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.menu-btn { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--glass-border); background: rgba(255,255,255,.5); font-size: 17px; cursor: pointer; flex-shrink: 0; }
.menu-btn:hover { background: #fff; }
.greet .user-avatar { width: 40px; height: 40px; font-size: 16px; }
.greet-hi { font-family: var(--display); font-size: 18px; font-weight: 600; letter-spacing: -.3px; }
.greet-role { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.menu-pop {
  position: absolute; top: calc(100% + 8px); left: 0; min-width: 230px; padding: 8px; z-index: 50;
  display: flex; flex-direction: column; gap: 2px;
  background: rgba(255,255,255,.97);     /* почти непрозрачно — пункты хорошо видны */
  border: 1px solid var(--border-strong);
  box-shadow: 0 16px 40px rgba(10,10,11,.18), inset 0 1px 0 rgba(255,255,255,.9);
}
.menu-pop[hidden] { display: none; }   /* перекрывает display:flex, иначе меню всегда видно */

/* Мегаменю на дашборде: шире обычного попапа, разбито по смысловым блокам в колонки.
   НЕ переопределяем display (наследуем flex-column от .menu-pop), иначе .menu-pop[hidden]
   перестал бы прятать меню (равная специфичность — решал бы порядок правил). */
.menu-pop.mega {
  width: min(720px, calc(100vw - 28px)); min-width: 0;
  max-height: calc(100vh - 130px); overflow: auto;
  padding: 14px; gap: 12px;
}
.mega-head { display: flex; align-items: center; gap: 11px; padding: 2px 4px 12px; border-bottom: 1px solid var(--border); }
.mega-head .user-avatar { width: 38px; height: 38px; font-size: 15px; flex-shrink: 0; }
.mega-id { flex: 1; min-width: 0; }
.mega-name { font-family: var(--display); font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mega-role { font-size: 12px; color: var(--muted); margin-top: 1px; }
.mega-logout { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; color: var(--red); font-size: 16px; flex-shrink: 0; }
.mega-logout:hover { background: var(--red-bg); }
.mega-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 4px 14px; align-items: start; }
.mega-col { display: flex; flex-direction: column; gap: 2px; }
.mega-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 8px 8px 4px; }
.mega-col a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--text); font-weight: 600; font-size: 13.5px; }
.mega-col a .mi { width: 20px; text-align: center; flex-shrink: 0; font-size: 15px; }
.mega-col a .mega-item-txt { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mega-col a:hover { background: rgba(110,40,247,.1); color: var(--brand); }
.mega-col a .pill { margin-left: auto; flex-shrink: 0; }

/* Часы — в левой части блока календаря (раньше были отдельной плашкой в шапке). */
.cal-clock { margin-bottom: 12px; }
.clock-time { font-family: var(--mono); font-size: 50px; font-weight: 600; line-height: 1; letter-spacing: -1.5px; display: flex; align-items: flex-start; gap: 5px; }
.clock-sec { font-size: 17px; color: var(--brand); font-weight: 600; margin-top: 4px; }
.clock-date { font-size: 12.5px; color: var(--muted); margin-top: 5px; }

/* ── Часы: аналоговые ── */
.analog { width: 118px; height: 118px; display: block; }
.an-face { fill: var(--card); stroke: var(--border-strong); stroke-width: 1.5; }
.an-tick { stroke: var(--muted-2); stroke-width: 1.4; }
.an-tick-major { stroke: var(--muted); stroke-width: 2.4; }
.an-num { fill: var(--muted); font: 700 11px var(--sans); text-anchor: middle; dominant-baseline: middle; }
.an-hand { stroke-linecap: round; }
.an-h { stroke: var(--text); stroke-width: 3.4; }
.an-m { stroke: var(--text); stroke-width: 2.4; }
.an-s { stroke: var(--brand); stroke-width: 1.2; }
.an-pin { fill: var(--text); }

/* ── Часы: «старый» LCD ── */
.clock--lcd .lcd-panel {
  display: inline-flex; align-items: baseline; gap: 7px;
  padding: 8px 14px; border-radius: 10px;
  background: #10231c; box-shadow: inset 0 2px 6px rgba(0,0,0,.55), 0 1px 0 rgba(255,255,255,.06);
  font-family: var(--mono); font-weight: 700; letter-spacing: 2px;
}
/* Призрак и живые цифры кладём в ОДНУ ячейку inline-grid — точное совпадение по
   обеим осям (моноширинный шрифт → одинаковая ширина, grid-area → одинаковая позиция). */
.clock--lcd .lcd-hm, .clock--lcd .lcd-ss { display: inline-grid; line-height: 1; }
.clock--lcd .lcd-hm { font-size: 38px; }
.clock--lcd .lcd-ss { font-size: 16px; }
.clock--lcd .lcd-hm > *, .clock--lcd .lcd-ss > * { grid-area: 1 / 1; }
.clock--lcd .lcd-ghost { color: rgba(70,245,165,.13); }  /* «негорящие» сегменты */
.clock--lcd .lcd-live { color: #46f5a5; text-shadow: 0 0 9px rgba(70,245,165,.6); }

/* Превью выбора часов в персонализации. */
.clock-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 720px) { .clock-grid { grid-template-columns: repeat(2, 1fr); } }
.cp { display: flex; align-items: center; justify-content: center; height: 92px; border-radius: 10px; background: color-mix(in srgb, var(--text) 4%, transparent); }
.cp svg { width: 64px; height: 64px; }
.cp-digital { font: 700 28px var(--mono); letter-spacing: -1px; color: var(--text); }
.cp-lcd { font: 700 22px var(--mono); letter-spacing: 2px; color: #46f5a5; background: #10231c; padding: 7px 11px; border-radius: 7px; text-shadow: 0 0 8px rgba(70,245,165,.55); }

/* Тосты на дашборде */
.toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; transition: opacity .4s; }
.toast { padding: 11px 18px; border-radius: 12px; font-weight: 600; font-size: 13.5px; box-shadow: var(--shadow-md); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }

/* Сетка десктопа: слева лента на всю высоту, справа календарь (верх, 40%) и ссылки
   (низ, 60%). Три блока — прямые потомки .desk-grid (без обёртки), чтобы на мобайле
   их можно было разложить в горизонтальную свайп-карусель через order. */
.desk-grid {
  flex: 1 1 auto; min-height: 0;
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 2fr 3fr; gap: 18px;
}
.desk-grid > .feed-col { grid-column: 1; grid-row: 1 / 3; }
.desk-grid > .cal-widget { grid-column: 2; grid-row: 1; }
.desk-grid > .links-widget { grid-column: 2; grid-row: 2; }
.desk-pane, .cal-widget, .links-widget { min-height: 0; }
/* Модуль «Календарь» выключен: ссылки занимают весь правый столбец (без пустой дыры). */
.desk-grid--no-cal > .links-widget { grid-row: 1 / 3; padding-bottom: 18px; }

/* Индикатор-пагинация свайпа (только мобайл/портретный планшет; не кликается). */
.desk-pager { display: none; flex: 0 0 auto; justify-content: center; align-items: center; gap: 7px; }
.desk-pager .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); opacity: .55; transition: width .25s, background .25s, opacity .25s; }
.desk-pager .dot.active { opacity: 1; width: 22px; border-radius: 4px; background: var(--brand); }

/* Панель (общее) */
.desk-pane { display: flex; flex-direction: column; padding: 18px 20px 0; overflow: hidden; }
.pane-head { display: flex; align-items: center; justify-content: space-between; flex: 0 0 auto; padding-bottom: 12px; }
.pane-head h2 { font-family: var(--display); font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -.3px; display: inline-flex; align-items: center; gap: 9px; }
/* Счётчик непрочитанных — пилюля акцентного цвета рядом с заголовком «Уведомления». */
.unread-badge { font-family: var(--sans); font-size: 12px; font-weight: 700; line-height: 1; color: #fff; background: linear-gradient(135deg, #7c3aff, #6e28f7); padding: 4px 9px; border-radius: 999px; letter-spacing: 0; box-shadow: 0 2px 8px rgba(110,40,247,.35); }
.pane-actions { display: flex; gap: 8px; }
.feed-toolbar, .active-pills, .feed-search { flex: 0 0 auto; }
.pane-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-bottom: 18px; margin-right: -6px; padding-right: 6px; }

/* Поиск по ленте */
.feed-search { position: relative; flex: 0 0 auto; margin-bottom: 12px; }
.feed-search-ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.feed-search input[type=search] {
  width: 100%; box-sizing: border-box; padding: 8px 32px 8px 34px;
  border: 1px solid var(--glass-border); border-radius: 11px; font: inherit; font-size: 13.5px;
  background: rgba(255,255,255,.55); color: var(--text);
  -webkit-appearance: none; appearance: none;
}
.feed-search input[type=search]::-webkit-search-cancel-button { display: none; }
.feed-search input[type=search]::placeholder { color: var(--muted); }
.feed-search input[type=search]:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); background: #fff; }
.feed-search-clear { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; padding: 0; border: none; border-radius: 50%; background: var(--border); color: var(--text); font-size: 11px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.feed-search-clear:hover { background: var(--border-strong); }
.search-hidden { display: none !important; }
[data-theme="dark"] .feed-search input[type=search] { background: rgba(255,255,255,.06); }
[data-theme="dark"] .feed-search input[type=search]:focus { background: rgba(255,255,255,.1); }

/* Календарь — половина высоты правой колонки, две колонки внутри */
.cal-widget { flex: 40 1 0; min-height: 0; display: flex; flex-direction: column; padding: 18px 20px; overflow: hidden; }
.cal-cols { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cal-left { min-height: 0; overflow-y: auto; overflow-x: hidden; }
.cal-right { min-height: 0; overflow-y: auto; overflow-x: hidden; border-left: 1px solid var(--border); padding-left: 14px; }
@media (max-width: 1180px) { .cal-cols { grid-template-columns: 1fr; } .cal-right { border-left: none; padding-left: 0; } }
/* Стекло как у непрочитанной карточки (.note.unread): полупрозрачная подложка БЕЗ
   backdrop-filter + мягкая тень и верхний блик. Цветовой акцент — зелёно-фиолетовый
   градиент слева направо (как у уведомлений, .note::before), просвечивает сквозь подложку. */
/* «Ближайшее» — без заливки, на общем фоне календаря; отделяется линией сверху
   (тем же бордером, что разделяет левую и правую части). Обычные цвета текста. */
.cal-next {
  padding: 12px 0 4px; margin-bottom: 0;
  border-top: 1px solid var(--border);
}
.cal-next-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; font-weight: 700; color: var(--cal-accent-text); }
.cal-next-time { font-family: var(--mono); font-size: 26px; font-weight: 600; line-height: 1.1; color: var(--text); }
.cal-next-title { font-weight: 700; margin-top: 2px; color: var(--text); overflow-wrap: anywhere; }
.cal-next-place { font-size: 12.5px; color: var(--muted); }
/* «Текущая встреча» (is-now) — сплошная зелёная заливка + белый текст (выделяем). */
.cal-next.is-now {
  background: linear-gradient(135deg, #34d27f, #16a34a); color: #fff;
  border: 0; border-radius: 14px; padding: 12px 14px;
  box-shadow: 0 6px 18px rgba(22,163,74,.28);
}
.cal-next.is-now .cal-next-label { color: rgba(255,255,255,.82); }
.cal-next.is-now .cal-next-time,
.cal-next.is-now .cal-next-title { color: #fff; }
.cal-next.is-now .cal-next-place { color: rgba(255,255,255,.82); }
/* «Встреч больше нет» — нейтрально, без линии и заливки. */
.cal-next-empty { border-top: 0; padding: 14px 2px; font-weight: 600; color: var(--muted); }
/* Кнопка «Подключиться» — справа от часов (см. .cal-clock-row). */
.cal-clock-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.cal-clock-row .cal-clock { margin-bottom: 0; }
.cal-join-slot { flex-shrink: 0; }
.cal-join { margin: 0; background: linear-gradient(135deg, #7c3aff, #6e28f7); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(110,40,247,.3); }
.cal-join:hover { background: linear-gradient(135deg, #6e28f7, #5a1ad6); color: #fff; transform: translateY(-1px); }
.cal-item.now .cal-time { color: var(--green); }
.cal-item.now .cal-title { font-weight: 700; }
/* Список встреч справа — компактный: мельче и тоньше. */
.cal-list { display: flex; flex-direction: column; gap: 1px; }
.cal-item { display: flex; align-items: baseline; gap: 8px; padding: 5px 2px; border-bottom: 1px solid var(--border); }
.cal-item:last-child { border-bottom: none; }
.cal-item.past { opacity: .42; }
.cal-time { font-family: var(--mono); font-size: 11.5px; font-weight: 500; color: var(--cal-accent-text); width: 36px; flex-shrink: 0; }
.cal-widget a:not(.btn) { color: var(--cal-accent-text); }
.cal-body { flex: 1 1 auto; min-width: 0; }   /* min-width:0 — чтобы длинный текст не распирал блок */
.cal-title { font-weight: 500; font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; }
.cal-place { font-size: 10.5px; color: var(--muted); margin-top: 1px; overflow-wrap: anywhere; }
.cal-link { font-size: 10.5px; margin-top: 1px; display: inline-block; max-width: 100%; }
.cal-foot { margin-top: 12px; font-size: 11.5px; }
.cal-empty-state { text-align: center; padding: 18px 8px 6px; color: var(--muted); }
.cal-empty-ico { font-size: 30px; margin-bottom: 8px; }
.cal-empty-state p { margin: 0 0 14px; }
.btn-link { border: none; background: none; padding: 0; font: inherit; color: var(--brand); cursor: pointer; text-decoration: underline; }
.btn-link:hover { color: var(--brand-600); }

/* Ссылки на дашборде */
.links-widget { flex: 60 1 0; min-height: 0; display: flex; flex-direction: column; padding: 18px 20px 0; overflow: hidden; }
.links-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-bottom: 16px; }
.links-group-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; font-weight: 700; color: var(--muted-2); margin: 6px 0 8px; }
.links-widget .tiles { grid-template-columns: repeat(3, 1fr); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
/* Кнопки-строки: иконка + текст в ряд, компактно (влезает больше). 3 колонки. */
.links-widget .tile {
  flex-direction: row; align-items: center; gap: 9px; padding: 9px 11px; min-width: 0;
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); border-color: var(--border);
}
.links-widget .tile:nth-child(3n) { border-right: none; }
.links-widget .tile-ico { font-size: 16px; flex-shrink: 0; }
/* Обрезаем длинные названия многоточием, чтобы сетка не «ехала». */
.links-widget .tile-title { flex: 1; min-width: 0; font-size: 12px; font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Мобайл / портретный планшет: блоки — полноэкранные «экраны», листаются свайпом
   по горизонтали (scroll-snap). Шапка и пагинация сверху остаются на месте; карточка
   стоит, скроллится только её содержимое. Порядок экранов: лента → ссылки → календарь.
   ВАЖНО: блок идёт ПОСЛЕ базовых правил панелей — иначе из-за равной специфичности
   переопределения flex/overflow/order не применились бы (решает порядок в файле). */
@media (max-width: 920px), (orientation: portrait) and (max-width: 1024px) {
  body.desk { height: 100vh; overflow: hidden; }
  .desk-pager { display: flex; }
  /* Шапка в столбик: табы переключения уезжают ПОД приветствие, чтобы не слипались
     на узком экране. Приветствие компактнее, длинный текст обрезается многоточием. */
  .desk-top { flex-direction: column; align-items: stretch; gap: 10px; }
  .greet { padding: 9px 12px; gap: 10px; }
  .greet .menu-btn { width: 34px; height: 34px; font-size: 16px; }
  .greet .user-avatar { width: 34px; height: 34px; font-size: 14px; }
  .greet-text { flex: 1; min-width: 0; }
  .greet-hi { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .greet-role { font-size: 11.5px; margin-top: 1px; }
  .desk-tabs { align-self: center; }
  /* Панель ленты: заголовок и кнопки действий переносятся, чтобы не вылезали за край. */
  .feed-col .pane-head { flex-wrap: wrap; gap: 10px; }

  /* Тулбар: сегмент во всю ширину сверху, инструменты — отдельным рядом под ним. */
  .feed-toolbar { gap: 8px; }
  .seg { width: 100%; justify-content: space-between; }
  .seg-item { flex: 1; text-align: center; padding: 7px 8px; }
  .feed-tools { margin-left: 0; width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  /* Панель поповера к левому краю — чтобы у крайних кнопок не уезжала за экран. */
  .fbtn-pop { right: auto; left: 0; }
  /* Лента карусели — во всю ширину экрана (выходим из 20px-паддингов body отрицательным
     полем), чтобы карточки могли уезжать ПОЛНОСТЬЮ за край. Внутренние padding/gap по
     20px дают отступ карточки от края экрана и такой же зазор между карточками. */
  .desk-grid {
    display: flex; flex-direction: row;
    grid-template-columns: none; grid-template-rows: none;
    margin-inline: -20px; max-width: none; width: calc(100% + 40px);
    padding-inline: 20px; gap: 20px;
    overflow-x: auto; overflow-y: hidden;
    scroll-snap-type: x mandatory; scroll-padding-inline: 20px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .desk-grid::-webkit-scrollbar { display: none; }
  /* Каждый блок = экран минус боковые отступы (100% контент-области = ширина экрана − 40px);
     внутренний вертикальный скролл сохраняется. */
  .desk-grid > .feed-col,
  .desk-grid > .cal-widget,
  .desk-grid > .links-widget {
    flex: 0 0 100%; height: 100%; min-height: 0;
    grid-column: auto; grid-row: auto;
    scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden;
  }
  .desk-grid > .feed-col { order: 1; }    /* экран 1 — уведомления */
  .desk-grid > .links-widget { order: 2; }  /* экран 2 — ссылки */
  .desk-grid > .cal-widget { order: 3; }    /* экран 3 — календарь */
  .pane-scroll, .links-scroll, .cal-left, .cal-right { overflow-y: auto; }
  /* Полноэкранная карточка узкая — плитки ссылок в 2 колонки (вместо 3), читаемее. */
  .links-widget .tiles { grid-template-columns: repeat(2, 1fr); }
  .links-widget .tile:nth-child(3n) { border-right: 1px solid var(--border); }
  .links-widget .tile:nth-child(2n) { border-right: none; }
}

/* Misc */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .big { font-size: 46px; margin-bottom: 12px; }
.empty p { margin: 0 0 16px; }
.empty-title { font-family: var(--display); font-size: 18px; font-weight: 600; color: var(--text); margin: 0 0 4px !important; }
.empty-sub { color: var(--muted); margin: 0 !important; }

/* Конфети «всё прочитано» — падают сверху вниз внутри панели ленты. */
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 5; }
.confetti i {
  position: absolute; top: -16px; border-radius: 2px; opacity: .95;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0%   { transform: translateY(-16px) rotate(0deg); }
  100% { transform: translateY(var(--fall, 600px)) rotate(720deg); }
}
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } }
.inline-form { display: inline; }
.flex { display: flex; align-items: center; gap: 10px; }
.gap-sm { gap: 6px; }
.stack { display: flex; flex-direction: column; gap: 2px; }

/* ═════════════ ТЕМЫ ОФОРМЛЕНИЯ (data-theme на <html>) ═════════════ */
/* «Яркая» (vivid) — дефолт из :root, отдельных правил не требует. */

/* ───── Светлая: почти белый фон, меньше кругов, они прозрачнее ───── */
[data-theme="light"] { --bg: #ffffff; }
[data-theme="light"] .blob { opacity: .2; filter: blur(80px); }
[data-theme="light"] .blob.b3,
[data-theme="light"] .blob.b4,
[data-theme="light"] .blob.b6 { display: none; }   /* оставляем 3 пятна */

/* ───── Тёмная («ночная»): тёмный фон, светлый текст, бледные яркие круги ───── */
[data-theme="dark"] {
  --bg: #0e1014;
  --card: #181b22;
  --text: #e7e9ee;
  --muted: rgba(231,233,238,.62);
  --muted-2: rgba(231,233,238,.42);
  --border: rgba(255,255,255,.10);
  --border-strong: rgba(255,255,255,.18);
  --brand-50: rgba(124,58,255,.16);
  --brand-100: rgba(124,58,255,.26);
  /* Акценты ярче — для контраста текста/бейджей на тёмном фоне. */
  --blue: #7d96ff;
  --green: #43d98a;
  --red: #ff7074;
  --blue-bg: rgba(55,90,244,.22);
  --green-bg: rgba(22,163,74,.22);
  --red-bg: rgba(229,72,77,.22);
  --glass: rgba(255,255,255,.05);
  --glass-strong: rgba(255,255,255,.09);
  --glass-border: rgba(255,255,255,.12);
  --glass-shadow: 0 8px 30px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.4);
  --shadow-md: 0 10px 30px rgba(0,0,0,.55);
  --cal-accent-text: #b39dff;   /* светло-фиолетовый — читаемо на тёмном */
}
/* Бледные яркие круги на тёмном (цвета пятен оставляем, гасим непрозрачность). */
[data-theme="dark"] .blob { opacity: .30; filter: blur(82px); }
/* Точечные правки «жёсткого белого», который не покрывается токенами. */
[data-theme="dark"] .topbar { background: rgba(16,18,24,.62); }
[data-theme="dark"] .note { background: rgba(255,255,255,.05); }
[data-theme="dark"] .note.clickable:hover { background: rgba(255,255,255,.10); }
[data-theme="dark"] .btn:hover { background: rgba(255,255,255,.12); }
[data-theme="dark"] .chip:hover { background: rgba(255,255,255,.14); }
[data-theme="dark"] .chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
[data-theme="dark"] .menu-btn:hover { background: rgba(255,255,255,.12); }
[data-theme="dark"] .menu-pop,
[data-theme="dark"] .fbtn-pop,
[data-theme="dark"] .rowmenu-body { background: #1c1f27; }
[data-theme="dark"] .seg-item.active { color: #fff; }
[data-theme="dark"] .fbtn > summary:hover,
[data-theme="dark"] .fbtn[open] > summary,
[data-theme="dark"] .fbtn-icon:hover,
[data-theme="dark"] .pill-x:hover { background: rgba(255,255,255,.12); color: var(--text); }
[data-theme="dark"] .fbtn-opt:hover { background: rgba(255,255,255,.08); }
[data-theme="dark"] .src-chip:hover { background: rgba(255,255,255,.1); }
[data-theme="dark"] .src-chip.is-on { background: color-mix(in srgb, var(--green) 24%, transparent); color: #8fe7b0; }
[data-theme="dark"] .src-chip.is-on:hover { background: color-mix(in srgb, var(--green) 32%, transparent); }
[data-theme="dark"] .color-pick { background: #181b22; }
[data-theme="dark"] .ch-slack { background: var(--brand-50); }
[data-theme="dark"] tbody tr:hover { background: rgba(255,255,255,.04); }
[data-theme="dark"] input[type=text],
[data-theme="dark"] input[type=email],
[data-theme="dark"] input[type=password],
[data-theme="dark"] input[type=number],
[data-theme="dark"] select,
[data-theme="dark"] textarea { background: rgba(255,255,255,.06); color: var(--text); }
/* Жёсткие тёмные цвета ТЕКСТА → светлые в тёмной теме (читаемость). */
[data-theme="dark"] .nav a { color: rgba(231,233,238,.82); }
[data-theme="dark"] .note-text { color: rgba(231,233,238,.6); }
[data-theme="dark"] .flash-success { color: #6ee7a0; }
[data-theme="dark"] .flash-error { color: #ff9ea1; }
[data-theme="dark"] .flash-info { color: #a8bcff; }
/* Календарь: фиолетовые акценты текста (время в ленте, метка, ссылки) — через тема-зависимый
   токен --cal-accent-text (см. :root и [data-theme=dark]); зелёные акценты — var(--green). */

/* ───── Классическая: палитра Support Monitor — «тёплый минимализм» ─────
   Бумажный фон вместо белого, хвойно-зелёный акцент вместо фиолетового,
   serif в заголовках. Каркас общий: тема меняет только токены и фон. */
[data-theme="classic"] {
  --bg: #f4f1ea;              /* бумага */
  --card: #fffdf9;
  --text: #211f1a;            /* тёплая тушь, не чёрный */
  --muted: #6d675c;
  --muted-2: #948e81;
  --border: rgba(33,31,26,.09);
  --border-strong: rgba(33,31,26,.16);

  --brand: #1d5c48;           /* хвоя */
  --brand-600: #144535;
  --brand-50: rgba(29,92,72,.10);
  --brand-100: rgba(29,92,72,.20);

  /* Статусные цвета приглушены под бумагу: на #f4f1ea неоновые режут глаз. */
  --blue: #3a5a8c;
  --blue-bg: #e6ecf5;
  --green: #196b43;
  --green-bg: #e2f2e4;
  --red: #a92c1c;
  --red-bg: #fbe5df;
  --amber: #e19410;

  --shadow: 0 1px 2px rgba(46,40,27,.06), 0 4px 14px -6px rgba(46,40,27,.08);
  --shadow-md: 0 18px 40px -16px rgba(46,40,27,.25);
  --radius: 18px;

  --glass: rgba(255,255,255,.74);
  --glass-strong: rgba(255,255,255,.86);
  --glass-border: rgba(255,255,255,.5);
  --glass-shadow: 0 8px 30px rgba(46,40,27,.10), inset 0 1px 0 rgba(255,255,255,.8);

  --cal-accent-text: var(--brand);
  /* Подпись темы: serif в заголовках (--display), текст остаётся гротеском. */
  --display: "Iowan Old Style", Palatino, Georgia, "Times New Roman", serif;
}
/* Фон: три мягких пятна вместо шести ярких — пыльная зелень, абрикос, барвинок.
   Анимацию оставляем: она общая для всех тем, тут гасим только цвет и контраст. */
[data-theme="classic"] .bg-mesh .blob { opacity: .5; filter: blur(90px); }
[data-theme="classic"] .blob.b1 { background: #bcd8c3; }
[data-theme="classic"] .blob.b2 { background: #f3d2ae; }
[data-theme="classic"] .blob.b3 { background: #d7dff0; }
[data-theme="classic"] .blob.b4,
[data-theme="classic"] .blob.b5,
[data-theme="classic"] .blob.b6 { display: none; }
/* Фиолетовые градиенты заданы литералами мимо --brand (логотип, главные кнопки,
   бейдж непрочитанных, аватар TG, метка упоминания) — в классической теме они
   выбивались сиреневыми пятнами. Переводим на хвою. Страницу входа не трогаем:
   она всегда рисуется в vivid (тема пользователя до логина неизвестна). */
[data-theme="classic"] .brand-mark,
[data-theme="classic"] .btn-primary,
[data-theme="classic"] .unread-badge,
[data-theme="classic"] .note-mention,
[data-theme="classic"] .tg-ava-front { background: linear-gradient(135deg, #24705a, #1d5c48); }
[data-theme="classic"] .btn-primary:hover { background: linear-gradient(135deg, #1d5c48, #144535); }
/* Свечение под теми же элементами тоже фиолетовое — иначе вокруг зелёных кнопок
   оставался сиреневый ореол. */
[data-theme="classic"] .brand-mark,
[data-theme="classic"] .btn-primary { box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 6px 18px rgba(29,92,72,.28); }
[data-theme="classic"] .unread-badge { box-shadow: 0 2px 8px rgba(29,92,72,.32); }
[data-theme="classic"] .desk-tab.active {
  background: linear-gradient(135deg, #24705a, #1d5c48);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 5px 16px rgba(29,92,72,.3);
}
[data-theme="classic"] .note.is-mention { box-shadow: inset 3px 0 0 0 var(--brand), 0 2px 12px rgba(29,92,72,.16); }
[data-theme="classic"] .hover-ring .ring-bg { stroke: rgba(29,92,72,.18); }
[data-theme="classic"] .fbtn-opt:hover,
[data-theme="classic"] .mega-col a:hover { background: var(--brand-50); color: var(--brand); }
/* Точечно: где в светлых темах жёстко задан #fff — на бумаге он выбивается пятном. */
[data-theme="classic"] .btn:hover,
[data-theme="classic"] .chip:hover,
[data-theme="classic"] .menu-btn:hover,
[data-theme="classic"] .fbtn > summary:hover,
[data-theme="classic"] .fbtn[open] > summary,
[data-theme="classic"] .fbtn-icon:hover,
[data-theme="classic"] .pill-x:hover,
[data-theme="classic"] .src-chip:hover,
[data-theme="classic"] .client-card:hover { background: var(--card); }
[data-theme="classic"] .fbtn-pop,
[data-theme="classic"] .menu-pop,
[data-theme="classic"] .rowmenu-body,
[data-theme="classic"] .color-pick { background: #fffdf9; }
[data-theme="classic"] .feed-search input[type=search]:focus { background: #fffdf9; }

/* ───── Превью тем в разделе «Персонализация» ───── */
/* auto-fit: тем стало четыре, фиксированные 3 колонки оставляли одну сиротой в ряду. */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; }
@media (max-width: 720px) { .theme-grid { grid-template-columns: 1fr; } }
.theme-card {
  position: relative; display: block; cursor: pointer; padding: 10px; border-radius: 14px;
  border: 1px solid var(--glass-border); background: var(--glass);
  transition: border-color .15s, box-shadow .15s;
}
.theme-card:hover { border-color: color-mix(in srgb, var(--brand) 50%, transparent); }
.theme-card.selected { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.theme-card input { position: absolute; opacity: 0; pointer-events: none; }
.theme-preview { position: relative; display: block; height: 96px; border-radius: 10px; overflow: hidden; }
.theme-preview .tp-blob { position: absolute; border-radius: 50%; filter: blur(13px); }
.theme-preview .tp-card { position: absolute; left: 14%; right: 14%; bottom: 13%; height: 26%; border-radius: 6px; }
.theme-name { display: block; font-weight: 700; margin-top: 9px; }
.theme-note { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
/* мини-имитация фона каждой темы (фиксированные цвета, не зависят от активной темы) */
.tp-vivid { background: #fafafa; }
.tp-vivid .tp-blob.a { background: #6e28f7; width: 46px; height: 46px; top: -10px; left: -6px; opacity: .7; }
.tp-vivid .tp-blob.b { background: #2dd4bf; width: 40px; height: 40px; bottom: -8px; right: 8px; opacity: .6; }
.tp-vivid .tp-blob.c { background: #e0488f; width: 38px; height: 38px; top: 16px; left: 44%; opacity: .6; }
.tp-vivid .tp-card { background: rgba(255,255,255,.7); border: 1px solid rgba(255,255,255,.85); }
.tp-light { background: #ffffff; }
.tp-light .tp-blob.a { background: #6e28f7; width: 42px; height: 42px; top: -8px; left: 0; opacity: .22; }
.tp-light .tp-blob.b { background: #375af4; width: 38px; height: 38px; bottom: -6px; right: 14px; opacity: .18; }
.tp-light .tp-blob.c { display: none; }
.tp-light .tp-card { background: rgba(255,255,255,.85); border: 1px solid #ececf0; }
.tp-dark { background: #0e1014; }
.tp-dark .tp-blob.a { background: #7c3aff; width: 44px; height: 44px; top: -10px; left: -4px; opacity: .4; }
.tp-dark .tp-blob.b { background: #2dd4bf; width: 38px; height: 38px; bottom: -8px; right: 10px; opacity: .32; }
.tp-dark .tp-blob.c { background: #e0488f; width: 34px; height: 34px; top: 14px; left: 46%; opacity: .32; }
.tp-dark .tp-card { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); }
.tp-classic { background: #f4f1ea; }
.tp-classic .tp-blob.a { background: #bcd8c3; width: 46px; height: 46px; top: -10px; left: -6px; opacity: .8; }
.tp-classic .tp-blob.b { background: #f3d2ae; width: 40px; height: 40px; top: -8px; right: -6px; opacity: .75; }
.tp-classic .tp-blob.c { background: #d7dff0; width: 44px; height: 44px; bottom: -14px; left: 38%; opacity: .7; }
.tp-classic .tp-card { background: rgba(255,253,249,.9); border: 1px solid rgba(33,31,26,.1); }

/* ───────── Оповещения ───────── */
/* «Важный» канал — звезда у отправителя в ленте. */
.note.is-priority .note-src::before { content: "★ "; color: var(--amber); }
.switch-row { display: flex; align-items: center; gap: 10px; margin: 14px 0; font-weight: 600; }
.switch-row input[type=checkbox], .switch-cell input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }
.alert-perm { display: flex; align-items: center; gap: 12px; margin: 6px 0 4px; flex-wrap: wrap; }
.quiet-row { display: flex; gap: 16px; align-items: end; flex-wrap: wrap; margin-top: 4px; }
.quiet-row input[type=time] {
  padding: 9px 12px; border: 1px solid var(--glass-border); border-radius: 11px;
  font-size: 14px; font-family: inherit; background: rgba(255,255,255,.65); color: var(--text);
}
[data-theme="dark"] .quiet-row input[type=time] { background: rgba(255,255,255,.06); }
.switch-cell { display: inline-flex; justify-content: center; width: 100%; }
.ch-dot-inline { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* ═════════ Клиенты (вкладка дашборда + админка, ADR-0011) ═════════ */
/* Табы «Домашний / Клиенты» в шапке дашборда */
/* Сегмент-контрол «Домашний / Клиенты» — только иконки. */
.desk-tabs { display: inline-flex; align-items: center; gap: 4px; padding: 5px; align-self: center; border-radius: 15px; }
.desk-tab {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 40px; border-radius: 11px; color: rgba(10,10,11,.45);
  transition: color .16s, background .16s, transform .16s, box-shadow .16s;
}
.desk-tab svg { width: 21px; height: 21px; display: block; }
.desk-tab:hover { color: var(--text); background: rgba(10,10,11,.05); }
.desk-tab:active { transform: scale(.94); }
.desk-tab.active {
  color: #fff; background: linear-gradient(135deg, #7c3aff, #6e28f7);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 5px 16px rgba(110,40,247,.36);
}
/* Тонкая точка-индикатор под активным табом — добавляет «табовости». */
.desk-tab.active::after {
  content: ""; position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
  width: 5px; height: 5px; border-radius: 50%; background: var(--brand);
}
[data-theme="dark"] .desk-tab { color: rgba(255,255,255,.5); }
[data-theme="dark"] .desk-tab:hover { background: rgba(255,255,255,.08); }

/* Контейнер вкладки «Клиенты» */
.desk-clients { flex: 1 1 auto; min-height: 0; width: 100%; max-width: 1600px; margin-inline: auto; display: flex; flex-direction: column; gap: 14px; }
.desk-clients > .feed-col, .desk-clients > .clients-overview { flex: 1 1 auto; min-height: 0; }

/* Шапка страницы клиента */
.client-head { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: 14px 20px; }
.client-back { font-size: 20px; color: var(--muted); }
.client-back:hover { color: var(--text); }
.client-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.client-name { font-family: var(--display); font-size: 18px; font-weight: 600; margin: 0; letter-spacing: -.3px; }
.client-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.client-chip { font-size: 12px; background: rgba(255,255,255,.6); border: 1px solid var(--glass-border); border-radius: 999px; padding: 4px 10px; color: var(--text); }
.client-chip-empty { font-size: 12px; color: var(--muted); }

/* Обзор клиентов — карточки */
.client-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; padding-bottom: 18px; }
.client-card { display: block; background: rgba(255,255,255,.5); border: 1px solid var(--glass-border); border-radius: 16px; padding: 16px; color: var(--text); transition: .14s; }
.client-card:hover { background: #fff; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.client-card-head { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.client-card-name { font-weight: 700; font-size: 15px; }
.client-card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cc-unread { font-size: 12.5px; background: var(--brand-50); color: var(--brand); border-radius: 999px; padding: 3px 10px; font-weight: 600; }
.cc-clear { font-size: 12.5px; color: var(--muted); }
.cc-crit { font-size: 12.5px; background: var(--red-bg); color: #b3262b; border-radius: 999px; padding: 3px 10px; font-weight: 700; }
[data-theme="dark"] .client-card { background: rgba(255,255,255,.06); }
[data-theme="dark"] .client-card:hover { background: rgba(255,255,255,.1); }

/* Админка клиентов */
.color-dots { display: flex; gap: 8px; }
.color-dot { width: 26px; height: 26px; border-radius: 50%; cursor: pointer; position: relative; display: inline-block; }
.color-dot input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.color-dot:has(input:checked) { outline: 2px solid var(--text); outline-offset: 2px; }
/* Форма создания клиента — в одну строку: название тянется, цвет и кнопка фиксированы. */
.client-create { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.client-create .field { flex: 1; min-width: 180px; }
/* Карточки клиентов не должны слипаться. */
.client-admin { margin-bottom: 16px; }
.client-admin:last-child { margin-bottom: 0; }
.client-admin-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.client-section { margin-top: 16px; }
.client-section-label { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 9px; }
.rules { display: flex; flex-wrap: wrap; gap: 8px; }
.rule { display: inline-flex; align-items: center; gap: 7px; margin: 0; background: var(--glass-strong); border: 1px solid var(--glass-border); border-radius: 999px; padding: 5px 6px 5px 11px; }
.rule-kind { font-size: 13px; }
.rule-val { font-size: 13px; font-weight: 600; }
/* Выбор источника кликом по чипу: тип-подпись слева, чипы-тогглы справа. */
.client-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.src-count { font-size: 12px; font-weight: 600; color: var(--muted); }
.src-hint { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.src-pick-row { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.src-pick-type { flex-shrink: 0; min-width: 104px; padding-top: 7px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.src-pick-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.src-chip-form { margin: 0; }
/* Чип-тоггл источника: нейтральный = свободен, зелёный (.is-on) = привязан к клиенту. */
.src-chip {
  display: inline-flex; align-items: center; gap: 5px; font-family: inherit; font-size: 13px; font-weight: 600;
  background: var(--glass-strong); border: 1px solid var(--glass-border); color: var(--text);
  border-radius: 999px; padding: 6px 12px; cursor: pointer; transition: background .14s, border-color .14s, color .14s;
}
.src-chip:hover { background: #fff; border-color: var(--border-strong); }
.src-chip-tick { display: none; font-weight: 800; color: var(--green); }
.src-chip.is-on { background: var(--green-bg); border-color: color-mix(in srgb, var(--green) 42%, transparent); color: #11703a; }
.src-chip.is-on .src-chip-tick { display: inline; }
.src-chip.is-on:hover { background: color-mix(in srgb, var(--green) 16%, #fff); }
/* Свободный чип с авто-подсказкой по имени клиента — лёгкая брендовая подсветка + ✨. */
.src-chip.is-suggested:not(.is-on) { background: var(--brand-50); border-color: color-mix(in srgb, var(--brand) 30%, transparent); color: var(--brand); }
.src-pick-star { font-size: 11px; }
/* Источник занят другим клиентом — неактивен, показываем владельца. */
.src-chip.is-taken { opacity: .5; cursor: not-allowed; background: var(--glass-strong); }
.src-chip-owner { font-size: 11px; font-weight: 500; color: var(--muted); }
/* Ручной ввод — свёрнут в details, чтобы не отвлекать от чипов. */
/* Добавление домена клиента вручную (инлайн-форма рядом с чипами доменов). */
.domain-add { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.domain-input { width: 150px; min-width: 0; padding: 6px 12px; border-radius: 999px; font-size: 13px; }
