/* ============================================================
   upost — панель управления
   Оглавление:
     01. Токены
     02. База, иконки, утилиты
     03. Кнопки и элементы управления
     04. Каркас: боковое меню
     05. Каркас: страницы, карточки, показатели
     06. Главная
     07. Карта каналов
     08. Создание публикации
     09. Календарь и лента
     10. История
     11. Подключения
     12. Команда
     13. Настройки
     14. Модальные окна и уведомления
     15. Нижняя панель и адаптив
   Правило файла: каждый селектор описан один раз, в своём разделе.
   ============================================================ */

/* ── 01. Токены ─────────────────────────────────────────── */
:root {
  /* Палитра: #00887A · #FFCCBC · #FFFFFF · #D3E3FC · #77A6F7.
     Производные (-ink, -hover) темнее исходных: светлые тона палитры
     не дают контраста 4.5:1 для мелкого текста на белом.
     Роли: бирюзовый — главное действие, голубой — выбор и навигация,
     персиковый — «обратите внимание». */

  /* Поверхности */
  --c-bg: #F4F8FE;
  --c-surface: #FFFFFF;
  --c-surface-2: #F8FBFF;
  --c-surface-3: #EAF1FD;

  /* Текст */
  --c-ink: #0F2340;
  --c-ink-2: #34465F;
  --c-muted: #5E6E85;

  /* Линии */
  --c-line: #D5E2F6;
  --c-line-2: #E6EEFA;
  --c-line-strong: #9FBDF2;

  /* Фирменные */
  --c-navy: #0F2A4D;
  --c-navy-2: #1E3F6B;
  --c-brand: #00887A;
  --c-brand-hover: #006F63;
  --c-brand-ink: #006B5F;
  --c-brand-soft: #DDF1EE;
  --c-accent: #2F63C0;
  --c-accent-hover: #244F9C;
  --c-accent-soft: #D3E3FC;
  --c-periwinkle: #77A6F7;
  --c-peach: #FFCCBC;
  --c-peach-soft: #FFEDE7;
  --c-peach-ink: #9A3B1E;

  /* Сайдбар — светло-голубой тон палитры */
  --side-bg: #D3E3FC;
  --side-ink: #0F2A4D;
  --side-muted: #3E5780;
  --side-line: rgba(15, 42, 77, .1);
  --side-hover: rgba(255, 255, 255, .55);

  /* Статусы */
  --c-success: #12704B;
  --c-success-soft: #E9F5EF;
  --c-warning: #8A5A00;
  --c-warning-soft: #FBF2E3;
  --c-danger: #A5261D;
  --c-danger-soft: #FBECEB;

  /* Форма: мягкие углы и тени вместо рамок */
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-pill: 999px;
  --shadow: 0 1px 2px rgba(15, 42, 77, .04), 0 4px 16px rgba(15, 42, 77, .05);
  --shadow-lift: 0 2px 4px rgba(15, 42, 77, .06), 0 10px 28px rgba(15, 42, 77, .1);
  --shadow-pop: 0 16px 44px rgba(15, 35, 64, .22);

  /* Размеры каркаса */
  --side-w: 260px;
  --side-w-folded: 76px;
  --page-pad: 32px;
  --tabbar-h: 68px;

  /* Шрифты: Onest подключён в index.html, без сети работает запасной. */
  --font: Onest, Inter, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Consolas, "Liberation Mono", monospace;
}

/* ── 02. База, иконки, утилиты ──────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-ink);
  font: 400 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }

/* Классы ниже задают display, поэтому [hidden] нужно усилить. */
[hidden] { display: none !important; }
b, strong { font-weight: 600; }
img { max-width: 100%; }
button, input, select { font-family: inherit; }

a { color: var(--c-accent); }

:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  flex: none;
  width: 20px; height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 8px; top: -60px;
  z-index: 200;
  padding: 10px 14px;
  background: var(--c-navy);
  color: #fff;
  border-radius: var(--r-md);
  text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus { top: 8px; }

.noscript {
  padding: 12px 16px;
  background: var(--c-warning-soft);
  color: var(--c-warning);
}

/* ── 03. Кнопки и элементы управления ───────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: none;
  color: inherit;
  font: 600 14px/1 var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.btn .icon { width: 18px; height: 18px; }

.btn--primary {
  background: var(--c-brand);
  border-color: var(--c-brand);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 136, 122, .28);
}
.btn--primary:hover { background: var(--c-brand-hover); border-color: var(--c-brand-hover); }

.btn--ghost {
  background: var(--c-surface);
  border-color: var(--c-line);
  color: var(--c-accent);
}
.btn--ghost:hover { background: var(--c-accent-soft); border-color: var(--c-line-strong); }

.btn--danger {
  background: var(--c-surface);
  border-color: var(--c-peach);
  color: var(--c-danger);
}
.btn--danger:hover { background: var(--c-danger-soft); }

.btn--sm { min-height: 34px; padding: 0 14px; font-size: 13px; }

.btn--icon {
  width: 36px;
  min-height: 36px;
  padding: 0;
  color: var(--c-muted);
}
.btn--icon:hover { background: var(--c-surface-3); color: var(--c-accent); }

.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.linkbtn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--c-accent);
  font: 600 13px/1.4 var(--font);
  cursor: pointer;
}
.linkbtn:hover { color: var(--c-brand-ink); text-decoration: underline; }

/* Переключатель из нескольких вариантов: режим, размер, вид. */
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-md);
  background: var(--c-surface-3);
}
.mode, .device-btn, .conn-view {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--c-muted);
  font: 600 13px/1 var(--font);
  cursor: pointer;
}
.mode .icon, .conn-view .icon { width: 16px; height: 16px; }
.mode:hover, .device-btn:hover, .conn-view:hover { color: var(--c-ink); }
.mode[aria-pressed="true"],
.device-btn[aria-pressed="true"],
.conn-view[aria-pressed="true"] {
  background: var(--c-surface);
  color: var(--c-brand-ink);
  box-shadow: 0 1px 3px rgba(15, 42, 77, .14);
}
.segmented--sm .device-btn { min-height: 28px; padding: 0 11px; font-size: 12px; }

.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-pill);
  background: var(--c-surface);
  color: var(--c-ink-2);
  font: 500 13px/1 var(--font);
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.chip:hover { border-color: var(--c-line-strong); }
.chip[aria-pressed="true"] {
  background: var(--c-accent-soft);
  border-color: var(--c-line-strong);
  color: var(--c-navy);
  font-weight: 600;
}

