/* CommentBot SuperAdmin — light airy theme */
:root {
  --bg-base: #f4f6f8;
  --bg-surface: #ffffff;
  --bg-elevated: #f8fafb;
  --surface-2: #f1f5f9;
  --surface-3: #e8eef3;
  --bg-hover: #eef2f5;
  --bg-sidebar: #ffffff;
  --bg-input: #f8fafb;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --border-subtle: #edf0f4;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-on-accent: #ffffff;
  --accent: #0f766e;
  --accent-rgb: 15, 118, 110;
  --accent-hover: #0d9488;
  --accent-muted: rgba(15, 118, 110, 0.1);
  --accent-border: rgba(15, 118, 110, 0.28);
  --success: #059669;
  --success-muted: rgba(5, 150, 105, 0.12);
  --warning: #d97706;
  --warning-muted: rgba(217, 119, 6, 0.12);
  --danger: #dc2626;
  --danger-muted: rgba(220, 38, 38, 0.1);
  --info: #2563eb;
  --info-muted: rgba(37, 99, 235, 0.1);
  --sidebar-width: 268px;
  --topbar-height: 76px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 48px rgba(15, 23, 42, 0.08);
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', monospace;
  --transition: 0.18s ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-primary);
  background:
    radial-gradient(ellipse 70% 50% at 100% 0%, rgba(13, 148, 136, 0.06), transparent 55%),
    radial-gradient(ellipse 50% 40% at 0% 100%, rgba(37, 99, 235, 0.04), transparent 50%),
    var(--bg-base);
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

.hidden {
  display: none !important;
}

/* Layout */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  box-shadow: 1px 0 0 rgba(15, 23, 42, 0.02);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.15rem 1.15rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, var(--accent-muted), rgba(13, 148, 136, 0.04));
  border: 1px solid var(--accent-border);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-title {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.03em;
}

.brand-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.65rem 0.7rem 1.25rem;
}

.nav-group-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 1.15rem 0.65rem 0.4rem;
  margin: 0;
}

.nav-group-label:first-child {
  padding-top: 0.4rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  margin-bottom: 2px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-muted);
  color: var(--accent);
  box-shadow: none;
  font-weight: 600;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 0.9rem 0.85rem 1rem;
  border-top: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, transparent, var(--bg-elevated));
}

.bot-status {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.bot-status-lines {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.bot-status-label {
  line-height: 1.3;
}

.bot-status-sub {
  font-size: 0.68rem;
  line-height: 1.35;
  color: var(--text-muted);
  opacity: 0.9;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-muted);
  margin-top: 0.25rem;
  flex-shrink: 0;
}

.main-wrap {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.75rem;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--border-subtle);
}

.page-header {
  flex: 1;
  min-width: 0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
  flex-wrap: wrap;
}

.breadcrumb-group {
  color: var(--text-secondary);
}

.breadcrumb-sep {
  opacity: 0.45;
}

.breadcrumb-current {
  color: var(--accent);
  font-weight: 600;
}

.topbar-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.2;
}

.page-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.45;
  max-width: 58ch;
}

.page-subtitle:empty {
  display: none;
}

.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-toggle svg {
  width: 18px;
  height: 18px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
  z-index: 90;
  backdrop-filter: blur(3px);
}

.sidebar-overlay.visible {
  display: block;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 1.75rem 1.85rem 2.25rem;
  max-height: calc(100vh - var(--topbar-height));
}

/* Typography & utilities */
h2 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
}

h3 {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.muted {
  color: var(--text-muted);
}

.text-sm {
  font-size: 0.8rem;
}

.text-secondary {
  color: var(--text-secondary);
}

.flex {
  display: flex;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.gap-sm {
  gap: 0.5rem;
}

.gap-md {
  gap: 0.75rem;
}

.mt-sm {
  margin-top: 0.5rem;
}

.mt-md {
  margin-top: 1rem;
}

.mb-md {
  margin-bottom: 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition);
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: var(--text-on-accent);
  box-shadow: 0 1px 2px rgba(15, 118, 110, 0.2);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.22);
}

.btn-ghost {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: color-mix(in srgb, var(--border) 70%, var(--text-muted));
}

.btn-danger {
  background: var(--danger-muted);
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.22);
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  padding: 0.35rem;
  min-width: 32px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-active {
  background: var(--success-muted);
  color: var(--success);
}

.badge-pending {
  background: var(--warning-muted);
  color: var(--warning);
}

.badge-muted {
  background: var(--bg-hover);
  color: var(--text-muted);
}

.badge-danger {
  background: var(--danger-muted);
  color: var(--danger);
}

.badge-accent {
  background: var(--accent-muted);
  color: var(--accent-hover);
}

/* Panels & grids */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.15rem;
  box-shadow: var(--shadow-sm);
}

.panel-flush {
  padding: 0;
  overflow: hidden;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.metric-card:hover {
  border-color: color-mix(in srgb, var(--accent-border) 60%, var(--border));
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.metric-card .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  font-weight: 560;
}

.metric-card .value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.metric-card .delta {
  font-size: 0.75rem;
  margin-top: 0.35rem;
  color: var(--text-secondary);
}

.metric-card .delta.positive {
  color: var(--success);
}

.metric-card .delta.negative {
  color: var(--danger);
}

.channel-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
}

.channel-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.05rem 1.1rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition), transform var(--transition);
}

.channel-card:hover {
  border-color: var(--accent-border);
  background: var(--bg-surface);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.channel-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted), var(--shadow-sm);
}

.channel-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.channel-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-muted);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.channel-card-title > span:nth-child(2) {
  flex: 1;
  min-width: 0;
}

