:root {
  /* Light theme (matches the admin console). The sidebar keeps a dark navy surface. */
  --bg-primary: #F4F5FA;
  --bg-secondary: #F6F7FB;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F1F2F8;
  --border-color: #E4E6F0;
  --border-focus: #6D5BFF;
  --text-main: #151827;
  --text-muted: #6B6F85;
  --accent: #6D5BFF;
  --accent-ink: #5B4BD8;
  --accent-soft: #F1EEFF;
  --sidebar: #12142B;
  --sidebar-text: #C9CBE0;
  --accent-cyan: #06b6d4;
  --accent-cyan-bg: rgba(6, 182, 212, 0.15);
  --accent-orange: #f97316;
  --accent-orange-bg: rgba(249, 115, 22, 0.15);
  --accent-blue: #6D5BFF;
  --accent-green: #22B465;
  --accent-red: #ef4444;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* App Shell */
.app-header {
  height: 64px;
  background-color: #FFFFFF;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: var(--sidebar);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.search-box {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 6px 12px;
  gap: 8px;
  width: 240px;
}

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 13px;
  width: 100%;
}

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

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.2s;
  position: relative;
}

.icon-btn:hover {
  background: var(--bg-card);
  color: var(--text-main);
}

.badge-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  background-color: var(--accent);
  border-radius: 50%;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  object-fit: cover;
  background-color: var(--accent-soft);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

/* Main Layout */
.app-container {
  display: flex;
  flex: 1;
}

/* Sidebar */
.sidebar {
  width: 236px;
  background-color: var(--sidebar);
  border-right: 0;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: #FFFFFF;
}

.nav-item.active {
  background-color: var(--accent);
  color: #FFFFFF;
  border-color: transparent;
  font-weight: 600;
}

.nav-item .nav-icon {
  font-size: 16px;
}

/* Content Area */
.main-content {
  flex: 1;
  padding: 28px 32px;
  overflow-y: auto;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.status-pill .indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green);
}

.header-controls {
  display: flex;
  gap: 10px;
}

/* Buttons */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: var(--accent-ink);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
}

/* Dashboard Grid matching Mockup 2 */
.settings-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 22px;
  box-shadow: none;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: -10px;
  margin-bottom: 16px;
}

/* Keyword Section */
.keyword-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.kw-group-label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  display: block;
}

.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 80px;
  margin-bottom: 12px;
  align-content: flex-start;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s;
}

.chip-target {
  background-color: var(--accent-cyan-bg);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.35);
}

.chip-negative {
  background-color: var(--accent-orange-bg);
  color: var(--accent-orange);
  border: 1px solid rgba(249, 115, 22, 0.35);
}

.chip-remove {
  background: transparent;
  border: none;
  cursor: pointer;
  color: inherit;
  font-size: 13px;
  opacity: 0.7;
}

.chip-remove:hover {
  opacity: 1;
}

.kw-input-row {
  display: flex;
  gap: 8px;
}

.kw-input {
  flex: 1;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-main);
  font-size: 12px;
  outline: none;
  transition: border-color 0.2s;
}

.kw-input:focus {
  border-color: var(--border-focus);
}

/* Active Platforms */
.platforms-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.platform-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  transition: all 0.2s;
}

.platform-row:hover {
  border-color: rgba(59, 130, 246, 0.4);
}

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

.platform-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
}

.icon-twitter {
  background-color: #000;
  color: #fff;
  border: 1px solid #333;
}

.icon-reddit {
  background-color: #ff4500;
  color: #fff;
}

.icon-youtube {
  background-color: #ff0000;
  color: #fff;
}

.icon-bluesky {
  background-color: #0285ff;
  color: #fff;
}