.input,
.form-grid input,
.form-grid select,
.modal-field input,
.modal-field select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: var(--c-surface);
  color: var(--c-ink);
  font: 400 14px/1 var(--font);
  outline: 0;
}
.input:focus,
.form-grid input:focus,
.form-grid select:focus,
.modal-field input:focus,
.modal-field select:focus,
.editor-box:focus-within,
.search:focus-within {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(47, 99, 192, .16);
}
.form-grid input:disabled { background: var(--c-surface-3); color: var(--c-muted); }

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 11px;
  border-radius: var(--r-pill);
  font: 600 12px/1 var(--font);
  white-space: nowrap;
}
.pill--ok   { background: var(--c-brand-soft);   color: var(--c-brand-ink); }
.pill--plan { background: var(--c-accent-soft);  color: var(--c-accent); }
.pill--err  { background: var(--c-danger-soft);  color: var(--c-danger); }
.pill--idle { background: var(--c-surface-3);    color: var(--c-muted); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 11px;
  border-radius: var(--r-pill);
  font: 600 12px/1 var(--font);
}
.tag .icon { width: 14px; height: 14px; }
.tag--peach { background: var(--c-peach); color: var(--c-peach-ink); }

.badge {
  display: grid;
  place-items: center;
  min-width: 30px; height: 28px;
  padding: 0 9px;
  border-radius: var(--r-pill);
  background: var(--c-accent-soft);
  color: var(--c-accent);
  font-size: 13px;
  font-weight: 600;
}

