:root {
  --bg-primary: #0a0d14;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(31, 41, 55, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(99, 102, 241, 0.4);
  
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --accent-cyan: #06b6d4;
  --accent-indigo: #6366f1;
  --accent-purple: #a855f7;
  
  --positive-bg: rgba(16, 185, 129, 0.12);
  --positive-border: rgba(16, 185, 129, 0.3);
  --positive-text: #34d399;
  
  --negative-bg: rgba(244, 63, 94, 0.12);
  --negative-border: rgba(244, 63, 94, 0.3);
  --negative-text: #fb7185;
  
  --neutral-bg: rgba(148, 163, 184, 0.1);
  --neutral-border: rgba(148, 163, 184, 0.25);
  --neutral-text: #cbd5e1;

  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(6, 182, 212, 0.06) 0%, transparent 40%);
  background-attachment: fixed;
}

.container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 24px 20px 80px 20px;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 28px;
}

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

.logo-badge {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
}

.brand-title h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.status-pills {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pill {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
}

.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--positive-text);
  box-shadow: 0 0 8px var(--positive-text);
}

/* Action Bar */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  padding: 16px 20px;
  border-radius: 14px;
  margin-bottom: 24px;
}

.btn-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-cyan {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35);
}

.btn-cyan:hover {
  background: linear-gradient(135deg, #0891b2, #0e7490);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.5);
}

.btn-telegram {
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  color: #ffffff !important;
  border: 1px solid #38bdf8;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
}

.btn-telegram:hover {
  background: linear-gradient(135deg, #0369a1, #0284c7);
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.5);
}

/* Tab Navigation */
.view-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.macro-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.macro-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

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

.card-title-group h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.badge-country {
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
}

.badge-importance {
  color: #fbbf24;
  letter-spacing: 2px;
}

/* Events mini-table */
.events-table-wrapper {
  margin-bottom: 20px;
  overflow-x: auto;
}

.events-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.events-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
}

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

.metric-tag {
  display: inline-block;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8rem;
}

.surprise-positive {
  color: var(--positive-text);
}

.surprise-negative {
  color: var(--negative-text);
}

/* Analysis Panel */
.analysis-panel {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 18px;
}

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

.strength-bar-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.strength-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.strength-bar {
  width: 100px;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.strength-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #06b6d4, #6366f1);
}

/* Asset Badges Grid */
.assets-impact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.asset-badge {
  padding: 8px 10px;
  border-radius: 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid transparent;
  transition: transform 0.2s ease;
}

.asset-badge:hover {
  transform: translateY(-2px);
}

.asset-badge.positive {
  background: var(--positive-bg);
  border-color: var(--positive-border);
  color: var(--positive-text);
}

.asset-badge.negative {
  background: var(--negative-bg);
  border-color: var(--negative-border);
  color: var(--negative-text);
}

.asset-badge.neutral {
  background: var(--neutral-bg);
  border-color: var(--neutral-border);
  color: var(--neutral-text);
}

.asset-symbol {
  font-size: 0.75rem;
  font-weight: 700;
  opacity: 0.85;
}

.asset-dir {
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
}

.macro-reason {
  font-size: 0.9rem;
  color: #e2e8f0;
  margin-bottom: 14px;
  line-height: 1.6;
  border-left: 3px solid var(--accent-indigo);
  padding-left: 12px;
}

.time-horizons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 14px;
  font-size: 0.8rem;
}

.horizon-box {
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.horizon-title {
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 4px;
}

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

/* Raw JSON View */
.json-container {
  background: #0d1117;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  overflow-x: auto;
  position: relative;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.85rem;
  color: #c9d1d9;
}

.copy-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Empty State & Loader */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.loader {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

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

/* ==========================================================
   Light Mode Support
   ========================================================== */
[data-theme="light"] {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.92);
  --bg-card-hover: #ffffff;
  --border-color: rgba(15, 23, 42, 0.08);
  --border-hover: rgba(99, 102, 241, 0.45);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --accent-cyan: #0284c7;
  --accent-indigo: #4f46e5;
  --accent-purple: #9333ea;
  
  --positive-bg: rgba(16, 185, 129, 0.12);
  --positive-border: rgba(16, 185, 129, 0.35);
  --positive-text: #059669;
  
  --negative-bg: rgba(244, 63, 94, 0.1);
  --negative-border: rgba(244, 63, 94, 0.3);
  --negative-text: #e11d48;
  
  --neutral-bg: rgba(100, 116, 139, 0.08);
  --neutral-border: rgba(100, 116, 139, 0.2);
  --neutral-text: #334155;
}

[data-theme="light"] body {
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(6, 182, 212, 0.04) 0%, transparent 40%);
}

