/* ==========================================================================
   CSS VARIABLE DECLARATIONS & PALETTE
   ========================================================================== */
:root {
  --font-primary: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Colors */
  --bg-darker: #0c0a1c;
  --bg-dark: #120e2e;
  --bg-panel: rgba(22, 18, 48, 0.55);
  --bg-panel-solid: #161230;
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(139, 92, 246, 0.15);

  --color-primary: #06b6d4; /* Cyan */
  --color-secondary: #8b5cf6; /* Purple */
  --color-gold: #eab308; /* Gold */
  --color-rose: #f43f5e; /* Rose */
  --color-emerald: #10b981; /* Emerald */

  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-light: #6b7280;

  --border-radius-lg: 16px;
  --border-radius-md: 10px;
  --border-radius-sm: 6px;

  --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --shadow-glow-cyan: 0 0 20px rgba(6, 182, 212, 0.35);
  --shadow-glow-purple: 0 0 20px rgba(139, 92, 246, 0.35);
}

/* ==========================================================================
   RESET & FOUNDATIONS
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-primary);
  background-color: var(--bg-darker);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
}

/* Scrollbar styles */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Ambient glow backgrounds */
.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.25;
}
.bg-glow-1 {
  width: 450px;
  height: 450px;
  background: var(--color-primary);
  top: -50px;
  left: 10%;
}
.bg-glow-2 {
  width: 500px;
  height: 500px;
  background: var(--color-secondary);
  bottom: 10%;
  right: 5%;
}
.bg-glow-3 {
  width: 350px;
  height: 350px;
  background: var(--color-rose);
  top: 40%;
  left: 45%;
}

/* Glassmorphism panels */
.glass-panel {
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-premium);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   LAYOUT STRUCTURE
   ========================================================================== */
.app-wrapper {
  max-width: 1600px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
}

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

.brand-icon {
  font-size: 2.2rem;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 10px rgba(6, 182, 212, 0.3));
}

.logo-text h1 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.logo-text .highlight {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text .subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* Badges list in header */
.account-summary-badges {
  display: flex;
  gap: 12px;
}

.summary-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: 50px;
  font-size: 0.82rem;
  font-weight: 600;
}

.summary-badge i {
  font-size: 0.9rem;
}

.health-badge {
  border-color: rgba(16, 185, 129, 0.25);
  color: var(--color-emerald);
}

.violations-badge {
  border-color: rgba(244, 63, 94, 0.25);
  color: var(--color-rose);
}

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

.header-controls .agent-avatar-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.avatar-emoji {
  font-size: 1.3rem;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.3));
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-primary);
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--color-primary);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--color-primary);
}

.pulse-dot {
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 12px var(--color-primary); }
  100% { transform: scale(0.9); opacity: 0.6; }
}

/* App Main Layout Grid */
.app-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 16px;
  align-items: start;
}

/* Sidebar Navigation */
.app-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 12px;
  height: 100%;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: none;
  border: none;
  border-radius: var(--border-radius-md);
  color: var(--text-secondary);
  font-family: var(--font-primary);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.2s ease-in-out;
  position: relative;
}

.nav-btn i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

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

.nav-btn.active {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(139, 92, 246, 0.15));
  color: var(--color-primary);
  border: 1px solid rgba(6, 182, 212, 0.25);
  box-shadow: inset 0 0 8px rgba(6, 182, 212, 0.05);
}

.badge-dot {
  position: absolute;
  top: 14px;
  right: 18px;
  width: 8px;
  height: 8px;
  background-color: var(--color-rose);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--color-rose);
}

.nav-count-badge {
  position: absolute;
  top: 10px;
  right: 14px;
  background-color: var(--color-secondary);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.back-to-lobby-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.2s;
}

.back-to-lobby-btn:hover {
  background: rgba(244, 63, 94, 0.1);
  color: var(--color-rose);
  border-color: rgba(244, 63, 94, 0.2);
}

/* Viewport Section */
.app-viewport {
  min-height: calc(100vh - 120px);
}

