/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, sans-serif;
  background: #0d1117;
  color: #c9d1d9;
  font-size: 13px;
  line-height: 1.5;
}

/* ── App shell ── */
.app-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* dash.page_container génère un <div> sans id/class — on le cible directement.
   Il faut lui donner flex:1 pour qu'il remplisse .app-wrapper et crée un
   contexte flex pour ses enfants (#_pages_content etc.). */
.app-wrapper > div {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Shared navbar ── */
.main-nav {
  display: flex;
  align-items: center;
  gap: 0;
  background: #161b22;
  border-bottom: 1px solid #21262d;
  padding: 0 20px;
  height: 46px;
  flex-shrink: 0;
  z-index: 100;
}

.nav-brand {
  text-decoration: none;
  margin-right: 28px;
  flex-shrink: 0;
}
.nav-brand-text {
  font-size: 15px;
  font-weight: 700;
  color: #58a6ff;
  letter-spacing: -0.3px;
}
.nav-brand:hover .nav-brand-text { color: #79c0ff; }

.nav-tabs {
  display: flex;
  gap: 2px;
  height: 100%;
  align-items: stretch;
  margin-left: 24px;
}

.lang-select-wrap {
  margin-left: auto;
  width: 90px;
  min-width: 90px;
}

.lang-toggle {
  display: inline-flex;
  width: 100%;
  background: #0d1117;
  border: 1px solid #3b4654;
  border-radius: 999px;
  overflow: hidden;
}

.lang-toggle-btn {
  flex: 1;
  height: 28px;
  border: none;
  background: transparent;
  color: #8b949e;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.lang-toggle-btn:hover {
  background: #1f2937;
  color: #c9d1d9;
}

.lang-toggle-btn.active {
  background: #1f6feb;
  color: #ffffff;
}

.nav-tab {
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  color: #8b949e;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.nav-tab:hover  { color: #c9d1d9; border-bottom-color: #30363d; }
.nav-tab.active { color: #f0f6fc; border-bottom-color: #58a6ff; }

/* Le contenu de la page courante */
#_pages_content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════
   CAC 40 PAGE  (ex home-page)
═══════════════════════════════════════════════ */

.index-page, .cac40-page, .home-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Top bar ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid #21262d;
  flex-shrink: 0;
}
.topbar h1 {
  font-size: 18px;
  font-weight: 600;
  color: #f0f6fc;
  letter-spacing: -0.4px;
}
.subtitle { color: #8b949e; font-size: 11.5px; margin-top: 3px; display: block; }

.btn-refresh {
  background: #161b22;
  border: 1px solid #30363d;
  color: #c9d1d9;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.btn-refresh:hover { border-color: #58a6ff; color: #f0f6fc; }

/* ── Toolbar ── */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 20px;
  border-bottom: 1px solid #21262d;
  flex-shrink: 0;
}

.search {
  background: #161b22;
  border: 1px solid #30363d;
  color: #c9d1d9;
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 13px;
  width: 200px;
}
.search:focus { outline: none; border-color: #58a6ff; }

.filter-group { display: flex; gap: 5px; }

.fbtn {
  background: #161b22;
  border: 1px solid #30363d;
  color: #8b949e;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.fbtn:hover { border-color: #58a6ff; color: #c9d1d9; }
.fbtn.active { border-color: #58a6ff; color: #f0f6fc; background: #1f2937; }

.count { color: #8b949e; font-size: 12px; margin-left: auto; }

/* ── Table loading wrapper (remplace dcc.Loading pour garder la chaîne flex) ── */
.table-loading-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Table wrap (scrollable) ── */
.table-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
}

/* ── Table ── */
table { width: 100%; border-collapse: collapse; }

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #0f1117;
  color: #8b949e;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid #21262d;
  white-space: nowrap;
}
thead th.no-sort { cursor: default; }

tbody tr { border-bottom: 1px solid #161b22; }
tbody tr:last-child { border-bottom: none; }

.stock-row { cursor: pointer; transition: background .1s; }
.stock-row:hover { background: #161b22; }

td { padding: 5px 10px; vertical-align: middle; font-size: 12px; }
td.mono  { font-family: "Menlo", "Consolas", monospace; font-size: 11px; }
td.muted { color: #8b949e; }
td.bold  { color: #f0f6fc; font-weight: 500; }
td.num   { font-family: "Menlo", "Consolas", monospace; text-align: right; font-size: 11.5px; }
td.chart-cell { padding: 2px 8px; }

/* Column accent colors */
.c-blue,   td.c-blue,   th.c-blue   { color: #79c0ff; }
.c-purple, td.c-purple, th.c-purple { color: #c084fc; }
.c-green,  td.c-green,  th.c-green  { color: #56d364; }
.c-up,     td.c-up,     th.c-up     { color: #3fb950; }
.c-down,   td.c-down,   th.c-down   { color: #f85149; }
.week-range { font-size: 11px; }

/* ── Signal badges (compact) ── */
.sig-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  align-items: center;
}
.sig-badge {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  font-family: "SFMono-Regular", Consolas, monospace;
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.sig-survente { background: #0d2418; color: #4ade80; border: 1px solid #166534; }
.sig-surachat { background: #2d0a0a; color: #f87171; border: 1px solid #7f1d1d; }
.sig-haussier { background: #0d1f17; color: #56d364; border: 1px solid #1a4731; }
.sig-baissier { background: #200d0d; color: #f85149; border: 1px solid #5c1a1a; }
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}
.b-survente { background: #0d2418; color: #4ade80; border: 1px solid #166534; }
.b-surachat { background: #2d0a0a; color: #f87171; border: 1px solid #7f1d1d; }
.b-neutre   { background: transparent; color: #4b5563; border: 1px solid transparent; }
.b-haussier { background: #0d2418; color: #4ade80; border: 1px solid #166534; }
.b-baissier { background: #2d0a0a; color: #f87171; border: 1px solid #7f1d1d; }
.b-acheter    { background: #052e16; color: #4ade80; border: 1px solid #16a34a; font-weight: 800; letter-spacing: .04em; }
.b-vendre     { background: #2d0a0a; color: #f87171; border: 1px solid #dc2626; font-weight: 800; letter-spacing: .04em; }
.b-consolider { background: #1e2433; color: #94a3b8; border: 1px solid #334155; }

/* ═══════════════════════════════════════════════
   STOCK DETAIL PAGE
═══════════════════════════════════════════════ */

.stock-page {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0;
}

/* ── Stock hero section ── */
.stock-hero {
  flex-shrink: 0;
  border-bottom: 1px solid #21262d;
  background: #0d1117;
}

.stock-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 28px 0;
  gap: 12px;
}

.stock-topbar .subtitle {
  font-size: 11px;
  color: #484f58;
}

.hero-body {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 0;
  min-height: 240px;
}

/* Left column */
.hero-left {
  padding: 16px 24px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-right: 1px solid #21262d;
}

.hero-name-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.stock-title { display: flex; flex-direction: column; gap: 2px; }

.stock-name {
  font-size: 22px;
  font-weight: 700;
  color: #f0f6fc;
  letter-spacing: -0.5px;
  line-height: 1.2;
}
.stock-ticker {
  font-size: 12px;
  font-family: "Menlo", "Consolas", monospace;
  color: #8b949e;
}

/* Sector/industry tags */
.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hero-tag {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.hero-tag-sector {
  background: rgba(88,166,255,0.12);
  color: #79c0ff;
  border: 1px solid rgba(88,166,255,0.25);
}

.hero-tag-industry {
  background: rgba(139,148,158,0.1);
  color: #8b949e;
  border: 1px solid #30363d;
}

/* Price + change */
.hero-price-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-price {
  font-size: 30px;
  font-weight: 700;
  font-family: "Menlo", "Consolas", monospace;
  color: #e6edf3;
  letter-spacing: -0.5px;
}

.hero-change {
  font-size: 16px;
  font-weight: 700;
  font-family: "Menlo", "Consolas", monospace;
}

.hero-change-abs {
  font-size: 13px;
  font-family: "Menlo", "Consolas", monospace;
  opacity: 0.75;
}

.hero-up   { color: #3fb950; }
.hero-down { color: #f85149; }

/* Range bar in hero */
.hero-range {
  padding: 0;
  border: none;
  margin-top: -4px;
}

/* Fundamentals grid in hero */
.hero-fund-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: #21262d;
  border: 1px solid #21262d;
  border-radius: 6px;
  overflow: hidden;
  margin-top: auto;
}

.hero-fund-grid .fund-box {
  background: #161b22;
  padding: 7px 10px;
  border: none;
  border-radius: 0;
}

.hero-fund-grid .fund-box:hover { background: #1c2128; }

/* Right column — chart */
.hero-right {
  padding: 12px 16px 12px 0;
  min-height: 220px;
}

/* Technical section divider */
.stock-tech-header {
  flex-shrink: 0;
  border-bottom: 1px solid #21262d;
}

.section-divider {
  padding: 10px 28px 0;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #484f58;
}

.stock-tech-header .stat-row {
  border-top: 1px solid #21262d;
  margin-top: 10px;
}

/* Keep back-link styles */
.back-link {
  color: #8b949e;
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
  padding: 5px 10px;
  border: 1px solid #30363d;
  border-radius: 5px;
  transition: border-color .15s, color .15s;
  flex-shrink: 0;
}
.back-link:hover { border-color: #58a6ff; color: #f0f6fc; }

/* Responsive hero */
@media (max-width: 860px) {
  .hero-body { grid-template-columns: 1fr; }
  .hero-right { border-top: 1px solid #21262d; padding: 0; min-height: 180px; }
  .hero-fund-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Stats row (shared with home panel style) ── */
.stat-row {
  display: flex;
  border-bottom: 1px solid #21262d;
  flex-shrink: 0;
}
.stat-box {
  flex: 1;
  padding: 10px 14px;
  border-right: 1px solid #21262d;
  min-width: 0;
  overflow: hidden;
}
.stat-box:last-child { border-right: none; }
.stat-label {
  font-size: 9.5px;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.stat-value {
  font-size: 13px;
  font-family: "Menlo", "Consolas", monospace;
  font-weight: 600;
  color: #c9d1d9;
  margin-top: 4px;
  white-space: pre-line;
}
.sv-blue   { color: #79c0ff; }
.sv-purple { color: #c084fc; }
.sv-up     { color: #4ade80; }
.sv-down   { color: #f87171; }
.sv-orange { color: #fb923c; }
.sv-adx    { color: #e2e8f0; }

/* ── Range bar (standalone use outside hero) ── */
.range-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  flex-shrink: 0;
}
.range-val  { font-size: 11px; color: #8b949e; font-family: monospace; min-width: 44px; }
.range-tag  { font-size: 10px; color: #58a6ff; }
.range-track {
  flex: 1;
  height: 4px;
  background: #21262d;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}
.range-fill {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  background: #58a6ff;
  border-radius: 2px;
}

/* ── Selectors row (période + type) ── */
.selectors-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0 8px;
  flex-wrap: wrap;
}
.selectors-row::after {
  content: '';
  flex: 1;
}

.period-selector {
  display: flex;
  gap: 6px;
}
.period-selector .fbtn {
  padding: 4px 12px;
  font-size: 11.5px;
}

/* ── Charts area ── */
.stock-charts {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 24px 32px;
}

.chart-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 16px;
}
.chart-title {
  font-size: 10.5px;
  font-weight: 600;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* ── Daily table ── */
.daily-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 4px;
}
.daily-table thead th {
  background: #0d1117;
  font-size: 10px;
  color: #8b949e;
  padding: 7px 12px;
  text-align: left;
  border-bottom: 1px solid #21262d;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  position: static;
  white-space: nowrap;
}
.daily-table tbody td {
  padding: 6px 12px;
  border-bottom: 1px solid #161b22;
  font-size: 12px;
  white-space: nowrap;
}
.daily-table tbody tr:last-child td { border-bottom: none; }
.daily-table tbody tr:hover { background: #161b22; }
.daily-table td.num { text-align: right; font-family: "Menlo","Consolas",monospace; }

/* ── Fundamentals row ── */
.fund-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0 6px;
  border-top: 1px solid #21262d;
  border-bottom: 1px solid #21262d;
  margin-bottom: 6px;
}
.fund-box {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
  padding: 8px 14px;
  min-width: 110px;
  flex: 1 1 110px;
}
.fund-box-wide {
  flex: 2 1 220px;
}
.fund-label {
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #6e7681;
  margin-bottom: 4px;
}
.fund-value {
  font-size: 13px;
  font-weight: 600;
  color: #c9d1d9;
  font-family: "Menlo","Consolas",monospace;
}
.fund-sep { color: #6e7681; font-size: 12px; }

/* ── Star / favourite button ── */
.star-cell { width: 32px; padding: 0 4px !important; text-align: center; }
.star-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  color: #6e7681;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  transition: color .15s;
}
.star-btn:hover  { color: #e3b341; }
.star-btn.active { color: #e3b341; }
.sp-star {
  font-size: 20px;
  margin-left: auto;
  padding: 4px 10px;
}

/* ── Stock name link in table ── */
.stock-link {
  color: #c9d1d9;
  text-decoration: none;
  font-weight: 600;
}
.stock-link:hover { color: #58a6ff; text-decoration: underline; }

/* ── Comparison dropdown ── */
.compare-dropdown .Select-control,
.compare-dropdown .Select-menu-outer,
.compare-dropdown .Select-option {
  background: #161b22;
  border-color: #30363d;
  color: #c9d1d9;
}
.compare-dropdown .Select-placeholder,
.compare-dropdown .Select-value-label { color: #8b949e !important; }
/* Dash 2.x uses react-select — scope to the component class */
.compare-dropdown {
  margin-top: 8px;
}

/* ── Signal history empty state ── */
.history-empty {
  font-size: 12px;
  color: #6e7681;
  padding: 16px 0 8px;
  font-style: italic;
}

/* ── Utility text colors ── */
.c-green { color: #4ade80; }
.c-red   { color: #f87171; }

/* ════════════════════════════════════════════════════════════════════════════
   RESPONSIVE — tablette (≤ 900 px) & mobile (≤ 640 px)
   ════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
  /* Hide: sparkline(5), Sem.Bas(6), Sem.Haut(7) */
  .stock-table th:nth-child(5),
  .stock-table td:nth-child(5),
  .stock-table th:nth-child(6),
  .stock-table td:nth-child(6),
  .stock-table th:nth-child(7),
  .stock-table td:nth-child(7) { display: none; }

  .topbar   { flex-wrap: wrap; gap: 8px; }
  .toolbar  { flex-wrap: wrap; gap: 6px; }
  .stat-row { flex-wrap: wrap; }
  .fund-row { flex-wrap: wrap; }
  .fund-box { flex: 1 1 130px; }
}

@media (max-width: 640px) {
  /* Keep only: star(1), ticker(2), nom(3), signaux(8) */
  .stock-table th:nth-child(4),
  .stock-table td:nth-child(4),
  .stock-table th:nth-child(5),
  .stock-table td:nth-child(5),
  .stock-table th:nth-child(6),
  .stock-table td:nth-child(6),
  .stock-table th:nth-child(7),
  .stock-table td:nth-child(7) { display: none; }

  .stock-charts { padding: 0 12px 80px; }

  .stat-box  { min-width: calc(50% - 4px); flex: 1 1 calc(50% - 4px); }
  .fund-box  { flex: 1 1 calc(50% - 4px); }

  .selectors-row { gap: 8px; }

  .topbar  { padding: 12px 12px 0; }
  .toolbar { padding: 8px 12px; }
}

/* ── Error page ── */
.error-msg {
  color: #8b949e;
  padding: 40px 28px 12px;
  font-size: 14px;
}

/* ═══════════════════════════════════════════════
   LANDING PAGE
═══════════════════════════════════════════════ */

.landing-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 20px 24px 40px;
  gap: 18px;
}

.landing-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.landing-title {
  font-size: 22px;
  font-weight: 700;
  color: #f0f6fc;
  letter-spacing: -0.4px;
}

.landing-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13px;
}
.summary-val  { font-weight: 600; color: #c9d1d9; }
.summary-lbl  { color: #8b949e; }
.summary-sep  { color: #30363d; margin: 0 2px; }
.summary-val.sv-up   { color: #3fb950; }
.summary-val.sv-down { color: #f85149; }

/* ── Movers section ── */
.landing-header  { flex-shrink: 0; }
.movers-section  { display: flex; flex-direction: column; gap: 10px; flex-shrink: 0; }
.movers-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #8b949e;
  border-bottom: 1px solid #21262d;
  padding-bottom: 6px;
}

/* ── Movers grid ── */
.movers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.movers-panel {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 6px;
  padding: 8px 10px;
}

.movers-title {
  font-size: 10.5px;
  font-weight: 700;
  color: #f0f6fc;
  margin-bottom: 3px;
}
.gainers-panel .movers-title { color: #3fb950; }
.losers-panel  .movers-title { color: #f85149; }

.movers-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ── Mover card — single row ── */
.mover-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  background: #0d1117;
  border: 1px solid #1c2128;
  border-left: 2px solid transparent;
  border-radius: 4px;
  text-decoration: none;
  color: inherit;
  transition: background .1s, border-color .1s;
  cursor: pointer;
  min-width: 0;
}
.mover-card:hover { background: #161b22; border-color: #30363d; }
.mover-card.gainer { border-left-color: #238636; }
.mover-card.loser  { border-left-color: #da3633; }

.mover-ticker {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  color: #c9d1d9;
  width: 72px;
  flex-shrink: 0;
  white-space: nowrap;
}
.mover-name {
  font-size: 11px;
  color: #6e7681;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.mover-badge {
  font-size: 9px;
  font-weight: 600;
  color: #6e7681;
  background: #1c2128;
  border: 1px solid #30363d;
  border-radius: 3px;
  padding: 0 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}
.mover-price {
  font-size: 10.5px;
  color: #484f58;
  font-family: "SFMono-Regular", Consolas, monospace;
  flex-shrink: 0;
  text-align: right;
  min-width: 60px;
}
.mover-pct {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11.5px;
  font-weight: 700;
  flex-shrink: 0;
  text-align: right;
  min-width: 52px;
}
.gainer-pct { color: #3fb950; }
.loser-pct  { color: #f85149; }

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

/* ══════════════════════════════════════════════════════════════
   Guide page
   ══════════════════════════════════════════════════════════════ */

.guide-page {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  width: 100%;
}

.guide-header {
  margin-bottom: 32px;
}

.guide-title {
  font-size: 26px;
  font-weight: 700;
  color: #e6edf3;
  margin: 0 0 8px;
}

.guide-intro {
  font-size: 14px;
  color: #8b949e;
  margin: 0;
}

/* ── Grid of cards ── */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.guide-card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  overflow: hidden;
}

.guide-card-header {
  padding: 14px 16px;
  border-left: 4px solid #58a6ff;
  background: #1c2128;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.guide-card-title {
  font-size: 16px;
  font-weight: 700;
  color: #e6edf3;
}

.guide-card-sub {
  font-size: 11px;
  color: #6e7681;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.guide-card-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.guide-section {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 6px 10px;
  align-items: start;
}

.guide-section dt {
  font-size: 10.5px;
  font-weight: 600;
  color: #6e7681;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-top: 1px;
  grid-column: 1;
}

.guide-section dd {
  font-size: 12.5px;
  color: #8b949e;
  margin: 0;
  line-height: 1.55;
  grid-column: 2;
}

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

.guide-tag {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.tag-survente  { background: rgba(248,113,113,0.15); color: #f87171; border: 1px solid rgba(248,113,113,0.3); }
.tag-surachat  { background: rgba(74,222,128,0.12);  color: #4ade80; border: 1px solid rgba(74,222,128,0.3); }
.tag-haussier  { background: rgba(74,222,128,0.12);  color: #4ade80; border: 1px solid rgba(74,222,128,0.3); }
.tag-baissier  { background: rgba(248,113,113,0.15); color: #f87171; border: 1px solid rgba(248,113,113,0.3); }
.tag-neutral   { background: rgba(139,148,158,0.15); color: #8b949e; border: 1px solid rgba(139,148,158,0.25); }

/* ── Disclaimer ── */
.guide-disclaimer-wrapper {
  grid-column: 1 / -1;
}

.guide-disclaimer-box {
  background: rgba(187,128,9,0.1);
  border: 1px solid rgba(187,128,9,0.3);
  border-radius: 8px;
  padding: 14px 18px;
}

.guide-disclaimer {
  font-size: 12.5px;
  color: #d29922;
  margin: 0;
  line-height: 1.6;
}

@media (max-width: 780px) {
  .guide-grid { grid-template-columns: 1fr; }
  .guide-section { grid-template-columns: 90px 1fr; }
}

/* ══════════════════════════════════════════════════════════════
   Screener page
   ══════════════════════════════════════════════════════════════ */

.screener-page {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 28px 60px;
}

.screener-header {
  margin-bottom: 24px;
}

.screener-title {
  font-size: 24px;
  font-weight: 700;
  color: #e6edf3;
  margin: 0 0 6px;
}

.screener-intro {
  font-size: 13px;
  color: #8b949e;
  margin: 0;
}

/* ── Filter sections ── */
.filter-section {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

.filter-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #6e7681;
  margin-bottom: 12px;
}

/* ── Presets row ── */
.presets-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.preset-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 9px 14px;
  border-radius: 7px;
  border: 1px solid #30363d;
  background: #1c2128;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  min-width: 140px;
}
.preset-btn:hover { background: #21262d; border-color: #58a6ff; }

.preset-label {
  font-size: 13px;
  font-weight: 600;
  color: #e6edf3;
}

.preset-desc {
  font-size: 10.5px;
  color: #6e7681;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.preset-rebond   { border-left: 3px solid #4ade80; }
.preset-breakout { border-left: 3px solid #58a6ff; }
.preset-golden   { border-left: 3px solid #facc15; }
.preset-trend    { border-left: 3px solid #fb923c; }
.preset-swing    { border-left: 3px solid #c084fc; }

/* ── Filters grid ── */
.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px 16px;
  margin-bottom: 14px;
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.filter-item-full {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.filter-key {
  font-size: 10.5px;
  font-weight: 600;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.filter-range {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-input {
  width: 70px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 5px;
  color: #c9d1d9;
  font-size: 13px;
  padding: 5px 8px;
  outline: none;
  font-family: "SFMono-Regular", Consolas, monospace;
}
.filter-input:focus { border-color: #58a6ff; }

.filter-sep {
  color: #484f58;
  font-size: 12px;
}

.filter-dropdown .Select-control,
.filter-dropdown .dropdown {
  background: #0d1117;
  border-color: #30363d;
}

/* Universe checklist */
.universe-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.universe-checklist label {
  font-size: 12.5px;
  color: #c9d1d9;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

/* Run button */
.run-btn {
  margin-top: 6px;
  padding: 8px 24px;
  background: #1f6feb;
  border: none;
  border-radius: 6px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.run-btn:hover { background: #388bfd; }

/* ── Results ── */
.screener-results {
  margin-top: 4px;
}

.screener-empty {
  font-size: 13px;
  color: #6e7681;
  padding: 24px 0;
  font-style: italic;
}

.screener-count {
  font-size: 12px;
  color: #6e7681;
  margin-bottom: 10px;
}

.screener-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  overflow: visible;
}
.screener-table thead {
  overflow: visible;
}

.screener-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #6e7681;
  padding: 7px 10px;
  border-bottom: 1px solid #21262d;
  white-space: nowrap;
}

.screener-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #161b22;
  vertical-align: middle;
}

.screener-row:hover td { background: #1c2128; }

.screener-ticker {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-weight: 700;
  color: #58a6ff;
  text-decoration: none;
  font-size: 13px;
}
.screener-ticker:hover { text-decoration: underline; }

.screener-name {
  color: #c9d1d9;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.screener-uni-badge {
  font-size: 9.5px;
  font-weight: 600;
  color: #6e7681;
  background: #1c2128;
  border: 1px solid #30363d;
  border-radius: 3px;
  padding: 1px 5px;
  text-transform: uppercase;
  letter-spacing: .3px;
  white-space: nowrap;
}

/* ── Screener sections ── */
.screener-section {
  margin-bottom: 24px;
}

.screener-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border-radius: 7px 7px 0 0;
  border-bottom: none;
}

.section-achat  { background: rgba(74,222,128,0.07);  border: 1px solid rgba(74,222,128,0.25); }
.section-vente  { background: rgba(248,113,113,0.07); border: 1px solid rgba(248,113,113,0.25); }
.section-neutre { background: rgba(139,148,158,0.05); border: 1px solid #21262d; }

.section-dir-label {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .03em;
}
.section-achat  .section-dir-label { color: #4ade80; }
.section-vente  .section-dir-label { color: #f87171; }
.section-neutre .section-dir-label { color: #8b949e; }

.section-dir-count {
  font-size: 11px;
  color: #6e7681;
}

/* Table border matches section color */
.screener-section-achat  .screener-table { border: 1px solid rgba(74,222,128,0.15);  border-top: none; border-radius: 0 0 7px 7px; }
.screener-section-vente  .screener-table { border: 1px solid rgba(248,113,113,0.15); border-top: none; border-radius: 0 0 7px 7px; }
.screener-section-neutre .screener-table { border: 1px solid #21262d;                border-top: none; border-radius: 0 0 7px 7px; }

/* Subtle left accent on rows */
.row-achat  td:first-child { border-left: 2px solid rgba(74,222,128,0.45); }
.row-vente  td:first-child { border-left: 2px solid rgba(248,113,113,0.45); }
.row-neutre td:first-child { border-left: 2px solid transparent; }

/* Score badges */
.score-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  font-family: "SFMono-Regular", Consolas, monospace;
}
.score-high      { background: rgba(74,222,128,0.15);  color: #4ade80; border: 1px solid rgba(74,222,128,0.3); }
.score-mid       { background: rgba(250,204,21,0.12);   color: #facc15; border: 1px solid rgba(250,204,21,0.3); }
.score-low       { background: rgba(139,148,158,0.12);  color: #8b949e; border: 1px solid #30363d; }
.score-bear-high { background: rgba(248,113,113,0.15); color: #f87171; border: 1px solid rgba(248,113,113,0.3); }
.score-bear-mid  { background: rgba(251,146,60,0.12);  color: #fb923c; border: 1px solid rgba(251,146,60,0.3); }
.score-bear-low  { background: rgba(139,148,158,0.12);  color: #8b949e; border: 1px solid #30363d; }

/* ── Data-tip tooltips ── */
[data-tip] {
  position: relative;
  cursor: help;
}
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 11.5px;
  font-weight: 400;
  color: #c9d1d9;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s ease;
  z-index: 300;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  line-height: 1.5;
}
[data-tip]:hover::after {
  opacity: 1;
}

/* Table headers: tooltip above, centred */
.screener-table th[data-tip]::after {
  left: 50%;
  transform: translateX(-50%);
}

/* Swing-specific sig badge */
.sig-badge.sig-squeeze {
  background: rgba(192,132,252,0.15);
  color: #c084fc;
  border: 1px solid rgba(192,132,252,0.35);
  font-weight: 700;
  letter-spacing: .04em;
}

@media (max-width: 860px) {
  .screener-page { padding: 16px 14px 60px; }
  .screener-table th:nth-child(n+5):nth-child(-n+8) { display: none; }
  .screener-table td:nth-child(n+5):nth-child(-n+8) { display: none; }
}
