/* ===================================================================
   OpenTracker — дизайн-система
   Эстетика: Apple (чистота, воздух, типографика, стекло, плавность)
   Палитра: Nvidia (глубокий чёрный + фирменный зелёный #76B900)
   =================================================================== */
:root {
  --bg: #eef2f7;
  --bg-soft: #f7f9fc;
  --panel: #ffffff;
  --panel2: #f2f5f9;
  --panel3: #e7ecf3;
  --border: #e4e9f0;
  --border-strong: #d4dbe6;
  --text: #16202b;
  --muted: #6b7684;
  --accent: #2f80ed;
  --accent-hover: #1c6ee0;
  --accent-dim: rgba(47, 128, 237, 0.10);
  --green: #16a34a;
  --red: #e5484d;
  --yellow: #f5a524;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(22, 32, 43, 0.08);
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

::selection { background: rgba(47, 128, 237, 0.22); }

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  letter-spacing: -0.01em;
  background: var(--bg);
  color: var(--text);
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--red); min-height: 20px; margin-top: 10px; font-size: 13px; }
a { color: var(--accent); text-decoration: none; transition: color 0.2s var(--ease); }
a:hover { color: var(--accent-hover); }
code {
  font-family: 'SF Mono', ui-monospace, Menlo, monospace; font-size: 12px;
  background: var(--panel2); padding: 2px 6px; border-radius: 6px;
}

/* тонкий скроллбар в духе macOS */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(22, 32, 43, 0.18); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(22, 32, 43, 0.32); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- логин ---------- */
.login-wrap {
  display: flex; align-items: center; justify-content: center; height: 100vh;
  background:
    radial-gradient(ellipse 70% 50% at 50% -10%, rgba(47, 128, 237, 0.12), transparent 60%),
    var(--bg);
}
.login-box {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(30px) saturate(1.4);
  -webkit-backdrop-filter: blur(30px) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 48px 40px;
  width: 380px;
  text-align: center;
  box-shadow: var(--shadow);
  animation: rise 0.5s var(--ease);
}
.login-box h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 6px; }
.login-box input { margin: 28px 0 14px; text-align: center; }

@keyframes rise {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

/* ---------- каркас: рейл разделов + подменю + топбар ---------- */
#app { display: flex; min-height: 100vh; }

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

/* крайняя панель-рейл = меню разделов */
.rail {
  width: 64px; min-width: 64px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 0;
  position: sticky; top: 0; height: 100vh;
}
.rail-logo {
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.rail-logo .icon { width: 20px; height: 20px; }
.rail-item {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.rail-item:hover { background: var(--panel2); color: var(--text); }
.rail-item.active { background: rgba(47, 128, 237, 0.2); color: var(--accent); }
.rail-item .icon { width: 20px; height: 20px; }
.rail-spacer { flex: 1; }

/* вторая колонка = меню выбранного раздела */
.submenu {
  width: 252px; min-width: 252px;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px;
  padding: 18px 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.submenu-head { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; padding: 0 10px 14px; }
.submenu .group-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); margin: 14px 10px 6px;
}
.submenu nav { display: flex; flex-direction: column; gap: 2px; }
.submenu nav a {
  padding: 9px 12px; border-radius: 10px;
  color: var(--muted); font-weight: 500; font-size: 13.5px;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.submenu nav a:hover { background: var(--panel); color: var(--text); }
.submenu nav a:active { transform: scale(0.99); }
.submenu nav a.active { background: rgba(47, 128, 237, 0.2); color: var(--accent); font-weight: 600; }
.submenu nav a.nav-off { opacity: .45; cursor: not-allowed; }
.submenu nav a.nav-off:hover { background: none; color: var(--muted); }
.submenu nav a.nav-off:active { transform: none; }
.submenu-foot { margin-top: auto; padding-top: 12px; }

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

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 28px;
  background: var(--panel); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 60;
}
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; min-width: 0; }
.crumbs .sep { color: var(--border-strong); }
.crumbs b { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.searchbox {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel2); border: 1px solid var(--border); border-radius: 10px;
  padding: 7px 12px; width: 300px; color: var(--muted);
}
.searchbox .icon { width: 15px; height: 15px; }
.searchbox input { border: none; background: transparent; padding: 0; width: 100%; font-size: 13px; }
.searchbox input:hover { border-color: transparent; }
.searchbox input:focus { box-shadow: none; background: transparent; border-color: transparent; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-dim); color: var(--accent);
  font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}