/* Цветные точки и плашки сетей: один набор цветов на всё приложение. */
.dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--c-muted);
  flex: none;
}
.dot--live { background: var(--c-brand); }
.dot--off { background: var(--c-line-strong); }
.dot--telegram  { background: #1E86B8; }
.dot--instagram { background: #A3235A; }
.dot--facebook  { background: #1B5FC1; }
.dot--vk        { background: #2B6FC4; }
.dot--ok        { background: #C26A07; }
.dot--youtube   { background: #C4111F; }
.dot--tiktok    { background: #1D2939; }
.dot--linkedin  { background: #0A5FA8; }
.dot--whatsapp  { background: #0F7A4A; }

.node-icon, .avatar-mini, .channel-avatar {
  display: grid;
  place-items: center;
  flex: none;
  border-radius: var(--r-md);
  color: #fff;
  font: 700 12px/1 var(--font);
}
.node-icon { width: 40px; height: 40px; }

/* ── 04. Каркас: боковое меню ───────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
}
.app--folded { --side-w: var(--side-w-folded); }

.side-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 35, 64, .45);
}

.side {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100vh;
  padding: 16px 12px 12px;
  background: var(--side-bg);
  color: var(--side-ink);
}

.side-head { display: flex; align-items: center; gap: 8px; }
.app--folded .side-head { flex-direction: column; }

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 8px 14px;
  background: #fff;
  border-radius: var(--r-lg);
  box-shadow: 0 1px 3px rgba(15, 42, 77, .08);
}
.app--folded .brand { flex: none; width: 48px; padding: 6px; }
.brand-img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.brand-img--mark { display: none; }
.app--folded .brand-img--full { display: none; }
.app--folded .brand-img--mark { display: block; }
.brand-text { display: none; color: var(--c-accent); font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.brand-text b { color: var(--c-brand-ink); font-weight: 700; }
.brand.is-broken .brand-img { display: none; }
.brand.is-broken .brand-text { display: block; }

.collapse-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px; height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--side-muted);
  cursor: pointer;
}
.collapse-btn:hover { background: var(--side-hover); color: var(--side-ink); }
.collapse-btn .icon { width: 18px; height: 18px; transition: transform .18s ease; }
.app--folded .collapse-btn .icon { transform: rotate(180deg); }

/* Расшифровка названия: заглавные буквы собираются в слово upost. */
.side-tagline {
  padding: 12px 6px 8px;
  color: var(--side-muted);
  font-size: 11px;
  line-height: 1.45;
}
.side-tagline b { color: var(--c-brand-ink); font-weight: 700; }
.app--folded .side-tagline { display: none; }

.side-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-md);
  background: none;
  color: var(--side-ink);
  font: 500 14px/1 var(--font);
  text-align: left;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.nav-item .icon { color: var(--side-muted); }
.nav-item:hover { background: var(--side-hover); }
.nav-item.is-active {
  background: var(--c-surface);
  color: var(--c-brand-ink);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15, 42, 77, .1);
}
.nav-item.is-active .icon { color: var(--c-brand); }
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.app--folded .nav-item { justify-content: center; padding: 0; }
.app--folded .nav-label { display: none; }

.helper {
  margin-top: auto;
  border-radius: var(--r-lg);
  background: var(--side-hover);
  overflow: hidden;
  cursor: pointer;
}
.helper-art { position: relative; display: block; height: clamp(110px, 16vh, 160px); }
.helper-img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  object-position: center bottom;
  transition: opacity .25s ease;
}
.helper-img--wave { opacity: 0; }
@media (hover: hover) {
  .helper:hover .helper-img--idle { opacity: 0; }
  .helper:hover .helper-img--wave { opacity: 1; }
}
.helper.is-greeting .helper-img--idle { opacity: 0; }
.helper.is-greeting .helper-img--wave { opacity: 1; }
.helper.is-artless .helper-art { display: none; }

.helper-body { display: block; padding: 10px 14px 12px; }
.helper-body b { display: block; color: var(--side-ink); font-size: 13px; }
.helper-body small { display: block; margin-top: 2px; color: var(--side-muted); font-size: 12px; }
.app--folded .helper { display: none; }

.side-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px 2px;
  margin-top: 8px;
  border-top: 1px solid var(--side-line);
}
.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--c-brand);
  color: #fff;
  font-weight: 700;
}
.side-user-id { min-width: 0; }
.side-user-id b { display: block; color: var(--side-ink); font-size: 13px; }
.side-user-id small { display: block; color: var(--side-muted); font-size: 12px; }
.app--folded .side-user { justify-content: center; padding-inline: 0; }
.app--folded .side-user-id { display: none; }

/* ── 05. Каркас: страницы, карточки, показатели ─────────── */
.main { min-width: 0; height: 100vh; overflow: auto; }

.menu-toggle {
  display: none;
  position: fixed;
  left: 12px; top: 12px;
  z-index: 45;
  width: 42px; height: 42px;
  place-items: center;
  border: 0;
  border-radius: var(--r-md);
  background: var(--c-surface);
  color: var(--c-navy);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.page { display: none; padding: 28px var(--page-pad) 40px; }
.page.is-active { display: block; }
.page:focus { outline: 0; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.page-title { color: var(--c-navy); font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.page-desc { margin-top: 6px; color: var(--c-muted); font-size: 15px; }
.page-actions { display: flex; align-items: center; gap: 12px; }

.card {
  border: 1px solid var(--c-line-2);
  border-radius: var(--r-lg);
  background: var(--c-surface);
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.card-title { color: var(--c-navy); font-size: 17px; font-weight: 600; line-height: 1.3; }
.card-sub { margin-top: 2px; color: var(--c-muted); font-size: 13px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat { padding: 20px; }
.stat-label { display: flex; align-items: center; gap: 10px; color: var(--c-ink-2); font-size: 14px; font-weight: 500; }
.stat-icon {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: var(--r-md);
}
.stat-icon .icon { width: 18px; height: 18px; }
.stat-icon--brand  { background: var(--c-brand-soft);  color: var(--c-brand-ink); }
.stat-icon--accent { background: var(--c-accent-soft); color: var(--c-accent); }
.stat-icon--peach  { background: var(--c-peach-soft);  color: var(--c-peach-ink); }
.stat-icon--danger { background: var(--c-danger-soft); color: var(--c-danger); }
.stat strong { display: block; margin: 14px 0 4px; color: var(--c-navy); font-size: 32px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.stat small { color: var(--c-muted); font-size: 13px; }
.is-positive { color: var(--c-success); }

/* ── 06. Главная ────────────────────────────────────────── */
.dash-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; }
.dash-card { grid-column: span 3; padding: 22px; }
.dash-card--chart { grid-column: span 4; }
.dash-card--tip {
  grid-column: span 2;
  position: relative;
  overflow: hidden;
  border-color: transparent;
  background: linear-gradient(150deg, var(--c-accent-soft), var(--c-brand-soft));
}
.dash-card--wide { grid-column: 1 / -1; }

.tip-body { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; max-width: 62%; }
.tip-body p { color: var(--c-ink-2); font-size: 14px; }
.tip-art { position: absolute; right: -6px; bottom: 0; height: 88%; object-fit: contain; object-position: bottom right; }

/* Столбцы: один цвет, сегодняшний день ярче; значение — в подсказке. */
.bars {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 16px;
  height: 220px;
  background: repeating-linear-gradient(to bottom, var(--c-line-2) 0, var(--c-line-2) 1px, transparent 1px, transparent 48px);
  background-size: 100% calc(100% - 30px);
  background-repeat: no-repeat;
}
.bar {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 30px;
  align-items: end;
  outline-offset: 2px;
}
.bar-fill {
  display: block;
  height: max(calc(var(--h) * 100%), 4px);
  border-radius: 6px 6px 0 0;
  background: var(--c-periwinkle);
  transition: background-color .15s ease;
}
.bar.is-today .bar-fill { background: var(--c-brand); }
.bar:hover .bar-fill, .bar:focus-visible .bar-fill { background: var(--c-accent); }
.bar-day { align-self: end; padding-top: 10px; color: var(--c-muted); font-size: 12px; text-align: center; white-space: nowrap; }
.bar.is-today .bar-day { color: var(--c-brand-ink); font-weight: 600; }
.bar::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(30px + (100% - 30px) * var(--h) + 8px);
  z-index: 2;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  background: var(--c-navy);
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
}
.bar:hover::after, .bar:focus-visible::after { opacity: 1; }

.dash-channels { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.dash-channel {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px dashed var(--c-line-strong);
  border-radius: var(--r-md);
  background: none;
  text-align: left;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.dash-channel:hover { background: var(--c-surface-2); }
.dash-channel.is-connected { border: 1px solid var(--c-line); background: var(--c-surface-2); }
.dash-channel:not(.is-connected) .node-icon { opacity: .45; }
.dash-channel-body { min-width: 0; }
.dash-channel-body b, .dash-channel-body small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-channel-body b { font-size: 14px; }
.dash-channel-body small { color: var(--c-muted); font-size: 12px; }

/* ── 07. Карта каналов (вкладка «Карта» в подключениях) ─── */
.conn-map { display: flex; flex-direction: column; gap: 12px; }
.legend { display: flex; gap: 18px; color: var(--c-muted); font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.legend-line { display: inline-block; width: 26px; border-top: 2px solid var(--c-accent); }
.legend-line--dashed { border-top: 2px dashed var(--c-periwinkle); }

.map {
  position: relative;
  height: clamp(520px, calc(100vh - 260px), 780px);
  border: 1px solid var(--c-line-2);
  border-radius: var(--r-xl);
  background: var(--c-surface);
  background-image: radial-gradient(var(--c-line) 1.2px, transparent 1.2px);
  background-size: 26px 26px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.map-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.map-lines .line-on { stroke: var(--c-accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.map-lines .line-off { stroke: var(--c-periwinkle); stroke-width: 1.5; stroke-dasharray: 6 6; vector-effect: non-scaling-stroke; }

.map-core {
  position: absolute;
  left: 50%; top: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  width: 224px;
  padding: 18px;
  border-radius: var(--r-lg);
  background: var(--c-surface);
  box-shadow: var(--shadow-lift);
  text-align: center;
}
.core-logo { display: grid; place-items: center; height: 56px; }
.core-img { display: block; max-height: 100%; object-fit: contain; }
.core-text { display: none; color: var(--c-accent); font-size: 32px; font-weight: 700; letter-spacing: -.03em; }
.core-text b { color: var(--c-brand-ink); font-weight: 700; }
.core-logo.is-broken .core-img { display: none; }
.core-logo.is-broken .core-text { display: block; }
.core-label { display: block; margin-top: 12px; color: var(--c-muted); font-size: 13px; }

.node-layer { position: absolute; inset: 0; z-index: 3; }
.node {
  position: absolute;
  left: var(--x, 0); top: var(--y, 0);
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  gap: 2px 12px;
  width: 200px;
  padding: 12px;
  border: 1px dashed var(--c-periwinkle);
  border-radius: var(--r-lg);
  background: var(--c-surface);
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.node:hover { box-shadow: var(--shadow-lift); }
.node.is-connected { border: 1px solid var(--c-accent); }
.node.is-dragging { cursor: grabbing; box-shadow: var(--shadow-pop); }
.node .node-icon { grid-row: 1 / 3; }
.node-body { min-width: 0; }
.node-body b { display: block; font-size: 14px; }
.node-body small { display: block; color: var(--c-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node-action {
  grid-column: 2;
  justify-self: start;
  padding: 0;
  border: 0;
  background: none;
  color: var(--c-accent);
  font: 600 12px/1.4 var(--font);
  cursor: pointer;
}
.node.is-connected .node-action { color: var(--c-brand-ink); }
.node-action:hover { text-decoration: underline; }

.map-hint { color: var(--c-muted); font-size: 13px; }

/* ── 08. Создание публикации ────────────────────────────── */
.page--composer { height: 100%; }
.page--composer.is-active { display: flex; flex-direction: column; gap: 20px; }

.composer-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.composer-title { min-width: 0; flex: 1; }
.title-input {
  width: 100%;
  max-width: 640px;
  margin-left: -10px;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--c-navy);
  font: 700 26px/1.25 var(--font);
  letter-spacing: -.02em;
  outline: 0;
}
.title-input:hover { background: var(--c-surface-3); }
.title-input:focus { border-color: var(--c-accent); background: var(--c-surface); }
.draft-state { display: flex; align-items: center; gap: 6px; margin-top: 2px; color: var(--c-muted); font-size: 13px; }
.draft-state .icon { width: 15px; height: 15px; color: var(--c-brand); }
.draft-state.is-busy .icon { color: var(--c-periwinkle); }
.composer-actions { flex: none; display: flex; gap: 10px; }

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--content-w, minmax(460px, 1.5fr)) 16px minmax(340px, 1fr);
}

.pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--c-line-2);
  border-radius: var(--r-xl);
  background: var(--c-surface);
  box-shadow: var(--shadow);
}
.pane--content { overflow: auto; padding: 0 26px; }

.pane-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 12px;
}
.pane-title { color: var(--c-navy); font-size: 17px; font-weight: 600; }

.field { padding: 22px 0; border-bottom: 1px solid var(--c-line-2); }
.field:last-child { border-bottom: 0; }
.field--grow { flex: 1; display: flex; flex-direction: column; min-height: 320px; }
.field-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--c-navy);
  font-size: 15px;
  font-weight: 600;
}
.field-aside { color: var(--c-muted); font-size: 13px; font-weight: 400; }

/* Каналы: круглые плашки с иконкой сети. */
.channel-list { display: flex; flex-wrap: wrap; gap: 10px; }
.channel {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 6px 14px 6px 6px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-pill);
  background: var(--c-surface);
  color: var(--c-ink-2);
  font: 500 14px/1 var(--font);
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.channel:hover { border-color: var(--c-line-strong); }
.channel .channel-avatar { width: 32px; height: 32px; border-radius: 50%; font-size: 11px; opacity: .55; }
.channel.is-on { background: var(--c-accent-soft); border-color: var(--c-accent); color: var(--c-navy); font-weight: 600; }
.channel.is-on .channel-avatar { opacity: 1; }
.channel-check {
  display: grid;
  place-items: center;
  width: 20px; height: 20px;
  border: 1.5px solid var(--c-line-strong);
  border-radius: 50%;
  color: transparent;
}
.channel-check .icon { width: 12px; height: 12px; stroke-width: 3; }
.channel.is-on .channel-check { background: var(--c-accent); border-color: var(--c-accent); color: #fff; }
/* Канал подключён, но публикации в ленту не принимает. */
.channel.is-locked { border-style: dashed; color: var(--c-muted); cursor: not-allowed; }
.channel.is-locked .channel-check { border: 0; color: var(--c-muted); }
.channel-empty { color: var(--c-muted); font-size: 14px; }

/* Вкладки версий текста: общий и отдельный для каждого канала. */
.text-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; }
.text-tab {
  min-height: 32px;
  padding: 0 14px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-pill);
  background: var(--c-surface);
  color: var(--c-muted);
  font: 500 13px/1 var(--font);
  cursor: pointer;
}
.text-tab:hover { border-color: var(--c-line-strong); color: var(--c-accent); }
.text-tab[aria-selected="true"] { background: var(--c-brand); border-color: var(--c-brand); color: #fff; }
.text-tab.has-own::after { content: " •"; color: var(--c-peach-ink); }
.text-tab.has-own[aria-selected="true"]::after { color: var(--c-peach); }
.text-reset { margin-left: auto; }

.editor-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  background: var(--c-surface);
  overflow: hidden;
}
.toolbar { display: flex; align-items: center; gap: 2px; padding: 6px 8px; border-bottom: 1px solid var(--c-line-2); background: var(--c-surface-2); }
.tool {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--c-ink-2);
  font-size: 14px;
  cursor: pointer;
}
.tool:hover { background: var(--c-surface-3); }
.tool .icon { width: 17px; height: 17px; }
.tool-sep { width: 1px; height: 20px; margin: 0 6px; background: var(--c-line); }

.editor {
  flex: 1;
  min-height: 170px;
  padding: 16px 18px 8px;
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  outline: 0;
}
.counter { padding: 6px 16px 12px; text-align: right; color: var(--c-muted); font-size: 12px; }
.counter.is-over { color: var(--c-danger); font-weight: 600; }
.counter-note { color: var(--c-muted); }

/* Медиа: плитки-миниатюры и плитка «Добавить». */
.media { display: flex; flex-wrap: wrap; gap: 10px; }
.media-items { display: contents; }
.media-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 4px;
  width: 96px; height: 96px;
  padding: 10px;
  border-radius: var(--r-lg);
  background: linear-gradient(145deg, var(--c-periwinkle), var(--c-accent));
  color: #fff;
}
.media-item:nth-child(2) { background: linear-gradient(145deg, var(--c-brand), var(--c-periwinkle)); }
.media-item:nth-child(3) { background: linear-gradient(145deg, var(--c-navy-2), var(--c-brand)); }
.media-item b { font-size: 12px; font-weight: 600; }
.media-del {
  position: absolute;
  right: 6px; top: 6px;
  display: grid;
  place-items: center;
  width: 24px; height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 35, 64, .35);
  color: #fff;
  cursor: pointer;
}
.media-del .icon { width: 13px; height: 13px; stroke-width: 2.5; }
.media-del:hover { background: var(--c-peach-ink); }
.media-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 96px; height: 96px;
  border: 1.5px dashed var(--c-line-strong);
  border-radius: var(--r-lg);
  color: var(--c-accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.media-upload:hover { background: var(--c-accent-soft); }

.attach { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.attach-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-pill);
  background: var(--c-surface);
  color: var(--c-ink-2);
  font: 500 13px/1 var(--font);
  cursor: pointer;
}
.attach-btn .icon { width: 16px; height: 16px; color: var(--c-muted); }
.attach-btn:hover { background: var(--c-surface-2); border-color: var(--c-line-strong); }

.dispatch { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.datetime { display: flex; gap: 8px; }
.datetime .input { width: auto; }

.splitter { position: relative; cursor: col-resize; touch-action: none; }
.splitter::before {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 4px; height: 48px;
  border-radius: 2px;
  background: var(--c-line);
  transform: translate(-50%, -50%);
}
.splitter:hover::before, .splitter.is-active::before { background: var(--c-accent); }
body.is-resizing, body.is-resizing * { cursor: col-resize !important; user-select: none !important; }

/* Предпросмотр */
.preview-tabs { flex: none; display: flex; gap: 6px; padding: 0 20px 12px; overflow-x: auto; }
.preview-tab {
  flex: none;
  min-height: 32px;
  padding: 0 14px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-pill);
  background: var(--c-surface);
  color: var(--c-muted);
  font: 500 13px/1 var(--font);
  cursor: pointer;
}
.preview-tab:hover { border-color: var(--c-line-strong); }
.preview-tab[aria-selected="true"] { background: var(--c-accent-soft); border-color: var(--c-accent); color: var(--c-navy); font-weight: 600; }

.validation {
  flex: none;
  margin: 0 20px 14px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--c-brand-soft);
  color: var(--c-brand-ink);
}
.validation.has-error { background: var(--c-danger-soft); color: var(--c-danger); }
.validation-line { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.validation-icon { width: 18px; height: 18px; }
.issues { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(15, 42, 77, .1); }
.issues:empty { display: none; }
.issue { display: flex; align-items: flex-start; gap: 8px; color: var(--c-ink-2); font-size: 13px; line-height: 1.4; }
.issue .dot { margin-top: 5px; }
.issue.is-error { color: var(--c-danger); }
.issue.is-hint { color: var(--c-ink-2); }

.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  padding: 22px 18px;
  background: var(--c-surface-3);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
  overflow: auto;
}

/* Пост: у каждой сети свой порядок блоков, как в самой сети. */
.post {
  display: flex;
  flex-direction: column;
  width: min(100%, 390px);
  height: max-content;
  border-radius: var(--r-lg);
  background: var(--c-surface);
  box-shadow: var(--shadow-lift);
  overflow: hidden;
}
.pane--preview.is-tablet .post { width: min(100%, 560px); }

.post-head { order: 0; display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.post-mark {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  padding: 4px;
  border: 1px solid var(--c-line);
  border-radius: 50%;
  background: var(--c-surface);
  flex: none;
}
.post-img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.post-text { display: none; color: var(--c-brand-ink); font-size: 12px; font-weight: 700; }
.post-mark.is-broken .post-img { display: none; }
.post-mark.is-broken .post-text { display: block; }
.post-id { flex: 1; min-width: 0; }
.post-id b { display: block; font-size: 14px; }
.post-id small { display: block; color: var(--c-muted); font-size: 12px; }
.post-more { color: var(--c-muted); }

.post-body { order: 1; padding: 4px 14px 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.post-body:empty::before { content: "Текст публикации появится здесь"; color: var(--c-muted); }

.post-media {
  order: 2;
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, var(--c-brand), var(--c-accent));
  color: rgba(255, 255, 255, .9);
}
.post-media .icon { width: 44px; height: 44px; stroke-width: 1.4; }
.post-media-count {
  position: absolute;
  right: 10px; top: 10px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: rgba(15, 35, 64, .4);
  font-size: 12px;
}
.post-media-count:empty { display: none; }
.pane--preview.is-tablet .post-media { aspect-ratio: 16 / 9; }

.post-actions { order: 3; display: none; gap: 14px; padding: 12px 14px 2px; color: var(--c-ink); }
.post-actions .post-save { margin-left: auto; }
.post-foot {
  order: 4;
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  padding: 0 14px 12px;
  color: var(--c-muted);
  font-size: 12px;
}
.post-views { display: inline-flex; align-items: center; gap: 5px; }
.post-views .icon { width: 14px; height: 14px; }
.post-reactions {
  order: 5;
  display: none;
  justify-content: space-around;
  padding: 8px 10px;
  border-top: 1px solid var(--c-line-2);
  color: var(--c-muted);
  font-size: 12px;
  font-weight: 600;
}
.post-reactions span { display: inline-flex; align-items: center; gap: 6px; }
.post-reactions .icon { width: 16px; height: 16px; }

/* Instagram: медиа сверху, под ним действия и подпись. */
.post--instagram .post-media { order: 1; aspect-ratio: 4 / 5; }
.post--instagram .post-actions { display: flex; }
.post--instagram .post-body { order: 4; padding-top: 6px; }
.post--instagram .post-foot { order: 5; }
.pane--preview.is-tablet .post--instagram .post-media { aspect-ratio: 1 / 1; }
/* Telegram: пузырь — вложение, подпись, просмотры и время. */
.post--telegram .post-media { order: 1; }
.post--telegram .post-body { order: 2; padding-top: 12px; }
.post--telegram .post-foot { order: 3; }
/* Facebook и LinkedIn: текст, затем медиа и реакции. */
.post--facebook .post-reactions,
.post--linkedin .post-reactions { display: flex; }

/* ── 09. Календарь и лента ──────────────────────────────── */
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-nav .btn--icon { border-color: var(--c-line); background: var(--c-surface); }
.cal-nav strong { min-width: 160px; color: var(--c-navy); font-size: 18px; font-weight: 600; text-align: center; }

.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.cal-card { padding: 16px; }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-week span { padding: 4px 10px 12px; color: var(--c-muted); font-size: 12px; font-weight: 600; text-align: right; }

.cal-day { min-height: 112px; padding: 8px; border-top: 1px solid var(--c-line-2); border-right: 1px solid var(--c-line-2); }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.is-muted { background: var(--c-surface-2); }
.cal-day.is-muted .cal-date { color: #98A6BB; }
.cal-date {
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  margin-left: auto;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 600;
}
.cal-day.is-today .cal-date { background: var(--c-brand); color: #fff; }

.cal-event {
  margin-top: 6px;
  padding: 5px 8px;
  border-radius: var(--r-sm);
  background: var(--c-accent-soft);
  color: var(--c-accent);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-event--done { background: var(--c-brand-soft); color: var(--c-brand-ink); }
.cal-event--draft { background: var(--c-peach-soft); color: var(--c-peach-ink); }

.agenda { padding: 22px; }
.feed { display: flex; flex-direction: column; }
.feed-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--c-line-2);
}
.feed-item:last-child { border-bottom: 0; padding-bottom: 0; }
.feed-item:first-child { padding-top: 0; }
.feed-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 48px; height: 48px;
  border-radius: var(--r-md);
  background: var(--c-accent-soft);
  color: var(--c-accent);
  line-height: 1.1;
}
.feed-date b { font-size: 17px; }
.feed-date small { font-size: 11px; }
.feed-date--time { width: 56px; }
.feed-date--time b { font-size: 14px; }
.feed-date--danger { background: var(--c-danger-soft); color: var(--c-danger); }
.feed-date--peach { background: var(--c-peach-soft); color: var(--c-peach-ink); }
.feed-body { flex: 1; min-width: 0; }
.feed-body b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.feed-body small { display: flex; align-items: center; gap: 7px; color: var(--c-muted); font-size: 13px; }
.feed-empty { display: flex; align-items: center; gap: 10px; padding: 8px 0; color: var(--c-muted); font-size: 14px; }
.feed-empty .icon { color: var(--c-brand); }

/* ── 10. История ────────────────────────────────────────── */
.table-card { overflow: hidden; }
.table-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--c-line-2); }
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(320px, 40vw);
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: var(--c-surface);
  color: var(--c-muted);
}
.search input { width: 100%; border: 0; outline: 0; background: none; color: var(--c-ink); font: 400 14px/1 var(--font); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  height: 44px;
  padding: 0 20px;
  background: var(--c-surface-2);
  color: var(--c-muted);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}
td { padding: 14px 20px; border-top: 1px solid var(--c-line-2); font-size: 14px; vertical-align: middle; }
td b { display: block; font-size: 14px; }
td small { display: block; margin-top: 2px; color: var(--c-muted); font-size: 13px; }
tbody tr:hover { background: var(--c-surface-2); }

.stack { display: flex; }
.stack .dot { width: 22px; height: 22px; margin-left: -6px; border: 2px solid var(--c-surface); }
.stack .dot:first-child { margin-left: 0; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 28px 20px 36px; color: var(--c-muted); text-align: center; }
.empty-art { height: 150px; margin-bottom: 8px; object-fit: contain; }
.empty b { color: var(--c-navy); font-size: 16px; }

/* ── 11. Подключения ────────────────────────────────────── */
.quota { padding: 8px 16px; border-radius: var(--r-md); background: var(--c-surface); box-shadow: var(--shadow); }
.quota > span { display: block; color: var(--c-muted); font-size: 12px; }
.quota strong { display: block; color: var(--c-navy); font-size: 16px; white-space: nowrap; }
.quota strong b { color: var(--c-brand-ink); }

.sync-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; padding: 14px 20px; }
.sync-state, .provider-state { display: flex; align-items: center; gap: 12px; }
.sync-state b, .provider-state b { display: block; font-size: 14px; }
.sync-state small, .provider-state small { display: block; color: var(--c-muted); font-size: 13px; }

