/* ============================================================
   ContentFlow — дизайн-система
   Светлая + тёмная темы · адаптив · аккуратные микровзаимодействия
   ============================================================ */

/* ─────────────────────────── Токены тем ─────────────────────────── */
:root {
  --accent:        #6d5df6;
  --accent-600:    #5b4cf0;
  --accent-700:    #4a3cd8;
  --accent-contrast:#ffffff;

  --radius:   14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --sidebar-w: 244px;
  --topbar-h: 88px;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --ease: cubic-bezier(.4, 0, .2, 1);
  --shadow-1: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.04);
  --shadow-2: 0 4px 12px rgba(16,24,40,.08), 0 2px 4px rgba(16,24,40,.04);
  --shadow-3: 0 18px 48px rgba(16,24,40,.18), 0 6px 16px rgba(16,24,40,.10);
  --shadow-pop: 0 12px 32px rgba(16,24,40,.14), 0 2px 8px rgba(16,24,40,.08);
}

html[data-theme="light"] {
  --bg:            #f5f6f9;
  --bg-grad:       radial-gradient(1200px 600px at 80% -10%, #efeefe 0%, transparent 60%);
  --surface:       #ffffff;
  --surface-2:     #f8f9fb;
  --surface-3:     #f1f2f6;
  --border:        #e7e9ef;
  --border-strong: #d7dbe3;
  --text:          #181b23;
  --text-2:        #61697a;
  --text-3:        #97a0b0;
  --accent-soft:   rgba(109,93,246,.10);
  --accent-soft-2: rgba(109,93,246,.06);
  --row-hover:     #f7f8fb;
  --scrim:         rgba(20,24,33,.40);
  --track:         #eceef3;
  color-scheme: light;
}

html[data-theme="dark"] {
  --accent:        #7d76ff;
  --accent-600:    #6f67ff;
  --accent-700:    #5c54f0;
  --bg:            #0d1016;
  --bg-grad:       radial-gradient(1100px 560px at 82% -12%, #1a1840 0%, transparent 58%);
  --surface:       #161b24;
  --surface-2:     #1a202b;
  --surface-3:     #212834;
  --border:        #262e3b;
  --border-strong: #323b4a;
  --text:          #e7e9ee;
  --text-2:        #97a1b3;
  --text-3:        #6a7383;
  --accent-soft:   rgba(125,118,255,.16);
  --accent-soft-2: rgba(125,118,255,.09);
  --row-hover:     #1b2230;
  --scrim:         rgba(2,4,8,.58);
  --track:         #232b38;
  color-scheme: dark;
}

/* ───────────────────────────── Reset ───────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
svg { display: block; }
::selection { background: var(--accent-soft); }

/* тонкие скроллбары */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* иконки-контур */
.ic { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.9; fill: none;
      stroke-linecap: round; stroke-linejoin: round; }

/* ════════════════════════════ Раскладка ════════════════════════════ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 18px 14px;
  position: sticky; top: 0; height: 100vh;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 18px; }
.brand-mark { display: grid; place-items: center; filter: drop-shadow(0 4px 10px rgba(91,76,240,.35)); }
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: -.02em; color: var(--text); }
.brand-name span { color: var(--accent); }

.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 550; font-size: 14.5px;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-link .ic { width: 19px; height: 19px; }
.nav-link:hover { background: var(--surface-3); color: var(--text); }
.nav-link.is-active { background: var(--accent-soft); color: var(--accent); }
.nav-link.is-active .ic { stroke: var(--accent); }
.nav-sep { height: 1px; background: var(--border); margin: 9px 10px; }

.sidebar-foot { margin-top: auto; padding-top: 14px; }

.shell { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

/* ───────────────────────────── Топбар ───────────────────────────── */
.topbar {
  min-height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 20px 26px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  position: sticky; top: 0; z-index: 30;
}
.topbar-title { min-width: 0; }
.topbar-title h1 { font-size: 19px; font-weight: 750; letter-spacing: -.02em; white-space: nowrap; }
.topbar-title p { font-size: 12.5px; color: var(--text-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.search {
  margin-left: auto; position: relative;
  display: flex; align-items: center; gap: 9px;
  width: 320px; max-width: 38vw;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0 14px; height: 40px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}
.search .ic { width: 17px; height: 17px; color: var(--text-3); flex: none; }
.search input { border: none; background: none; outline: none; width: 100%; font-size: 13.5px; }
.search input::placeholder { color: var(--text-3); }
.search:focus-within { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }

.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-pop);
  padding: 6px; max-height: 60vh; overflow: auto; z-index: 60;
}
.sr-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.sr-item:hover { background: var(--row-hover); }
.sr-title { font-weight: 550; font-size: 13.5px; }
.sr-meta { font-size: 12px; color: var(--text-2); }
.sr-empty { padding: 16px; text-align: center; color: var(--text-2); font-size: 13px; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* ───────────────────────── Кнопки ───────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border-radius: var(--radius-sm); font-weight: 600; font-size: 13.5px;
  background: var(--accent); color: var(--accent-contrast);
  box-shadow: 0 1px 2px rgba(91,76,240,.25), inset 0 1px 0 rgba(255,255,255,.18);
  transition: transform .12s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease), opacity .15s;
  white-space: nowrap;
}
.btn .ic { width: 17px; height: 17px; stroke-width: 2.1; }
.btn:hover { background: var(--accent-600); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }

.btn-soft { background: var(--surface-2); color: var(--text); box-shadow: none; border: 1px solid var(--border); }
.btn-soft:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn-soft .ic { stroke: var(--text-2); }

.btn-ghost { background: transparent; color: var(--text-2); box-shadow: none; }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }

.btn-danger { background: #ef4444; box-shadow: 0 1px 2px rgba(239,68,68,.3); }
.btn-danger:hover { background: #dc2626; }

.btn-block { width: 100%; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }

.icon-btn {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center; border-radius: var(--radius-sm);
  color: var(--text-2); position: relative;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .ic { width: 20px; height: 20px; }

.avatar {
  width: 40px; height: 40px; flex: none; border-radius: 50%;
  background: linear-gradient(135deg, #8b7bff, #5b4cf0);
  color: #fff; font-weight: 700; font-size: 15px;
  display: grid; place-items: center; letter-spacing: .01em;
  box-shadow: 0 2px 8px rgba(91,76,240,.35);
}
.avatar-lg { width: 44px; height: 44px; font-size: 17px; }

/* колокольчик-бейдж */
.badge {
  position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px;
  padding: 0 4px; border-radius: 99px; background: #ef4444; color: #fff;
  font-size: 10.5px; font-weight: 700; display: grid; place-items: center;
  border: 2px solid var(--surface); line-height: 1;
}

/* ───────────────────────── Поповеры ───────────────────────── */
.pop-wrap { position: relative; }
.pop {
  position: absolute; top: calc(100% + 10px); right: 0;
  min-width: 230px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-pop); padding: 7px; z-index: 60;
  animation: pop-in .14s var(--ease);
}
.pop-right { right: 0; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
.pop-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: var(--radius-sm); font-size: 13.5px;
  color: var(--text); text-align: left; transition: background .12s var(--ease);
}
.pop-item:hover { background: var(--row-hover); }
.pop-ic { width: 18px; display: inline-grid; place-items: center; color: var(--text-2); font-size: 14px; }
.pop-danger { color: #ef4444; } .pop-danger:hover { background: rgba(239,68,68,.10); }
.pop-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.pop-user { display: flex; gap: 11px; align-items: center; padding: 8px 8px 10px; }
.pop-user-name { font-weight: 650; font-size: 14px; }
.pop-user-mail { font-size: 12px; color: var(--text-2); }
.pop-head { padding: 8px 10px 6px; font-size: 12px; font-weight: 650; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }

/* лента уведомлений */
.notif { display: flex; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); align-items: flex-start; cursor: pointer; }
.notif:hover { background: var(--row-hover); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; }
.notif-title { font-size: 13px; font-weight: 550; line-height: 1.35; }
.notif-meta { font-size: 11.5px; color: var(--text-2); margin-top: 2px; }

/* ───────────────────────── Чипы / теги ───────────────────────── */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: color-mix(in srgb, var(--c, var(--accent)) 13%, transparent);
  color: color-mix(in srgb, var(--c, var(--accent)) 72%, var(--text));
}
html[data-theme="dark"] .tag { color: color-mix(in srgb, var(--c, var(--accent)) 62%, #fff); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--accent)); flex: none; }

.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 26px; padding: 0 11px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: color-mix(in srgb, var(--c) 14%, transparent);
  color: color-mix(in srgb, var(--c) 70%, var(--text));
}
html[data-theme="dark"] .status-pill { color: color-mix(in srgb, var(--c) 60%, #fff); }
.status-pill .dot { background: var(--c); }

/* значок канала */
.chan-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none;
           background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); }
.chan-ic svg { width: 17px; height: 17px; }
.chan-ic.solid { background: var(--c); color: #fff; }

/* ───────────────────────── Тосты ───────────────────────── */
.toast-root { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast {
  display: flex; align-items: center; gap: 11px; min-width: 240px; max-width: 380px;
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius); box-shadow: var(--shadow-3); padding: 13px 15px;
  font-size: 13.5px; animation: toast-in .22s var(--ease);
}
.toast.ok { border-left-color: #22c55e; } .toast.err { border-left-color: #ef4444; }
.toast.leaving { animation: toast-out .2s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }
.toast-ic { width: 20px; height: 20px; flex: none; }

/* ════════════════════════════ Модалки ════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; background: var(--scrim);
  backdrop-filter: blur(2px); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 18px 18px; overflow-y: auto;
  animation: fade .16s var(--ease);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 560px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3); animation: modal-in .2s var(--ease);
  display: flex; flex-direction: column; max-height: 88vh;
}
.modal.lg { max-width: 720px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; }
.modal-head .close { margin-left: auto; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 22px; border-top: 1px solid var(--border); }
.modal-foot .spread { margin-right: auto; }

/* ───────────────────────── Формы ───────────────────────── */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 13px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; color: var(--text);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}
.textarea { height: auto; padding: 11px 13px; resize: vertical; min-height: 80px; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent); background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2397a0b0' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.hint { font-size: 11.5px; color: var(--text-3); margin-top: 6px; }
.err-text { color: #ef4444; font-size: 12px; margin-top: 6px; }
.input.invalid, .select.invalid { border-color: #ef4444; box-shadow: 0 0 0 4px rgba(239,68,68,.12); }

/* переключатель (toggle) */
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.toggle input { display: none; }
.toggle-track { width: 40px; height: 23px; border-radius: 99px; background: var(--border-strong); position: relative; transition: background .18s var(--ease); flex: none; }
.toggle-track::after { content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: transform .18s var(--ease); }
.toggle input:checked + .toggle-track { background: var(--accent); }
.toggle input:checked + .toggle-track::after { transform: translateX(17px); }
.toggle-label { font-size: 13.5px; }

/* сегментированный контрол (Таблица|Календарь, период диаграммы) */
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.segmented button { padding: 7px 14px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--text-2); transition: all .14s var(--ease); }
.segmented button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
html[data-theme="dark"] .segmented button.is-active { background: var(--surface-3); }

/* выбор цвета */
.color-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.color-dot { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; position: relative; border: 2px solid transparent; transition: transform .12s var(--ease); }
.color-dot:hover { transform: scale(1.12); }
.color-dot.is-active { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }
.color-dot.is-active::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 700; }

/* выбор типа канала (radio-карточки) */
.type-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.type-card { border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 12px 10px; display: flex; flex-direction: column; align-items: center; gap: 7px; cursor: pointer; transition: all .14s var(--ease); }
.type-card:hover { border-color: var(--border-strong); background: var(--surface-2); }
.type-card.is-active { border-color: var(--accent); background: var(--accent-soft-2); }
.type-card .chan-ic { width: 34px; height: 34px; }
.type-card span { font-size: 12.5px; font-weight: 600; }

/* загрузка файлов */
.dropzone { border: 1.5px dashed var(--border-strong); border-radius: var(--radius); padding: 18px; text-align: center; color: var(--text-2); cursor: pointer; transition: all .15s var(--ease); }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft-2); color: var(--accent); }
.dropzone .ic { width: 22px; height: 22px; margin: 0 auto 6px; }
.file-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.file-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.file-chip .fc-ic { width: 30px; height: 30px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.file-chip .fc-name { font-size: 13px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip .fc-size { font-size: 11.5px; color: var(--text-3); }
.file-chip .fc-actions { margin-left: auto; display: flex; gap: 2px; }

/* редактор (Editor.js) */
.editor-shell { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); padding: 6px 12px; min-height: 130px; transition: border-color .15s var(--ease); }
.editor-shell:focus-within { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
.codex-editor__redactor { padding-bottom: 40px !important; }
.ce-block__content, .ce-toolbar__content { max-width: none; }
.cdx-block { font-size: 14px; }

/* ════════════════════════ Карточки/панели ════════════════════════ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.panel-h { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.panel-h h3 { font-size: 14.5px; font-weight: 700; }
.panel-h .count { font-size: 12px; color: var(--text-2); background: var(--surface-3); padding: 2px 8px; border-radius: 99px; font-weight: 600; }

/* ───────── Контентная страница (каналы) ───────── */
.channels-layout { display: grid; grid-template-columns: 296px 1fr; gap: 20px; padding: 24px 26px 30px; align-items: start; }
.chan-list-wrap { min-width: 0; }
.chan-main { min-width: 0; }   /* критично: колонка может ужиматься → нет горизонтального скролла страницы */

.chan-list { display: flex; flex-direction: column; gap: 10px; }
.chan-card {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: border-color .15s var(--ease), transform .12s var(--ease), box-shadow .15s var(--ease);
  position: relative;
}
.chan-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-1); }
.chan-card.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-2); }
.chan-card .chan-meta { min-width: 0; flex: 1; }
.chan-card .chan-name { font-weight: 650; font-size: 14px; display: flex; align-items: center; gap: 7px; }
.chan-card .chan-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.chan-card .chan-count { font-size: 12.5px; font-weight: 700; color: var(--text); background: var(--surface-3); border-radius: 8px; padding: 4px 9px; }
.pin { color: var(--accent); }

