/* ============================================================
   Survey / document dark-mode overrides

   The compliance-audit survey & document templates (RAMA, TIUF,
   RAEPSA, InfoStato, SCQSF1/2, startup-assessment, the rama_matrix
   views, plus their landing / confirm / analytics / placeholder
   pages) each ship a large embedded <style> block of hardcoded
   LIGHT surfaces (#fff / #f8f9fa / #e9ecef …) and dark text
   (#32325d / #525f7f / #8898aa …) with NO dark-theme handling. In
   dark mode that produced the recurring "light grey boxes +
   unreadable text" pattern (esp. read-only / disabled fields).

   This file is purely ADDITIVE and scoped to [data-bs-theme="dark"]
   only — light mode is never touched. It is keyed on the structural
   class names the whole family shares, so every current (and future)
   survey page using these classes is covered at once. Colours come
   from theme-tokens.css so they track the rest of the dark palette.

   Loaded globally in base.html AFTER theme-dark-overrides.css; the
   [data-bs-theme="dark"] ancestor gives every rule here enough
   specificity to win over each template's embedded block.
   ============================================================ */

/* --- 1. Page-level containers (were #f4f6f9) --------------------- */
[data-bs-theme="dark"] .rama-container,
[data-bs-theme="dark"] .tiuf-container,
[data-bs-theme="dark"] .raepsa-container,
[data-bs-theme="dark"] .infostato-container,
[data-bs-theme="dark"] .startup-assessment-container,
[data-bs-theme="dark"] .rama-landing-container,
[data-bs-theme="dark"] .tiuf-landing-container,
[data-bs-theme="dark"] .raepsa-landing-container,
[data-bs-theme="dark"] .infostato-landing-container,
[data-bs-theme="dark"] .startup-assessment-landing-container,
[data-bs-theme="dark"] .check1-landing-container,
[data-bs-theme="dark"] .analytics-container,
[data-bs-theme="dark"] .rama-matrix-container,
[data-bs-theme="dark"] .confirm-container {
  background: var(--bg-app);
}

/* --- 2. Elevated surface cards / panels (were #fff) ------------- */
[data-bs-theme="dark"] .page-header,
[data-bs-theme="dark"] .landing-header,
[data-bs-theme="dark"] .section-card,
[data-bs-theme="dark"] .question-card,
[data-bs-theme="dark"] .survey-notes-panel,
[data-bs-theme="dark"] .selection-card,
[data-bs-theme="dark"] .confirm-card,
[data-bs-theme="dark"] .placeholder-card,
[data-bs-theme="dark"] .analytics-header,
[data-bs-theme="dark"] .matrix-header,
[data-bs-theme="dark"] .matrix-wrapper,
[data-bs-theme="dark"] .filter-panel,
[data-bs-theme="dark"] .filter-bar,
[data-bs-theme="dark"] .legend-card,
[data-bs-theme="dark"] .survey-card,
[data-bs-theme="dark"] .empty-state {
  background: var(--bg-surface);
  border-color: var(--border-default);
}

/* --- 3. Secondary / muted surfaces (were #f8f9fa/#fafbfc/#f1f3f5) */
[data-bs-theme="dark"] .section-header,
[data-bs-theme="dark"] .section-header:hover,
[data-bs-theme="dark"] .group-card,
[data-bs-theme="dark"] .group-header,
[data-bs-theme="dark"] .file-upload-area,
[data-bs-theme="dark"] .uploaded-file,
[data-bs-theme="dark"] .note-section,
[data-bs-theme="dark"] .survey-notes-panel .card-header,
[data-bs-theme="dark"] .survey-notes-panel .note-section,
[data-bs-theme="dark"] .confirm-details,
[data-bs-theme="dark"] .company-info,
[data-bs-theme="dark"] .action-bar .save-status,
[data-bs-theme="dark"] .cell-no-data,
[data-bs-theme="dark"] .status-non-compilato,
[data-bs-theme="dark"] .status-indicator.empty,
[data-bs-theme="dark"] .td-rama,
[data-bs-theme="dark"] .matrix-table thead th,
[data-bs-theme="dark"] .status-table th,
[data-bs-theme="dark"] .survey-card-footer,
[data-bs-theme="dark"] .survey-card-header,
[data-bs-theme="dark"] .quick-link {
  background: var(--bg-surface-2);
  border-color: var(--border-muted);
}

/* --- 4. Muted chips / hover / disabled fills (were #e9ecef) ----- */
[data-bs-theme="dark"] .matrix-table thead th.th-rama,
[data-bs-theme="dark"] .survey-card-meta .year-badge,
[data-bs-theme="dark"] .quick-link:hover,
[data-bs-theme="dark"] .pagination .page-link:hover,
[data-bs-theme="dark"] .arera-header-panel .arera-field:disabled,
[data-bs-theme="dark"] .survey-notes-panel .survey-note-field:disabled {
  background: var(--bg-muted);
  border-color: var(--border-default);
}