.conn-groups { display: flex; flex-direction: column; gap: 28px; }
.conn-group-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.section-kicker { color: var(--c-brand-ink); font-size: 13px; font-weight: 600; }
.section-title { margin-top: 2px; color: var(--c-navy); font-size: 20px; font-weight: 700; }
.conn-group-desc { margin-top: 4px; color: var(--c-muted); font-size: 14px; }

.provider-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 14px 20px;
  border: 1px solid var(--c-line-2);
  border-radius: var(--r-lg);
  background: var(--c-surface);
  box-shadow: var(--shadow);
}
.provider-actions { display: flex; gap: 8px; flex: none; }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.conn-card {
  display: flex;
  flex-direction: column;
  padding: 20px;
  border: 1px solid var(--c-line-2);
  border-radius: var(--r-lg);
  background: var(--c-surface);
  box-shadow: var(--shadow);
}
.conn-card.is-connected { border-color: var(--c-line-strong); }
.conn-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.conn-card h2 { margin: 16px 0 6px; color: var(--c-navy); font-size: 18px; font-weight: 600; }
.conn-card p { min-height: 42px; color: var(--c-muted); font-size: 14px; line-height: 1.45; }
.conn-account { display: flex; align-items: center; gap: 12px; margin: 14px 0; padding: 10px; border-radius: var(--r-md); background: var(--c-surface-2); }
.conn-id { min-width: 0; }
.conn-account b, .conn-account small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-account b { font-size: 14px; }
.conn-account small { color: var(--c-muted); font-size: 13px; }
.avatar-mini { width: 38px; height: 38px; font-size: 11px; }
.conn-empty { display: grid; place-items: center; min-height: 58px; margin: 14px 0; border: 1px dashed var(--c-line-strong); border-radius: var(--r-md); color: var(--c-muted); font-size: 13px; }
.conn-card .conn-tag { min-height: 0; margin-top: 10px; padding: 6px 10px; border-radius: var(--r-sm); background: var(--c-peach-soft); color: var(--c-peach-ink); font-size: 13px; }
.conn-card .btn { margin-top: auto; width: 100%; }

