/* ========================================================================
   SCREENER — styles propres à la page Screener.
   À charger APRÈS styles.css dans screener.html.
   Les règles qui apparaissent aussi dans styles.css (sidebar, login,
   user menu, notifications, password modal…) ne sont PAS redéfinies ici.
   ======================================================================== */

/* HEADER — barre de recherche unifiée spécifique Screener */
.header-search {
  flex: 1;
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  background: #f3f4f6;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.header-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
  background: var(--surface);
}
.header-search input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 14px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  color: var(--text);
}
.header-search input::placeholder { color: #9ca3af; }
.header-search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: var(--primary);
  color: white;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 0 6px 6px 0;
  transition: background 0.15s;
}
.header-search-btn:hover { background: var(--primary-hover); }
.header-search-btn svg { width: 16px; height: 16px; }

/* Le conteneur de page Screener (seul <main> du CRM utilise un autre padding) */
.page-content {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 20px 32px 32px;
  min-height: calc(100vh - 64px);
}

.search-container {
  width: 100%;
  max-width: 720px;
}

.result-container {
  margin-top: 0;
  width: 100%;
}

/* ===== Empty state — barre de recherche centrale ===== */
.screener-empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 64px - 52px);
  width: 100%;
  padding: 24px;
}
.empty-hero {
  width: 100%;
  max-width: 640px;
  text-align: center;
  animation: fadeIn 0.3s ease;
}
.empty-hero-logo {
  width: 96px;
  height: 96px;
  margin: 0 auto 20px;
}
.empty-hero-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.empty-hero-title {
  font-size: 34px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.empty-hero-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}
.empty-hero-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px 6px 6px 16px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.empty-hero-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}
.empty-hero-search-icon {
  width: 20px;
  height: 20px;
  color: #9ca3af;
  flex-shrink: 0;
}
.empty-hero-search input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  padding: 12px 8px;
}
.empty-hero-search input::placeholder { color: #9ca3af; }
.empty-hero-search-btn {
  border: none;
  background: var(--primary);
  color: #fff;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.empty-hero-search-btn:hover { background: var(--primary-hover); }

.hint {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-secondary);
}

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

/* Les boutons "Screener" ont un style un peu différent (padding+border).
   On les scope sous .screener-page pour ne pas toucher au CRM. */
.screener-page .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all 0.15s ease;
  font-family: inherit;
}
.screener-page .btn svg { width: 16px; height: 16px; }
.screener-page .btn-primary {
  background: var(--primary);
  color: white;
  border-color: transparent;
}
.screener-page .btn-primary:hover { background: var(--primary-hover); }

/* ======================== */
/* RESULT CARDS             */
/* ======================== */
.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: var(--shadow);
  animation: fadeIn 0.3s ease;
}
.result-card.error {
  border-color: #fecaca;
  background: #fef2f2;
}
.result-card.error p {
  color: #991b1b;
  font-weight: 600;
}
.result-card.info {
  text-align: center;
  color: var(--text-secondary);
}

/* Company result layout */
.company-result {
  animation: fadeIn 0.35s ease;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.company-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.company-header-left h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}
