/* ==========================================================================
   SUPABASE DESIGN SYSTEM: FRANCHISE PLATFORM
   Typography: Plus Jakarta Sans + JetBrains Mono (Tabular Nums)
   Aesthetic: Obsidian surfaces (#0c0d0e, #121316, #16181d), Supabase Emerald (#3ECF8E),
   dot-grid background, micro-borders, bento cards, vector icons.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg-main: #0c0d0e;
  --bg-surface: #121316;
  --bg-card: #16181d;
  --bg-card-hover: #1c1f26;
  --bg-card-elevated: #20242c;
  
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-card: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(62, 207, 142, 0.35);
  
  --primary: #3ECF8E;
  --primary-hover: #4ee49d;
  --primary-glow: rgba(62, 207, 142, 0.18);
  --primary-dark: #24b47e;
  
  --text-primary: #ededed;
  --text-secondary: #9aa0a6;
  --text-muted: #646b79;
  
  --green: #3ECF8E;
  --green-glow: rgba(62, 207, 142, 0.25);
  --red: #f85149;
  --red-glow: rgba(248, 81, 73, 0.2);
  --amber: #d29922;
  --amber-glow: rgba(210, 153, 34, 0.2);
  --blue: #58a6ff;
  --purple: #a371f7;
  
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 25px rgba(62, 207, 142, 0.12);
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  background-image: radial-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom Sleek Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: #252830;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #363b47;
}

/* Tabular numbers for financial metrics and statistics */
.num-val, .bento-value, .metric-value, .badge-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   NAVBAR & HEADER
   -------------------------------------------------------------------------- */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(12, 13, 14, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #1a382b 0%, #111d17 100%);
  border: 1px solid var(--primary-glow);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px var(--primary-glow);
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(62, 207, 142, 0.12);
  color: var(--primary);
  border: 1px solid rgba(62, 207, 142, 0.25);
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 4px;
  border-radius: var(--radius-md);
}

.nav-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.nav-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.nav-tab-btn.active {
  color: #fff;
  background: var(--bg-card-elevated);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.status-dot-pulse {
  width: 8px;
  height: 8px;
  background-color: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(62, 207, 142, 0.6);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(62, 207, 142, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(62, 207, 142, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(62, 207, 142, 0);
  }
}

.logout-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.logout-btn:hover {
  color: var(--red);
  border-color: rgba(248, 81, 73, 0.3);
  background: rgba(248, 81, 73, 0.08);
}

/* --------------------------------------------------------------------------
   PAGE CONTAINER & LAYOUT
   -------------------------------------------------------------------------- */
.main-wrapper {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 32px 64px 32px;
}

.view-section {
  display: none;
}

.view-section.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.section-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #fff;
}

.section-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   BUTTONS & INPUTS
   -------------------------------------------------------------------------- */
.btn {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--primary);
  color: #0b1510;
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 0 16px var(--primary-glow);
}

.btn-secondary {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.18);
}

.btn-danger {
  background: rgba(248, 81, 73, 0.12);
  border: 1px solid rgba(248, 81, 73, 0.3);
  color: var(--red);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(248, 81, 73, 0.22);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.select-custom, .input-custom {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-sans);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  outline: none;
  transition: var(--transition);
}

.select-custom:focus, .input-custom:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

/* --------------------------------------------------------------------------
   BENTO STATS CARDS
   -------------------------------------------------------------------------- */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

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

@media (max-width: 640px) {
  .bento-grid {
    grid-template-columns: 1fr;
  }
}

.bento-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 148px;
  box-sizing: border-box;
}

.bento-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.bento-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
}

.bento-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 22px;
}

.bento-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.bento-icon {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.bento-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  margin: 10px 0;
  line-height: 1;
  font-family: var(--font-sans);
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.bento-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  min-height: 24px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-growth {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(62, 207, 142, 0.12);
  color: var(--primary);
  border: 1px solid rgba(62, 207, 142, 0.25);
  font-family: var(--font-mono);
}

.badge-neutral {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.badge-warning {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(210, 153, 34, 0.14);
  color: #ffc84b;
  border: 1px solid rgba(210, 153, 34, 0.3);
}

/* --------------------------------------------------------------------------
   CHARTS & SECTIONS
   -------------------------------------------------------------------------- */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-card);
  position: relative;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 280px;
}

/* --------------------------------------------------------------------------
   TARIFFS DETAILED BREAKDOWN CARDS
   -------------------------------------------------------------------------- */