/* ── 12. Команда ────────────────────────────────────────── */
.team-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.team-card, .perm-card { padding: 22px; }

.member {
  display: grid;
  grid-template-columns: minmax(230px, 1.4fr) 110px 150px 36px;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--c-line-2);
}
.member:last-child { border-bottom: 0; padding-bottom: 0; }
.member-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.member-id b { display: block; font-size: 14px; }
.member-id small { display: block; color: var(--c-muted); font-size: 13px; }
.member-avatar {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border-radius: 50%;
  color: #fff;
  font: 700 13px/1 var(--font);
  flex: none;
}
.member-avatar--brand { background: var(--c-brand); }
.member-avatar--accent { background: var(--c-accent); }
.member-avatar--teal { background: var(--c-navy-2); }
.member-avatar--amber { background: var(--c-peach-ink); }
.member-avatar--lg { width: 60px; height: 60px; font-size: 16px; }

.role { justify-self: start; padding: 5px 12px; border-radius: var(--r-pill); background: var(--c-accent-soft); color: var(--c-accent); font-size: 12px; font-weight: 600; }
.role--owner { background: var(--c-brand-soft); color: var(--c-brand-ink); }
.role--analyst { background: var(--c-peach-soft); color: var(--c-peach-ink); }
.member-state { color: var(--c-muted); font-size: 13px; }
.member-state.is-online { color: var(--c-success); }
.member-state.is-pending { color: var(--c-peach-ink); }