.tab-view {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.tab-view.active {
  display: flex;
}

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

.page-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

/* ==========================================================================
   BUTTONS AND FORM ELEMENTS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  outline: none;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--border-radius-sm);
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-glass);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-clear {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  transition: color 0.2s;
}

.btn-clear:hover {
  color: var(--color-rose);
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--border-radius-md);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.15);
  background: rgba(0, 0, 0, 0.35);
}

.form-group textarea {
  font-family: var(--font-primary);
}

.form-group small {
  font-size: 0.72rem;
  color: var(--text-light);
  line-height: 1.3;
}

/* ==========================================================================
   METRICS GRID & CARDS
   ========================================================================== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
}

.card-icon {
  font-size: 1.5rem;
  opacity: 0.8;
}

.card-info {
  display: flex;
  flex-direction: column;
}

.card-info .label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-info .value {
  font-size: 1.25rem;
  font-weight: 700;
}

/* Text coloring variations */
.text-cyan { color: var(--color-primary); }
.text-cyan .card-icon { color: var(--color-primary); }
.text-purple { color: var(--color-secondary); }
.text-purple .card-icon { color: var(--color-secondary); }
.text-gold { color: var(--color-gold); }
.text-gold .card-icon { color: var(--color-gold); }
.text-emerald { color: var(--color-emerald); }
.text-emerald .card-icon { color: var(--color-emerald); }
.text-rose { color: var(--color-rose); }
.text-rose .card-icon { color: var(--color-rose); }

/* ==========================================================================
   CHARTS & SECTIONS
   ========================================================================== */
.charts-row {
  display: flex;
  gap: 16px;
}

.chart-panel {
  flex: 1;
  padding: 20px;
}

.chart-panel h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 6px;
  color: var(--text-primary);
}

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

/* Campaigns list grid and Zoom panel */
.campaigns-section-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 16px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.panel-header h3 {
  font-size: 1rem;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-glass);
  padding: 4px 10px;
  border-radius: var(--border-radius-sm);
  width: 160px;
}

.search-box i {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.search-box input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 0.78rem;
  width: 100%;
}

.campaigns-list-panel {
  padding: 16px;
}

.table-scroll-container {
  max-height: 380px;
  overflow-y: auto;
}

.table-scroll-container.compact {
  max-height: 200px;
}

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

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

.data-table th {
  color: var(--text-secondary);
  font-weight: 600;
  position: sticky;
  top: 0;
  background: var(--bg-panel-solid);
  z-index: 1;
}

.data-table tbody tr {
  cursor: pointer;
  transition: background 0.15s;
}

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

.data-table tbody tr.active {
  background: rgba(6, 182, 212, 0.08);
  color: var(--color-primary);
}

/* Details Zoom Panel */
.campaigns-detail-panel {
  padding: 20px;
  min-height: 440px;
  display: flex;
  flex-direction: column;
}

.zoom-placeholder {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  text-align: center;
  color: var(--text-secondary);
  flex: 1;
  padding: 40px;
}

.zoom-placeholder i {
  font-size: 3rem;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 0.8;
}

.zoom-placeholder p {
  max-width: 320px;
  font-size: 0.88rem;
  line-height: 1.4;
}

.zoom-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  flex: 1;
}

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

.zoom-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.zoom-stats-bar {
  display: flex;
  gap: 20px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--border-radius-md);
  font-size: 0.8rem;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.zoom-sub-panel-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  flex: 1;
}

.zoom-sub-list h4 {
  font-size: 0.85rem;
  margin-bottom: 8px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.zoom-group-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
}

.zoom-group-list li {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zoom-group-list li:hover {
  background: rgba(255, 255, 255, 0.08);
}

.zoom-group-list li.active {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(139, 92, 246, 0.15));
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* Zoom sub-details */
.zoom-sub-details {
  display: flex;
  flex-direction: column;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  padding-left: 16px;
}

.sub-details-placeholder {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px 0;
  font-size: 0.8rem;
  margin: auto;
}

.sub-details-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.tabs-sub {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 4px;
}

.tab-sub-btn {
  background: none;
  border: none;
  padding: 4px 12px;
  color: var(--text-secondary);
  font-family: var(--font-primary);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}

.tab-sub-btn:hover {
  color: var(--text-primary);
}

.tab-sub-btn.active {
  color: var(--color-primary);
}

.tab-sub-btn.active::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--color-primary);
}