.icon-meta {
  background: linear-gradient(135deg, #0081fb, #d62976, #fa7e1e);
  color: #fff;
}

.icon-github { background-color: #24292e; color: #fff; }
.icon-hackernews { background-color: #ff6600; color: #fff; font-weight: 900; }
.icon-mastodon { background-color: #6364ff; color: #fff; }
.icon-discord { background-color: #5865f2; color: #fff; }
.icon-telegram { background-color: #229ed9; color: #fff; }
.icon-tiktok { background-color: #000; color: #00f2fe; border: 1px solid #ff0050; }
.icon-pinterest { background-color: #e60023; color: #fff; font-weight: 900; }
.icon-discourse { background-color: #232323; color: #00a4bd; }
.icon-disqus { background-color: #2e9fff; color: #fff; font-weight: 900; }
.icon-quora { background-color: #b92b27; color: #fff; font-weight: 900; }

.platform-name {
  font-size: 14px;
  font-weight: 600;
}

.platform-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-toggle {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #E4E6F0;
  transition: 0.25s;
  border-radius: 24px;
}

.slider-toggle:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.25s;
  border-radius: 50%;
}

input:checked + .slider-toggle {
  background-color: #3b82f6;
}

input:checked + .slider-toggle:before {
  transform: translateX(20px);
}

/* AI Persona Slider */
.tone-slider-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tone-range {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 4px;
  background: #E4E6F0;
  outline: none;
}

.tone-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.6);
}

.tone-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.tone-active-label {
  color: #60a5fa;
  font-weight: 600;
}

/* Hourly Rate Limit Gauges */
.gauges-container {
  display: flex;
  justify-content: space-around;
  gap: 12px;
  margin-top: 10px;
}

.gauge-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.gauge-circle {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.4);
}

.gauge-circle.blue {
  background: radial-gradient(circle, #F6F7FB 60%, transparent 61%),
              conic-gradient(#3b82f6 var(--gauge-percent, 75%), #F1F2F8 0);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

.gauge-circle.orange {
  background: radial-gradient(circle, #F6F7FB 60%, transparent 61%),
              conic-gradient(#f97316 var(--gauge-percent, 70%), #F1F2F8 0);
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.3);
}

.gauge-circle.red {
  background: radial-gradient(circle, #F6F7FB 60%, transparent 61%),
              conic-gradient(#ef4444 var(--gauge-percent, 100%), #F1F2F8 0);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.35);
}

.gauge-val {
  font-size: 18px;
  font-weight: 700;
}

.gauge-unit {
  font-size: 10px;
  color: var(--text-muted);
}

.gauge-platform {
  font-size: 12px;
  font-weight: 600;
  margin-top: 8px;
}

.gauge-limit {
  font-size: 11px;
  color: var(--text-muted);
}

/* Threshold Box */
.threshold-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.threshold-badge-row {
  display: flex;
  justify-content: flex-end;
}

.threshold-badge {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 4px 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 15px;
  color: #60a5fa;
}

/* Stat Rows */
.stat-table {
  width: 100%;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

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

.stat-num {
  font-weight: 600;
  color: var(--text-main);
}

/* Toast Notifications */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  background-color: #151827;
  border: 0;
  border-radius: 12px;
  color: #FFFFFF;
  font-size: 13px;
  box-shadow: 0 10px 25px rgba(18,20,43,0.25);
  display: none;
  z-index: 1000;
  animation: slideUp 0.3s ease;
}

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

/* Feed View Styles */
.feed-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.2s;
}

.feed-item:hover {
  border-color: rgba(59, 130, 246, 0.4);
}

.feed-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
}

.feed-author {
  font-weight: 600;
  color: var(--text-main);
}

.feed-content {
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 10px;
}

.feed-reply {
  background: var(--bg-card);
  border-left: 3px solid #3b82f6;
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  font-size: 12px;
  color: #cbd5e1;
}

/* Credential Tester Badges */
.test-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.test-badge.success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.test-badge.failed {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.test-badge.loading {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
  animation: pulseOpacity 1.2s infinite;
}

@keyframes pulseOpacity {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Sentiment Bars & Analytics Widgets */
.sentiment-bar-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sentiment-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.sentiment-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
}

.sentiment-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.analytics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.analytics-table th {
  text-align: left;
  padding: 8px 10px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  font-size: 11px;
  text-transform: uppercase;
}

.analytics-table td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

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

/* Webhook Checkbox & Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #E4E6F0;
  transition: .3s;
  border-radius: 22px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: #10b981;
}

input:checked + .toggle-slider:before {
  transform: translateX(18px);
}