/* --- 5. Editable inputs / fields (were #fff) ------------------- */
[data-bs-theme="dark"] .survey-note-field,
[data-bs-theme="dark"] .survey-notes-panel .survey-note-field,
[data-bs-theme="dark"] .arera-header-panel .arera-field,
[data-bs-theme="dark"] .arera-header-panel.edit-mode .arera-field,
[data-bs-theme="dark"] .question-card.edit-mode .evo-input,
[data-bs-theme="dark"] .question-card.edit-mode .evo-input-multi,
[data-bs-theme="dark"] .question-card.edit-mode .file-input,
[data-bs-theme="dark"] .filter-bar select {
  background-color: var(--input-bg);
  color: var(--input-fg);
  border-color: var(--input-border);
}

/* --- 6. Read-only / disabled fields — the reported broken boxes - */
[data-bs-theme="dark"] .evo-field textarea[readonly],
[data-bs-theme="dark"] .evo-field textarea[disabled],
[data-bs-theme="dark"] .arera-header-panel:not(.edit-mode) .arera-field,
[data-bs-theme="dark"] .question-card:not(.edit-mode) .evo-input,
[data-bs-theme="dark"] .question-card:not(.edit-mode) .evo-input-multi,
[data-bs-theme="dark"] .question-card:not(.edit-mode) .file-input {
  background-color: var(--input-bg);
  color: var(--input-fg);
  border-color: var(--input-border);
}

/* --- 7. Fixed action bar (was #fff !important) ----------------- */
[data-bs-theme="dark"] .action-bar {
  background-color: var(--bg-surface) !important;
  border-top-color: var(--border-default);
}

/* --- 8. Headings / labels with explicit dark text (were #32325d
         /#525f7f/#495057) — would vanish on dark surfaces ---------- */
[data-bs-theme="dark"] .page-header h1,
[data-bs-theme="dark"] .landing-header h1,
[data-bs-theme="dark"] .analytics-header h1,
[data-bs-theme="dark"] .matrix-header h1,
[data-bs-theme="dark"] .section-header h3,
[data-bs-theme="dark"] .group-header h4,
[data-bs-theme="dark"] .question-title,
[data-bs-theme="dark"] .note-label,
[data-bs-theme="dark"] .survey-notes-panel .note-label,
[data-bs-theme="dark"] .survey-notes-panel .card-header h6,
[data-bs-theme="dark"] .evo-field label,
[data-bs-theme="dark"] .form-label,
[data-bs-theme="dark"] .filter-bar label,
[data-bs-theme="dark"] .selection-card h4,
[data-bs-theme="dark"] .confirm-card h2,
[data-bs-theme="dark"] .confirm-details .detail-value,
[data-bs-theme="dark"] .company-info .value,
[data-bs-theme="dark"] .empty-state h4,
[data-bs-theme="dark"] .empty-state h5,
[data-bs-theme="dark"] .placeholder-card h2,
[data-bs-theme="dark"] .legend-title,
[data-bs-theme="dark"] .matrix-table thead th,
[data-bs-theme="dark"] .status-table th,
[data-bs-theme="dark"] .survey-card-meta .year-badge,
[data-bs-theme="dark"] .survey-card-title,
[data-bs-theme="dark"] .td-rama .rama-title,
[data-bs-theme="dark"] .feature-item,
[data-bs-theme="dark"] .nav-pills .nav-link {
  color: var(--fg-default);
}

/* --- 9. Muted text / toggle icons (were #8898aa / #6c757d) ----- */
[data-bs-theme="dark"] .analytics-header p,
[data-bs-theme="dark"] .landing-header p,
[data-bs-theme="dark"] .matrix-header p,
[data-bs-theme="dark"] .selector-label,
[data-bs-theme="dark"] .section-header .toggle-icon,
[data-bs-theme="dark"] .group-header .toggle-icon,
[data-bs-theme="dark"] .group-header .code,
[data-bs-theme="dark"] .file-upload-area i,
[data-bs-theme="dark"] .empty-state i,
[data-bs-theme="dark"] .empty-state p,
[data-bs-theme="dark"] .cell-no-data,
[data-bs-theme="dark"] .status-non-compilato,
[data-bs-theme="dark"] .status-indicator.empty,
[data-bs-theme="dark"] .company-info .label,
[data-bs-theme="dark"] .confirm-details .detail-label,
[data-bs-theme="dark"] .filter-panel .form-label,
[data-bs-theme="dark"] .legend-label,
[data-bs-theme="dark"] .pagination-info,
[data-bs-theme="dark"] .placeholder-card p,
[data-bs-theme="dark"] .btn-edit-question,
[data-bs-theme="dark"] .survey-notes-panel .notes-toggle-icon {
  color: var(--fg-muted);
}