.tariffs-detailed-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

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

.tariff-item-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 16px;
  position: relative;
}

.tariff-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.tariff-item-name {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tariff-share-pct {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.progress-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin: 10px 0 14px 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #24b47e 0%, #3ECF8E 100%);
  border-radius: 3px;
  transition: width 0.6s ease;
}

.tariff-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* --------------------------------------------------------------------------
   COMPARATIVE BOTS STATS SECTION (КАЖДЫЙ БОТ ОТДЕЛЬНО)
   -------------------------------------------------------------------------- */
.bots-analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.bot-stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  position: relative;
}

.bot-stat-card:hover {
  border-color: rgba(62, 207, 142, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.bot-stat-card.is-active-filter {
  border-color: #3ECF8E;
  background: linear-gradient(180deg, rgba(62, 207, 142, 0.08) 0%, rgba(26, 30, 38, 0.6) 100%);
  box-shadow: 0 0 0 1px #3ECF8E, 0 8px 30px rgba(62, 207, 142, 0.15);
}

.bot-stat-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.bot-stat-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bot-stat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(62, 207, 142, 0.12);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(62, 207, 142, 0.2);
}

.bot-stat-identity {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bot-stat-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bot-id-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 5px;
  border-radius: 4px;
}

.bot-stat-handle {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.bot-stat-channel {
  font-size: 12px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bot-stat-channel-label {
  color: var(--text-muted);
}

.bot-stat-channel-val {
  color: #ededed;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bot-stat-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 12px;
  margin-bottom: 16px;
}

.bot-stat-metric-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(0, 0, 0, 0.2);
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.bot-stat-metric-item .m-label {
  font-size: 11px;
  color: var(--text-muted);
}

.bot-stat-metric-item .m-val {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.bot-stat-metric-item .revenue-val {
  color: #3ECF8E;
}

.bot-stat-metric-item .subs-val {
  color: #58a6ff;
}

.bot-stat-metric-item .users-val {
  color: #ededed;
}

.bot-stat-metric-item .cr-val {
  color: #fbbf24;
}

.bot-stat-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
}

.bot-stat-action-btn {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s;
}

.bot-stat-action-btn.active {
  color: #3ECF8E;
  font-weight: 700;
}

.bot-stat-card:hover .bot-stat-action-btn {
  color: #58e8a7;
}

/* --------------------------------------------------------------------------
   GATEWAY HEALTH & DIAGNOSTICS MATRIX
   -------------------------------------------------------------------------- */
.gateway-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.gateway-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
}

.gateway-card:hover {
  border-color: var(--border-hover);
}

.gateway-card-alert {
  border-color: rgba(248, 81, 73, 0.35) !important;
  background: linear-gradient(180deg, rgba(248, 81, 73, 0.05) 0%, rgba(26, 30, 38, 0.8) 100%) !important;
}

.gateway-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.gateway-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.health-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  letter-spacing: 0.02em;
}

.health-pill-healthy {
  background: rgba(62, 207, 142, 0.12);
  color: #3ECF8E;
  border: 1px solid rgba(62, 207, 142, 0.25);
}

.health-pill-warning {
  background: rgba(234, 179, 8, 0.12);
  color: #eab308;
  border: 1px solid rgba(234, 179, 8, 0.28);
}

.health-pill-critical {
  background: rgba(248, 81, 73, 0.14);
  color: #f85149;
  border: 1px solid rgba(248, 81, 73, 0.35);
  animation: pulseCritical 2s infinite ease-in-out;
}

@keyframes pulseCritical {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(248, 81, 73, 0.4);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(248, 81, 73, 0.0);
  }
}

.health-pill-idle {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.gateway-cr-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 10px 0 8px 0;
}

.gateway-cr-label {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 2px;
}

.gateway-cr-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}

.gateway-rev-value {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.gateway-segmented-bar {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  margin-bottom: 14px;
}

.gateway-seg-paid {
  background: linear-gradient(90deg, #24b47e, #3ECF8E);
  transition: width 0.5s ease;
}

.gateway-seg-failed {
  background: rgba(248, 81, 73, 0.5);
  transition: width 0.5s ease;
}

.gateway-details-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
}

.g-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}

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

.g-detail-val {
  color: #fff;
  font-family: var(--font-mono);
  font-size: 12px;
}