.progress-card { padding: 16px; }
.progress-card h4 { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.progress-card .sub { font-size: 12px; color: var(--text-2); margin-bottom: 14px; }
.progress-bar { height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; display: flex; }
.progress-bar i { height: 100%; display: block; }
.progress-legend { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.pl-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.pl-row .val { margin-left: auto; font-weight: 700; }

/* шапка раздела канала */
.chan-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.chan-head .chan-ic { width: 44px; height: 44px; border-radius: 12px; }
.chan-head .chan-ic svg { width: 22px; height: 22px; }
.chan-head h2 { font-size: 18px; font-weight: 750; letter-spacing: -.01em; display: flex; align-items: center; gap: 9px; }
.chan-head .chan-sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.chan-head .head-actions { margin-left: auto; display: flex; gap: 9px; align-items: center; }

/* панель инструментов таблицы */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .search { margin-left: 0; width: 260px; max-width: none; }
.filter-select { height: 38px; }
.toolbar .spacer { flex: 1; }

/* фильтры-чипы (каналы/типы/статусы в календаре) */
.chip-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.fchip {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px;
  border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--surface);
  font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: all .14s var(--ease);
}
.fchip:hover { border-color: var(--border-strong); color: var(--text); }
.fchip.is-active { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.fchip .dot { width: 9px; height: 9px; }

/* ════════════════════════════ Таблица ════════════════════════════ */
.table-wrap { overflow-x: auto; max-width: 100%; }
.ctable { width: 100%; border-collapse: collapse; min-width: 760px; }
.ctable thead th {
  text-align: left; font-size: 11.5px; font-weight: 650; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .04em; padding: 12px 14px;
  border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface);
  position: sticky; top: 0;
}
.ctable thead th.sortable { cursor: pointer; user-select: none; }
.ctable thead th.sortable:hover { color: var(--text); }
.ctable tbody td { padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.ctable tbody tr { transition: background .12s var(--ease); }
.ctable tbody tr.main-row:hover { background: var(--row-hover); }
.ctable tbody tr.is-done .c-title { color: var(--text-3); text-decoration: line-through; }

.c-grip { color: var(--text-3); cursor: grab; width: 16px; opacity: .55; transition: opacity .12s; }
.main-row:hover .c-grip { opacity: 1; }
.c-grip:active { cursor: grabbing; }
.c-title-cell { display: flex; align-items: center; gap: 10px; }
.c-title { font-weight: 600; font-size: 13.6px; }
.c-hash { font-size: 12px; color: var(--text-3); }
.c-info-btn { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; max-width: 280px; cursor: pointer; }
.c-info-btn .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-info-btn:hover { color: var(--accent); }
.c-info-btn .chev { width: 15px; height: 15px; transition: transform .18s var(--ease); flex: none; }
.c-info-btn.open .chev { transform: rotate(90deg); }
.c-files { display: flex; align-items: center; gap: 5px; color: var(--text-2); font-size: 12.5px; }
.c-empty-files { color: var(--text-3); }

.check {
  width: 22px; height: 22px; border-radius: 7px; border: 1.8px solid var(--border-strong);
  display: grid; place-items: center; cursor: pointer; transition: all .14s var(--ease); background: var(--surface);
}
.check:hover { border-color: var(--accent); }
.check.on { background: var(--accent); border-color: var(--accent); }
.check svg { width: 14px; height: 14px; stroke: #fff; stroke-width: 3; opacity: 0; transform: scale(.6); transition: all .14s var(--ease); }
.check.on svg { opacity: 1; transform: none; }

.row-menu-btn { color: var(--text-3); }
.row-menu-btn:hover { color: var(--text); }

/* раскрытая «Информация» */
.info-row td { padding: 0 !important; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.info-pane { padding: 6px 18px 20px 44px; animation: fade .18s var(--ease); }
.info-render { font-size: 14px; line-height: 1.62; color: var(--text); max-width: 760px; }
.info-render h3 { font-size: 15.5px; font-weight: 700; margin: 14px 0 6px; }
.info-render p { margin: 8px 0; }
.info-render ul, .info-render ol { margin: 8px 0; padding-left: 22px; }
.info-render li { margin: 3px 0; }
.info-render blockquote { border-left: 3px solid var(--accent); padding: 4px 14px; color: var(--text-2); margin: 10px 0; background: var(--accent-soft-2); border-radius: 0 8px 8px 0; }
.info-render hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.info-render .cl-item { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0; }
.info-render .cl-box { width: 17px; height: 17px; border-radius: 5px; border: 1.6px solid var(--border-strong); flex: none; margin-top: 2px; display: grid; place-items: center; }
.info-render .cl-box.on { background: #22c55e; border-color: #22c55e; color: #fff; font-size: 11px; }
.info-actions { margin-top: 14px; display: flex; gap: 8px; }
.info-empty { color: var(--text-3); font-style: italic; }

/* пагинация */
.pager { display: flex; align-items: center; gap: 12px; padding: 14px 4px 2px; justify-content: space-between; flex-wrap: wrap; }
.pager .info { font-size: 12.5px; color: var(--text-2); }
.pager .pages { display: flex; gap: 4px; }
.pager .pg { min-width: 34px; height: 34px; padding: 0 8px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--text-2); display: grid; place-items: center; }
.pager .pg:hover:not(:disabled) { border-color: var(--border-strong); color: var(--text); }
.pager .pg.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager .pg:disabled { opacity: .4; cursor: default; }

/* ════════════════════════ Календарь ════════════════════════ */
.calendar-layout { display: grid; grid-template-columns: 1fr 312px; gap: 20px; padding: 24px 26px 30px; align-items: start; }
.cal-main { min-width: 0; }
.cal-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-filters { margin-bottom: 16px; display: flex; flex-direction: column; gap: 10px; }
.cal-filter-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cal-filter-group .lbl { font-size: 12px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; min-width: 64px; }

.cal-card { padding: 8px; }

/* правый столбец */
.cal-side { display: flex; flex-direction: column; gap: 18px; }
.side-list { display: flex; flex-direction: column; }
.side-item { display: flex; align-items: center; gap: 11px; padding: 11px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .12s var(--ease); }
.side-item:last-child { border-bottom: none; }
.side-item:hover { background: var(--row-hover); }
.side-time { font-size: 12px; font-weight: 700; color: var(--text-2); width: 40px; flex: none; }
.side-title { font-size: 13px; font-weight: 550; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.side-date { font-size: 11px; color: var(--text-3); }
.side-empty { padding: 22px 16px; text-align: center; color: var(--text-3); font-size: 13px; }

/* кольцевая диаграмма */
.donut-wrap { padding: 18px; }
.donut-canvas-box { position: relative; width: 168px; height: 168px; margin: 4px auto 16px; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none; }
.donut-total { font-size: 27px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.donut-total-label { font-size: 11px; color: var(--text-2); margin-top: 3px; }
.donut-legend { display: flex; flex-direction: column; gap: 9px; }
.dl-row { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.dl-row .val { margin-left: auto; font-weight: 700; color: var(--text); }
.dl-row .pct { color: var(--text-3); font-size: 11.5px; width: 34px; text-align: right; }

/* легенда каналов */
.legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 14px 18px; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 550; color: var(--text-2); }

/* ─── FullCalendar — кастомизация под тему ─── */
.fc { --fc-border-color: var(--border); --fc-today-bg-color: var(--accent-soft-2); --fc-page-bg-color: transparent;
      --fc-neutral-bg-color: var(--surface-2); --fc-list-event-hover-bg-color: var(--row-hover); }
.fc .fc-toolbar.fc-header-toolbar { margin-bottom: 12px; }
.fc .fc-toolbar-title { font-size: 16px !important; font-weight: 750; letter-spacing: -.01em; text-transform: capitalize; }
.fc .fc-button { background: var(--surface-2) !important; border: 1px solid var(--border) !important; color: var(--text-2) !important;
                 font-weight: 600 !important; font-size: 12.5px !important; padding: 6px 12px !important; box-shadow: none !important; text-transform: none; transition: all .14s var(--ease); }
.fc .fc-button:hover { background: var(--surface-3) !important; color: var(--text) !important; }
.fc .fc-button-primary:not(:disabled).fc-button-active { background: var(--accent) !important; border-color: var(--accent) !important; color: #fff !important; }
.fc .fc-button-group > .fc-button { border-radius: 0 !important; }
.fc .fc-button-group > .fc-button:first-child { border-radius: 8px 0 0 8px !important; }
.fc .fc-button-group > .fc-button:last-child { border-radius: 0 8px 8px 0 !important; }
.fc .fc-button:focus { box-shadow: 0 0 0 3px var(--accent-soft) !important; }
.fc .fc-col-header-cell-cushion { font-size: 12px; font-weight: 650; color: var(--text-2); padding: 8px 4px; text-transform: capitalize; }
.fc .fc-daygrid-day-number { font-size: 12.5px; color: var(--text-2); padding: 6px 8px; font-weight: 550; }
.fc .fc-day-today .fc-daygrid-day-number { color: var(--accent); font-weight: 800; }
.fc .fc-daygrid-day.fc-day-today { background: var(--accent-soft-2); }
.fc-theme-standard td, .fc-theme-standard th { border-color: var(--border); }
.fc .fc-scrollgrid { border-radius: var(--radius); overflow: hidden; }
.fc .fc-daygrid-day-frame { min-height: 96px; }

/* событие-чип */
.cal-ev { display: flex; align-items: center; gap: 6px; padding: 3px 7px; border-radius: 7px; font-size: 12px; font-weight: 600;
          overflow: hidden; cursor: pointer; background: color-mix(in srgb, var(--c) 14%, var(--surface));
          border-left: 3px solid var(--c); color: var(--text); transition: transform .1s var(--ease), box-shadow .12s; }
.cal-ev:hover { box-shadow: var(--shadow-1); }
.cal-ev .ev-time { font-size: 11px; color: var(--text-2); font-weight: 600; flex: none; }
.cal-ev .ev-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev.done { opacity: .6; }
.cal-ev.done .ev-title { text-decoration: line-through; }
.cal-ev.overdue { border-left-color: #ef4444; background: color-mix(in srgb, #ef4444 12%, var(--surface)); }
.fc-daygrid-event-harness { margin-top: 2px !important; }
.fc-event { background: transparent !important; border: none !important; box-shadow: none !important; }
.fc-h-event .fc-event-main, .fc-daygrid-event .fc-event-main { padding: 0 !important; color: inherit !important; }
.fc-timegrid-event .cal-ev { height: 100%; align-items: flex-start; flex-direction: column; gap: 1px; }

/* ─── Пустые состояния ─── */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 56px 24px; text-align: center; color: var(--text-2);
}
.empty .empty-ic { width: 56px; height: 56px; border-radius: 16px; background: var(--accent-soft); color: var(--accent);
                   display: grid; place-items: center; margin-bottom: 16px; }
.empty .empty-ic svg { width: 28px; height: 28px; }
.empty h3 { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty p { font-size: 13.5px; max-width: 320px; margin-bottom: 18px; }

/* скелетоны загрузки */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
            background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.sk-line { height: 14px; margin: 8px 0; }

/* служебное */
.only-mobile { display: none; }
.only-desktop { display: inline; }
html[data-theme="light"] .ic-moon { display: none; }
html[data-theme="dark"]  .ic-sun  { display: none; }
.spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: rot .7s linear infinite; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }
.mt-card { margin-top: 16px; }

/* ════════════════════════ Адаптив ════════════════════════ */
@media (max-width: 1140px) {
  .calendar-layout { grid-template-columns: 1fr; }
  .cal-side { order: -1; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .cal-side .donut-card { grid-row: span 2; }
}
@media (max-width: 980px) {
  .channels-layout { grid-template-columns: 1fr; }
  .chan-list-wrap { order: 0; }
}
@media (max-width: 760px) {
  :root { --topbar-h: 64px; }
  .sidebar {
    position: fixed; left: 0; top: 0; transform: translateX(-100%);
    transition: transform .26s var(--ease); box-shadow: var(--shadow-3);
  }
  body.nav-open .sidebar { transform: none; }
  .only-mobile { display: grid; }
  .only-desktop { display: none; }
  .topbar { padding: 12px 14px; gap: 10px; }
  .topbar-title h1 { font-size: 16px; }
  .topbar-title p { display: none; }
  .search { display: none; }
  body.search-open .search { display: flex; position: absolute; left: 10px; right: 10px; top: 10px; width: auto; max-width: none; z-index: 40; }
  .scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 39; }
  .calendar-layout, .channels-layout { padding: 16px 14px; gap: 16px; }
  .cal-side { grid-template-columns: 1fr; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { max-width: 100%; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 94vh; }
  .row2 { grid-template-columns: 1fr; }
  .type-grid { grid-template-columns: repeat(3, 1fr); }
  .toast-root { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: none; }
  .fc .fc-toolbar.fc-header-toolbar { flex-direction: column; gap: 8px; align-items: stretch; }
  .fc .fc-daygrid-day-frame { min-height: 70px; }
}
@media (max-width: 420px) {
  .chan-head .head-actions { width: 100%; }
  .chan-head .head-actions .btn { flex: 1; }
}

/* доступность */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