.perm { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--c-line-2); }
.perm:first-child { padding-top: 0; }
.perm:last-child { border-bottom: 0; }
.perm-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-md); }
.perm-icon--owner { background: var(--c-brand-soft); color: var(--c-brand-ink); }
.perm-icon--editor { background: var(--c-accent-soft); color: var(--c-accent); }
.perm-icon--analyst { background: var(--c-peach-soft); color: var(--c-peach-ink); }
.perm b { font-size: 14px; }
.perm p { margin-top: 2px; color: var(--c-muted); font-size: 13px; line-height: 1.45; }
.perm-card .btn--block { margin-top: 14px; }

/* ── 13. Настройки ──────────────────────────────────────── */
.settings-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; padding: 8px; }
.settings-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-md);
  background: none;
  color: var(--c-ink-2);
  font: 500 14px/1 var(--font);
  text-align: left;
  cursor: pointer;
}
.settings-tab .icon { color: var(--c-muted); }
.settings-tab:hover { background: var(--c-surface-2); }
.settings-tab[aria-selected="true"] { background: var(--c-accent-soft); color: var(--c-navy); font-weight: 600; }
.settings-tab[aria-selected="true"] .icon { color: var(--c-accent); }

.settings-content { min-height: 460px; padding: 28px; }
.settings-panel:focus { outline: 0; }