.company-header-left .company-ids {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.company-header-left .company-ids span {
  font-family: 'SF Mono', SFMono-Regular, ui-monospace, monospace;
}
.company-header-right {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.company-header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.status-badge.active { background: #dcfce7; color: #166534; }
.status-badge.closed { background: #fee2e2; color: #991b1b; }
.status-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.status-badge.active .status-badge-dot { background: #16a34a; }
.status-badge.closed .status-badge-dot { background: #dc2626; }

/* Sections — single-column full-width layout */
.result-sections {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.result-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  min-width: 0;
}
.section-header {
  padding: 14px 20px;
  background: #f9fafb;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-header svg {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}
.section-body { padding: 16px 20px; }

/* Info grid — 3 colonnes full width */
.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 768px) {
  .info-grid { grid-template-columns: repeat(2, 1fr); }
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.info-item .info-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}
.info-item .info-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.info-item .info-value.empty {
  color: #d1d5db;
  font-style: italic;
}

/* Activity summary */
.activity-summary {
  margin-top: 18px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #f0f4ff, #f8f9ff);
  border: 1px solid #e0e7ff;
  border-radius: 10px;
}
.activity-summary-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.activity-summary-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
}
.activity-loading {
  color: var(--text-secondary);
  font-style: italic;
  font-size: 13px;
}
.activity-loading-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  color: var(--text-secondary);
  font-size: 13px;
}
.activity-loading-box .mini-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #e5e7eb;
  border-top: 2px solid var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

/* ---------- Activité IA — rendu par axes (Métiers / Secteurs / Clientèle) ---------- */
.activity-axes {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.activity-resume {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}
.activity-resume + .activity-axis {
  margin-top: 2px;
}
.activity-axis {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.activity-axis-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
}
.activity-axis-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.activity-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  color: #4338ca;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  line-height: 1.4;
  white-space: nowrap;
}
.activity-axis:nth-child(2) .activity-chip {
  color: #0e7490;
  background: #ecfeff;
  border-color: #a5f3fc;
}
.activity-axis:nth-child(3) .activity-chip {
  color: #9a3412;
  background: #fff7ed;
  border-color: #fed7aa;
}
.activity-fallback-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-primary);
}
.activity-fallback-text.activity-empty {
  color: var(--text-secondary);
  font-style: italic;
}
.activity-note {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--text-secondary);
  font-style: italic;
}

/* API settings */
.api-settings-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  justify-content: center;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s;
}
.api-settings-toggle:hover { color: var(--primary); }
.api-settings {
  display: none;
  margin-top: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  animation: fadeIn 0.2s ease;
}
.api-settings.visible { display: block; }
.api-setting-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.api-setting-row label {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  min-width: 120px;
}
.api-setting-row input {
  flex: 1;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
}

.section-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  text-align: center;
  min-height: 200px;
}
.section-placeholder svg {
  width: 40px;
  height: 40px;
  margin-bottom: 12px;
  opacity: 0.35;
}
.section-placeholder .placeholder-text {
  font-size: 13px;
  font-style: italic;
}

/* Dirigeants — strip horizontale pleine largeur (hauteur réduite, scroll →) */
.dirigeants-strip .dirigeants-strip-body {
  padding: 12px 16px;
}
.dirigeant-strip-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
}
.dirigeant-strip-list::-webkit-scrollbar { height: 6px; }
.dirigeant-strip-list::-webkit-scrollbar-track { background: transparent; }
.dirigeant-strip-list::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
.dirigeant-strip-list::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
.dirigeant-chip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 10px;
  background: #f9fafb;
  border: 1px solid #eef0f3;
  border-radius: 10px;
  min-width: 210px;
  max-width: 280px;
}
.dirigeant-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.dirigeant-chip-info { flex: 1; min-width: 0; }
.dirigeant-chip-info .dirigeant-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dirigeant-chip-info .dirigeant-meta {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dirigeant-chip-info .dirigeant-age {
  color: #6b7280;
  font-weight: 500;
}
.dirigeant-chip-info .dirigeant-via {
  font-size: 10.5px;
  color: #9ca3af;
  font-style: italic;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dirigeant-badge-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  font-size: 13px;
  color: #92400e;
  margin-bottom: 8px;
}
.dirigeant-count {
  font-size: 12px;
  color: var(--text-secondary);
  margin-left: 8px;
  font-weight: 400;
}
.dirigeant-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  color: var(--text-secondary);
  font-size: 13px;
}
.dirigeant-loading .mini-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #e5e7eb;
  border-top: 2px solid var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Finances table */