.subtab-view {
  display: none;
}

.subtab-view.active {
  display: block;
}

/* Ads card view scroll */
.ads-card-scroll {
  max-height: 250px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
}

.ad-card-preview {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-md);
  padding: 12px;
  position: relative;
  font-size: 0.8rem;
}

.ad-card-preview .ad-tag {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-light);
  border: 1px solid var(--border-glass);
  padding: 1px 6px;
  border-radius: 4px;
}

.ad-card-preview .g-url {
  color: #8ab4f8;
  font-size: 0.72rem;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 80%;
  display: block;
}

.ad-card-preview .g-title {
  color: #8ab4f8;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 4px;
}

.ad-card-preview .g-desc {
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.35;
}

/* Tags in Keywords view */
.kw-tag {
  display: inline-block;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: 50px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  margin-right: 4px;
  margin-bottom: 6px;
}

.kw-tag.exact { border-color: rgba(6, 182, 212, 0.25); color: var(--color-primary); }
.kw-tag.phrase { border-color: rgba(139, 92, 246, 0.25); color: var(--color-secondary); }
.kw-tag.broad { border-color: rgba(234, 179, 8, 0.25); color: var(--color-gold); }

/* ==========================================================================
   TAB 2: COMPLIANCE CHECKER
   ========================================================================== */
.compliance-overview {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  gap: 24px;
}

.overview-desc {
  flex: 1.5;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.overview-stats {
  display: flex;
  gap: 24px;
}

.c-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 20px;
  border-radius: var(--border-radius-md);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.c-stat .val {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--color-primary);
}

.c-stat .lbl {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.violations-layout {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 16px;
}

.violations-list-panel {
  padding: 20px;
}

.violations-list-panel h3 {
  font-size: 1rem;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 8px;
}

.violation-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 480px;
  overflow-y: auto;
}

.violation-item-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}

.violation-item-btn:hover {
  background: rgba(255, 255, 255, 0.07);
}

.violation-item-btn.active {
  background: rgba(244, 63, 94, 0.08);
  border-color: var(--color-rose);
}

.v-item-info h4 {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.v-item-info p {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.violation-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.violation-badge.high {
  background: rgba(244, 63, 94, 0.15);
  color: var(--color-rose);
  border: 1px solid rgba(244, 63, 94, 0.25);
}

.violation-badge.medium {
  background: rgba(234, 179, 8, 0.15);
  color: var(--color-gold);
  border: 1px solid rgba(234, 179, 8, 0.25);
}

/* Violation Editor Panel */
.violations-editor-panel {
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.editor-placeholder {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  text-align: center;
  color: var(--text-secondary);
  flex: 1;
  padding: 40px;
}

.editor-placeholder i {
  font-size: 3rem;
  color: var(--color-secondary);
  opacity: 0.8;
}

.editor-placeholder p {
  max-width: 320px;
  font-size: 0.88rem;
  line-height: 1.4;
}

.editor-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.editor-content h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.ce-meta {
  display: flex;
  gap: 20px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 12px;
  border-radius: var(--border-radius-sm);
}

.editor-boxes {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.editor-box h4 {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.highlighted-error-box {
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.2);
  border-radius: var(--border-radius-md);
  padding: 14px;
  position: relative;
}

.highlighted-error-box p {
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 8px;
}

.field-badge {
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--color-rose);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
}

.highlighted-success-box {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--border-radius-md);
  padding: 14px;
}

.highlighted-success-box p {
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 8px;
  color: var(--color-emerald);
}

.safe-badge {
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--color-emerald);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
}

.ce-actions {
  display: flex;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 16px;
}

.ai-variations-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-variations-section h4 {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.ai-variations-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-variations-list li {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-sm);
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-variations-list li .use-var-btn {
  background: var(--color-secondary);
  border: none;
  color: white;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
}

/* ==========================================================================
   TAB 3: DAILY OPTIMIZER
   ========================================================================== */
.evaluation-date {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 12px;
  border-radius: 50px;
}

.health-gauge-row {
  display: flex;
  gap: 16px;
}

.health-card {
  flex: 0.7;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.health-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.gauge-wrapper {
  margin: 10px 0;
}

.gauge-ring {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--bg-dark) 80%, transparent 0 100%),
              conic-gradient(var(--color-primary) var(--percent), rgba(255, 255, 255, 0.05) 0);
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: var(--shadow-glow-cyan);
}

.gauge-ring.critical {
  background: radial-gradient(closest-side, var(--bg-dark) 80%, transparent 0 100%),
              conic-gradient(var(--color-rose) var(--percent), rgba(255, 255, 255, 0.05) 0);
  box-shadow: 0 0 20px rgba(244, 63, 94, 0.35);
}

.gauge-value {
  font-size: 2.2rem;
  font-weight: 800;
}

.gauge-note {
  font-size: 0.72rem;
  color: var(--text-light);
  text-align: center;
  margin-top: 10px;
  line-height: 1.3;
}

.overview-tips-card {
  flex: 1.3;
  padding: 20px;
}

.overview-tips-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 6px;
}