.profile-line {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin: 18px 0;
  padding: 16px 0;
  border-top: 1px solid var(--c-line-2);
  border-bottom: 1px solid var(--c-line-2);
}
.profile-line b { display: block; font-size: 14px; }
.profile-line small { display: block; color: var(--c-muted); font-size: 13px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-grid--spaced { margin-top: 18px; }
.form-grid label { display: block; }
.form-grid label > span, .modal-field > span { display: block; margin-bottom: 7px; color: var(--c-ink-2); font-size: 13px; font-weight: 600; }
.form-grid .is-wide { grid-column: 1 / -1; }

.note { display: flex; gap: 12px; margin-top: 22px; padding: 16px; border-radius: var(--r-md); background: var(--c-accent-soft); }
.note-mark { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--c-surface); color: var(--c-accent); }
.note-mark .icon { width: 16px; height: 16px; }
.note b { display: block; font-size: 14px; }
.note small { display: block; color: var(--c-ink-2); font-size: 13px; }

.switch-row, .security-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 0; border-bottom: 1px solid var(--c-line-2); }
.switch-row:last-child, .security-row:last-child { border-bottom: 0; }
.switch-row b, .security-row b { display: block; font-size: 14px; }
.switch-row small, .security-row small { display: block; color: var(--c-muted); font-size: 13px; }

.switch {
  position: relative;
  flex: none;
  width: 46px; height: 26px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--c-line-strong);
  cursor: pointer;
  transition: background-color .15s ease;
}
.switch::after {
  content: "";
  position: absolute;
  left: 3px; top: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 42, 77, .3);
  transition: transform .15s ease;
}
.switch[aria-checked="true"] { background: var(--c-brand); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }

/* ── 14. Модальные окна и уведомления ───────────────────── */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 35, 64, .5); }
.modal-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  padding: 30px;
  border-radius: var(--r-xl);
  background: var(--c-surface);
  box-shadow: var(--shadow-pop);
}
.modal-card--wide { width: min(580px, 100%); max-height: calc(100vh - 32px); overflow: auto; }
.modal-card h2 { margin: 10px 0 6px; padding-right: 36px; color: var(--c-navy); font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.modal-tag { display: inline-flex; align-items: center; gap: 8px; min-height: 28px; padding: 0 12px; border-radius: var(--r-pill); background: var(--c-surface-3); color: var(--c-ink-2); font-size: 13px; font-weight: 600; }
.modal-tag .icon { width: 15px; height: 15px; }
.modal-desc { margin-bottom: 20px; color: var(--c-muted); font-size: 14px; }
.modal-field { display: block; margin-bottom: 16px; }
.modal-close {
  position: absolute;
  right: 16px; top: 16px;
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--c-surface-3);
  color: var(--c-muted);
  cursor: pointer;
}
.modal-close:hover { background: var(--c-accent-soft); color: var(--c-ink); }
.field-error { margin: -6px 0 14px; color: var(--c-danger); font-size: 13px; }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.modal-note { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--c-line-2); color: var(--c-muted); font-size: 13px; line-height: 1.5; }

.steps { counter-reset: step; margin-bottom: 22px; }
.steps li { position: relative; counter-increment: step; margin-left: 13px; padding: 0 0 14px 34px; border-left: 2px solid var(--c-line-2); }
.steps li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps li::before {
  content: counter(step);
  position: absolute;
  left: -14px; top: -2px;
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--c-accent-soft);
  color: var(--c-accent);
  font: 700 12px/1 var(--font);
}
.steps b { display: block; margin-bottom: 2px; font-size: 14px; }
.steps span { color: var(--c-muted); font-size: 13px; }
.steps code, .scopes code { padding: 1px 6px; border-radius: 6px; background: var(--c-surface-3); font: 500 12px/1.4 var(--font-mono); }

.verify { margin-bottom: 16px; padding: 16px; border-radius: var(--r-lg); background: var(--c-brand-soft); }
.verify-head { display: flex; align-items: center; gap: 12px; }
.verify-id { flex: 1; min-width: 0; }
.verify-id b { display: block; font-size: 14px; }
.verify-id small { display: block; color: var(--c-ink-2); font-size: 13px; }

