:root {
  --bg: #0b0d10;
  --surface: #14181d;
  --surface-2: #1b2027;
  --border: #252b33;
  --text: #e7ecf2;
  --text-muted: #8993a3;
  --accent: #f5a623;
  --bull: #22c55e;
  --bear: #ef4444;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Topbar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 18px; margin: 0; font-weight: 600; letter-spacing: 0.3px; }
.logo { font-size: 22px; }
.meta { display: flex; align-items: center; gap: 14px; color: var(--text-muted); font-size: 13px; }
.asset-select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  max-width: 260px;
  appearance: auto;
}
.asset-select:hover { border-color: var(--accent); }
.asset-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(245,166,35,0.2); }
.asset-select:disabled { opacity: 0.5; cursor: not-allowed; }
.asset-select optgroup { font-weight: 600; color: var(--accent); font-size: 12px; }
.asset-select option { font-weight: 400; color: var(--text); background: var(--surface); padding: 4px; }
#refresh-btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
}
#refresh-btn:hover { background: var(--border); }

/* Container */
.container {
  max-width: 1200px;
  margin: 28px auto;
  padding: 0 24px;
}

/* Synthèse IA */
.synthesis-card {
  background: linear-gradient(135deg, rgba(245, 166, 35, 0.09), rgba(245, 166, 35, 0.02));
  border: 1px solid rgba(245, 166, 35, 0.35);
  border-radius: 12px;
  padding: 24px 28px;
  margin-bottom: 24px;
}
.synthesis-card .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent);
  margin-bottom: 10px;
  font-weight: 600;
}
.synthesis-text {
  font-size: 15px;
  margin: 0;
  font-weight: 400;
  color: var(--text);
  line-height: 1.65;
}
.synthesis-text p {
  margin: 0 0 10px 0;
}
.synthesis-text p:last-child { margin-bottom: 0; }
.synthesis-text strong {
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.synthesis-text ul {
  margin: 4px 0 14px 0;
  padding-left: 18px;
  list-style: disc;
}
.synthesis-text li {
  margin-bottom: 4px;
}
/* Verdict colore apres "Faut-il acheter/investir" */
.synthesis-text .verdict-buy {
  color: var(--bull);
  font-weight: 700;
  font-size: 16px;
}
.synthesis-text .verdict-sell {
  color: var(--bear);
  font-weight: 700;
  font-size: 16px;
}
.synthesis-text .verdict-wait {
  color: #f59e0b;
  font-weight: 700;
  font-size: 16px;
}
.synthesis-footer {
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Chart TradingView */
.chart-card {
  margin-bottom: 24px;
}
.chart-body {
  padding: 0 !important;
  overflow: hidden;
  border-radius: 0 0 12px 12px;
}
#spy-chart {
  position: relative;
  width: 100%;
  height: 600px;
}
@media (max-width: 960px) {
  #spy-chart {
    height: 420px;
  }
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 960px) {
  .grid { grid-template-columns: 1fr; }
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.card-header h2 {
  font-size: 14px;
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.timeframe {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.card-body { padding: 14px 18px; }

/* Supertrend */
.supertrend-summary {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.supertrend-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.supertrend-table th,
.supertrend-table td {
  text-align: left;
  padding: 9px 6px;
  border-bottom: 1px solid var(--border);
}
.supertrend-table tr:last-child td { border-bottom: none; }
.supertrend-table th {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.4px;
}
.supertrend-table td small {
  color: var(--text-muted);
  font-size: 11px;
}
.signal-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.bull { color: var(--bull); }
.bull .signal-dot { background: var(--bull); }
.bear { color: var(--bear); }
.bear .signal-dot { background: var(--bear); }
.unknown { color: var(--text-muted); }
.unknown .signal-dot { background: var(--text-muted); }
.price-col { color: var(--text); font-variant-numeric: tabular-nums; font-size: 12px; }
.change-up { color: var(--bull); font-weight: 600; font-size: 12px; }
.change-down { color: var(--bear); font-weight: 600; font-size: 12px; }

/* Supertrend - valeur courante mise en avant */
.st-current td {
  font-weight: 600;
  font-size: 14px;
}
.st-separator td {
  padding: 8px 0 4px;
  border-bottom: none;
  color: var(--text-muted);
  font-style: italic;
}

/* Polymarket */
.poly-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.poly-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.poly-list li:last-child { border-bottom: none; }
.poly-name {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
}
.poly-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}
.poly-bar-track {
  flex: 1;
  background: var(--surface-2);
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
}
.poly-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.5s ease;
}
.poly-pct {
  font-weight: 600;
  font-size: 13px;
  min-width: 40px;
  text-align: right;
  color: var(--text);
}

/* News */
.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.news-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.news-list li:last-child { border-bottom: none; }
.news-list a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}
.news-list a:hover { color: var(--accent); }
.news-source {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Recherche Web */
.websearch-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.websearch-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.websearch-list li:last-child { border-bottom: none; }
.websearch-list a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}
.websearch-list a:hover { color: var(--accent); }
.websearch-snippet {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}
.websearch-source {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  opacity: 0.7;
}

/* Admin */
.hard-refresh-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.hard-refresh-btn:hover { background: linear-gradient(135deg, #d97706, #b45309); }
.hard-refresh-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.admin-login { display: inline-flex; align-items: center; }
.admin-badge {
  font-size: 11px;
  color: var(--accent);
  background: rgba(245,166,35,0.12);
  border: 1px solid rgba(245,166,35,0.3);
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 500;
}

/* Admin Panel */
.admin-panel {
  margin-top: 28px;
  background: var(--surface);
  border: 1px solid rgba(245,166,35,0.3);
  border-radius: 10px;
  overflow: hidden;
}
.admin-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(245,166,35,0.06);
}
.admin-panel-header h2 {
  font-size: 14px;
  margin: 0;
  font-weight: 600;
  color: var(--accent);
}
.admin-panel-actions { display: flex; gap: 8px; }
.admin-btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.admin-btn:hover { background: var(--border); }
.admin-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.admin-btn-warn {
  background: rgba(245,166,35,0.15);
  border-color: rgba(245,166,35,0.3);
  color: var(--accent);
}
.admin-btn-warn:hover { background: rgba(245,166,35,0.25); }
.admin-panel-body { padding: 14px 18px; }
.admin-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
@media (max-width: 700px) {
  .admin-grid { grid-template-columns: repeat(2, 1fr); }
}
.admin-stat {
  background: var(--surface-2);
  border-radius: 6px;
  padding: 10px 12px;
}
.admin-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.admin-stat-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.admin-ok { color: var(--bull); }
.admin-err { color: var(--bear); }
.admin-warn { color: var(--accent); }
.admin-log {
  background: #0a0c0f;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  max-height: 200px;
  overflow-y: auto;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-muted);
}
.admin-log-line { white-space: pre-wrap; }
.admin-batch-progress { margin-top: 12px; }
.admin-progress-bar {
  background: var(--surface-2);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 6px;
}
.admin-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #22c55e);
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}
.admin-progress-text {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* Cron controls */
.admin-cron-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.admin-btn-cron-start {
  background: linear-gradient(135deg, #22c55e, #16a34a) !important;
  border-color: #16a34a !important;
  color: #fff !important;
  font-weight: 600;
}
.admin-btn-cron-start:hover { background: linear-gradient(135deg, #16a34a, #15803d) !important; }
.admin-btn-cron-stop {
  background: linear-gradient(135deg, #ef4444, #dc2626) !important;
  border-color: #dc2626 !important;
  color: #fff !important;
  font-weight: 600;
}
.admin-btn-cron-stop:hover { background: linear-gradient(135deg, #dc2626, #b91c1c) !important; }
.cron-status-text {
  font-size: 12px;
  color: var(--text-muted);
}

/* Empty state */
.empty-msg {
  color: var(--text-muted);
  font-style: italic;
  font-size: 13px;
  padding: 12px 0;
}

/* Footer */
.footer {
  max-width: 1200px;
  margin: 32px auto;
  padding: 0 24px 24px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}