.tips-bullet-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tip-item {
  display: flex;
  gap: 12px;
  align-items: start;
}

.tip-icon {
  font-size: 1rem;
  color: var(--color-primary);
  margin-top: 3px;
}

.tip-item p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.tip-item p b {
  color: var(--text-primary);
}

/* Recommendations Actions List */
.optimizer-recommendations-section h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.recommendations-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rec-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-left: 4px solid var(--color-primary);
}

.rec-card.rec-warning { border-left-color: var(--color-gold); }
.rec-card.rec-critical { border-left-color: var(--color-rose); }
.rec-card.rec-success { border-left-color: var(--color-emerald); }
.rec-card.rec-tip { border-left-color: var(--color-primary); }

.rec-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 80%;
}

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

.rec-header-row h4 {
  font-size: 0.95rem;
  font-weight: 700;
}

.rec-tag-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
}

.rec-card.rec-warning .rec-tag-badge { color: var(--color-gold); background: rgba(234, 179, 8, 0.08); }
.rec-card.rec-critical .rec-tag-badge { color: var(--color-rose); background: rgba(244, 63, 94, 0.08); }
.rec-card.rec-success .rec-tag-badge { color: var(--color-emerald); background: rgba(16, 185, 129, 0.08); }

.rec-main .desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* ==========================================================================
   TAB 4: AI COPYWRITER & GENERATOR
   ========================================================================== */
.generator-layout-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 16px;
}

.generator-input-panel {
  padding: 20px;
}

.generator-input-panel h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 8px;
}

.generator-result-panel {
  padding: 20px;
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

.result-placeholder {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  text-align: center;
  color: var(--text-secondary);
  flex: 1;
  padding: 40px;
}

.result-placeholder i {
  font-size: 3rem;
  color: var(--color-primary);
  opacity: 0.8;
}

.result-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  flex: 1;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.result-header h3 {
  font-size: 1.05rem;
}

.preview-scroll-box {
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.preview-scroll-box h4 {
  font-size: 0.85rem;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.generated-list-ol {
  padding-left: 20px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.generated-list-ol li {
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.kw-category-box {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-glass);
  padding: 10px 12px;
  border-radius: var(--border-radius-md);
}

.kw-category-box h5 {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.kw-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.kw-tag-badge {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  padding: 2px 8px;
  border-radius: 4px;
}

.kw-tags.negative .kw-tag-badge {
  background: rgba(244, 63, 94, 0.05);
  border-color: rgba(244, 63, 94, 0.2);
  color: var(--color-rose);
}

/* ==========================================================================
   TAB 5: CSV MANAGER
   ========================================================================== */
.csv-layout-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
}

.csv-upload-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.csv-upload-card h3 {
  font-size: 1.1rem;
}

.csv-upload-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--border-radius-lg);
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(0, 0, 0, 0.1);
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--color-primary);
  background: rgba(6, 182, 212, 0.04);
}

.drop-icon {
  font-size: 2.2rem;
  color: var(--text-secondary);
}

.drop-zone p {
  font-size: 0.85rem;
  text-align: center;
}

.drop-zone p span {
  color: var(--color-primary);
  font-weight: 700;
  text-decoration: underline;
}

.file-info-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: var(--border-radius-md);
  font-size: 0.82rem;
}