.rights, .scopes { display: flex; flex-direction: column; gap: 8px; }
.rights { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(15, 42, 77, .1); }
.rights li, .scopes li { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; }
.rights li.is-off { color: var(--c-muted); }
.right-mark { display: grid; place-items: center; width: 20px; height: 20px; flex: none; border-radius: 50%; background: var(--c-brand); color: #fff; font: 700 12px/1 var(--font); }
.right-mark .icon { width: 12px; height: 12px; stroke-width: 3; }
.rights li.is-off .right-mark { background: var(--c-line); color: var(--c-muted); }
.scopes { margin-bottom: 16px; }
.scopes b { display: block; font-size: 13px; font-weight: 500; }
.scopes code { display: inline-block; margin-top: 2px; }

.step-label { margin-bottom: 10px; color: var(--c-navy); font-size: 14px; font-weight: 600; }
.hint { margin-bottom: 16px; padding: 10px 14px; border-radius: var(--r-md); background: var(--c-peach-soft); color: var(--c-peach-ink); font-size: 13px; line-height: 1.45; }
.meta-user { margin-bottom: 16px; padding: 10px 14px; border-radius: var(--r-md); background: var(--c-accent-soft); color: var(--c-accent); font-size: 13px; font-weight: 500; }

.asset-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.asset { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--c-line); border-radius: var(--r-md); background: var(--c-surface); cursor: pointer; }
.asset:hover { border-color: var(--c-line-strong); }
.asset:has(input:checked) { border-color: var(--c-accent); background: var(--c-accent-soft); }
.asset input { width: 17px; height: 17px; flex: none; accent-color: var(--c-accent); cursor: pointer; }
.asset-body { flex: 1; min-width: 0; }
.asset-body b { display: block; font-size: 14px; }
.asset-body small { display: block; color: var(--c-muted); font-size: 13px; }

.toast {
  position: fixed;
  right: 24px; bottom: 24px;
  z-index: 150;
  max-width: min(380px, calc(100vw - 36px));
  padding: 14px 18px;
  border-radius: var(--r-md);
  background: var(--c-navy);
  color: #fff;
  font: 500 14px/1.4 var(--font);
  box-shadow: var(--shadow-pop);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.toast::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 10px; border-radius: 50%; background: var(--c-brand); vertical-align: 1px; }
.toast.is-visible { opacity: 1; transform: none; }
.toast.is-error::before { background: var(--c-peach); }

/* ── 15. Нижняя панель и адаптив ────────────────────────── */
.tabbar { display: none; }

@media (max-width: 1280px) {
  .dash-card--chart { grid-column: span 6; }
  .dash-card--tip { grid-column: span 6; min-height: 190px; }
  .cal-layout { grid-template-columns: minmax(0, 1fr) 290px; }
  .member { grid-template-columns: minmax(200px, 1fr) 100px 130px 36px; }
}

@media (max-width: 1080px) {
  :root { --page-pad: 22px; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .splitter { display: none; }
  .page--composer { height: auto; }
  .pane--content { overflow: visible; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-card { grid-column: 1 / -1; }
  .cal-layout, .team-layout, .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .agenda { order: -1; }
  .settings-nav { flex-direction: row; overflow-x: auto; }
  .settings-tab { flex: none; }
  .table-head { flex-direction: column; align-items: stretch; }
  .search { width: 100%; }
}

@media (max-width: 860px) {
  .page-head, .composer-head { flex-direction: column; align-items: stretch; }
  .page-actions, .composer-actions { flex-wrap: wrap; }
  .sync-bar, .provider-bar { flex-direction: column; align-items: stretch; gap: 12px; }
  .provider-actions .btn { flex: 1; }
}

@media (max-width: 720px) {
  :root { --page-pad: 16px; }

  .app { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed;
    left: 0; top: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  .app.is-menu-open .side { transform: none; }
  .app--folded { --side-w: 0; }
  .collapse-btn { display: none; }

  .main { height: auto; overflow: visible; padding-bottom: calc(var(--tabbar-h) + 16px); }
  .page { padding: 20px var(--page-pad) 16px; }
  .page-title { font-size: 24px; }
  .page-actions .btn, .composer-actions .btn { flex: 1; }

  .stat { padding: 16px; }
  .stat strong { font-size: 26px; }
  .dash-card { padding: 18px; }
  .tip-body { max-width: 70%; }
  .bars { gap: 8px; }

  .title-input { font-size: 22px; }
  .pane--content { padding: 0 18px; }
  .channel { min-height: 44px; }
  .editor-box { min-height: 260px; }
  .media-item, .media-upload { width: 84px; height: 84px; }

  .map { height: 880px; }
  .map-core { width: 176px; padding: 12px; }
  .core-logo { height: 44px; }
  .node { width: 150px; grid-template-columns: 32px minmax(0, 1fr); gap: 2px 8px; padding: 8px; }
  .node .node-icon { width: 32px; height: 32px; font-size: 10px; }

  .conn-group-head { flex-direction: column; gap: 8px; }
  .cards-grid { grid-template-columns: minmax(0, 1fr); }
  .modal-actions { flex-direction: column; }
  .modal-actions .btn { width: 100%; }
  .modal-card { padding: 24px 20px; }

  .cal-toolbar { flex-direction: column; align-items: stretch; }
  .cal-card { padding: 8px; overflow-x: auto; }
  .cal-week, .cal-grid { min-width: 660px; }

  .member { grid-template-columns: minmax(0, 1fr) auto; row-gap: 8px; }
  .member-id { grid-column: 1 / -1; }
  .role, .member-state { grid-column: 1; }
  .member .btn--icon { grid-column: 2; grid-row: 2 / 4; }

  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .is-wide { grid-column: auto; }
  .profile-line { grid-template-columns: 60px minmax(0, 1fr); }
  .profile-line .btn { grid-column: 1 / -1; }
  .security-row { flex-direction: column; align-items: stretch; gap: 12px; }
  .security-row .btn { width: 100%; }

  .toast { right: 12px; left: 12px; bottom: calc(var(--tabbar-h) + 12px); max-width: none; }

  /* Нижняя панель вместо бургера: пять самых частых действий под большим пальцем. */
  .tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: end;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    padding: 6px 6px env(safe-area-inset-bottom, 0px);
    background: var(--c-surface);
    box-shadow: 0 -4px 20px rgba(15, 42, 77, .08);
  }
  .tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 56px;
    border: 0;
    border-radius: var(--r-md);
    background: none;
    color: var(--c-muted);
    font: 500 11px/1 var(--font);
    cursor: pointer;
  }
  .tab-item.is-active { color: var(--c-brand-ink); font-weight: 600; }
  .tab-item.is-active .icon { color: var(--c-brand); }
  .tab-item--create { justify-content: flex-start; }
  .tab-fab {
    display: grid;
    place-items: center;
    width: 54px; height: 54px;
    margin-top: -20px;
    border-radius: 50%;
    background: var(--c-brand);
    color: #fff;
    box-shadow: 0 6px 18px rgba(0, 136, 122, .4);
  }
  .tab-item--create.is-active .tab-fab .icon { color: #fff; }
}

@media (max-width: 520px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
  .cal-nav strong { min-width: 120px; }
  .map { height: 960px; }
  .bar-day { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