.finance-table-wrapper {
  overflow-x: auto;
  margin: 0 -4px;
  padding: 0 4px 8px;
}
.finance-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 500px;
}
.finance-table th, .finance-table td {
  padding: 10px 14px;
  text-align: right;
  white-space: nowrap;
}
.finance-table th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  background: #f9fafb;
}
.finance-table th:first-child,
.finance-table td:first-child {
  text-align: left;
  font-weight: 600;
  color: var(--text);
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 1;
  min-width: 140px;
}
.finance-table th:first-child { background: #f9fafb; }
.finance-table tbody tr { border-bottom: 1px solid #f0f0f0; }
.finance-table tbody tr:last-child { border-bottom: none; }
.finance-table tbody tr:hover { background: #f9fafb; }
.finance-table td.positive { color: #16a34a; font-weight: 600; }
.finance-table td.negative { color: #dc2626; font-weight: 600; }
.finance-table td.empty-val { color: #d1d5db; font-style: italic; }
.finance-empty {
  text-align: center;
  padding: 20px;
  color: var(--text-secondary);
  font-size: 13px;
  font-style: italic;
}

/* Financial score box */
.finance-score-box {
  margin-top: 16px;
  padding: 16px 20px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.finance-score-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.finance-score-title { font-size: 14px; font-weight: 700; color: var(--text); }
.finance-score-badge {
  font-size: 20px;
  font-weight: 800;
  padding: 4px 14px;
  border-radius: 8px;
  line-height: 1;
}
.finance-score-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 13px;
}
.finance-score-label {
  width: 110px;
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
}
.finance-score-value {
  width: 65px;
  font-weight: 700;
  flex-shrink: 0;
  text-align: right;
}
.finance-score-period {
  font-size: 11px;
  color: #9ca3af;
  width: 70px;
  flex-shrink: 0;
}
.finance-score-bar {
  flex: 1;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  min-width: 60px;
}
.finance-score-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}
.finance-score-flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}
.finance-score-flag.warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
}
.finance-score-flag.good {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #10b981;
}
.finance-score-flag.neutral {
  background: #f0f9ff;
  color: #1e40af;
  border: 1px solid #60a5fa;
}

/* --- v2 : 5 indicators + global score /100 --- */
.finance-score-sublabel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: -8px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed #e5e7eb;
  font-size: 13px;
  font-weight: 600;
}
.finance-score-sublabel-na { color: #6b7280; font-weight: 500; font-style: italic; }
.finance-score-coverage {
  font-size: 11px;
  font-weight: 500;
  color: #9ca3af;
  padding: 2px 8px;
  background: #f3f4f6;
  border-radius: 10px;
}
.finance-score-row-v2 {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  font-size: 13px;
  border-bottom: 1px solid #f1f5f9;
}
.finance-score-row-v2:last-child { border-bottom: none; }
.finance-score-row-label {
  flex: 0 0 auto;
  min-width: 120px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.finance-score-row-value {
  flex: 1 1 auto;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.finance-score-pill {
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  min-width: 36px;
  text-align: center;
  white-space: nowrap;
}

/* ---------- Adéquation thèse Emergence (split Activité) ---------- */
.thesis-fit-container {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #e0e7ff;
}
.thesis-fit-box {
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid #e0e7ff;
  border-radius: 10px;
}
.thesis-fit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.thesis-fit-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.thesis-fit-badge {
  font-size: 18px;
  font-weight: 800;
  padding: 3px 11px;
  border-radius: 8px;
  line-height: 1;
}
.thesis-fit-sublabel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: -4px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed #e5e7eb;
  font-size: 12.5px;
  font-weight: 600;
}
.thesis-fit-sublabel-na {
  color: #6b7280;
  font-weight: 500;
  font-style: italic;
}
.thesis-fit-coverage {
  font-size: 11px;
  font-weight: 500;
  color: #9ca3af;
  padding: 2px 8px;
  background: #f3f4f6;
  border-radius: 10px;
}
.thesis-fit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 12.5px;
  border-bottom: 1px solid #f1f5f9;
}
.thesis-fit-row:last-child { border-bottom: none; }
.thesis-fit-row-label {
  flex: 0 0 auto;
  min-width: 140px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.thesis-fit-row-value {
  flex: 1 1 auto;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.thesis-fit-pill {
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.4;
  min-width: 34px;
  text-align: center;
  white-space: nowrap;
}

/* Independence box */
.indep-box { padding: 16px 20px; }
.indep-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.indep-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 14px; border-radius: 20px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px;
}
.indep-badge.independent { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.indep-badge.pe-vc { background: #fff7ed; color: #c2410c; border: 1px solid #fdba74; }
.indep-badge.subsidiary { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }
.indep-confidence {
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.indep-confidence.high { background: #dcfce7; color: #166534; }
.indep-confidence.medium { background: #fef9c3; color: #854d0e; }
.indep-confidence.low { background: #fef2f2; color: #991b1b; }
.indep-summary {
  font-size: 14px; line-height: 1.6; color: var(--text);
  margin-bottom: 14px;
}
.indep-details {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
  margin-bottom: 14px; padding: 12px 14px;
  background: #f9fafb; border-radius: 8px; border: 1px solid var(--border);
}
.indep-detail-item .indep-detail-label {
  font-size: 10px; font-weight: 600; text-transform: uppercase; color: var(--text-secondary);
}
.indep-detail-item .indep-detail-value {
  font-size: 13px; font-weight: 500; color: var(--text);
}
.indep-sources { border-top: 1px solid var(--border); padding-top: 10px; }
.indep-sources-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  color: var(--text-secondary); margin-bottom: 6px;
}
.indep-source-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; padding: 4px 0;
}
.indep-source-item a {
  color: var(--primary); text-decoration: none; font-weight: 500;
}
.indep-source-item a:hover { text-decoration: underline; }
.indep-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 30px 20px; color: var(--text-secondary); text-align: center; min-height: 120px;
}
.indep-loading .spinner {
  width: 28px; height: 28px; border: 3px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin-bottom: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.indep-error {
  padding: 20px; text-align: center; color: #991b1b; font-size: 13px;
}
.indep-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
}
.indep-date { font-size: 11px; color: var(--text-secondary); font-style: italic; }
.indep-reanalyze {
  font-size: 11px; color: var(--primary); cursor: pointer;
  background: none; border: none; font-weight: 600; padding: 0;
}
.indep-reanalyze:hover { text-decoration: underline; }

/* API key banner */
.api-key-banner {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.api-key-banner label {
  font-size: 13px;
  font-weight: 600;
  color: #92400e;
  white-space: nowrap;
}
.api-key-banner input {
  flex: 1;
  min-width: 200px;
  padding: 7px 12px;
  border: 1px solid #fcd34d;
  border-radius: 6px;
  font-size: 13px;
  font-family: 'SF Mono', SFMono-Regular, ui-monospace, monospace;
  outline: none;
}
.api-key-banner input:focus { border-color: var(--primary); }
.api-key-banner .btn { padding: 7px 14px; font-size: 13px; }

/* Action buttons (scoped screener) */
.result-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.screener-page .btn-outline {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.screener-page .btn-outline:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}
.screener-page .btn-success {
  background: #16a34a;
  color: white;
}
.screener-page .btn-success:hover { background: #15803d; }

/* Spinner */
.screener-page .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
.loading-card {
  text-align: center;
  padding: 40px 24px;
}

/* Search separator */
.search-separator {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 12px 0;
}
.search-separator::before,
.search-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.search-separator span {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Search results list (name search) */
.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.search-result-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  animation: fadeIn 0.3s ease;
}
.search-result-item:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(37,99,235,0.08);
}
.search-result-item .result-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #f0f9ff;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 15px;
  font-weight: 800;
}
.search-result-item .result-item-info { flex: 1; min-width: 0; }
.search-result-item .result-item-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.search-result-item .result-item-details {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.search-result-item .result-item-details span {
  display: flex;
  align-items: center;
  gap: 4px;
}
.search-result-item .result-item-finance {
  text-align: right;
  flex-shrink: 0;
}
.search-result-item .result-item-ca {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.search-result-item .result-item-year {
  font-size: 11px;
  color: var(--text-secondary);
}
.search-results-header {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  font-weight: 500;
}

/* Search history */
.history-section {
  margin-top: 32px;
  width: 100%;
}
.history-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.history-section-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.history-section-header h3 svg {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}
.history-section-header button {
  font-size: 12px;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 4px 8px;
  border-radius: 4px;
}
.history-section-header button:hover {
  background: #f3f4f6;
  color: #dc2626;
}
.history-list-screener {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.history-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.history-entry:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.06);
}
.history-entry .entry-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #eff6ff;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.history-entry .entry-icon svg {
  width: 16px;
  height: 16px;
}
.history-entry .entry-info { flex: 1; min-width: 0; }
.history-entry .entry-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-entry .entry-siren {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: 'SF Mono', SFMono-Regular, ui-monospace, monospace;
}
.history-entry .entry-date {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}
.history-entry .entry-remove {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  cursor: pointer;
  color: #d1d5db;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.history-entry:hover .entry-remove { opacity: 1; }
.history-entry .entry-remove:hover { color: #dc2626; background: #fef2f2; }
.history-entry .entry-remove svg { width: 14px; height: 14px; }

/* Finance layout: table + chart side by side */
.finance-layout {
  display: flex;
  gap: 20px;
  align-items: stretch;
}
.finance-layout > .finance-table-wrapper {
  flex: 1;
  min-width: 0;
}
.finance-layout > .finance-chart {
  flex: 1;
  min-width: 0;
  margin-top: 0;
}
@media (max-width: 900px) {
  .finance-layout { flex-direction: column; }
}

/* Finance chart */
.finance-chart {
  margin-top: 20px;
  padding: 12px 16px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.finance-chart-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}
.finance-chart-container {
  display: flex;
  align-items: flex-end;
  gap: 0;
  height: 180px;
  padding: 0 8px;
  border-bottom: 2px solid var(--border);
  position: relative;
}
.finance-chart-group {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  height: 100%;
  position: relative;
}
.finance-chart-bar {
  width: 28px;
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  position: relative;
  transition: height 0.4s ease;
}
.finance-chart-bar.ca-bar { background: #3b82f6; }
.finance-chart-bar.ebe-bar { background: #f59e0b; }
.finance-chart-bar.negative {
  border-radius: 0 0 4px 4px;
  align-self: flex-start;
  margin-top: auto;
}
.finance-chart-bar-label {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-secondary);
}
.finance-chart-labels {
  display: flex;
  gap: 0;
}
.finance-chart-year {
  flex: 1;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  padding-top: 6px;
}
.finance-chart-legend {
  display: flex;
  gap: 20px;
  margin-top: 12px;
  justify-content: center;
}
.finance-chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 500;
}
.finance-chart-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}
.finance-chart-legend-line {
  display: inline-block;
  width: 18px;
  height: 3px;
  border-radius: 2px;
}

/* ========================================================================
   SCREENER V2 — nouveau layout : Hero + Row2 split + Finances V2
   ======================================================================== */

/* ---------- BOX 1 : HERO (3 colonnes) ---------- */
.hero-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 26px;
  margin-bottom: 0;
  display: grid;
  grid-template-columns: minmax(220px, 1.1fr) minmax(0, 2fr) auto;
  gap: 28px;
  align-items: flex-start;
  box-shadow: var(--shadow);
  animation: fadeIn 0.35s ease;
}
.hero-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.hero-name {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.15;
  margin: 0;
  word-break: break-word;
  color: var(--text);
}
.hero-ids-plain {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: 'SF Mono', SFMono-Regular, ui-monospace, monospace;
  font-size: 13px;
  color: var(--text-secondary);
}
.hero-left .status-badge {
  align-self: flex-start;
  margin-top: 4px;
}

.hero-center {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.hero-row {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.hero-row-label {
  flex: 0 0 auto;
  min-width: 130px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.hero-row-label::after {
  content: " :";
  color: var(--text-secondary);
}
.hero-row-value {
  flex: 1 1 auto;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
  min-width: 0;
}
.hero-row-value.empty {
  color: #d1d5db;
  font-style: italic;
}

@media (max-width: 700px) {
  .hero-row { flex-direction: column; align-items: flex-start; gap: 2px; }
  .hero-row-label { min-width: 0; }
  .hero-row-label::after { content: ""; }
}

.hero-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  flex-shrink: 0;
}
.screener-page .hero-action-btn {
  justify-content: center;
  white-space: nowrap;
  font-size: 13px;
  padding: 9px 16px;
}

@media (max-width: 900px) {
  .hero-box {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .hero-right {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

/* ---------- RANGÉE : Activité IA (gauche) | Performance financière (droite) ---------- */
/* Deux sections autonomes, même hauteur via align-items:stretch. */
.row2-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 0;
  align-items: stretch;
}
.row2-grid > .row2-section {
  display: flex;
  flex-direction: column;
}

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

/* Bodies Activité IA / Performance financière — remplissent la box, scroll si besoin */
.split-body-ai,
.split-body-perf {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.split-body-ai {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  background: linear-gradient(135deg, #fafaff, #f4f6ff);
}
.split-body-ai .activity-summary-text {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
}
.split-body-perf {
  background: #fbfcfd;
}
.split-body-perf .finance-score-box {
  margin-top: 0;
  padding: 4px 2px 8px;
  background: transparent;
  border: none;
}

/* ---------- IA sparkle icon ---------- */
.ia-sparkle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, #8b5cf6, #3b82f6);
  color: white;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(139, 92, 246, 0.25);
}
.ia-sparkle-icon svg {
  width: 14px;
  height: 14px;
  color: white;
}

/* ---------- BOX FINANCES V2 (line chart + tableau scrollable) ---------- */
.finance-layout-v2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}
.finance-chart-col {
  display: flex;
  min-width: 0;
}
.finance-chart-col .finance-chart {
  flex: 1;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.finance-table-col {
  min-width: 0;
}
.finance-table-scroll {
  max-height: 440px;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.finance-table-scroll table {
  width: 100%;
  margin: 0;
  min-width: 0;
}
.finance-table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f3f4f6;
}
.finance-table-scroll tbody td:first-child,
.finance-table-scroll thead th:first-child {
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 1;
}
.finance-table-scroll thead th:first-child {
  z-index: 3;
  background: #f3f4f6;
}

/* Version compacte du tableau finances pour tenir à côté du chart
   sur un 13" (1440×900) — police et paddings réduits. */
.finance-table-scroll .finance-table {
  font-size: 12px;
  /* Width auto : le tableau peut dépasser la largeur du conteneur
     pour permettre le scroll horizontal vers les années plus anciennes. */
  width: auto;
  min-width: 100%;
}
.finance-table-scroll .finance-table th,
.finance-table-scroll .finance-table td {
  padding: 5px 8px;
  font-size: 12px;
}
.finance-table-scroll .finance-table th {
  font-size: 10.5px;
  letter-spacing: 0.3px;
}
/* Colonnes années : largeur fixe pour déclencher le scroll horizontal quand
   on a plus de 5-6 années. */
.finance-table-scroll .finance-table th:not(:first-child),
.finance-table-scroll .finance-table td:not(:first-child) {
  min-width: 76px;
  width: 76px;
}
.finance-table-scroll .finance-table th:first-child,
.finance-table-scroll .finance-table td:first-child {
  min-width: 150px;
  width: 150px;
  font-size: 11.5px;
}

@media (max-width: 900px) {
  .finance-layout-v2 { grid-template-columns: 1fr; }
}

/* ---------- Barre de progression globale (Pappers + Gemini activité + Gemini indépendance) ---------- */
.screener-progress-bar {
  position: fixed;
  top: 64px;                 /* juste sous le header sticky 64px */
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  z-index: 99;               /* sous le header (100) mais au-dessus du contenu */
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.screener-progress-bar.visible {
  opacity: 1;
}
.screener-progress-bar.fading {
  opacity: 0;
}
.screener-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #8b5cf6, #3b82f6);
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.35);
  transition: width 0.45s ease;
  border-radius: 0 2px 2px 0;
}

/* ---------- Multi-screening ---------- */
.ms-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 28px;
}
.ms-header h2 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.ms-subtitle {
  color: var(--text-secondary);
  font-size: 13.5px;
  margin: 0 0 20px;
}
.ms-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  margin-bottom: 16px;
}
.ms-breadcrumb { margin-bottom: 12px; font-size: 12.5px; }
.ms-breadcrumb a { color: var(--primary); text-decoration: none; }
.ms-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 18px;
}
.ms-card h3 {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.ms-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: #f3f4f6;
  padding: 2px 9px;
  border-radius: 999px;
}
.ms-card textarea {
  width: 100%;
  min-height: 140px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  box-sizing: border-box;
}
.ms-card textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.ms-preview {
  margin-top: 10px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #eef2f7;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--text);
}
.ms-form-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  flex-wrap: wrap;
}
.ms-form-row input[type=text] {
  flex: 1 1 220px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}
.ms-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text);
  cursor: pointer;
}
.ms-btn {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, border-color 0.15s;
}
.ms-btn:hover:not(:disabled) { background: #f8fafc; border-color: #cbd5e1; }
.ms-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ms-btn-primary {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}
.ms-btn-primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--primary); }
.ms-btn-danger {
  color: #dc2626;
  border-color: #fecaca;
}
.ms-btn-danger:hover:not(:disabled) { background: #fef2f2; border-color: #fca5a5; }
.ms-empty {
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
  padding: 24px 8px;
  background: #fafafa;
  border: 1px dashed #e5e7eb;
  border-radius: 8px;
}
.ms-muted { color: var(--text-secondary); }
.ms-warn { color: #dc2626; font-weight: 600; }

/* Progress */
.ms-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ms-progress-lg { margin-bottom: 16px; }
.ms-progress-bar {
  flex: 1;
  height: 10px;
  background: #eef2f7;
  border-radius: 999px;
  overflow: hidden;
  min-width: 120px;
}
.ms-progress-lg .ms-progress-bar { height: 14px; }
.ms-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #3b82f6);
  border-radius: 999px;
  transition: width 0.45s ease;
}
.ms-progress-txt { font-size: 11.5px; color: var(--text-secondary); white-space: nowrap; }
.ms-progress-txt-big { font-size: 13px; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }

.ms-counters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.ms-counter {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid #eef2f7;
  color: var(--text);
}
.ms-counter-num { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; margin-right: 10px; }
.ms-counter.ok   { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.ms-counter.skip { background: #f8fafc; border-color: #e5e7eb; color: #6b7280; }
.ms-counter.err  { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.ms-counter.pend { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

.ms-controls { display: flex; gap: 8px; flex-wrap: wrap; }

/* Jobs table */
.ms-jobs-table { width: 100%; overflow-x: auto; }
.ms-jobs-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ms-jobs-table th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-secondary);
}
.ms-jobs-table td {
  padding: 10px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text);
}
.ms-jobs-table .ms-row { cursor: pointer; transition: background 0.1s; }
.ms-jobs-table .ms-row:hover { background: #f8fafc; }
.ms-cell-name { font-weight: 600; }
.ms-cell-date { color: var(--text-secondary); font-size: 12px; white-space: nowrap; }
.ms-cell-actions { color: var(--text-secondary); text-align: right; font-size: 18px; }

.ms-status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

/* Items list */
.ms-items {
  display: flex;
  flex-direction: column;
  max-height: 500px;
  overflow-y: auto;
}
.ms-item {
  display: grid;
  grid-template-columns: 30px 120px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 7px 10px;
  font-size: 12.5px;
  border-bottom: 1px solid #f1f5f9;
}
.ms-item:last-child { border-bottom: none; }
.ms-item-done { }
.ms-item-processing { background: #f0f9ff; }
.ms-item-error { background: #fef2f2; }
.ms-item-skipped { opacity: 0.65; }
.ms-item[onclick] { cursor: pointer; }
.ms-item[onclick]:hover { background: #f8fafc; }
.ms-item-siren { font-family: 'SF Mono', Menlo, monospace; color: var(--text-secondary); }
.ms-item-nom { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-item-err { color: #991b1b; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.ms-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
}
.ms-icon.ok   { background: #dcfce7; color: #15803d; }
.ms-icon.err  { background: #fef2f2; color: #991b1b; }
.ms-icon.skip { background: #f3f4f6; color: #6b7280; }
.ms-icon.pend { background: #eff6ff; color: #1e40af; font-size: 13px; }
.ms-icon.proc { background: #dbeafe; color: #1e40af; }
.ms-dot-spin {
  width: 10px; height: 10px;
  border: 2px solid #bfdbfe;
  border-top-color: #1e40af;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ---------- Bandeau "Dernière mise à jour" + bouton Mettre à jour ---------- */
.last-update-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  margin-bottom: 14px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  font-size: 12.5px;
  color: #0369a1;
  flex-wrap: wrap;
}
.last-update-banner.aging {
  background: #fef9c3;
  border-color: #fde68a;
  color: #854d0e;
}
.last-update-banner.stale {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}
.last-update-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.last-update-info svg { width: 14px; height: 14px; }
.last-update-info strong { font-weight: 600; }
.last-update-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: filter 0.15s;
}
.last-update-btn:hover { filter: brightness(1.08); }
.last-update-btn svg { width: 13px; height: 13px; }

/* ---------- Historique screener — vue tableau ---------- */
.hist-section {
  width: 100%;
  padding: 4px 0 24px;
}
.hist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.hist-header-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.hist-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.hist-header h3 svg { width: 18px; height: 18px; color: var(--primary); }
.hist-count {
  font-size: 12.5px;
  color: var(--text-secondary);
  font-weight: 500;
}
.hist-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hist-btn {
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.hist-btn:hover:not(:disabled) { background: #f8fafc; border-color: #cbd5e1; }
.hist-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.hist-btn-reset { padding: 6px 9px; font-size: 13px; }
.hist-btn-danger { color: #dc2626; border-color: #fecaca; }
.hist-btn-danger:hover:not(:disabled) { background: #fef2f2; border-color: #fca5a5; }
.hist-btn-primary {
  color: #fff;
  background: var(--primary, #2563eb);
  border-color: var(--primary, #2563eb);
}
.hist-btn-primary:hover:not(:disabled) {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

/* Compteur "N sélectionnée(s)" — affiché inline dans la barre d'actions */
.hist-selection-count {
  font-size: 12.5px;
  color: #1e40af;
  padding: 6px 8px;
  align-self: center;
}
.hist-selection-count strong { font-weight: 700; }
/* Séparateur vertical entre bloc sélection et boutons génériques */
.hist-actions-sep {
  width: 1px;
  background: #e5e7eb;
  margin: 0 4px;
  align-self: stretch;
}

/* Checkbox column */
.hist-th-select, .hist-td-select {
  width: 38px;
  min-width: 38px;
  text-align: center;
  padding: 6px 4px !important;
}
.hist-checkbox {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--primary, #2563eb);
  vertical-align: middle;
}
.hist-row-selected { background: #eff6ff !important; }
.hist-row-selected:hover { background: #dbeafe !important; }
.hist-empty {
  color: var(--text-secondary);
  font-size: 13.5px;
  padding: 24px 8px;
  text-align: center;
  background: #fafafa;
  border: 1px dashed #e5e7eb;
  border-radius: 10px;
}
.hist-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.hist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.hist-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f8fafc;
  color: var(--text);
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
/* Checkbox column : sticky à gauche (col 1) */
.hist-table thead th.hist-th-select {
  position: sticky;
  left: 0;
  z-index: 5;
  background: #eef2ff;
  cursor: default;
  padding: 6px 4px;
}
/* Sélecteur plus spécifique (.hist-table thead th…) pour battre la règle générique */
.hist-table thead th.hist-th-fixed {
  background: #eef2ff;
  cursor: pointer; /* sortable mais pas draggable */
  position: sticky;
  z-index: 5; /* > thead th (3) et > td sticky (2) — reste en avant partout */
}
/* NOM (fixed #1) démarre juste après la checkbox (38px) */
.hist-table thead th.hist-th-select + th.hist-th-fixed {
  left: 38px;
}
/* SIREN (fixed #2) démarre après checkbox + NOM (38 + 200 = 238px) */
.hist-table thead th.hist-th-fixed + th.hist-th-fixed {
  left: 238px;
}
.hist-th-dragging { opacity: 0.4; }
.hist-th-over { background: #dbeafe; outline: 2px dashed #60a5fa; outline-offset: -2px; }
.hist-row {
  cursor: pointer;
  transition: background 0.1s;
}
.hist-row:hover { background: #f8fafc; }
.hist-td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text);
  vertical-align: middle;
}
/* Checkbox cell : sticky col 1 */
.hist-td.hist-td-select {
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 2;
}
.hist-row:hover .hist-td.hist-td-select { background: #f8fafc; }
.hist-row-selected .hist-td.hist-td-select { background: #eff6ff; }
/* NOM : sticky après la checkbox (38px) */
.hist-td.hist-td-nom {
  font-weight: 600;
  position: sticky;
  left: 38px;
  background: #fff;
  z-index: 2;
}
.hist-row:hover .hist-td.hist-td-nom { background: #f8fafc; }
.hist-row-selected .hist-td.hist-td-nom { background: #eff6ff; }
/* SIREN : sticky après checkbox + NOM (238px) */
.hist-td.hist-td-siren {
  position: sticky;
  left: 238px;
  background: #fff;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  font-size: 12.5px;
  z-index: 2;
}
.hist-row:hover .hist-td.hist-td-siren { background: #f8fafc; }
.hist-row-selected .hist-td.hist-td-siren { background: #eff6ff; }

/* Séparateur visuel à droite du cluster figé (checkbox + NOM + SIREN)
   pour que l'utilisateur voie clairement où s'arrête la zone figée
   pendant le scroll horizontal. Une ombre douce sur la colonne SIREN
   (la dernière sticky) suffit. */
.hist-table thead th[data-key="siren"],
.hist-td.hist-td-siren {
  box-shadow: 6px 0 8px -5px rgba(15, 23, 42, 0.18);
}
.hist-resume {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 360px;
  color: var(--text-secondary);
  line-height: 1.4;
}
.hist-chip {
  display: inline-block;
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 500;
  color: #4338ca;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  line-height: 1.3;
  white-space: nowrap;
}
.hist-score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.hist-indep-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.hist-year {
  font-size: 11px;
  color: #9ca3af;
  font-weight: 500;
}
.hist-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 12.5px;
}
.hist-link:hover { text-decoration: underline; }

/* Pill batch */
.hist-batch-pill {
  display: inline-block;
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: #3730a3;
  background: #e0e7ff;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  line-height: 1.3;
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.hist-muted {
  color: #9ca3af;
  font-size: 12px;
}

/* Filter */
.hist-btn-active {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #4338ca;
}
.hist-btn-active:hover:not(:disabled) {
  background: #e0e7ff;
  border-color: #a5b4fc;
}
.hist-filter-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #4338ca;
  border-radius: 50%;
  margin-left: 2px;
  vertical-align: middle;
}
.hist-filter-panel {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.hist-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.hist-filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  color: var(--text-secondary);
  font-weight: 600;
}
.hist-filter-field > span {
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.hist-filter-field select,
.hist-filter-field input {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  font-weight: 500;
  min-width: 160px;
}
.hist-filter-field input { max-width: 120px; min-width: 100px; }
.hist-filter-row .hist-btn-reset {
  margin-left: auto;
  height: 32px;
}