main {
  flex: 1; padding: 28px 32px; max-width: none; overflow-x: auto;
  background: var(--bg);
  animation: fade 0.3s var(--ease);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

h2 { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 22px; }
h3 { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.page-head h2 { margin: 0; }

/* ---------- элементы форм ---------- */
input, select, textarea {
  width: 100%; padding: 11px 14px;
  background: var(--panel2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: inherit; outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent); background: var(--panel);
  box-shadow: 0 0 0 4px var(--accent-dim);
}
select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2386868b' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 34px;
}
label {
  display: block; font-size: 12px; color: var(--muted);
  margin: 14px 0 6px; font-weight: 600; letter-spacing: 0.01em;
}

.btn {
  padding: 10px 18px; border: 1px solid var(--border-strong); border-radius: 980px;
  cursor: pointer; background: var(--panel2); color: var(--text);
  font: inherit; font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease),
              transform 0.15s var(--ease), box-shadow 0.2s var(--ease);
}
.btn:hover { background: var(--panel3); border-color: rgba(255, 255, 255, 0.22); }
.btn:active { transform: scale(0.97); }
.btn.primary {
  background: var(--accent); border-color: var(--accent); color: #000;
}
.btn.primary:hover {
  background: var(--accent-hover); border-color: var(--accent-hover);
  box-shadow: 0 4px 20px rgba(118, 185, 0, 0.35);
}
.btn.danger { background: transparent; border-color: rgba(255, 69, 58, 0.4); color: var(--red); }
.btn.danger:hover { background: rgba(255, 69, 58, 0.12); border-color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.btn.sm { padding: 5px 12px; font-size: 12px; }
.btn.wide { width: 100%; }

/* ---------- таблицы ---------- */
table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
th {
  background: var(--bg-soft); color: var(--muted);
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
}
tbody tr { transition: background 0.15s var(--ease); }
tbody tr:hover td { background: rgba(118, 185, 0, 0.045); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pos { color: var(--green); font-weight: 600; }
.neg { color: var(--red); font-weight: 600; }
.warn { color: var(--yellow); font-weight: 600; }

/* ---------- блок состояния сервера ---------- */
.server-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px; margin-top: 16px;
}
.server-item {
  background: var(--panel2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px;
}
.server-item .val { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 4px 0 6px; }
.server-item .sub { font-size: 12px; color: var(--muted); margin-top: 6px; }
.meter { height: 6px; background: var(--panel3); border-radius: 980px; overflow: hidden; }
.meter-fill { height: 100%; border-radius: 980px; transition: width 0.4s var(--ease); }
.meter-fill.pos { background: var(--green); }
.meter-fill.warn { background: var(--yellow); }
.meter-fill.neg { background: var(--red); }

/* ---------- график истории нагрузки ---------- */
.range-tabs { display: flex; gap: 4px; background: var(--panel2); border: 1px solid var(--border); border-radius: 980px; padding: 3px; flex-wrap: wrap; }
.range-tab {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font: 600 12px/1 inherit; letter-spacing: 0.01em; padding: 6px 11px; border-radius: 980px;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.range-tab:hover { color: var(--text); }
.range-tab.active { background: var(--accent); color: #000; }
.metrics-legend { display: flex; gap: 18px; margin: 14px 0 4px; flex-wrap: wrap; }
.metrics-legend .lg-item { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; }
.metrics-legend .lg-item i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.metrics-chart { position: relative; margin-top: 6px; }
.metrics-chart svg { display: block; width: 100%; min-width: 560px; }
.mgrid { stroke: var(--border); stroke-width: 1; }
.maxis { fill: var(--muted); font-size: 11px; }
.mcross { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.metrics-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 150px;
  background: rgba(255, 255, 255, 0.97); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 10px 12px; backdrop-filter: blur(8px);
  box-shadow: var(--shadow); font-size: 12px;
}
.metrics-tip .tip-t { font-weight: 700; margin-bottom: 6px; }
.metrics-tip .tip-row { display: flex; align-items: center; gap: 7px; margin-top: 3px; }
.metrics-tip .tip-row i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

.tag {
  display: inline-block; padding: 3px 10px; border-radius: 980px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.01em;
}
.tag.on { background: var(--accent-dim); color: var(--accent-hover); }
.tag.off { background: rgba(255, 69, 58, 0.14); color: var(--red); }
.tag.pending { background: rgba(255, 204, 0, 0.14); color: #ffb800; }

/* ---------- карточки метрик ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 26px; }
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 55%), var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.card:hover {
  transform: translateY(-2px);
  border-color: rgba(118, 185, 0, 0.35);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}
.card .val { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; margin-top: 4px; }
.card .sub { font-size: 12px; color: var(--muted); margin-top: 5px; }

/* ---------- график ---------- */
.chart-box {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; margin-bottom: 26px;
}
.bars { display: flex; align-items: flex-end; gap: 6px; height: 150px; margin-top: 16px; }
.bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; }
.bar {
  width: 100%;
  background: linear-gradient(180deg, var(--accent-hover), var(--accent));
  border-radius: 4px 4px 0 0; min-height: 2px;
  transition: filter 0.2s var(--ease);
}
.bar-col:hover .bar { filter: brightness(1.25); }
.bar-lbl { font-size: 10px; color: var(--muted); }
.bar-val { font-size: 10px; font-weight: 600; line-height: 1; white-space: nowrap; }

/* ---------- модальные окна ---------- */
.modal-wrap {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 48px 16px; z-index: 100; overflow-y: auto;
  animation: fade 0.2s var(--ease);
}
.modal {
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 28px; width: 100%; max-width: 720px;
  box-shadow: var(--shadow);
  animation: rise 0.3s var(--ease);
}
.modal h3 { margin-bottom: 10px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }
.row { display: flex; gap: 14px; }
.row > * { flex: 1; }

/* ---------- редактор потоков ---------- */
.stream-box {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px; margin-top: 14px;
}
.stream-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.stream-head strong { font-size: 13px; }
.mini-list { margin-top: 8px; }
.mini-row { display: flex; gap: 8px; margin-top: 6px; align-items: center; }
.mini-row select { flex: 3; } .mini-row input { flex: 1; }
.filters-box { margin-top: 10px; }

/* ---------- прочее ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: flex-end; }
.toolbar > div { min-width: 140px; }

.ck-summary {
  display: flex; gap: 20px; flex-wrap: wrap;
  padding: 10px 16px; margin-bottom: 12px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; color: var(--muted);
}
.ck-summary b { color: var(--fg); margin-right: 4px; }

.multi-select details { position: relative; }
.multi-select summary {
  background: var(--panel2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px; cursor: pointer;
  color: var(--text); font-size: 13px; min-width: 160px;
}
.multi-select summary:hover { border-color: var(--border-strong); }
.multi-options {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 100;
  background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 8px; min-width: 220px; max-height: 320px; overflow: auto;
  box-shadow: var(--shadow);
}
.multi-options label {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px; border-radius: 6px; cursor: pointer;
  font-size: 13px; white-space: nowrap;
}
.multi-options label:hover { background: var(--panel2); }
.multi-options input[type="checkbox"] { accent-color: var(--accent); }

.copy-box {
  background: var(--bg-soft); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm); padding: 11px 14px;
  font-family: 'SF Mono', ui-monospace, Menlo, monospace; font-size: 12px;
  word-break: break-all; cursor: pointer; margin-top: 6px; white-space: normal;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.copy-box:hover { border-color: var(--accent); background: var(--accent-dim); }

.toast {
  position: fixed; bottom: 28px; right: 28px;
  background: var(--accent); color: #000;
  font-weight: 600; font-size: 13.5px;
  padding: 13px 22px; border-radius: 980px; z-index: 200;
  box-shadow: 0 8px 28px rgba(118, 185, 0, 0.4);
  animation: rise 0.3s var(--ease);
}

.hint { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.55; }
.table-scroll { overflow-x: auto; border-radius: var(--radius); }

/* ---------- inline SVG icons ---------- */
.icon {
  display: inline-block;
  width: 1.05em; height: 1.05em;
  vertical-align: -0.18em;
  flex-shrink: 0;
}
.icon svg {
  width: 100%; height: 100%;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.icon.lg { width: 1.3em; height: 1.3em; vertical-align: -0.28em; }
.nav-icon { width: 1.15em; height: 1.15em; margin-right: 10px; vertical-align: -0.22em; }
.logo .icon { width: 1.25em; height: 1.25em; margin-right: 8px; vertical-align: -0.28em; }
.btn .icon { width: 1em; height: 1em; vertical-align: -0.16em; margin-right: 4px; }
.btn.sm .icon { width: 0.95em; height: 0.95em; vertical-align: -0.14em; margin-right: 2px; }
.sidebar nav a { display: flex; align-items: center; }
.bot-icon { color: var(--muted); }

/* Карточки-переходы между сервисами в сайдбаре */
.nav-service {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; margin-top: 8px;
  border-radius: 14px;
  background: var(--panel); border: 1px solid var(--border);
  color: var(--text); font-size: 14px; font-weight: 500;
  text-decoration: none; transition: background .15s var(--ease), border-color .15s var(--ease), transform .1s var(--ease);
}
.nav-service:hover { background: var(--panel2); border-color: var(--border-strong); transform: translateY(-1px); }
.nav-service .icon { width: 22px; height: 22px; color: var(--accent); }
.nav-service .nav-arrow { margin-left: auto; color: var(--muted); opacity: .6; transition: opacity .15s var(--ease), transform .15s var(--ease), color .15s var(--ease); }
.nav-service:hover .nav-arrow { opacity: 1; color: var(--text); transform: translateX(2px); }
.md-foot .nav-service { margin-top: 0; }
.bot-row { background: rgba(255, 59, 48, 0.08); }
.bot-row:hover { background: rgba(255, 59, 48, 0.14); }

/* ---------- App Switcher (Tracker / TG Bots) ---------- */
.app-switch {
  display: flex; gap: 4px;
  padding: 6px;
  margin: 8px 12px 12px;
  background: var(--panel);
  border-radius: 980px;
  border: 1px solid var(--border);
}
.app-switch-btn {
  flex: 1;
  padding: 7px 0;
  border: none;
  border-radius: 980px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.app-switch-btn.active {
  background: var(--accent);
  color: #000;
  box-shadow: 0 2px 8px rgba(118, 185, 0, 0.3);
}
.app-switch-btn:hover:not(.active) {
  color: var(--text);
  background: var(--panel2);
}

/* ---------- TG Bot Selector ---------- */
.tg-bot-selector {
  display: inline-flex; align-items: center; gap: 12px;
  margin-bottom: 16px; padding: 10px 14px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
}
.tg-bot-selector .tbs-icon { display: flex; color: var(--accent); }
.tg-bot-selector .tbs-icon .icon { width: 20px; height: 20px; }
.tg-bot-selector label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); font-weight: 600;
}
.tg-bot-selector select {
  width: auto; min-width: 200px; max-width: 340px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 8px 34px 8px 12px;
  font-size: 13px; font-weight: 600;
}
.tg-bot-selector select:focus { border-color: var(--accent); }

/* ---------- сортировка таблиц ---------- */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sortable::after { content: '↕'; margin-left: 5px; font-size: 10px; opacity: .4; }
th.sortable[data-dir="desc"]::after { content: '↓'; opacity: 1; color: var(--accent); }
th.sortable[data-dir="asc"]::after { content: '↑'; opacity: 1; color: var(--accent); }

/* ---------- TG Chat UI ---------- */
.tg-chats-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 0;
  height: calc(100vh - 60px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.tg-chats-sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.tg-chats-sidebar .chat-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.tg-chats-sidebar .chat-item:hover { background: var(--panel2); }
.tg-chats-sidebar .chat-item.active { background: var(--accent-dim); }
.tg-chats-sidebar .chat-item .name { font-weight: 600; font-size: 13px; }
.tg-chats-sidebar .chat-item .meta { font-size: 11px; color: var(--muted); margin-top: 2px; }

.tg-chat-area {
  display: flex;
  flex-direction: column;
}
.tg-chat-header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  font-weight: 600;
}
.tg-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tg-chat-msg {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
}
.tg-chat-msg.outgoing {
  align-self: flex-end;
  background: var(--accent);
  color: #000;
  border-bottom-right-radius: 4px;
}
.tg-chat-msg.incoming {
  align-self: flex-start;
  background: var(--panel2);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.tg-chat-msg .time { font-size: 10px; opacity: 0.6; margin-top: 4px; }

.tg-chat-input {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  gap: 8px;
}
.tg-chat-input textarea {
  flex: 1;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px;
  font-size: 13px;
  resize: none;
  min-height: 40px;
  max-height: 100px;
}
.tg-chat-input button {
  align-self: flex-end;
}

/* ---------- TG Broadcast Progress ---------- */
.tg-progress-bar {
  height: 6px;
  background: var(--panel2);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}
.tg-progress-bar .fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s;
}

/* ---------- TG Funnel Steps ---------- */
.tg-funnel-step {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
}
.tg-funnel-step .step-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.tg-funnel-step .step-num {
  font-weight: 700;
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 3px 8px;
  border-radius: 6px;
}
.tg-funnel-step .step-delay {
  font-size: 11px;
  color: var(--muted);
}
.tg-funnel-step .step-msg {
  font-size: 13px;
  white-space: pre-wrap;
}

/* ---------- TG Status Badges ---------- */
.tg-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}
.tg-badge.active { background: rgba(118, 185, 0, 0.15); color: var(--accent); }
.tg-badge.inactive { background: rgba(255, 69, 58, 0.15); color: var(--red); }
.tg-badge.draft { background: rgba(134, 134, 139, 0.15); color: var(--muted); }
.tg-badge.sending { background: rgba(255, 214, 10, 0.15); color: var(--yellow); }
.tg-badge.completed { background: rgba(118, 185, 0, 0.15); color: var(--accent); }
.tg-badge.scheduled { background: rgba(10, 132, 255, 0.15); color: #0a84ff; }
.tg-badge.pending { background: rgba(255, 214, 10, 0.15); color: #ffb800; }

/* ---------- Nutra генератор текстов ---------- */
.nutra-grid {
  display: grid;
  grid-template-columns: minmax(400px, 500px) 1fr;
  gap: 20px; align-items: start;
  margin-bottom: 26px;
}
@media (max-width: 1100px) { .nutra-grid { grid-template-columns: 1fr; } }

.design-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 6px; }
.design-card {
  background: var(--panel2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.15s var(--ease), box-shadow 0.2s var(--ease);
}
.design-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.design-card.selected {
  border-color: var(--accent); background: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.design-card .dc-name { font-weight: 700; font-size: 13px; letter-spacing: -0.01em; }
.design-card.selected .dc-name { color: var(--accent-hover); }
.design-card .dc-desc { font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.4; }

.photo-drop {
  display: flex; align-items: center; gap: 10px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  padding: 11px 14px; cursor: pointer; color: var(--muted); font-size: 12.5px;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.photo-drop:hover { border-color: var(--accent); background: var(--accent-dim); }
.photo-drop img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

.gen-result {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 18px;
  min-height: 320px; max-height: 560px; overflow-y: auto;
  white-space: pre-wrap; line-height: 1.65; font-size: 13.5px;
}
.gen-spinner {
  display: inline-block; width: 14px; height: 14px; vertical-align: -2px;
  border: 2px solid var(--accent-dim); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; display: block; border: 1px solid var(--border); }

/* ---------- Нутра: лендинги ---------- */
.ld-swatch {
  display: inline-block; width: 30px; height: 13px; border-radius: 4px;
  vertical-align: -2px; margin-right: 8px; border: 1px solid rgba(255,255,255,.15);
}
.device-switch { display: inline-flex; gap: 2px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 3px; }
.device-switch button {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: none; color: var(--muted);
  font: inherit; font-size: 12.5px; padding: 5px 12px; border-radius: 6px; cursor: pointer;
}
.device-switch button.active { background: var(--accent); color: #000; font-weight: 600; }
.preview-frame-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px; overflow: auto; }
#ld-frame {
  width: 100%; height: 720px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; display: block; transition: width .25s;
}
#ld-frame.mobile {
  width: 390px; height: 760px; margin: 0 auto; border-radius: 28px;
  border: 6px solid #2a2a2e; box-shadow: 0 14px 40px rgba(0,0,0,.5);
}

/* ---------- Тонкая настройка стиля текста (ТЗ) ---------- */
.style-box { margin-top: 14px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; background: rgba(0,0,0,.15); }
.style-box summary { cursor: pointer; font-weight: 600; font-size: 13px; outline: none; }
.style-box summary:hover { color: var(--accent); }
.style-presets { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 2px; }
.style-presets .btn { border-radius: 999px; padding: 5px 15px; font-size: 12.5px; }
.style-presets .btn.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }
.style-adv { margin-top: 10px; }
.style-adv summary { cursor: pointer; font-size: 12px; color: var(--muted); outline: none; }
.style-adv summary:hover { color: var(--accent); }
.style-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; margin-top: 10px; }
.style-item label { margin: 0 0 4px; font-size: 12px; display: flex; justify-content: space-between; align-items: center; }
.style-item .sv { font-weight: 700; color: var(--accent); font-size: 12px; min-width: 24px; text-align: right; }
.style-item input[type=range] { width: 100%; accent-color: var(--accent); margin: 0; }
.style-item select { width: 100%; }
@media (max-width: 760px) { .style-grid { grid-template-columns: 1fr; } }

/* компактная форма нутра-генератора: группы + чекбоксы блоков */
.nt-form { padding: 20px; }
.nt-sec {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--muted); margin: 22px 0 8px;
}
.nt-form > .nt-sec:first-child { margin-top: 0; }
.nt-sec::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.blocks-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 8px; margin-top: 10px; }
.block-item {
  display: flex; align-items: center; gap: 7px; margin: 0; padding: 5px 8px;
  font-size: 12.5px; font-weight: 500; color: var(--text); cursor: pointer;
  border-radius: 8px; transition: background 0.15s var(--ease);
}
.block-item:hover { background: var(--panel2); }
.block-item input { width: auto; padding: 0; margin: 0; accent-color: var(--accent); }
@media (max-width: 900px) { .blocks-grid { grid-template-columns: 1fr 1fr; } }

/* ---------- Галерея AI-картинок лендинга ---------- */
.ai-images-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.ai-img {
  position: relative; border: 2px solid var(--border); border-radius: 10px; overflow: hidden;
  cursor: pointer; background: var(--panel); transition: border-color .15s, transform .15s;
}
.ai-img:hover { border-color: var(--accent); transform: translateY(-2px); }
.ai-img.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(118,185,0,.35); }
.ai-img img { width: 100%; height: 120px; object-fit: cover; display: block; }
.ai-img p { margin: 0; padding: 8px 10px; font-size: 11px; color: var(--text2, #8888a0); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.ai-img-badge {
  position: absolute; top: 8px; right: 8px; background: var(--accent); color: #000;
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px;
}
.ai-img-err { cursor: default; border-style: dashed; opacity: .85; }
.ai-img-err:hover { border-color: var(--border-strong); transform: none; }
.ai-img-err p { -webkit-line-clamp: 6; }
.ai-img-miss {
  height: 120px; display: flex; flex-direction: column; gap: 6px;
  align-items: center; justify-content: center; color: var(--muted);
  background: var(--panel2); font-size: 12px;
}

/* ---------- Button Builder ---------- */
.btn-builder {
  margin: 10px 0; padding: 10px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
}
.btn-builder > label { font-weight: 600; font-size: 13px; margin-bottom: 8px; display: block; }
.btn-builder-rows { display: flex; flex-direction: column; gap: 8px; }
.btn-row {
  background: var(--panel2); border: 1px solid var(--border); border-radius: 6px;
  padding: 8px;
}
.btn-row-items { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.btn-item {
  flex: 1; min-width: 160px; max-width: 250px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  padding: 6px; display: flex; flex-direction: column; gap: 4px;
}
.btn-item input, .btn-item select { font-size: 12px; padding: 4px 6px; }
.btn-row-actions { display: flex; gap: 6px; }

/* ===================================================================
   Адаптивность (мобильные) — общая для Трекера, TG Bots и Sports CRM
   =================================================================== */
/* ---------- Бургер-меню и мобильная шторка ---------- */
.burger {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 42px; height: 38px; padding: 9px 10px; margin-left: auto; flex: 0 0 auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; cursor: pointer;
}
.burger span {
  display: block; height: 2px; width: 100%; background: var(--text);
  border-radius: 2px; transition: transform .2s var(--ease), opacity .15s var(--ease);
}
.burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-drawer {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 70;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 18px 44px rgba(22, 32, 43, .18);
  max-height: calc(100vh - 58px); max-height: calc(100dvh - 58px);
  overflow-y: auto; padding: 10px 12px 14px;
  animation: abFade .2s var(--ease);
}
.mobile-drawer .md-nav { display: flex; flex-direction: column; gap: 2px; }
.mobile-drawer a[data-page] {
  display: flex; align-items: center; gap: 11px; padding: 12px 14px;
  border-radius: 10px; font-size: 14.5px; font-weight: 500;
  color: var(--text); white-space: nowrap;
}
.mobile-drawer a[data-page]:active { background: var(--panel2); }
.mobile-drawer a[data-page].active { background: var(--accent-dim); color: var(--accent-hover); }
.mobile-drawer a.nav-off { opacity: .45; }
.mobile-drawer .md-foot {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--border);
}
.mobile-drawer .md-foot .btn { text-align: center; margin-top: 0 !important; }

@media (max-width: 900px) {
  #app { flex-direction: column; }
  .sidebar { position: static; min-height: 0; height: auto; }
  .rail { display: none; }
  .submenu { display: none; }
  .topbar { padding: 10px 14px; gap: 10px; }
  .topbar .burger { display: flex; order: -1; margin-left: 0; }
  .crumbs .sep, .crumbs .crumb-root { display: none; }
  .searchbox { display: none; }
  .burger { display: flex; }

  main { padding: 18px 14px; max-width: 100%; }
  h2 { font-size: 22px; }

  .login-box { width: 100%; max-width: 380px; padding: 36px 24px; }
  .modal-wrap { padding: 24px 12px; }
  .modal { padding: 20px; }
  .row { flex-direction: column; }

  .cards { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .server-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .chart-box { padding: 16px; overflow-x: auto; }

  /* графики: горизонтальный скролл вместо сжатия */
  .bars { min-width: 520px; }
  .metrics-chart { overflow-x: auto; }
  #dash-chart { overflow-x: auto; }
  #dash-chart svg { min-width: 600px; }
}

@media (max-width: 600px) {
  main { padding: 14px 10px; }
  th, td { padding: 10px 10px; }
  .card .val { font-size: 22px; }
  .server-item .val { font-size: 19px; }
  .page-head { align-items: flex-start; flex-direction: column; }
}

@media (min-width: 901px) {
  .burger, .mobile-drawer { display: none !important; }
}

/* ─── Авто-рассылка: форма в стиле Apple/NVIDIA ────────────────────── */
.ab-form { display: flex; flex-direction: column; gap: 16px; }
.ab-section {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.ab-section-title {
  font-size: 11px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 12px;
}
.ab-hint { font-size: 11.5px; color: var(--muted); margin-top: 8px; line-height: 1.5; }

/* iOS-переключатель */
.ab-switch { display: inline-flex; align-items: center; cursor: pointer; user-select: none; font-size: 14px; color: var(--text); }
.ab-switch input { display: none; }
.ab-switch .track {
  width: 50px; height: 30px; border-radius: 15px; background: var(--panel3);
  position: relative; transition: background .2s var(--ease); flex: none;
  margin-right: 12px;
}
.ab-switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px;
  border-radius: 50%; background: #fff; transition: transform .2s var(--ease);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
}
.ab-switch input:checked + .track { background: var(--accent); }
.ab-switch input:checked + .track::after { transform: translateX(20px); }

/* ---------- глобальный iOS-свитч (крупный, для всех админок) ---------- */
.switch { display: inline-flex; align-items: center; cursor: pointer; user-select: none; font-size: 14px; color: var(--text); }
.switch input { display: none; }
.switch .track {
  width: 50px; height: 30px; border-radius: 15px; background: var(--panel3);
  position: relative; transition: background .2s var(--ease); flex: none;
  margin-right: 12px;
}
.switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px;
  border-radius: 50%; background: #fff; transition: transform .2s var(--ease);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(20px); }

/* увеличенные нативные чекбоксы (списки, фильтры, карточки блоков) */
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

/* блок «Отправить по расписанию» в форме рассылки */
.bc-schedule-box {
  margin-top: 12px; padding: 14px 16px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 12px;
  display: flex; flex-direction: column; gap: 12px;
}

/* Карточки ботов */
.ab-bots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 560px) { .ab-bots { grid-template-columns: 1fr; } }
.ab-bot-card {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; cursor: pointer; background: var(--panel);
  transition: border-color .15s var(--ease), background .15s var(--ease);
  display: block;
}
.ab-bot-card:hover { border-color: var(--border-strong); }
.ab-bot-card.sel { border-color: var(--accent); background: var(--accent-dim); }
.ab-bot-card input { display: none; }
.ab-bot-card .nm { font-weight: 600; font-size: 13px; margin-bottom: 4px; color: var(--text); }
.ab-bot-card .meta { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ab-lang-badge {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .05em;
  padding: 2px 8px; border-radius: 20px; background: var(--accent-dim); color: var(--accent);
}

/* Пилюли дней недели */
.ab-days { display: flex; gap: 6px; }
.ab-day { flex: 1; }
.ab-day input { display: none; }
.ab-day span {
  display: block; text-align: center; padding: 8px 0; border-radius: 20px;
  border: 1px solid var(--border); font-size: 12px; font-weight: 600;
  color: var(--muted); cursor: pointer; transition: all .15s var(--ease);
}
.ab-day span:hover { border-color: var(--border-strong); color: var(--text); }
.ab-day input:checked + span { background: var(--accent); border-color: var(--accent); color: #000; }

.ab-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .ab-row { grid-template-columns: 1fr; } }
.ab-field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.ab-field input, .ab-field textarea, .ab-field select { width: 100%; }

/* Чипы плейсхолдеров */
.ab-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ab-chip {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 11px;
  padding: 3px 10px; border-radius: 20px; background: var(--panel2);
  border: 1px solid var(--border); color: var(--accent); cursor: pointer;
  transition: border-color .15s var(--ease);
}
.ab-chip:hover { border-color: var(--accent); }

/* Предпросмотр */
.ab-preview-box {
  margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .02); backdrop-filter: blur(20px); padding: 14px;
  animation: abFade .25s var(--ease);
}
@keyframes abFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ab-preview-text { white-space: pre-wrap; font-size: 13px; line-height: 1.55; }
.ab-preview-text blockquote {
  margin: 8px 0; padding: 6px 12px; border-left: 3px solid var(--accent);
  background: rgba(255, 255, 255, .03); border-radius: 0 8px 8px 0;
}
.ab-preview-text tg-spoiler {
  background: var(--panel3); color: var(--muted); border-radius: 4px;
  padding: 0 4px; font-size: 12px;
}

/* История запусков авто-рассылки */
.btn.hist-open { color: var(--muted); }
.btn.hist-open:hover { color: var(--text); }
.btn.hist-open.open { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.btn.hist-open .arr { display: inline-block; transition: transform .2s var(--ease); font-size: 11px; }
.btn.hist-open.open .arr { transform: rotate(180deg); }
.ab-hist-wrap > td { background: var(--bg-soft); padding: 0; }
.ab-hist {
  padding: 16px 20px 18px; display: flex; flex-direction: column; gap: 16px;
  animation: abFade .25s var(--ease);
}
.ab-hist-day-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.ab-hist-date { font-weight: 700; font-size: 13px; letter-spacing: -0.01em; text-transform: capitalize; }
.ab-hist-sum { font-size: 11.5px; color: var(--muted); }
.ab-hist-item {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 14px; display: flex; flex-direction: column; gap: 7px; margin-bottom: 6px;
  transition: border-color .15s var(--ease);
}
.ab-hist-item:hover { border-color: var(--border-strong); }
.ab-hist-top { display: flex; align-items: center; gap: 8px; font-size: 12.5px; flex-wrap: wrap; }
.ab-hist-top .time { color: var(--muted); font-size: 11.5px; margin-left: auto; }
.ab-bar { height: 5px; border-radius: 3px; background: var(--panel3); overflow: hidden; display: flex; }
.ab-bar .ok { background: var(--accent); height: 100%; }
.ab-bar .fail { background: var(--red); height: 100%; }
.ab-hist-nums { font-size: 11.5px; color: var(--muted); }


/* ---------- Визард прелендингов ---------- */
.pl-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.pl-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px;
  display: flex; flex-direction: column; gap: 10px; transition: border-color .15s var(--ease), transform .15s var(--ease);
}
.pl-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.pl-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.pl-card-top .tag { white-space: nowrap; flex-shrink: 0; }
.pl-card-meta { font-size: 12px; }
.pl-card-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: auto; }