.file-info-bar i {
  color: var(--color-primary);
}

.file-info-bar .file-name {
  font-weight: 700;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-status {
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
}

.csv-current-data-card {
  padding: 24px;
}

.csv-current-data-card h3 {
  font-size: 1.1rem;
  margin-bottom: 16px;
}

.database-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.db-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-md);
}

.db-info {
  display: flex;
  align-items: start;
  gap: 12px;
  max-width: 75%;
}

.db-icon {
  font-size: 1.3rem;
  margin-top: 2px;
}

.db-info h4 {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.db-info p {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

.db-status-badge {
  font-size: 0.7rem;
  font-weight: 700;
}

/* ==========================================================================
   TAB 6: CONSULTATION CHAT
   ========================================================================== */
.chat-main-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  padding: 0;
  overflow: hidden;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.agent-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-emoji {
  font-size: 1.8rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-glass);
}

.agent-profile h3 {
  font-size: 0.95rem;
  font-weight: 700;
}

.agent-profile p {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.chat-meta-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-secondary);
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.25);
  padding: 4px 10px;
  border-radius: 50px;
}

/* Messages log scroll window */
.chat-messages-log {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}

.message.agent {
  align-self: flex-start;
}

.message.user {
  align-self: flex-end;
}

.message-bubble {
  padding: 12px 16px;
  border-radius: var(--border-radius-lg);
  font-size: 0.88rem;
  line-height: 1.45;
}

.message.agent .message-bubble {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.message.user .message-bubble {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.15);
}

.message-time {
  font-size: 0.65rem;
  color: var(--text-light);
  margin-top: 4px;
  padding: 0 4px;
}

.message.agent .message-time { text-align: left; }
.message.user .message-time { text-align: right; }

/* Typing indicator dot animation */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 20px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.typing-indicator .dot {
  width: 6px;
  height: 6px;
  background-color: var(--text-secondary);
  border-radius: 50%;
  display: inline-block;
  animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator .dot:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}

/* Chat Input bar */
.chat-input-row {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.1);
}

.chat-input-row input {
  flex: 1;
  padding: 12px 16px;
  border-radius: var(--border-radius-md);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s;
}

.chat-input-row input:focus {
  border-color: var(--color-primary);
  background: rgba(0, 0, 0, 0.35);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.15);
}

.btn-send-message {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  border: none;
  border-radius: var(--border-radius-md);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  box-shadow: 0 4px 10px rgba(6, 182, 212, 0.2);
  transition: all 0.2s;
}

.btn-send-message:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 15px rgba(6, 182, 212, 0.3);
}

.btn-send-message:active {
  transform: translateY(0);
}

/* Hidden Class Utility */
.hidden {
  display: none !important;
}

/* Markdown styling inside chat messages */
.message-bubble strong {
  font-weight: 700;
  color: #fff;
}
.message-bubble h1, .message-bubble h2, .message-bubble h3, .message-bubble h4 {
  margin: 10px 0 6px;
  font-weight: 700;
  color: #fff;
}
.message-bubble ul, .message-bubble ol {
  padding-left: 20px;
  margin: 6px 0;
}
.message-bubble li {
  margin-bottom: 4px;
}
.message-bubble code {
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.3);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* ==========================================================================
   ACCOUNTS TAB STYLING
   ========================================================================== */
.accounts-layout-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
  margin-top: 10px;
}

.accounts-cards-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 6px;
}

.account-card-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-lg);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.account-card-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.account-card-item.active {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);
  border-color: var(--color-primary);
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.15);
}

.account-card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.account-card-info h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.account-card-info .cust-id {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-primary);
  font-weight: 700;
}

.account-card-stats {
  display: flex;
  gap: 14px;
  margin-top: 6px;
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.account-card-stats span b {
  color: var(--text-primary);
}

.account-card-status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-badge-active {
  background: rgba(16, 185, 129, 0.1);
  color: var(--color-emerald);
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid rgba(16, 185, 129, 0.2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-badge-inactive {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--border-glass);
}