.gateway-diagnosis-box {
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.gateway-diagnosis-box svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.diag-critical {
  background: rgba(248, 81, 73, 0.12);
  color: #ff9b96;
  border: 1px solid rgba(248, 81, 73, 0.25);
}

.diag-warning {
  background: rgba(234, 179, 8, 0.1);
  color: #fde047;
  border: 1px solid rgba(234, 179, 8, 0.2);
}

.funnel-steps-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 18px 0;
  flex-wrap: wrap;
}

.funnel-step-box {
  flex: 1;
  min-width: 130px;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  text-align: center;
}

.funnel-step-num {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.funnel-step-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
}

.funnel-arrow {
  color: var(--text-muted);
  font-size: 14px;
}

/* --------------------------------------------------------------------------
   SORTABLE TABLES & VECTOR ARROWS
   -------------------------------------------------------------------------- */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-card);
  user-select: none;
}

.sortable-th {
  cursor: pointer;
  transition: var(--transition);
}

.sortable-th:hover {
  color: var(--primary);
  background: rgba(62, 207, 142, 0.04);
}

.th-content {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sort-icon {
  width: 12px;
  height: 12px;
  display: inline-flex;
  color: var(--text-muted);
  transition: var(--transition);
}

.sortable-th.sort-asc .sort-icon {
  color: var(--primary);
  transform: rotate(180deg);
}

.sortable-th.sort-desc .sort-icon {
  color: var(--primary);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Status Badges */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  line-height: 1;
}

.status-running {
  background: rgba(62, 207, 142, 0.12);
  color: var(--primary);
  border: 1px solid rgba(62, 207, 142, 0.3);
}

.status-stopped {
  background: rgba(248, 81, 73, 0.12);
  color: var(--red);
  border: 1px solid rgba(248, 81, 73, 0.3);
}

.status-error {
  background: rgba(210, 153, 34, 0.12);
  color: var(--amber);
  border: 1px solid rgba(210, 153, 34, 0.3);
}

.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.bot-info-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bot-avatar-vector {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.bot-name {
  font-weight: 600;
  color: #fff;
}

.bot-handle {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* Action Icon Buttons */
.action-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.action-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.18);
}

.action-btn.btn-play:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.action-btn.btn-stop:hover {
  color: var(--red);
  border-color: var(--red);
}

.action-btn.btn-restart:hover {
  color: var(--blue);
  border-color: var(--blue);
}

.action-btn.btn-trash:hover {
  color: var(--red);
  border-color: var(--red);
}

/* --------------------------------------------------------------------------
   CHANNELS VIEW
   -------------------------------------------------------------------------- */
.channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.channel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 22px;
  transition: var(--transition);
  position: relative;
}

.channel-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.channel-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.channel-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.channel-id-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: 2px 7px;
  border-radius: 4px;
}

.channel-metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}

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

/* --------------------------------------------------------------------------
   MODALS
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  padding: 20px;
}

.modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.85), 0 0 24px rgba(62, 207, 142, 0.1);
  overflow: hidden;
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-content.modal-lg {
  max-width: 720px;
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  padding: 6px;
  border-radius: 4px;
  transition: var(--transition);
}

.modal-close-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.modal-body {
  padding: 24px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 10px 14px;
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 5px;
}

/* Validated Bot Preview Box */
.bot-preview-box {
  background: rgba(62, 207, 142, 0.06);
  border: 1px solid rgba(62, 207, 142, 0.25);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* --------------------------------------------------------------------------
   LOGIN VIEW SPECIFIC STYLES
   -------------------------------------------------------------------------- */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7), 0 0 35px var(--primary-glow);
  position: relative;
}