[data-theme="light"] .brand-title h1 {
  background: linear-gradient(90deg, #0f172a, #334155);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .macro-card {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .macro-card:hover {
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.12);
}

[data-theme="light"] .analysis-panel {
  background: rgba(248, 250, 252, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .analysis-header strong {
  color: #0f172a !important;
}

[data-theme="light"] .macro-reason {
  color: #1e293b;
}

[data-theme="light"] .horizon-box {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .json-container {
  background: #f8fafc;
  color: #1e293b;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .action-bar {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .view-tabs {
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .tab-btn.active {
  background: #ffffff;
  color: #0f172a;
}

[data-theme="light"] .badge-country {
  background: rgba(0, 0, 0, 0.06);
  color: #334155;
}

[data-theme="light"] .btn {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-primary);
  border: 1px solid rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .btn:hover {
  background: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .btn.btn-primary,
[data-theme="light"] .btn-primary {
  background: linear-gradient(135deg, #4f46e5, #4338ca) !important;
  color: #ffffff !important;
  border: 1px solid rgba(79, 70, 229, 0.4) !important;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

[data-theme="light"] .btn.btn-primary:hover,
[data-theme="light"] .btn-primary:hover {
  background: linear-gradient(135deg, #4338ca, #3730a3) !important;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
}

[data-theme="light"] .btn.btn-cyan,
[data-theme="light"] .btn-cyan {
  background: linear-gradient(135deg, #0284c7, #0369a1) !important;
  color: #ffffff !important;
  border: 1px solid rgba(2, 132, 199, 0.4) !important;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

[data-theme="light"] .btn.btn-cyan:hover,
[data-theme="light"] .btn-cyan:hover {
  background: linear-gradient(135deg, #0369a1, #075985) !important;
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.35);
}

[data-theme="light"] .btn.btn-telegram,
[data-theme="light"] .btn-telegram {
  background: linear-gradient(135deg, #0088cc, #0284c7) !important;
  color: #ffffff !important;
  border: 1px solid rgba(0, 136, 204, 0.5) !important;
  box-shadow: 0 4px 12px rgba(0, 136, 204, 0.3);
}

[data-theme="light"] .btn.btn-telegram:hover,
[data-theme="light"] .btn-telegram:hover {
  background: linear-gradient(135deg, #0077b5, #00628f) !important;
  box-shadow: 0 6px 16px rgba(0, 136, 204, 0.4);
}

[data-theme="light"] .copy-btn {
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.15);
  color: #0f172a;
}

[data-theme="light"] .copy-btn:hover {
  background: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .events-table th {
  color: #475569;
}

[data-theme="light"] .events-table td {
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .strength-bar {
  background: rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Scenario Boxes (Pre-Release Scenarios)
   ========================================================================== */
.scenarios-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.scenario-box {
  background: rgba(15, 23, 42, 0.6);
  border-radius: 10px;
  padding: 14px 16px;
  border-left: 4px solid var(--border-color);
  transition: all 0.2s ease;
}

.scenario-box:hover {
  transform: translateY(-2px);
}

.scenario-above {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.scenario-below {
  border-left-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}

.scenario-inline {
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
}

.scenario-title {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.scenario-above .scenario-title { color: #f87171; }
.scenario-below .scenario-title { color: #34d399; }
.scenario-inline .scenario-title { color: #fbbf24; }

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

/* ==========================================================================
   Generic Data Tables (Jobs & Telegram History)
   ========================================================================== */
.table-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  overflow: hidden;
}

.table-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.data-table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th {
  text-align: left;
  padding: 12px 14px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  white-space: nowrap;
}

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

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

.badge-status-pending {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-status-released {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* ==========================================================================
   Pagination Controls
   ========================================================================== */
.pagination-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.page-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.page-btn:hover:not(:disabled) {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.15);
}

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

/* ==========================================================================
   Bot / Scheduler Status Monitor
   ========================================================================== */
.bot-monitor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

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

.bot-status-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
}

.bot-indicator {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.bot-pulse-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
}

.bot-pulse-dot.active {
  background: #10b981;
  box-shadow: 0 0 16px #10b981;
}

.bot-pulse-dot.inactive {
  background: #ef4444;
  box-shadow: 0 0 16px #ef4444;
}

.bot-status-title {
  font-size: 1.3rem;
  font-weight: 700;
}

.bot-meta-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.bot-meta-item {
  display: flex;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.bot-meta-item strong {
  color: var(--text-primary);
}

.code-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.88rem;
  color: #38bdf8;
  margin-bottom: 12px;
  user-select: all;
  display: flex;
  align-items: center;
}

.code-box code {
  color: inherit;
  font-family: inherit;
}

[data-theme="light"] .code-box {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #0369a1;
}

[data-theme="light"] .bot-status-card {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