.channel-card-title strong {
  display: block;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Split view (channels) */
.split-view {
  display: flex;
  gap: 0;
  min-height: calc(100vh - var(--topbar-height) - 4rem);
  margin: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.split-list {
  width: 292px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  max-height: calc(100vh - var(--topbar-height) - 4rem);
  padding: 0.65rem;
  background: color-mix(in srgb, var(--bg-elevated) 75%, #fff);
}

.split-detail {
  flex: 1;
  min-width: 0;
  padding: 1.25rem 1.4rem;
  overflow-y: auto;
  max-height: calc(100vh - var(--topbar-height) - 4rem);
  background: var(--bg-surface);
}

/* Users page */
.users-page {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.users-toolbar .search-bar .input {
  max-width: min(420px, 100%);
}

.users-toolbar .search-bar .select {
  max-width: 220px;
}

.users-split {
  display: grid;
  grid-template-columns: minmax(280px, 33%) 1fr;
  min-height: calc(100vh - var(--topbar-height) - 12rem);
}

.users-list-pane {
  border-right: 1px solid var(--border-subtle);
  max-height: calc(100vh - var(--topbar-height) - 12rem);
  overflow-y: auto;
  background: color-mix(in srgb, var(--bg-surface) 88%, transparent);
}

.users-list-host {
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.user-list-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.9rem;
  cursor: pointer;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.user-list-item:hover {
  border-color: var(--accent-border);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.user-list-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted), var(--shadow-sm);
}

.user-list-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
}

.user-list-head-clean {
  justify-content: space-between;
}

.user-list-identity {
  min-width: 0;
  flex: 1;
}

.user-list-name {
  font-size: 0.96rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-list-channels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
}

.user-channel-tag {
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--accent-muted) 70%, transparent);
  color: var(--accent-hover);
  border: 1px solid color-mix(in srgb, var(--accent-border) 75%, transparent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-channel-tag-empty {
  background: color-mix(in srgb, var(--bg-hover) 85%, transparent);
  color: var(--text-muted);
  border-color: var(--border-subtle);
}

.user-list-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.user-list-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

.user-list-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  font-size: 0.72rem;
}

.users-detail-pane {
  padding: 0.85rem;
  max-height: calc(100vh - var(--topbar-height) - 12rem);
  overflow-y: auto;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-muted);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-avatar.with-photo img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.user-list-avatar {
  width: 42px;
  height: 42px;
  font-size: 0.86rem;
}

.user-detail-avatar {
  width: 64px;
  height: 64px;
  font-size: 1.05rem;
}

.user-detail-header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.user-detail-head-main h2 {
  margin-bottom: 0.2rem;
}

.user-detail-id {
  color: var(--text-muted);
  font-size: 0.74rem;
}

.user-detail-badges {
  margin-top: 0.45rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.user-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.65rem;
  margin: 0.95rem 0 0.35rem;
}

.user-kpi-value {
  font-size: 1rem !important;
}

.user-channel-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.55rem;
}

.user-channel-card {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.65rem;
}

.user-actions-row {
  margin-top: 0.95rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.user-comments-tabs {
  margin-top: 1rem;
}

.list-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.75rem;
  margin-bottom: 4px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: background var(--transition);
}

.list-item:hover {
  background: var(--bg-hover);
}

.list-item.active {
  background: var(--accent-muted);
  border-color: transparent;
  color: var(--accent);
  font-weight: 600;
}

.list-item-title {
  font-weight: 500;
  font-size: 0.875rem;
}

.list-item-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.list-item-channel {
  padding: 0.55rem 0.65rem;
}

.list-item-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.list-item-body {
  min-width: 0;
  flex: 1;
}

.channel-avatar.list-avatar {
  width: 36px;
  height: 36px;
  font-size: 0.75rem;
}

.channel-avatar.with-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.channel-detail-head {
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.channel-detail-intro {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  flex: 1;
}

.channel-detail-avatar {
  width: 56px;
  height: 56px;
  font-size: 1rem;
}

.channel-detail-head-text h2 {
  line-height: 1.25;
}

.channel-detail-status {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
}

.channel-detail-status.active {
  color: var(--success);
  background: var(--success-muted);
}

.channel-detail-status.pending {
  color: var(--warning);
  background: var(--warning-muted);
}

.section-title {
  margin: 1.25rem 0 0.75rem;
  font-size: 0.95rem;
}

.recent-comments {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.comment-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.85rem;
}

.comment-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.comment-card-user {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.comment-card-user strong {
  font-size: 0.875rem;
}

.comment-card-time {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.comment-status {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

.comment-status.answered {
  color: var(--success);
  background: var(--success-muted);
}

.comment-status.pending {
  color: var(--warning);
  background: var(--warning-muted);
}

.comment-source-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 0.35rem;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #2aabee;
  background: #2aabee20;
}

.comment-card-text {
  font-size: 0.875rem;
  line-height: 1.45;
  margin-bottom: 0.55rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-post-context {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  padding: 0.55rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
}

a.comment-post-context {
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease, border-color 0.15s ease;
}

a.comment-post-context:hover {
  background: var(--bg-hover, var(--bg-hover));
  border-color: var(--border-strong, var(--border-subtle));
}

.comment-post-label {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.comment-post-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.comment-post-body {
  min-width: 0;
  flex: 1;
}

.comment-post-author {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.1rem;
}

.comment-post-text {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.comment-post-time {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.comment-reply-block {
  margin-top: 0.55rem;
  padding: 0.55rem 0.65rem;
  border-left: 3px solid var(--success);
  background: var(--success-muted);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.comment-reply-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--success);
  margin-bottom: 0.2rem;
}

.comment-reply-text {
  font-size: 0.82rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-reply-time {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.settings-summary {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
}

.settings-summary-title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.settings-summary-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.settings-summary-row {
  display: grid;
  grid-template-columns: minmax(140px, 38%) 1fr;
  gap: 0.65rem;
  align-items: start;
}

.settings-summary-row dt {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.settings-summary-row dd {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.4;
  word-break: break-word;
}

.settings-editor {
  margin-top: 0.25rem;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.2rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.15rem;
  flex-wrap: wrap;
}

.tab {
  padding: 0.55rem 0.85rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 560;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.tab:hover {
  color: var(--text-secondary);
  background: var(--bg-hover);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: transparent;
}

.period-tabs {
  display: inline-flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}

.period-tab {
  padding: 0.35rem 0.7rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 560;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.period-tab.active {
  background: var(--bg-surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* Toggle switch */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.toggle-row:last-child {
  border-bottom: none;
}

.toggle-label {
  font-size: 0.875rem;
}

.toggle-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.switch {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
  background: var(--bg-hover);
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--transition);
  border: 1px solid var(--border);
}

.switch.on {
  background: var(--accent);
  border-color: var(--accent);
}

.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--transition);
}

.switch.on::after {
  transform: translateX(18px);
}

/* Tags */
.tags-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 42px;
  align-items: center;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.45rem;
  background: var(--accent-muted);
  color: var(--accent-hover);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
}

.tag button {
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  opacity: 0.7;
}

.tag button:hover {
  opacity: 1;
}

.tags-input {
  flex: 1;
  min-width: 80px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.8125rem;
  outline: none;
}

/* Forms */
.form-group {
  margin-bottom: 0.85rem;
}

.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.875rem;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.textarea {
  min-height: 88px;
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.search-bar .input {
  max-width: 280px;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

thead th {
  text-align: left;
  padding: 0.5rem 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

tbody tr:hover td {
  background: var(--bg-elevated);
}

/* Activity feed */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent-hover);
}

.activity-body {
  flex: 1;
  min-width: 0;
}

.activity-title {
  font-size: 0.875rem;
  font-weight: 500;
}

.activity-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.activity-preview {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Funnel */
.funnel {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.funnel-step {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  text-align: center;
  position: relative;
}

.funnel-step:not(:last-child)::after {
  content: '→';
  position: absolute;
  right: -0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
  z-index: 1;
}

.funnel-step .num {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent-hover);
}

.funnel-step .lbl {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Chart bars */
.chart-wrap {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 140px;
  padding: 0.5rem 0 0;
}

.chart-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  min-width: 0;
}

.chart-bar {
  width: 100%;
  max-width: 28px;
  background: linear-gradient(180deg, var(--accent-hover), var(--accent));
  border-radius: 4px 4px 0 0;
  margin-top: auto;
  min-height: 2px;
  transition: height 0.3s ease;
}

.chart-lbl {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* Metric bars */
.metric-bars {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.metric-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.8rem;
}

.bar-track {
  height: 6px;
  background: var(--bg-hover);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.metric-row .val {
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 2.5rem;
  text-align: right;
}

/* Effectiveness ring */
.dash-grid-top {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.eff-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
}

.eff-ring {
  width: 88px;
  height: 88px;
  margin: 0 auto 0.5rem;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--pct, 0) * 1%), var(--bg-hover) 0);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.eff-ring::before {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--bg-surface);
}

.eff-score {
  position: relative;
  z-index: 1;
  font-size: 1.5rem;
  font-weight: 700;
}

.eff-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0;
}

.eff-grade {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.eff-grade.excellent {
  background: var(--success-muted);
  color: var(--success);
}

.eff-grade.good {
  background: var(--accent-muted);
  color: var(--accent-hover);
}

.eff-grade.fair {
  background: var(--warning-muted);
  color: var(--warning);
}

.eff-grade.low {
  background: var(--danger-muted);
  color: var(--danger);
}

.insights-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.insights-list li {
  margin-bottom: 0.35rem;
}

/* Log viewer */
.log-toolbar {
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.log-auto-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.log-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 0.65rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.log-stat strong {
  color: var(--text-primary);
}

.log-stat.stat-warn strong {
  color: var(--warning);
}

.log-stat.stat-error strong {
  color: var(--danger);
}

.log-stat.stat-debug strong {
  color: var(--text-muted);
}

.log-viewer {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  max-height: 65vh;
  overflow: auto;
  font-size: 0.84rem;
  line-height: 1.45;
}

.log-entry {
  border-left: 3px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.65rem;
  margin-bottom: 0.45rem;
  background: var(--bg-card);
}

.log-entry.level-info {
  border-left-color: var(--text-muted);
}

.log-entry.level-warn {
  border-left-color: var(--warning);
  background: color-mix(in srgb, var(--warning) 6%, var(--bg-card));
}

.log-entry.level-error {
  border-left-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 7%, var(--bg-card));
}

.log-entry.level-debug {
  border-left-color: var(--accent);
  opacity: 0.92;
}

.log-entry-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.log-entry-actions {
  margin-left: auto;
}

.log-copy-btn {
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  gap: 0.25rem;
}

.log-copy-btn i {
  width: 0.85rem;
  height: 0.85rem;
}

.log-copy-payload {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.log-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.log-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: var(--bg-input);
  color: var(--text-secondary);
}

.log-badge-chain {
  text-transform: none;
  background: color-mix(in srgb, var(--accent, #0d9488) 16%, transparent);
  color: var(--accent, #0d9488);
}

.chain-log-panel {
  margin-bottom: 12px;
  padding: 12px 14px;
  background: var(--surface-2, #f4f5f7);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.chain-log-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  justify-content: space-between;
}

.chain-log-health {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.chain-log-health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.chain-log-health.is-ok .chain-log-health-dot {
  background: #16a34a;
}

.chain-log-health.is-warn .chain-log-health-dot {
  background: var(--warning, #e07b00);
}

.chain-log-health.is-bad .chain-log-health-dot {
  background: var(--danger, #dc2626);
}

.chain-log-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.chain-log-metrics .is-warn,
.chain-log-card-stats .is-warn,
.chain-log-queue-row .is-warn {
  color: var(--warning, #e07b00);
}

.chain-log-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.chain-log-card {
  cursor: pointer;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.chain-log-card.is-ok {
  border-left-color: #16a34a;
}

.chain-log-card.is-warn {
  border-left-color: var(--warning, #e07b00);
}

.chain-log-card.is-bad {
  border-left-color: var(--danger, #dc2626);
}

.chain-log-card.is-idle {
  border-left-color: var(--text-muted);
  opacity: 0.88;
}

.chain-log-card header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
}

.chain-log-kind,
.chain-log-status {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.chain-log-title {
  font-weight: 600;
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chain-log-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 0.75rem;
  margin-top: 4px;
  color: var(--text-secondary);
}

.chain-log-error {
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--danger, #dc2626);
  word-break: break-word;
}

.chain-log-queue,
.chain-log-events {
  margin-top: 10px;
}

.chain-log-queue h4,
.chain-log-events h4 {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--text-secondary);
}

.chain-log-queue-row,
.chain-log-event {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 0.78rem;
  padding: 4px 0;
  border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

.chain-log-event time {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.chain-log-event-tag {
  font-size: 0.68rem;
  font-weight: 650;
  text-transform: uppercase;
}

.chain-log-event.outcome-success .chain-log-event-tag {
  color: #16a34a;
}

.chain-log-event.outcome-fail .chain-log-event-tag {
  color: var(--danger, #dc2626);
}

.chain-log-event.outcome-retry,
.chain-log-event.outcome-partial,
.chain-log-event.outcome-queue {
  color: inherit;
}

.chain-log-event.outcome-retry .chain-log-event-tag,
.chain-log-event.outcome-partial .chain-log-event-tag,
.chain-log-event.outcome-queue .chain-log-event-tag {
  color: var(--warning, #e07b00);
}

.log-entry.level-warn .log-badge {
  background: color-mix(in srgb, var(--warning) 18%, transparent);
  color: var(--warning);
}

.log-entry.level-error .log-badge {
  background: color-mix(in srgb, var(--danger) 18%, transparent);
  color: var(--danger);
}

.log-message {
  margin: 0;
  word-break: break-word;
  white-space: pre-wrap;
  color: var(--text-primary);
}

.log-extra {
  margin: 0.4rem 0 0;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border);
  font-size: 0.72rem;
  line-height: 1.45;
  overflow-x: auto;
  max-height: 14rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-secondary);
}

.log-extra-wrap {
  margin-top: 0.35rem;
}

.log-extra-wrap summary {
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--accent);
  user-select: none;
}

.log-extra-wrap[open] .log-extra {
  max-height: min(50vh, 32rem);
}

.log-extra-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: 0.35rem 0 0.25rem;
}

.log-hl {
  background: color-mix(in srgb, var(--accent) 35%, transparent);
  color: inherit;
  padding: 0 0.1em;
  border-radius: 2px;
}

.log-loading,
.log-empty {
  padding: 1rem;
  text-align: center;
}

/* AI log analysis */
.log-ai-panel {
  margin-bottom: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--accent) 4%, var(--bg-card));
}

.log-ai-loading,
.log-ai-error {
  padding: 0.75rem 0.25rem;
  text-align: center;
}

.log-ai-error {
  text-align: left;
  color: var(--danger);
}

.log-ai-error p {
  margin: 0.35rem 0 0;
  color: var(--text-secondary);
}

.log-ai-spinner {
  display: inline-block;
  width: 0.95rem;
  height: 0.95rem;
  margin-right: 0.35rem;
  border: 2px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: log-ai-spin 0.8s linear infinite;
  vertical-align: -2px;
}

@keyframes log-ai-spin {
  to {
    transform: rotate(360deg);
  }
}

.log-ai-head {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.log-ai-score {
  flex-shrink: 0;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 700;
  border: 2px solid var(--border);
}

.log-ai-score-ok {
  border-color: rgba(16, 185, 129, 0.45);
  color: #10b981;
  background: color-mix(in srgb, #10b981 8%, transparent);
}

.log-ai-score-attention {
  border-color: rgba(245, 158, 11, 0.45);
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 8%, transparent);
}

.log-ai-score-critical {
  border-color: rgba(239, 68, 68, 0.45);
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}

.log-ai-head-text {
  flex: 1;
  min-width: 0;
}

.log-ai-status {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.25rem;
}

.log-ai-status-ok {
  color: #10b981;
}

.log-ai-status-attention {
  color: var(--warning);
}

.log-ai-status-critical {
  color: var(--danger);
}

.log-ai-summary {
  margin: 0;
  line-height: 1.5;
}

.log-ai-meta {
  margin-top: 0.35rem;
}

.log-ai-head-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.log-ai-section {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.log-ai-section-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 0.55rem;
  font-size: 0.92rem;
}

.log-ai-section-title i {
  width: 1rem;
  height: 1rem;
}

.log-ai-problems {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.log-ai-problem {
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left-width: 3px;
}

.log-ai-problem-critical {
  border-left-color: var(--danger);
}

.log-ai-problem-warning {
  border-left-color: var(--warning);
}

.log-ai-problem-info {
  border-left-color: var(--accent);
}

.log-ai-problem p {
  margin: 0.35rem 0 0;
  color: var(--text-secondary);
  line-height: 1.45;
}

.log-ai-problem-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.log-ai-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
}

.log-ai-badge-critical {
  background: color-mix(in srgb, var(--danger) 16%, transparent);
  color: var(--danger);
}

.log-ai-badge-warning {
  background: color-mix(in srgb, var(--warning) 16%, transparent);
  color: var(--warning);
}

.log-ai-badge-info {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
}

.log-ai-fix {
  margin-top: 0.45rem;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  font-size: 0.82rem;
  line-height: 1.45;
}

.log-ai-fix span {
  font-weight: 600;
  color: var(--text-primary);
}

.log-ai-list {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.log-ai-recs li + li {
  margin-top: 0.25rem;
}

.log-ai-action-panel {
  margin-bottom: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  background: color-mix(in srgb, var(--accent) 5%, var(--bg-card));
}

.log-ai-action-panel--inline {
  padding: 0.75rem;
}

.log-ai-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* AI operator settings */
.ai-operator-panel {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
}

.ai-operator-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  background: var(--bg-input);
}

.ai-operator-status.is-ok {
  color: #10b981;
  background: color-mix(in srgb, #10b981 10%, var(--bg-input));
}

.ai-operator-status.is-off {
  color: var(--text-muted);
}

.ai-operator-status-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: currentColor;
}

.ai-operator-summary {
  margin-bottom: 0.85rem;
}

.ai-operator-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.ai-operator-test-result {
  margin: 0.65rem 0 0.25rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  line-height: 1.45;
}

.ai-operator-test-result.is-loading {
  background: var(--bg-input);
  color: var(--text-secondary);
}

.ai-operator-test-result.is-ok {
  background: color-mix(in srgb, #10b981 10%, var(--bg-input));
  border: 1px solid color-mix(in srgb, #10b981 30%, var(--border));
  color: var(--text-primary);
}

.ai-operator-test-result.is-error {
  background: color-mix(in srgb, var(--danger) 8%, var(--bg-input));
  border: 1px solid color-mix(in srgb, var(--danger) 28%, var(--border));
  color: var(--danger);
}

/* Legacy one-line logs (fallback) */
.log-line {
  padding: 0.1rem 0;
  word-break: break-word;
  white-space: pre-wrap;
}

.log-line.level-info {
  color: var(--text-secondary);
}

.log-line.level-warn {
  color: var(--warning);
}

.log-line.level-error {
  color: var(--danger);
}

.log-line.level-debug {
  color: var(--text-muted);
}

/* Toast */
.toast-root {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 240px;
  max-width: 360px;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  color: var(--text-primary);
  animation: toast-in 0.25s ease;
}

.toast.success {
  border-color: rgba(16, 185, 129, 0.4);
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.4);
}

.toast.info {
  border-color: var(--accent-border);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fade-in 0.15s ease;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.45rem;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.modal h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.modal p {
  margin: 0 0 1rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Skeleton */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-hover) 25%,
    var(--bg-elevated) 50%,
    var(--bg-hover) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 0.875rem;
  margin-bottom: 0.35rem;
}

.skeleton-title {
  height: 1.25rem;
  width: 60%;
  margin-bottom: 0.5rem;
}

.skeleton-card {
  height: 100px;
  border-radius: var(--radius-md);
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3.25rem 1.75rem;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}

.empty-state svg {
  width: 40px;
  height: 40px;
  margin-bottom: 0.85rem;
  opacity: 0.35;
  color: var(--accent);
}

.empty-state h3 {
  color: var(--text-primary);
  margin-bottom: 0.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.empty-state p {
  font-size: 0.875rem;
  max-width: 340px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Stats grid (dashboard extended) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
}

.stat-card .label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.stat-card .value {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0.2rem 0;
}

.stat-card .sub {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.dash-loading {
  color: var(--text-muted);
  padding: 2rem;
  text-align: center;
}

.home-bot-launcher {
  margin: 1.25rem 0;
  padding: 1.1rem 1.15rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--accent-muted) 35%, var(--bg-surface)),
    var(--bg-surface)
  );
}

.home-bot-launcher-title {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 700;
}

.home-bot-launcher-sub {
  margin: 0 0 14px;
  font-size: 13px;
}

.home-bot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.home-bot-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.home-bot-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-border);
  box-shadow: var(--shadow-md);
}

.home-bot-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.home-bot-card-top i {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.home-bot-platform {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.home-bot-platform.tg {
  background: #2aabee22;
  color: #2aabee;
}

.home-bot-platform.max {
  background: var(--accent-muted);
  color: var(--accent);
}

.home-bot-card--tg:hover {
  border-color: #2aabee55;
}

.home-bot-card--max:hover {
  border-color: var(--accent-border);
}

.home-bot-card-title {
  font-size: 15px;
  font-weight: 700;
}

.home-bot-card-desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
  flex: 1;
}

.home-bot-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.home-bot-card--tg .home-bot-card-cta {
  color: #2aabee;
}

.home-bot-card-cta i {
  width: 14px;
  height: 14px;
}

.dash-platform-section {
  margin-top: 1.75rem;
  padding-top: 0.35rem;
}

.dash-platform-head {
  margin-bottom: 0.9rem;
}

.dash-platform-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.dash-platform-sub {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
}

.dash-platform-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
}

.dash-platform-badge.tg {
  background: #2aabee18;
  color: #0b8ecf;
}

.dash-platform-badge.max {
  background: var(--accent-muted);
  color: var(--accent);
}

.dash-platform-body {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

.dash-platform-section--max .dash-platform-body {
  border-color: color-mix(in srgb, var(--accent-border) 55%, var(--border));
}

.dash-platform-section--tg .dash-platform-body {
  border-color: color-mix(in srgb, #2aabee 22%, var(--border));
}

@media (max-width: 900px) {
  .home-bot-grid {
    grid-template-columns: 1fr;
  }
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.tg-proxy-panel + .two-col {
  margin-top: 0.25rem;
}

@media (max-width: 1100px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .funnel {
    grid-template-columns: repeat(2, 1fr);
  }

  .funnel-step:nth-child(2n)::after {
    display: none;
  }

  .dash-grid-top {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar-toggle {
    display: inline-flex;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-wrap {
    margin-left: 0;
  }

  .page-subtitle {
    display: none;
  }

  .topbar {
    padding: 0.65rem 0.85rem;
    min-height: auto;
  }

  .split-view {
    flex-direction: column;
  }

  .split-list {
    width: 100%;
    max-height: 200px;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }

  .split-detail {
    padding-left: 0;
    padding-top: 1rem;
  }

  .users-split {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .users-list-pane {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    max-height: 230px;
  }

  .users-detail-pane {
    max-height: none;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .two-col,
  .form-row {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 0.85rem;
  }
}

/* Integrations */
.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-muted);
  color: var(--accent);
}

.int-page { max-width: 920px; }

.int-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.int-page-head-text h2 {
  margin: 0 0 6px;
  font-size: 1.15rem;
}

.int-page-head-text p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 520px;
}

.int-status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.int-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-elevated, var(--bg-surface));
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.int-status-pill.is-ok {
  border-color: rgba(16, 185, 129, 0.35);
  color: var(--success);
  background: var(--success-muted);
}

.int-status-pill.is-muted {
  color: var(--text-muted);
}

.int-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.int-pill-dot.telegram { background: #2aabee; }
.int-pill-dot.vk { background: #4c75a3; }
.int-pill-dot.max { background: var(--accent); }

.int-guide {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 10px;
  align-items: stretch;
  margin-bottom: 20px;
  padding: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.int-guide-item {
  display: flex;
  gap: 10px;
  font-size: 12px;
  line-height: 1.45;
}

.int-guide-item p {
  margin: 4px 0 8px;
  color: var(--text-secondary);
}

.int-guide-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.int-guide-icon.telegram { background: #2aabee20; color: #2aabee; }
.int-guide-icon.max { background: var(--accent-muted); color: var(--accent); }
.int-guide-icon.vk { background: #4c75a320; color: #4c75a3; }

.int-guide-arrow {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  opacity: 0.5;
}

.int-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0;
}

.int-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 14px;
  margin-bottom: -1px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  cursor: pointer;
}

.int-tab.active {
  background: transparent;
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.int-tab-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--accent-muted);
  color: var(--accent);
}

.int-section-block { margin-bottom: 24px; }

.integrations-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.integrations-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.integration-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.integration-card.connected { border-color: rgba(16, 185, 129, 0.3); }

.int-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 12px;
}

.int-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.int-logo.telegram { background: #2aabee20; color: #2aabee; }
.int-logo.vk { background: #4c75a320; color: #4c75a3; }
.int-logo.max { background: var(--accent-muted); color: var(--accent); }

.int-info { flex: 1; min-width: 0; }
.int-name { font-weight: 600; font-size: 14px; }
.int-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; line-height: 1.4; }

.int-status {
  margin-left: auto;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.int-status.disconnected { background: var(--danger-muted); color: var(--danger); }
.int-status.connected { background: var(--success-muted); color: var(--success); }

.int-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 16px 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(217, 119, 6, 0.12);
  color: var(--warning, #d97706);
  font-size: 12px;
  line-height: 1.4;
}

.int-quick-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 12px;
}

.int-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  min-width: 72px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.int-stat-val {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}

.int-stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.int-details {
  border-top: 1px solid var(--border-subtle);
}

.int-details summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.int-details summary::-webkit-details-marker { display: none; }

.int-details summary:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.int-details-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent-muted);
  color: var(--accent);
}

.int-details-body {
  padding: 0 16px 16px;
}

.int-body { padding-top: 4px; border-top: none; }

.int-meta {
  padding: 0 16px 16px;
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
}

.saved-token-block {
  padding: 0 0 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.saved-token-label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.saved-token-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.saved-token-input {
  flex: 1;
  min-width: 180px;
  font-size: 12px;
}

.saved-token-hint { margin: 6px 0 0; }

.form-hint { margin: 6px 0 0; line-height: 1.4; }

.int-token-warning {
  padding: 8px 16px;
  color: var(--warning, #d97706);
}

.tg-chats-panel-wrap { padding: 0; border-bottom: none; }

.tg-chats-panel-head { margin-bottom: 8px; }

.tg-chats-panel-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.int-channel-stat {
  font-size: 12px;
  color: var(--text-secondary);
}

.int-channel-stat.is-ok strong { color: var(--success); }

.int-channels-hint { margin: 0 0 10px; }

.tg-chats-actions { display: flex; gap: 8px; flex-shrink: 0; }

.tg-chats-list { list-style: none; margin: 0; padding: 0; }

.tg-chat-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.tg-chat-item--admin { border-left: 3px solid var(--success, #10b981); padding-left: 8px; }

.tg-chats-section-label { margin: 8px 0 4px; }

.tg-chats-empty { padding: 12px 0; }

.int-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.int-expand-btn {
  width: 100%;
  padding: 10px;
  background: none;
  border: none;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
}

.int-info-callout {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: var(--accent-muted);
  border: 1px solid var(--accent-border, var(--accent-border));
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.int-info-callout > i,
.int-info-callout svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--accent);
}

.int-flows-toolbar { margin-top: 16px; }

.flow-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 10px;
}

.flow-card.is-active { border-color: rgba(16, 185, 129, 0.25); }
.flow-card.is-paused { opacity: 0.85; }

.flow-card-head { margin-bottom: 12px; }
.flow-card-title { font-weight: 600; font-size: 14px; }
.flow-card-sub { margin-top: 2px; }

.flow-pipeline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }

.flow-node { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 140px; }

.flow-node-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
}

.flow-node-icon.telegram { background: #2aabee20; color: #2aabee; }
.flow-node-icon.vk { background: #4c75a320; color: #4c75a3; }
.flow-node-icon.max { background: var(--accent-muted); color: var(--accent); }

.flow-node-platform { font-size: 10px; color: var(--text-muted); text-transform: uppercase; }

.flow-arrow { display: flex; flex-direction: column; align-items: center; color: var(--text-muted); }

.flow-filter-badge { font-size: 10px; color: var(--text-muted); }

.flow-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.flow-stat { display: inline-flex; align-items: center; gap: 4px; }

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

.flow-builder {
  background: var(--bg-surface);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 16px;
}

.flow-builder-head h3 { margin: 0; font-size: 1rem; }

.flow-builder-steps {
  display: flex;
  gap: 12px;
  margin: 12px 0 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.flow-builder-step { padding: 4px 10px; background: var(--bg-elevated); border-radius: 999px; }

.builder-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.builder-step { margin-bottom: 0; }

.step-label { display: flex; align-items: center; gap: 10px; font-weight: 500; margin-bottom: 12px; }

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-optional { font-size: 11px; color: var(--text-muted); font-weight: 400; }

.builder-actions { display: flex; gap: 8px; margin-top: 16px; }

.analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.analytics-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.analytics-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }

.analytics-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.a-stat-val { font-size: 20px; font-weight: 600; }

.a-stat-label { font-size: 11px; color: var(--text-muted); }

.analytics-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px;
  color: var(--text-muted);
  font-size: 13px;
}

.badge.success { background: var(--success-muted); color: var(--success); font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.badge.disconnected { background: var(--danger-muted); color: var(--danger); font-size: 11px; padding: 2px 8px; border-radius: 10px; }

.int-log-card .forwarded-list { max-height: 360px; overflow-y: auto; }

.forwarded-list { max-height: 360px; overflow-y: auto; }

.forwarded-item {
  display: grid;
  grid-template-columns: auto auto auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
}

.fwd-platform {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.fwd-platform.telegram { background: #2aabee20; color: #2aabee; }
.fwd-platform.vk { background: #4c75a320; color: #4c75a3; }
.fwd-platform.max { background: var(--accent-muted); color: var(--accent); }

.fwd-preview { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.fwd-time { color: var(--text-muted); white-space: nowrap; }

.mt-md { margin-top: 16px; }

.card-like {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

/* Шаг 7: блок Telegram → MAX */
.mtproto-panel {
  border: 1px solid var(--border, #e5e7eb);
}
.mtproto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.mtproto-status-badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: var(--radius-md, 8px);
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-muted, #f3f4f6);
  color: var(--text-muted, #6b7280);
  max-width: min(320px, 100%);
  line-height: 1.35;
}
.mtproto-status-badge.is-ok {
  background: #ecfdf5;
  color: #047857;
}
.mtproto-status-badge.is-err {
  background: #fef2f2;
  color: #b91c1c;
}
.mtproto-login-block {
  padding-top: 12px;
  border-top: 1px dashed var(--border, #e5e7eb);
}
.mtproto-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.forwarding-section {
  margin-top: 0;
}
.forwarding-section-title {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 600;
}
.forwarding-empty {
  color: var(--text-muted);
}

.forwarding-add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.forwarding-add-form .input,
.forwarding-add-form .select {
  flex: 1;
  min-width: 160px;
}
.forwarding-add-form--picks {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}
.forwarding-add-form--picks .form-group {
  margin: 0;
}
.forwarding-add-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.forwarding-list-wrap {
  margin-top: 16px;
}
.forwarding-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  background: var(--bg-surface);
}
.forwarding-row-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Цепочки (Chains hub) ── */
.tg-chains-page,
.chains-hub {
  max-width: 1180px;
}

.chains-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}

.chains-page-head-text h2 {
  margin: 0 0 4px;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.chains-page-head-text p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
  max-width: 52ch;
}

.chains-inline-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chains-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.chains-stat-pill strong {
  color: var(--text-primary);
  font-weight: 700;
}

.chains-stat-pill.is-warn {
  border-color: color-mix(in srgb, var(--danger, #e11) 35%, var(--border-subtle));
  background: color-mix(in srgb, var(--danger, #e11) 8%, var(--bg-surface));
  color: var(--danger, #e11);
}

.chains-stat-pill i,
.chains-stat-pill svg {
  width: 13px;
  height: 13px;
  opacity: 0.75;
}

.chains-platform-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  padding: 0.25rem;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  width: fit-content;
}

.chains-platform-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
}

.chains-platform-tab i,
.chains-platform-tab svg {
  width: 15px;
  height: 15px;
  opacity: 0.8;
}

.chains-platform-tab .chains-tab-count {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--bg-hover);
  color: var(--text-muted);
}

.chains-platform-tab:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.chains-platform-tab.active {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.chains-platform-tab.active .chains-tab-count {
  background: var(--accent-muted);
  color: var(--accent-hover);
}

.chains-connect-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.75rem 0.9rem;
  margin-bottom: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--warning-muted);
  background: var(--warning-muted);
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.chains-layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  gap: 1.1rem;
  align-items: start;
}

.chains-panel {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  overflow: hidden;
}

.chains-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
}

.chains-panel-head h3 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.chains-panel-head h3 i,
.chains-panel-head h3 svg {
  width: 16px;
  height: 16px;
  color: var(--accent-hover);
}

.chains-panel-body {
  padding: 1rem;
}

.chains-panel--list .chains-panel-body {
  padding: 0.75rem 1rem 1rem;
}

.chains-wizard-steps {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.chains-wizard-step {
  flex: 1;
  text-align: center;
  padding: 0.45rem 0.35rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-subtle);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.25;
}

.chains-wizard-step.is-done {
  border-style: solid;
  border-color: var(--accent-border);
  background: var(--accent-muted);
  color: var(--accent-hover);
}

.chains-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.chains-search-wrap {
  flex: 1 1 140px;
  position: relative;
  min-width: 0;
}

.chains-search-wrap i,
.chains-search-wrap svg {
  position: absolute;
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.chains-search-input {
  width: 100%;
  padding: 0.42rem 0.65rem 0.42rem 2rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.82rem;
}

.chains-search-input:focus {
  outline: none;
  border-color: var(--accent-border);
  box-shadow: 0 0 0 2px var(--accent-muted);
}

.chains-filter-chips {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.chains-filter-chip {
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 0.28rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.chains-filter-chip:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.chains-filter-chip.active {
  background: var(--accent-muted);
  border-color: var(--accent-border);
  color: var(--accent-hover);
}

.chains-list-grid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.chains-list-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.chain-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.chain-card:hover {
  border-color: var(--accent-border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.chain-card.is-paused {
  opacity: 0.78;
}

.chain-card.is-paused .chain-card__flow::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.chain-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem 0;
}

.chain-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.chain-status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.chain-status-badge--active {
  background: color-mix(in srgb, #1d9e75 15%, transparent);
  color: #1d9e75;
}

.chain-status-badge--paused {
  background: color-mix(in srgb, var(--text-muted) 18%, transparent);
  color: var(--text-muted);
}

.chain-card__id {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: var(--font-mono, monospace);
}

.chain-card__flow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  position: relative;
}

.chain-card__node {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.chain-card__platform-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.chain-card__node--tg .chain-card__platform-icon {
  background: #2aabee22;
  color: #2aabee;
}

.chain-card__node--max .chain-card__platform-icon {
  background: var(--accent-muted);
  color: var(--accent);
}

.chain-card__node--vk .chain-card__platform-icon {
  background: rgba(76, 117, 163, 0.18);
  color: #7eb0e8;
}

.chain-card__node-info {
  min-width: 0;
  flex: 1;
}

.chain-card__node-name {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chain-card__node-id {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chain-card__connector {
  flex-shrink: 0;
  color: var(--accent);
  opacity: 0.85;
}

.chain-card__connector i,
.chain-card__connector svg {
  width: 16px;
  height: 16px;
}

.chain-card__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  padding: 0 0.85rem 0.55rem;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.chain-card__stats span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.chain-card__stats i,
.chain-card__stats svg {
  width: 12px;
  height: 12px;
  opacity: 0.7;
}

.chain-card__stats .is-error {
  color: var(--danger, #e11);
  font-weight: 600;
}

.chain-card__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  padding: 0.55rem 0.85rem;
  border-top: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--bg-surface) 60%, transparent);
}

.chain-card__toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  align-items: center;
}

.chain-card__actions-end {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  margin-left: auto;
}

.chains-mtproto-fold {
  margin-bottom: 0.85rem;
}

.chains-mtproto-fold summary {
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  user-select: none;
  padding: 0.35rem 0;
}

.chains-mtproto-fold .mtproto-panel {
  margin-top: 0.5rem;
  border: none;
  padding: 0;
  background: transparent;
}

.chains-requirements {
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.chains-requirements ul {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
}

.chains-requirements li {
  margin-bottom: 0.15rem;
}

.chains-wizard-toggle {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chains-wizard-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.chains-wizard-toggle i,
.chains-wizard-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform var(--transition);
}

.chains-panel.is-collapsed .chains-wizard-toggle i,
.chains-panel.is-collapsed .chains-wizard-toggle svg {
  transform: rotate(-90deg);
}

.chains-panel.is-collapsed .chains-panel-body {
  display: none;
}

@media (min-width: 961px) {
  .chains-panel--wizard {
    position: sticky;
    top: 0.75rem;
    max-height: calc(100vh - var(--topbar-height, 56px) - 1.5rem);
    overflow-y: auto;
    align-self: start;
  }
}

.tg-chain-node.vk-dest .tg-chain-node-badge {
  background: rgba(76, 117, 163, 0.18);
  color: #7eb0e8;
  border-color: rgba(76, 117, 163, 0.35);
}
.tg-chain-hero {
  margin-bottom: 16px;
}
.tg-chain-flow-diagram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 16px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated, var(--bg-surface));
  border: 1px dashed var(--border-subtle);
}
.tg-chain-node {
  flex: 1 1 140px;
  max-width: 220px;
  text-align: center;
  padding: 12px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}
.tg-chain-node-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 6px;
}
.tg-chain-node.tg-source .tg-chain-node-badge {
  background: #2aabee22;
  color: #2aabee;
}
.tg-chain-node.max-dest .tg-chain-node-badge {
  background: var(--accent-muted);
  color: var(--accent);
}
.tg-chain-node-title {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
}
.tg-chain-node-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.tg-chain-arrow {
  flex: 0 0 auto;
  font-size: 22px;
  color: var(--accent);
  font-weight: 700;
  line-height: 1;
}
.tg-chain-steps {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
}
.tg-chain-steps li {
  margin-bottom: 4px;
}
.tg-chain-setup-title {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 600;
}
.tg-chain-pair-live {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--accent-muted);
  border: 1px solid var(--accent-border, var(--border));
  font-size: 13px;
  line-height: 1.45;
}
.tg-chain-pair-live.is-empty {
  background: var(--bg-elevated, var(--bg-surface));
  border-color: var(--border-subtle);
  color: var(--text-muted);
}
.tg-chain-advanced {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}
.tg-chain-advanced summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  user-select: none;
}
.tg-chain-comment-sync {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-elevated, #f8fafc);
}
.tg-chain-comment-settings {
  margin: 10px 0 4px;
}
.tg-chain-comment-settings summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  user-select: none;
}
.tg-chain-list-title {
  margin: 20px 0 10px;
  font-size: 16px;
  font-weight: 600;
}
.tg-chain-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--bg-surface);
}
.tg-chain-card.is-paused {
  opacity: 0.72;
}
.tg-chain-card-flow {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.tg-chain-card-end {
  flex: 1 1 120px;
  min-width: 0;
}
.tg-chain-card-end-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.tg-chain-card-end-name {
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tg-chain-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.tg-chain-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
}
.tg-chain-card-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: center;
}
.tg-chain-mini-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.tg-chain-empty,
.chains-empty {
  text-align: center;
  padding: 2.5rem 1.25rem;
  color: var(--text-muted);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}

.chains-empty-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 0.65rem;
  color: var(--text-muted);
  opacity: 0.5;
}

.chains-empty-title {
  margin: 0 0 4px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.chains-empty-hint {
  margin: 0;
  font-size: 0.78rem;
}

@media (max-width: 960px) {
  .chains-layout {
    grid-template-columns: 1fr;
  }

  .chains-panel--wizard {
    order: 2;
  }

  .chains-panel--list {
    order: 1;
  }
}

@media (max-width: 560px) {
  .chain-card__flow {
    flex-direction: column;
    align-items: stretch;
  }

  .chain-card__connector {
    align-self: center;
    transform: rotate(90deg);
  }

  .chain-card__footer {
    flex-direction: column;
    align-items: stretch;
  }

  .chain-card__actions-end {
    margin-left: 0;
    justify-content: flex-end;
  }
}

.card-header { margin-bottom: 12px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 8px 0; }

@media (max-width: 768px) {
  .integrations-grid,
  .analytics-grid,
  .builder-grid,
  .int-guide {
    grid-template-columns: 1fr;
  }

  .int-guide-arrow {
    display: none;
  }

  .int-page-head {
    flex-direction: column;
  }

  .forwarded-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

/* ── Quick navigation (dashboard) ── */
.quick-nav {
  margin-bottom: 1.5rem;
}

.quick-nav-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.quick-nav-title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.quick-nav-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
}

.quick-nav-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  padding: 1rem 1.05rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), background var(--transition), transform var(--transition), box-shadow var(--transition);
  font: inherit;
  text-align: left;
}

.quick-nav-card:hover {
  border-color: var(--accent-border);
  background: var(--bg-surface);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.quick-nav-card i,
.quick-nav-card svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.quick-nav-card-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.quick-nav-card-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* ── Section headers inside content ── */
.content-block-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 1.25rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.content-block-head:first-child {
  margin-top: 0;
}

.content-block-head h3,
.content-block-head h2 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.content-block-head .block-desc {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.content h3 {
  font-size: 0.875rem;
  font-weight: 600;
  margin: 1.25rem 0 0.65rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-subtle);
}

.content h3:first-child {
  margin-top: 0;
}

/* ── Scrollbars ── */
.sidebar-nav,
.content,
.split-list,
.split-detail,
.log-viewer {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar-nav::-webkit-scrollbar,
.content::-webkit-scrollbar,
.split-list::-webkit-scrollbar,
.log-viewer::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb,
.content::-webkit-scrollbar-thumb,
.split-list::-webkit-scrollbar-thumb,
.log-viewer::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

/* ── Login page ── */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.75rem;
  background:
    radial-gradient(ellipse 70% 50% at 50% -5%, rgba(13, 148, 136, 0.16), transparent 55%),
    radial-gradient(ellipse 45% 40% at 100% 100%, rgba(37, 99, 235, 0.06), transparent 50%),
    #f4f6f8;
}

.login-wrap {
  width: 100%;
  max-width: 440px;
}

.login-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 2.25rem 2.15rem;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(8px);
}

.login-card h1 {
  margin: 0 0 0.4rem;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.035em;
}

.login-card .login-lead {
  color: var(--text-secondary);
  margin: 0 0 1.65rem;
  font-size: 0.9rem;
  line-height: 1.55;
}

.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  min-height: 1.2em;
  margin-top: 0.75rem;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.65rem;
  padding-bottom: 1.35rem;
  border-bottom: 1px solid var(--border-subtle);
}

.login-brand-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--accent-muted), rgba(13, 148, 136, 0.04));
  border: 1px solid var(--accent-border);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.login-brand-title {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.login-brand-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 560;
}

.login-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.login-field {
  margin-bottom: 1rem;
}

.login-field input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.login-field input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.login-hint {
  margin-top: 1.35rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.5;
}

@media (max-width: 1100px) {
  .quick-nav-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .quick-nav-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Pulse-анимация статуса бота */
.status-dot {
  animation: bot-pulse 2.5s ease-in-out infinite;
}
@keyframes bot-pulse {
  0%, 100% { box-shadow: 0 0 5px var(--success); }
  50% { box-shadow: 0 0 12px var(--success); }
}

/* Улучшенные metric-card иконки */
.metric-card-icon {
  margin-bottom: 0.5rem;
}
.metric-card-icon svg {
  width: 18px;
  height: 18px;
}
.metric-card .sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Hover на строках таблицы — чуть заметнее */
tbody tr:hover td {
  background: var(--bg-hover) !important;
}

/* Danger zone panel */
.panel-danger {
  border-color: rgba(239, 68, 68, 0.3) !important;
}
.danger-zone-item {
  padding: 0.75rem;
  background: var(--danger-muted);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  margin-bottom: 0.65rem;
}
.danger-zone-item:last-child {
  margin-bottom: 0;
}
.danger-zone-item-title {
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.2rem;
}
.danger-zone-item-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* Toggle grid (для антиспама) */
.toggle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 0.75rem 0;
}
.toggle-grid-item {
  padding: 0.6rem 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}
.toggle-grid-item .toggle-row {
  padding: 0;
  border: none;
}

/* Skeleton улучшение */
.skeleton-card {
  height: 80px;
}

/* Фильтры в search-bar */
.search-bar .select {
  max-width: 180px;
}

/* Empty state улучшение */
.empty-state {
  padding: 3rem 1.5rem;
}

/* ── Антиспам ── */
.field-hint {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.as-page {
  max-width: 960px;
}

.as-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.as-page-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.as-page-desc {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  max-width: 52ch;
}

.as-status-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.as-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
}

.as-status-pill svg {
  width: 14px;
  height: 14px;
}

.as-status-pill.on {
  background: var(--success-muted, rgba(16, 185, 129, 0.12));
  color: var(--success, #10b981);
  border-color: rgba(16, 185, 129, 0.25);
}

.as-status-pill.soft {
  background: var(--accent-muted);
  color: var(--accent);
  border-color: var(--accent-border);
}

.as-status-pill.off {
  background: var(--danger-muted, rgba(239, 68, 68, 0.1));
  color: var(--danger, #ef4444);
  border-color: rgba(239, 68, 68, 0.2);
}

.as-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.5rem;
  flex-wrap: wrap;
}

.as-tab {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.82rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.as-tab.active {
  background: var(--accent-muted);
  color: var(--accent);
}

.as-metrics {
  margin-bottom: 1rem;
}

.as-hint-box {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.85rem;
  border-radius: var(--radius-md);
  background: var(--accent-muted);
  border: 1px solid var(--accent-border);
  font-size: 0.8rem;
}

.as-hint-box svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--accent);
}

.as-hint-box p {
  margin: 0.2rem 0 0;
  color: var(--text-secondary);
  line-height: 1.45;
}

.as-channel-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.as-rule-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  background: var(--bg-elevated);
}

.as-rule-pill svg {
  width: 13px;
  height: 13px;
  opacity: 0.7;
}

.as-rule-pill.on {
  color: var(--text-primary);
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.08);
}

.as-word-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.as-word-chip {
  font-size: 0.78rem;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
}

.as-rule-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.65rem;
}

.as-rule-card {
  padding: 0.65rem 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.as-rule-card .toggle-row {
  padding: 0;
  border: none;
}

.as-mode-toggles .toggle-row {
  border-bottom: 1px solid var(--border-subtle);
}

.as-mode-toggles .toggle-row:last-child {
  border-bottom: none;
}

.as-score-scale {
  margin: 0.5rem 0 0;
}

.as-score-track {
  position: relative;
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg-elevated);
  margin-bottom: 1.75rem;
}

.as-score-zone.ok { background: rgba(16, 185, 129, 0.45); }
.as-score-zone.caution { background: rgba(234, 179, 8, 0.5); }
.as-score-zone.warn { background: rgba(249, 115, 22, 0.5); }
.as-score-zone.danger { background: rgba(239, 68, 68, 0.55); }

.as-score-marker {
  position: absolute;
  top: 14px;
  transform: translateX(-50%);
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.as-score-marker span {
  display: inline-block;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.as-score-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.as-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.3rem;
  vertical-align: middle;
}

.as-dot.ok { background: #10b981; }
.as-dot.caution { background: #eab308; }
.as-dot.warn { background: #f97316; }
.as-dot.danger { background: #ef4444; }

.as-scoring-hints {
  display: grid;
  gap: 0.5rem;
  margin-top: 1rem;
}

.as-scoring-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.8rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.as-scoring-item:last-child {
  border-bottom: none;
}

.as-scoring-item span {
  color: var(--text-muted);
  text-align: right;
}

.as-thresholds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.as-threshold-field label {
  font-size: 0.82rem;
  font-weight: 500;
}

.as-threshold-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.as-threshold-num {
  width: 4.5rem;
  text-align: center;
  padding: 0.3rem 0.4rem;
}

.as-threshold-range {
  width: 100%;
  margin-top: 0.25rem;
  accent-color: var(--accent);
}

.as-section-label {
  margin: 0.75rem 0 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.as-save-bar {
  position: sticky;
  bottom: 0;
  margin-top: 1rem;
  padding: 0.85rem 0;
  background: linear-gradient(transparent, var(--bg-base, var(--bg)) 30%);
}

.as-test-card {
  padding: 1rem 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.as-test-card.ok {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.08);
}

.as-test-card.caution {
  border-color: rgba(234, 179, 8, 0.35);
  background: rgba(234, 179, 8, 0.08);
}

.as-test-card.warn,
.as-test-card.danger {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
}

.as-test-verdict {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.as-test-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.as-test-user-msg {
  margin: 0.65rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

.as-score-badge {
  display: inline-block;
  min-width: 2rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.as-score-badge.ok { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.as-score-badge.caution { background: rgba(234, 179, 8, 0.15); color: #ca8a04; }
.as-score-badge.warn { background: rgba(249, 115, 22, 0.15); color: #ea580c; }
.as-score-badge.danger { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

.as-log-filters {
  margin-bottom: 0.75rem;
}

.as-log-text {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.8rem;
}

.as-channel-panel .settings-summary {
  margin-top: 0.5rem;
}

.as-words-toolbar {
  margin-bottom: 1rem;
  gap: 0.5rem;
}

.as-words-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.as-words-tier {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  overflow: hidden;
}

.as-words-tier-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.as-words-tier-head::-webkit-details-marker {
  display: none;
}

.as-tier-badge {
  display: inline-flex;
  min-width: 2.25rem;
  justify-content: center;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.as-words-tier.tier-critical .as-tier-badge {
  background: rgba(239, 68, 68, 0.2);
  color: #b91c1c;
}

.as-words-tier.tier-high .as-tier-badge {
  background: rgba(249, 115, 22, 0.2);
  color: #c2410c;
}

.as-words-tier.tier-medium .as-tier-badge {
  background: rgba(234, 179, 8, 0.15);
  color: #a16207;
}

.as-words-tier.tier-low .as-tier-badge {
  background: var(--accent-border);
  color: var(--accent);
}

.as-words-tier.tier-safe .as-tier-badge {
  background: rgba(34, 197, 94, 0.15);
  color: #047857;
}

.as-words-tier.tier-muted .as-tier-badge {
  background: var(--surface-3);
  color: var(--text-muted);
}

.as-tier-title {
  font-weight: 600;
  font-size: 0.88rem;
}

.as-tier-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: auto;
}

.as-tier-hint {
  flex-basis: 100%;
  font-size: 0.75rem;
  padding-left: 2.75rem;
}

.as-words-tier-body {
  padding: 0 0.85rem 0.85rem;
  border-top: 1px solid var(--border);
}

.as-words-tags {
  margin-top: 0.65rem;
}

@media (max-width: 640px) {
  .as-scoring-item {
    flex-direction: column;
    gap: 0.15rem;
  }
  .as-scoring-item span {
    text-align: left;
  }
  .as-thresholds-grid {
    grid-template-columns: 1fr;
  }
}

/* ── VK community picker ─────────────────────────────────────────────────── */

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.label-hint {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-muted);
}

.chain-card__node-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.78rem;
}
.chain-card__node-link:hover { text-decoration: underline; color: var(--accent); }

/* Preview of selected community */
.vk-group-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.vk-group-preview--compact { padding: 8px 10px; }
.vk-group-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.vk-group-avatar--empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--surface-3);
  color: var(--text-muted);
}
.vk-group-preview__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.vk-group-preview__name {
  font-weight: 600;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vk-group-preview__url {
  font-size: 0.78rem;
  color: var(--accent);
  text-decoration: none;
}
.vk-group-preview__url:hover { text-decoration: underline; }
.vk-group-preview__check {
  margin-left: auto;
  color: var(--success);
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

/* Scrollable list of managed communities */
.vk-groups-picker {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}
.vk-group-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.vk-group-item:hover { border-color: var(--accent); background: var(--surface-3); }
.vk-group-item.is-selected { border-color: var(--accent); background: var(--accent-muted); }
.vk-group-item__cb {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
.vk-group-item__info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}
.vk-group-item__name {
  font-size: 0.88rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vk-group-item__url {
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vk-group-item__check {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.15s;
}
.vk-group-item.is-selected .vk-group-item__check { opacity: 1; }

/* Плашка мульти-выбора */
.vk-multi-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  margin-top: 8px;
  background: var(--accent-muted);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}
.vk-multi-bar strong { color: var(--accent); }

.vk-community-search-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.vk-community-search-row .input {
  flex: 1;
  min-width: 0;
}

.vk-chain-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.vk-chain-form-actions .btn-primary {
  margin-left: auto;
}

.vk-check-slot,
.vk-chain-check-slot {
  margin-top: 10px;
}
.vk-chain-check-slot:empty {
  display: none;
}

.vk-check-result {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.vk-check-result.is-ok {
  border-color: var(--success, #16a34a);
  background: color-mix(in srgb, var(--success, #16a34a) 8%, transparent);
}
.vk-check-result.is-fail {
  border-color: var(--danger, #e11);
  background: color-mix(in srgb, var(--danger, #e11) 8%, transparent);
}
.vk-check-result__title {
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 2px;
}
.vk-check-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.82rem;
  line-height: 1.35;
}
.vk-check-item i,
.vk-check-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-top: 2px;
}
.vk-check-item.is-ok { color: var(--success, #16a34a); }
.vk-check-item.is-fail { color: var(--danger, #e11); }
.vk-check-item div {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  color: var(--text);
}
.vk-check-item span {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.chain-card.is-warn {
  box-shadow: inset 3px 0 0 var(--warning, #d97706);
}

#vc_tg_max_hint:empty,
#vc_tg_max_hint.hidden {
  display: none;
}


/* ── Light theme polish ── */
.users-split {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.users-list-pane {
  background: color-mix(in srgb, var(--bg-elevated) 80%, #fff);
}

.stat-card {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.skeleton {
  background: linear-gradient(
    90deg,
    #eef2f5 25%,
    #f8fafb 50%,
    #eef2f5 75%
  );
  background-size: 200% 100%;
}

.badge-accent {
  color: var(--accent);
}

.bot-status {
  padding: 0.55rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
}

@keyframes bot-pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--success-muted); }
  50% { box-shadow: 0 0 0 5px rgba(5, 150, 105, 0.18); }
}

@media (max-width: 900px) {
  .content {
    padding: 1.15rem 1rem 1.75rem;
  }

  .split-view {
    flex-direction: column;
  }

  .split-list {
    width: 100%;
    max-height: 240px;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }

  .split-detail {
    max-height: none;
  }
}

/* Backup */
.backup-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.backup-include-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.backup-include-list li {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
}

.backup-include-list li i,
.backup-include-list li svg {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  color: var(--accent);
  flex-shrink: 0;
}

.backup-include-list strong {
  display: block;
  font-size: 0.875rem;
}

.backup-include-list span {
  display: block;
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.4;
}

.backup-skip-note {
  margin: 0 0 1rem;
}

.backup-secret-hint {
  background: var(--warning-muted);
  border-color: rgba(217, 119, 6, 0.28);
}

.backup-secret-hint svg {
  color: var(--warning);
}

.backup-row-actions {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
  white-space: nowrap;
}

.backup-table td {
  vertical-align: middle;
}

@keyframes backup-spin {
  to { transform: rotate(360deg); }
}

#backupCreateBtn[disabled] svg {
  animation: backup-spin 0.9s linear infinite;
}

/* Telegram proxy settings */
.tg-proxy-panel {
  margin-bottom: 0.75rem;
}

.tg-proxy-status-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.tg-proxy-status-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tg-proxy-status-kicker {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.tg-proxy-active-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.tg-proxy-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 650;
  background: var(--surface-2);
  color: var(--text-secondary);
}

.tg-proxy-badge.is-good {
  background: var(--success-muted);
  color: var(--success);
}

.tg-proxy-badge.is-poor {
  background: var(--warning-muted);
  color: var(--warning);
}

.tg-proxy-badge.is-down {
  background: var(--danger-muted);
  color: var(--danger);
}

.tg-proxy-ms {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.tg-proxy-warn {
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--warning-muted);
  color: var(--warning);
  font-size: 0.82rem;
}

.tg-proxy-toolbar {
  display: flex;
  gap: 0.5rem;
  margin: 0.75rem 0 1rem;
}

.tg-proxy-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1.1rem;
}

.tg-proxy-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  background: var(--bg-surface);
}

.tg-proxy-card.is-active {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.tg-proxy-card-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.tg-proxy-card-name {
  font-weight: 650;
  font-size: 0.95rem;
}

.tg-proxy-card-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.tg-proxy-card-uri {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  word-break: break-all;
}

.tg-proxy-card-quality {
  text-align: right;
  flex-shrink: 0;
}

.tg-proxy-err {
  margin-top: 0.3rem;
  font-size: 0.72rem;
  color: var(--danger);
  max-width: 220px;
}

.tg-proxy-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.tg-proxy-active-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-sm);
  background: var(--accent-muted);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 650;
}

.tg-proxy-forms {
  border-top: 1px dashed var(--border);
  padding-top: 1rem;
}

.tg-proxy-add {
  margin-top: 1.1rem;
}

@media (max-width: 720px) {
  .tg-proxy-card-top {
    flex-direction: column;
  }
  .tg-proxy-card-quality {
    text-align: left;
  }
}