.login-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px auto;
  background: rgba(62, 207, 142, 0.12);
  border: 1px solid rgba(62, 207, 142, 0.3);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.login-title {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.login-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* Alert Boxes */
.alert-box {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-error {
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid rgba(248, 81, 73, 0.3);
  color: #ff9b96;
}

.alert-lockout {
  background: rgba(210, 153, 34, 0.12);
  border: 1px solid rgba(210, 153, 34, 0.35);
  color: #ffdf94;
}

.lockout-timer {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 8px;
  border-radius: 4px;
}

/* ==========================================================================
   PAYMENT SYSTEMS VIEW & SWITCHES
   ========================================================================== */
.payments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 18px;
}

.gateway-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.gateway-card:hover {
  border-color: rgba(62, 207, 142, 0.35);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  transform: translateY(-2px);
}

.gateway-card.is-disabled {
  border-color: rgba(255, 255, 255, 0.05);
  background: rgba(18, 19, 22, 0.6);
}

.gateway-card.is-disabled .gateway-card-header .gateway-icon-box {
  filter: grayscale(1);
  opacity: 0.6;
}

.gateway-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.gateway-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gateway-icon-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.gateway-icon-cactus {
  background: rgba(62, 207, 142, 0.12);
  color: var(--primary);
  border: 1px solid rgba(62, 207, 142, 0.25);
}

.gateway-icon-paritypay {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.gateway-icon-stars {
  background: rgba(234, 179, 8, 0.12);
  color: #eab308;
  border: 1px solid rgba(234, 179, 8, 0.25);
}

.gateway-icon-crypto {
  background: rgba(88, 166, 255, 0.12);
  color: var(--blue);
  border: 1px solid rgba(88, 166, 255, 0.25);
}

.gateway-icon-ton {
  background: rgba(0, 152, 234, 0.12);
  color: #0098ea;
  border: 1px solid rgba(0, 152, 234, 0.25);
}

.gateway-icon-admin {
  background: rgba(163, 113, 247, 0.12);
  color: var(--purple);
  border: 1px solid rgba(163, 113, 247, 0.25);
}

.gateway-title-wrap h3 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
  margin: 0 0 2px 0;
}

.gateway-short-name {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.gateway-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.gateway-status-pill.status-active {
  background: rgba(62, 207, 142, 0.12);
  color: var(--primary);
  border: 1px solid rgba(62, 207, 142, 0.3);
}

.gateway-status-pill.status-active::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
}

.gateway-status-pill.status-disabled {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.gateway-status-pill.status-disabled::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.gateway-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 18px;
  min-height: 38px;
}

.gateway-config-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gateway-config-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

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

.gateway-config-val {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.gateway-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.gateway-action-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gateway-action-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.gateway-action-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

/* iOS-style toggle switch */
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
  cursor: pointer;
}

.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.switch-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #242730;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 26px;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #a0a6b2;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.switch-toggle input:checked + .switch-slider {
  background-color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 14px rgba(62, 207, 142, 0.35);
}

.switch-toggle input:checked + .switch-slider:before {
  transform: translateX(22px);
  background-color: #0c0d0e;
}

.switch-toggle input:disabled + .switch-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==========================================================================
   POSTERS HUB & MEDIA QUEUE STYLES
   ========================================================================== */
.posters-subtabs-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  gap: 4px;
}

.posters-subtab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  border: none;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.posters-subtab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.posters-subtab-btn.active {
  color: #fff;
  background: var(--bg-card-elevated);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-card);
}

.posters-subview {
  display: none;
}

.posters-subview.active {
  display: block;
}

.hashtag-chip-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding: 6px 2px;
}

.hashtag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(62, 207, 142, 0.08);
  border: 1px solid rgba(62, 207, 142, 0.2);
  color: var(--primary);
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  user-select: none;
  transition: var(--transition);
}

.hashtag-chip:hover {
  background: rgba(62, 207, 142, 0.15);
  border-color: rgba(62, 207, 142, 0.35);
}

.hashtag-chip .chip-remove-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.hashtag-chip .chip-remove-btn:hover {
  color: var(--red);
}

.time-slot-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
}

.time-slot-chip .slot-del-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
}

.time-slot-chip .slot-del-btn:hover {
  color: var(--red);
}

.status-badge-ready {
  background: rgba(62, 207, 142, 0.12);
  color: var(--primary);
  border: 1px solid rgba(62, 207, 142, 0.25);
}

.status-badge-processing {
  background: rgba(88, 166, 255, 0.12);
  color: var(--blue);
  border: 1px solid rgba(88, 166, 255, 0.25);
}

.status-badge-pending {
  background: rgba(154, 160, 166, 0.12);
  color: var(--text-secondary);
  border: 1px solid rgba(154, 160, 166, 0.25);
}

.status-badge-posted {
  background: rgba(163, 113, 247, 0.12);
  color: var(--purple);
  border: 1px solid rgba(163, 113, 247, 0.25);
}

.status-badge-failed {
  background: rgba(248, 81, 73, 0.12);
  color: var(--red);
  border: 1px solid rgba(248, 81, 73, 0.25);
}

.pulse-badge-running {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(62, 207, 142, 0.1);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(62, 207, 142, 0.25);
}

.pulse-badge-stopped {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(248, 81, 73, 0.1);
  color: var(--red);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(248, 81, 73, 0.25);
}

