:root {
  --bg-dark: #0b0f19;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(26, 35, 54, 0.9);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.3);
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.4);
  
  --accent: #06b6d4;
  --accent-glow: rgba(6, 182, 212, 0.4);
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.3);
  
  --warning: #f59e0b;
  --danger: #ef4444;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.12) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(15, 23, 42, 0.8) 0px, transparent 100%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  padding: 20px;
  -webkit-font-smoothing: antialiased;
}

/* Security Authentication Gate Overlay */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99999;
  background: rgba(11, 15, 25, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s;
}

.auth-overlay.unlocked {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-card {
  background: rgba(18, 24, 38, 0.85);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 20px;
  padding: 36px 32px;
  width: 100%;
  max-width: 440px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(99, 102, 241, 0.2);
  transform: translateY(0);
  transition: transform 0.3s ease;
}

.auth-card.shake {
  animation: authShake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes authShake {
  10%, 90% { transform: translate3d(-3px, 0, 0); }
  20%, 80% { transform: translate3d(5px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

.auth-icon-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.auth-lock-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(6, 182, 212, 0.2));
  border: 1px solid rgba(6, 182, 212, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 0 25px rgba(6, 182, 212, 0.3);
}

.auth-card h2 {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.auth-card h2 span {
  background: linear-gradient(135deg, #06b6d4, #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon input {
  width: 100%;
  padding: 12px 42px 12px 14px;
  background: rgba(11, 15, 25, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 15px;
  font-family: var(--font-mono);
  outline: none;
  transition: all 0.2s ease;
}

.input-with-icon input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 15px var(--accent-glow);
}

.btn-input-icon {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
}

.btn-input-icon:hover {
  color: #fff;
}

.auth-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  margin-top: 6px;
  text-align: left;
}

.auth-footer-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 18px;
}

.btn-danger-subtle {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger-subtle:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #fff;
}

.app-container {
  max-width: 1460px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}

.logo-icon svg { width: 24px; height: 24px; }
.brand-text h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.brand-text h1 span {
  background: linear-gradient(135deg, #06b6d4, #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.version-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  background: rgba(6, 182, 212, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: 6px;
  vertical-align: middle;
  margin-left: 6px;
}
.subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cloud-endpoint-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(11, 15, 25, 0.6);
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  border-radius: 30px;
}

.cloud-endpoint-box input {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 12px;
  width: 220px;
  outline: none;
}

.btn-icon-sm {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--accent);
}

/* Workspace Grid */
.workspace-grid {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 20px;
}

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

.panel-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.panel-header h2, .panel-header h3 {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-tag {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

/* Form Styles */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.label-with-badge {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slider-badge {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--primary);
  background: rgba(99, 102, 241, 0.15);
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.slider-badge.cyan {
  color: var(--accent);
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.input-action-group {
  display: flex;
  gap: 8px;
}

.input-action-group input, input[type="text"], input[type="number"], input[type="password"], select {
  flex: 1;
  background: rgba(11, 15, 25, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-main);
  font-size: 13px;
  font-family: var(--font-main);
  outline: none;
  transition: all 0.2s ease;
}

.input-action-group input:focus, input[type="text"]:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}

.input-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Channel Preview */
.channel-preview {
  background: rgba(11, 15, 25, 0.7);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 12px;
  animation: fadeIn 0.3s ease;
}

.preview-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.channel-avatar {
  font-size: 20px;
  background: rgba(255, 255, 255, 0.05);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.channel-meta h4 { font-size: 14px; font-weight: 700; color: #fff; }
.channel-meta p { font-size: 11px; color: var(--text-muted); }

.preview-stats {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.stat-pill {
  font-size: 11px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text-muted);
}

.stat-pill.highlight {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

/* Queue List */
.queue-list {
  background: rgba(11, 15, 25, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  max-height: 140px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
}

.queue-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.queue-item-name { font-weight: 600; color: var(--accent); }
.btn-remove-queue { background: transparent; border: none; color: var(--danger); cursor: pointer; font-size: 14px; font-weight: bold; }
.empty-queue-msg { font-size: 11px; color: var(--text-dim); text-align: center; padding: 12px; }

/* Accounts Selection Checklist */
.accounts-chk-list {
  background: rgba(11, 15, 25, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  max-height: 150px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
}

.acc-chk-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.acc-chk-item:hover { background: rgba(255, 255, 255, 0.05); }

/* Concurrency & Quick Pills */
.concurrency-box {
  background: rgba(11, 15, 25, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quick-pills {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.pill-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pill-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Segmented Control */
.segmented-control {
  display: flex;
  background: rgba(11, 15, 25, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
}

.segment {
  flex: 1;
  text-align: center;
  position: relative;
}

.segment input { position: absolute; opacity: 0; }
.segment span {
  display: block;
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.segment input:checked + span {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 10px var(--primary-glow);
}

/* Toggles Grid */
.toggles-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

.toggle-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(11, 15, 25, 0.5);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.toggle-label { font-size: 12px; font-weight: 600; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-main);
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 8px; font-size: 10px; }
.btn-lg { padding: 14px 20px; font-size: 14px; letter-spacing: 0.5px; }

.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 0 15px var(--primary-glow); }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }

.btn-accent {
  background: linear-gradient(135deg, #06b6d4 0%, #6366f1 100%);
  color: #fff;
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.4);
}
.btn-accent:hover { transform: translateY(-1px); box-shadow: 0 0 25px rgba(6, 182, 212, 0.6); }

.btn-secondary { background: rgba(255, 255, 255, 0.08); color: var(--text-main); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: rgba(255, 255, 255, 0.12); }

.btn-outline { background: transparent; color: var(--text-main); border: 1px solid var(--border-color); }
.btn-outline:hover { background: rgba(255, 255, 255, 0.05); }

.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 0 15px rgba(239, 68, 68, 0.4); }
.btn-danger:hover { background: #dc2626; }

.btn-ghost { background: transparent; border: none; color: var(--text-muted); cursor: pointer; }
.btn-ghost:hover { color: var(--text-main); }

.btn-text-danger { background: none; border: none; color: var(--danger); font-size: 11px; cursor: pointer; font-weight: 600; }
.btn-text-cyan { background: none; border: none; color: var(--accent); font-size: 11px; cursor: pointer; font-weight: 600; }
.btn-text-green { background: none; border: none; color: var(--success); font-size: 11px; cursor: pointer; font-weight: 600; }

.form-actions-stacked {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.hidden { display: none !important; }

/* Dashboard Right Side */
.dashboard-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon { font-size: 24px; }
.stat-info { display: flex; flex-direction: column; gap: 2px; }
.stat-title { font-size: 11px; color: var(--text-dim); font-weight: 600; text-transform: uppercase; }
.stat-number { font-size: 18px; font-weight: 800; font-family: var(--font-mono); color: #fff; }
.badge-text { font-size: 13px; color: var(--success); font-family: var(--font-main); }

/* Progress Panel */
.progress-panel { gap: 10px; padding: 16px 20px; }
.progress-info-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 600; }
.progress-track { width: 100%; height: 8px; background: rgba(255, 255, 255, 0.05); border-radius: 8px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, #06b6d4, #6366f1); transition: width 0.3s ease; }
.current-channel-badge-wrap { display: flex; gap: 10px; margin-top: 4px; }
.badge-mini { font-size: 11px; color: var(--text-dim); background: rgba(255, 255, 255, 0.03); padding: 2px 8px; border-radius: 4px; }
.badge-mini b { color: var(--accent); }

/* Active Workers Panel */
.workers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  max-height: 220px;
  overflow-y: auto;
  padding: 2px;
}

.worker-card {
  background: rgba(11, 15, 25, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: fadeIn 0.2s ease;
}

.worker-header { display: flex; justify-content: space-between; align-items: center; font-size: 11px; font-weight: 700; }
.worker-title { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.empty-placeholder { font-size: 12px; color: var(--text-dim); text-align: center; padding: 24px; grid-column: 1 / -1; }

/* Logs Panel */
.terminal-logs {
  background: #060911;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  height: 220px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.log-entry { line-height: 1.4; word-break: break-all; }
.log-entry.info { color: #94a3b8; }
.log-entry.success { color: #34d399; font-weight: 600; }
.log-entry.warning { color: #fbbf24; }
.log-entry.error { color: #f87171; font-weight: 600; }
.log-time { color: var(--text-dim); margin-right: 6px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-stealth { background: rgba(6, 182, 212, 0.15); color: #38bdf8; border: 1px solid rgba(6, 182, 212, 0.3); }

.pulse-dot-green {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulseDot 1.5s infinite;
}

.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
.modal-content {
  background: #111827;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }

.add-account-box { background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 14px; margin-bottom: 16px; }
.account-form-grid { display: grid; grid-template-columns: 1fr 1.5fr auto; gap: 8px; margin-top: 8px; }

.accounts-list { display: flex; flex-direction: column; gap: 8px; }
.account-card { display: flex; justify-content: space-between; align-items: center; background: rgba(11, 15, 25, 0.6); border: 1px solid var(--border-color); padding: 12px 16px; border-radius: var(--radius-md); }
.account-info h5 { font-size: 14px; font-weight: 700; color: #fff; }
.account-info p { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.account-actions { display: flex; align-items: center; gap: 8px; }
.btn-close { background: transparent; border: none; color: var(--text-muted); font-size: 22px; cursor: pointer; }

.modal-actions-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 13px; color: var(--text-muted); }
.history-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.history-table th, .history-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border-color); }
.history-table th { color: var(--text-muted); font-weight: 600; }

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