.wz-wrap { display: grid; grid-template-columns: 250px 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .wz-wrap { grid-template-columns: 1fr; } }
.wz-steps {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 10px;
  display: flex; flex-direction: column; gap: 4px; position: sticky; top: 14px;
}
.wz-step {
  display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px;
  color: var(--muted); font-size: 13px; transition: background .15s var(--ease);
}
.wz-step b { display: block; font-size: 13px; color: inherit; }
.wz-step small { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }
.wz-step.clickable { cursor: pointer; }
.wz-step.clickable:hover { background: var(--panel2); }
.wz-step.done { color: var(--text); }
.wz-step.active { background: var(--accent-dim); color: var(--text); }
.wz-step.active b { color: var(--accent-hover); }
.wz-num {
  flex: 0 0 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.wz-step.done .wz-num { border-color: var(--accent); color: var(--accent); }
.wz-step.active .wz-num { border-color: var(--accent); background: var(--accent); color: #0b0b0d; }
.wz-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 20px; min-height: 320px; }
.wz-footer { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.wz-frame { width: 100%; height: 720px; border: 1px solid var(--border); border-radius: 8px; background: #fff; display: block; }

/* карточки тем сторителлинга */
.themes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.theme-card {
  background: var(--panel2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
  font-size: 13px; line-height: 1.45; cursor: pointer;
  transition: border-color .15s var(--ease), background .15s var(--ease), transform .15s var(--ease);
}
.theme-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.theme-card.sel { border-color: var(--accent); background: var(--accent-dim); }
.theme-angle {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 5px;
}

/* карточки идей креативов */
.idea-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px;
  display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px;
}
.idea-card label { margin: 4px 0 0; }
.idea-card input, .idea-card textarea { margin: 0; }

/* галерея креативов */
.cr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.cr-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.cr-img-wrap { position: relative; background: var(--panel2); aspect-ratio: 1 / 1; }
.cr-img-wrap.vert { aspect-ratio: 9 / 16; max-height: 420px; margin: 0 auto; width: 100%; }
.cr-img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cr-aspect {
  position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.65); color: #fff;
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px;
}
.cr-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.cr-body p { margin: 0; font-size: 11.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cr-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 8px; }

/* ---------- полировка визарда (Apple + NVIDIA) ---------- */
.toast { max-width: min(560px, calc(100vw - 56px)); border-radius: 18px; line-height: 1.45; text-align: left; }

.wz-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.wz-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 980px;
  padding: 6px 12px; font-size: 12px; color: var(--text);
}
.wz-chip small { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.wz-chip b { font-weight: 600; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wz-chip.on { border-color: rgba(118, 185, 0, 0.4); background: var(--accent-dim); }
.wz-chip.on small { color: var(--accent); }

.wz-card { border-radius: 18px; padding: 24px; }
.wz-steps { border-radius: 18px; }

/* читаемый предпросмотр текста */
.wz-preview {
  background: var(--panel2); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px 22px; max-height: 480px; overflow: auto; margin-top: 4px;
}
.wz-preview h3 { margin: 0 0 6px; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
.wz-preview h4 {
  margin: 16px 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--accent);
}
.wz-preview p { margin: 0 0 8px; font-size: 13px; line-height: 1.6; color: #b8b8c0; }
.wz-preview p b { color: var(--text); }
.wz-preview .wz-sub { color: var(--muted); font-style: italic; }
.wz-preview details { margin: 10px 0; }
.wz-preview summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--accent-hover); }
.wz-preview::-webkit-scrollbar { width: 8px; }
.wz-preview::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

/* структура: двухколоночный чек-лист с описанием блоков */
.blocks-grid-wide { grid-template-columns: repeat(2, 1fr); gap: 6px 10px; }
.blocks-grid-wide .block-item { align-items: flex-start; padding: 8px 10px; }
.blocks-grid-wide .block-item input { margin-top: 3px; }
.blocks-grid-wide .block-item span { display: flex; flex-direction: column; gap: 1px; }
.blocks-grid-wide .block-item b { font-size: 12.5px; font-weight: 600; }
.blocks-grid-wide .block-item small { font-size: 11px; color: var(--muted); line-height: 1.35; }
@media (max-width: 900px) { .blocks-grid-wide { grid-template-columns: 1fr; } }

/* шаг 4: фото продукта */
.s4-photo { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.s4-photo-prev {
  flex: 0 0 84px; width: 84px; height: 84px; border-radius: 14px; overflow: hidden;
  background: var(--panel2); border: 1px dashed var(--border-strong);
  display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 11px;
}
.s4-photo-prev img { width: 100%; height: 100%; object-fit: cover; }
.ai-img-err .btn { margin-top: 10px; }

/* ответы в цепочках отзывов (предпросмотр текста) */
.wz-preview .wz-reply { margin: -2px 0 8px 18px; color: var(--muted); }

/* Чипы выбора стилей креативов */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.chip { border: 1px solid var(--border); background: var(--panel); color: var(--muted); border-radius: 999px; padding: 6px 14px; font-size: 13px; cursor: pointer; transition: all 0.15s ease; }
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.on { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* Бейдж стиля на карточке идеи креатива */
.idea-style { display: inline-block; margin-bottom: 6px; padding: 3px 10px; border-radius: 999px; background: var(--accent-dim); color: var(--accent); font-size: 12px; font-weight: 600; }

/* Библиотека креативов: оффер + дата в карточке */
.cr-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; font-size: 12px; }

/* ===================================================================
   Светлая тема: текст на акценте и тинты (переопределения)
   =================================================================== */
.btn.primary, .range-tab.active, .device-switch button.active,
.style-presets .btn.active, .ab-day input:checked + span, .wz-step.active .wz-num,
.ai-img-badge, .toast, .tg-chat-msg.outgoing, .app-switch-btn.active { color: #fff; }

.btn.primary:hover { box-shadow: 0 6px 20px rgba(47, 128, 237, 0.35); }
.sidebar nav a.active { box-shadow: none; }
.app-switch-btn.active { box-shadow: 0 2px 8px rgba(47, 128, 237, 0.3); }
.toast { box-shadow: 0 8px 28px rgba(47, 128, 237, 0.35); }
tbody tr:hover td { background: rgba(47, 128, 237, 0.05); }
.card { background: var(--panel); }
.card:hover { border-color: rgba(47, 128, 237, 0.35); box-shadow: 0 12px 32px rgba(22, 32, 43, 0.10); }
.btn.ghost:hover { background: rgba(22, 32, 43, 0.05); color: var(--text); }
.mobile-drawer a[data-page] { color: var(--text); }
.mobile-drawer a[data-page].active { background: rgba(47, 128, 237, 0.2); color: var(--accent); }
.mobile-drawer a[data-page]:active { background: var(--panel2); }
.ab-preview-text blockquote { background: rgba(47, 128, 237, 0.06); }
.style-box { background: rgba(22, 32, 43, 0.03); }
.wz-preview p { color: var(--muted); }
.tg-badge.active, .tg-badge.completed { background: rgba(47, 128, 237, 0.12); color: var(--accent); }
.ld-swatch { border-color: var(--border-strong); }
.ab-preview-box { background: var(--panel); }

/* ===================================================================
   Третий раздел «Аналитика» — дашборд по макету
   =================================================================== */
.an-sub { color: var(--muted); font-size: 13.5px; margin: -14px 0 20px; }
.an-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.an-controls .spacer { flex: 1; }
.an-pill {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px; font-size: 13px; color: var(--text); font-weight: 500;
}
.an-pill .icon { width: 15px; height: 15px; color: var(--muted); }
.an-pill button { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 2px; display: flex; }
.an-pill button:hover { color: var(--text); }
.an-pill select { width: auto; border: 0; background: transparent; padding: 0 18px 0 0; font-size: 13px; font-weight: 500; }
.an-avatars { display: inline-flex; }
.an-avatars .av {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 10px; font-weight: 700; margin-left: -6px;
}
.an-avatars .av:first-child { margin-left: 0; }

.an-insight {
  background: linear-gradient(120deg, rgba(47, 128, 237, 0.10), rgba(47, 128, 237, 0.03) 60%, transparent);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 18px;
}
.an-insight-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.an-insight-head .icon { color: var(--accent); }
.an-insight p { color: var(--muted); font-size: 13px; line-height: 1.6; }
.an-insight-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.an-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 980px;
  padding: 5px 12px; font-size: 12px; color: var(--muted);
}
.an-chip b { color: var(--text); font-weight: 600; }
.an-pager { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.an-pager button { border: 0; background: transparent; color: var(--muted); cursor: pointer; display: flex; padding: 2px; }
.an-pager button:hover { color: var(--text); }

.an-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 1100px) { .an-kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .an-kpis { grid-template-columns: 1fr; } }
.an-kpi {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
}
.an-kpi .lbl { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.an-kpi .val { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.an-spark { display: flex; align-items: flex-end; gap: 3px; height: 34px; }
.an-spark i { width: 8px; border-radius: 3px 3px 0 0; background: var(--panel3); }
.an-spark i.hi { background: var(--accent); }

.an-grid2 { display: grid; grid-template-columns: 1fr 340px; gap: 14px; margin-bottom: 18px; }
@media (max-width: 1100px) { .an-grid2 { grid-template-columns: 1fr; } }
.an-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.an-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.an-card-head h3 { font-size: 15px; }
.an-legend { display: flex; gap: 16px; align-items: center; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.an-legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.an-trend { position: relative; }
.an-trend svg { display: block; width: 100%; height: auto; }
.an-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 170px;
  background: #fff; border: 1px solid var(--border-strong); border-radius: 10px;
  box-shadow: var(--shadow); padding: 10px 12px; font-size: 12px;
}
.an-tip .t { font-weight: 700; margin-bottom: 6px; }
.an-tip .r { display: flex; align-items: center; gap: 7px; margin-top: 3px; color: var(--muted); }
.an-tip .r b { margin-left: auto; color: var(--text); }
.an-tip .r i { width: 8px; height: 8px; border-radius: 50%; }
.an-tip .d { display: flex; justify-content: space-between; gap: 14px; margin-top: 3px; color: var(--muted); }
.an-stack { display: flex; height: 8px; border-radius: 980px; overflow: hidden; margin-bottom: 14px; }
.an-chan { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.an-chan:first-of-type { border-top: 0; }
.an-chan .ic { width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 12px; flex: 0 0 auto; }
.an-chan .nm { font-weight: 600; font-size: 13px; }
.an-chan .sub { font-size: 11.5px; color: var(--muted); }
.an-chan .pc { margin-left: auto; font-weight: 700; font-size: 13px; }

/* переключатель разделов в мобильной шторке */
.mobile-drawer .md-sections {
  display: flex; gap: 8px; padding: 2px 2px 12px; margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.mobile-drawer .md-sections .md-sec {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel2); color: var(--muted);
}
.mobile-drawer .md-sections .md-sec.active { background: var(--accent-dim); color: var(--accent); }
.mobile-drawer .md-sections .md-sec .icon { width: 20px; height: 20px; }

/* ===================================================================
   SEO-раздел: статистика контента, генерация, каналы публикации, AI SEO
   =================================================================== */
.an-kpis.cols5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1400px) { .an-kpis.cols5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1100px) { .an-kpis.cols5 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .an-kpis.cols5 { grid-template-columns: 1fr; } }
.an-kpi .sub { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.an-chan .ic.plain { background: var(--panel2); color: var(--muted); }
.tag.err { background: rgba(229, 72, 77, 0.14); color: var(--red); }

/* длинные заголовки статей переносим — иначе таблица уезжает в горизонтальный скролл */
#pub-queue td:nth-child(2), #seo-stats td:first-child { white-space: normal; min-width: 220px; }

.seo-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.seo-chips .tag { padding: 4px 10px; font-size: 12px; }
.seo-list { list-style: none; }
.seo-list li {
  position: relative; padding: 8px 0 8px 20px; font-size: 13px;
  color: var(--muted); line-height: 1.55; border-top: 1px solid var(--border);
}
.seo-list li:first-child { border-top: 0; }
.seo-list li::before {
  content: ''; position: absolute; left: 3px; top: 15px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}

.chk { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.chk input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* ---------- каналы публикации ---------- */
.seo-chans { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.seo-chan {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px; transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.seo-chan:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.seo-chan-top { display: flex; align-items: flex-start; gap: 10px; }
.seo-chan-top > div { flex: 1 1 auto; min-width: 0; }
.seo-chan-top b { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seo-chan-top .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seo-chan-top .tag { flex: 0 0 auto; margin-top: 2px; }
.seo-chan-ic {
  width: 34px; height: 34px; flex: 0 0 auto; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-dim); color: var(--accent-hover);
}
.seo-chan-stats { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0; font-size: 12px; color: var(--muted); }
.seo-chan-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- генерация статей ---------- */
.gen-topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.gen-topic {
  display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.gen-topic:hover { border-color: var(--border-strong); }
.gen-topic:has(input:checked) { border-color: var(--accent); background: var(--accent-dim); }
.gen-topic input { width: 15px; height: 15px; margin-top: 3px; flex: 0 0 auto; accent-color: var(--accent); }
.gen-topic b { display: block; font-size: 13px; line-height: 1.4; }
.gen-topic small { display: block; margin-top: 3px; font-size: 11px; }
.gen-progress {
  display: flex; align-items: center; gap: 10px; margin-top: 14px;
  padding: 13px 16px; font-size: 13px; color: var(--accent-hover);
  background: var(--accent-dim); border: 1px solid rgba(47, 128, 237, 0.25); border-radius: var(--radius-sm);
}
.gen-summary {
  margin-top: 14px; padding: 14px 16px; font-size: 13px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.gen-summary > p { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.gen-summary .seo-chips { margin-top: 10px; }

/* ---------- предпросмотр статьи в редакторе ---------- */
.ws-article-body { font-size: 14.5px; line-height: 1.75; }
.ws-article-body h1, .ws-article-body h2, .ws-article-body h3 { margin: 18px 0 8px; letter-spacing: -0.01em; }
.ws-article-body h1 { font-size: 22px; }
.ws-article-body h2 { font-size: 18px; }
.ws-article-body h3 { font-size: 15.5px; }
.ws-article-body p { margin: 0 0 12px; }
.ws-article-body ul, .ws-article-body ol { margin: 0 0 12px 20px; }
.ws-article-body li { margin-bottom: 4px; }
.ws-article-body img { max-width: 100%; border-radius: var(--radius-sm); }
.ws-article-body blockquote {
  margin: 0 0 12px; padding: 4px 0 4px 14px;
  border-left: 3px solid var(--accent); color: var(--muted);
}
.ws-article-body table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.ws-article-body th, .ws-article-body td { white-space: normal; padding: 8px 10px; font-size: 13px; }

/* ---------- Telegram: сообщества (группы, каналы, модерация) ---------- */
.page-head .spacer { flex: 1; }

.tgc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; margin-top: 16px; }
.tgc-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.tgc-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.tgc-card.off { opacity: .55; }
.tgc-card-top { display: flex; align-items: flex-start; gap: 12px; }
.tgc-ic {
  flex: none; width: 38px; height: 38px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-dim); color: var(--accent);
}
.tgc-ic .icon { width: 20px; height: 20px; }
.tgc-ic.chan { background: rgba(245, 165, 36, .14); color: var(--yellow); }
.tgc-card-head { flex: 1; min-width: 0; }
.tgc-card-title { font-weight: 650; font-size: 14.5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tgc-type {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); background: var(--panel2); border-radius: 6px; padding: 2px 6px;
}
.tgc-card-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tgc-card-stats > div {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.tgc-card-stats span { font-size: 10.5px; color: var(--muted); }
.tgc-card-stats b { font-size: 15px; font-weight: 650; }
.tgc-card-foot { font-size: 11.5px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tgc-card-foot .icon { width: 13px; height: 13px; }
.tgc-card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }

.tgc-empty {
  text-align: center; padding: 54px 20px; margin-top: 18px;
  background: var(--panel); border: 1px dashed var(--border-strong); border-radius: var(--radius);
}
.tgc-empty > .icon { width: 42px; height: 42px; color: var(--muted); }
.tgc-empty h3 { margin: 12px 0 8px; font-size: 17px; }
.tgc-empty p { margin-bottom: 18px; line-height: 1.7; }

.tgc-mini { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 12px; }
.tgc-mini > div {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; min-width: 0;
}
.tgc-mini span { font-size: 11px; }
.tgc-mini b { font-size: 18px; font-weight: 650; }

.tgc-alert {
  display: flex; align-items: center; gap: 9px; margin: 14px 0;
  padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13px; line-height: 1.55;
  background: rgba(245, 165, 36, .10); border: 1px solid rgba(245, 165, 36, .35); color: var(--text);
}
.tgc-alert .icon { flex: none; width: 18px; height: 18px; color: var(--yellow); }

.tgc-mod-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; align-items: start; }
.tgc-mod-grid > div { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.tgc-sec { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.tgc-sec-title { display: flex; align-items: center; gap: 7px; font-weight: 650; font-size: 14px; margin-bottom: 6px; }
.tgc-sec-title .icon { width: 17px; height: 17px; color: var(--accent); }
.tgc-sec label.switch { display: flex; margin: 14px 0 4px; font-size: 13.5px; color: var(--text); font-weight: 500; }
.tgc-sec .hint { margin-bottom: 4px; }
.tgc-row { display: grid; grid-template-columns: minmax(0, 1fr) 160px; gap: 12px; align-items: end; }
.tgc-row label { margin: 12px 0 6px; }

.tgc-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 8px; }
.tgc-stat {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 12.5px;
}
.tgc-stat span { color: var(--muted); }
.tgc-stat b { font-size: 15px; font-weight: 650; }

.tgc-post-btn { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; }
.tgc-member-actions { display: flex; gap: 4px; justify-content: flex-end; white-space: nowrap; }
.tgc-member-actions .btn.sm { padding: 5px 9px; }

@media (max-width: 1100px) {
  .tgc-mod-grid { grid-template-columns: 1fr; }
  .tgc-mini { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 620px) {
  .tgc-mini { grid-template-columns: repeat(2, 1fr); }
  .tgc-card-stats { grid-template-columns: repeat(2, 1fr); }
  .tgc-row { grid-template-columns: 1fr; }
  .tgc-post-btn { grid-template-columns: 1fr; }
}

/* ---------- Read: внутренний блог ---------- */
.read-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.read-search { width: 280px; max-width: 100%; }

.read-chips { margin-bottom: 4px; }

.read-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px; margin-top: 14px;
}
.read-card {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; cursor: pointer;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.read-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.read-pin {
  position: absolute; top: 12px; right: 12px;
  width: 26px; height: 26px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-dim); color: var(--accent);
}
.read-pin .icon { width: 14px; height: 14px; }
.read-card:has(.read-pin) .read-card-title { padding-right: 30px; }
.read-card-title { font-size: 15px; font-weight: 650; line-height: 1.4; letter-spacing: -0.01em; }
.read-card-excerpt {
  font-size: 13px; color: var(--muted); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.read-card-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 11.5px; margin-top: auto; padding-top: 4px;
}
.read-tag {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: var(--accent-dim); color: var(--accent-hover); white-space: nowrap;
}
a.read-tag:hover { background: rgba(47, 128, 237, 0.18); }
.read-tag.src { background: var(--panel2); color: var(--muted); font-weight: 500; }

.read-empty {
  text-align: center; padding: 54px 20px; margin-top: 18px;
  background: var(--panel); border: 1px dashed var(--border-strong); border-radius: var(--radius);
}
.read-empty > .icon { width: 42px; height: 42px; color: var(--muted); }
.read-empty h3 { margin: 12px 0 8px; font-size: 17px; }
.read-empty p { margin-bottom: 18px; line-height: 1.7; }

/* ---------- Read: просмотр материала ---------- */
.read-post { max-width: 820px; margin: 0 auto; }
.read-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.read-actions .spacer { flex: 1; }
.read-title { font-size: 30px; font-weight: 700; line-height: 1.25; letter-spacing: -0.02em; margin-bottom: 10px; }
.read-post-meta {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--muted); margin-bottom: 18px;
}
.read-post-meta .icon { width: 13px; height: 13px; }
.read-src { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; }
a.read-src { color: var(--accent); }
span.read-src { color: var(--muted); }
.read-lead {
  font-size: 15.5px; line-height: 1.7; color: var(--muted);
  padding: 2px 0 2px 14px; border-left: 3px solid var(--accent); margin-bottom: 22px;
}

.read-article { font-size: 15px; line-height: 1.8; }
.read-article > :first-child { margin-top: 0; }
.read-article h1, .read-article h2, .read-article h3, .read-article h4, .read-article h5, .read-article h6 {
  margin: 26px 0 10px; line-height: 1.35; letter-spacing: -0.01em;
}
.read-article h1 { font-size: 24px; }
.read-article h2 { font-size: 20px; }
.read-article h3 { font-size: 17px; }
.read-article h4 { font-size: 15.5px; }
.read-article h5 { font-size: 14.5px; }
.read-article h6 { font-size: 13.5px; color: var(--muted); }
.read-article p { margin: 0 0 14px; }
.read-article ul, .read-article ol { margin: 0 0 14px 22px; }
.read-article li { margin-bottom: 6px; }
.read-article li > p { margin-bottom: 6px; }
.read-article strong { font-weight: 650; }
.read-article del { color: var(--muted); }
.read-article blockquote {
  margin: 0 0 14px; padding: 10px 14px 10px 16px;
  border-left: 3px solid var(--accent); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--bg-soft); color: var(--muted);
}
.read-article blockquote p:last-child { margin-bottom: 0; }
.read-article img { max-width: 100%; border-radius: var(--radius-sm); }
.read-article hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
.read-pre {
  margin: 0 0 14px; padding: 14px 16px; overflow-x: auto;
  background: var(--panel2); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.read-pre code { background: transparent; padding: 0; font-size: 12.5px; line-height: 1.6; }
.read-table-wrap {
  overflow-x: auto; margin: 0 0 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.read-table-wrap table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.read-table-wrap th, .read-table-wrap td {
  padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top;
}
.read-table-wrap th { background: var(--bg-soft); font-weight: 650; white-space: nowrap; }
.read-table-wrap tr:last-child td { border-bottom: 0; }

/* ---------- Read: редактор ---------- */
.read-form { display: flex; flex-direction: column; gap: 14px; max-width: 900px; }
.read-form-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1.3fr); gap: 12px; }
.read-field { display: block; }
.read-field > span { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.read-check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.read-check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.read-tabs { display: flex; gap: 6px; }
.read-tabs .btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.read-editor-ta {
  width: 100%; min-height: 440px; resize: vertical; padding: 14px 16px;
  font: 13px/1.65 'SF Mono', ui-monospace, Menlo, monospace;
}
.read-preview {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 18px 20px; min-height: 200px;
}

/* ---------- Read: подразделы ---------- */
.read-topics { padding: 6px; }
.read-topics > .muted { padding: 14px 12px; }
.read-topic-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center;
  padding: 12px; border-top: 1px solid var(--border);
}
.read-topic-row:first-child { border-top: 0; }
.read-topic-main b { display: block; font-size: 14px; font-weight: 650; }
.read-topic-main .muted { font-size: 12.5px; margin-top: 3px; line-height: 1.5; }
.read-topic-actions { display: flex; gap: 6px; }
.read-hint { margin-top: 12px; font-size: 12.5px; line-height: 1.6; max-width: 760px; }

@media (max-width: 900px) {
  .read-form-row { grid-template-columns: 1fr; }
  .read-search { width: 100%; }
}
@media (max-width: 620px) {
  .read-list { grid-template-columns: 1fr; }
  .read-title { font-size: 24px; }
  .read-post { max-width: none; }
  .read-topic-row { grid-template-columns: 1fr auto; gap: 10px; }
  .read-topic-main { grid-column: 1 / -1; }
}
