/**
 * Correzioni leggibilità SOLO preset CRM «Light soft» (data-preset="light").
 * Non modificare regole globali dark: tutti i selettori sono scoped su [data-preset="light"].
 */

html[data-preset="light"],
body[data-preset="light"] {
  --ui-subtle: var(--crm-text-2, #334155);
  --ui-muted: var(--crm-text-3, #64748b);
}

/* Tailwind utility — testo su card chiare */
html[data-preset="light"] .text-white,
body[data-preset="light"] .text-white {
  --tw-text-opacity: 1;
  color: rgb(15 23 42 / var(--tw-text-opacity, 1)) !important;
}

html[data-preset="light"] .ui-card .text-slate-300,
html[data-preset="light"] .ui-panel .text-slate-300,
body[data-preset="light"] .ui-card .text-slate-300,
body[data-preset="light"] .ui-panel .text-slate-300 {
  --tw-text-opacity: 1;
  color: rgb(71 85 105 / var(--tw-text-opacity, 1)) !important;
}

html[data-preset="light"] .ui-card .text-slate-400,
html[data-preset="light"] .ui-panel .text-slate-400,
body[data-preset="light"] .ui-card .text-slate-400,
body[data-preset="light"] .ui-panel .text-slate-400 {
  --tw-text-opacity: 1;
  color: rgb(100 116 139 / var(--tw-text-opacity, 1)) !important;
}

/* Richieste immobili */
html[data-preset="light"] .crm-req-contact__link:hover,
body[data-preset="light"] .crm-req-contact__link:hover {
  color: #0f172a !important;
}

html[data-preset="light"] .crm-req-card__task-link,
body[data-preset="light"] .crm-req-card__task-link {
  color: #1d4ed8 !important;
}

html[data-preset="light"] .crm-req-card__task-link:hover,
body[data-preset="light"] .crm-req-card__task-link:hover {
  color: #0f172a !important;
}

html[data-preset="light"] .crm-req-message__text,
body[data-preset="light"] .crm-req-message__text {
  background: rgba(15, 23, 42, 0.04) !important;
  border-left-color: rgba(99, 102, 241, 0.45) !important;
}

/* Profilo agenzia — subnav inline */
html[data-preset="light"] .agency-settings-subnav,
body[data-preset="light"] .agency-settings-subnav {
  border-color: rgba(15, 23, 42, 0.1) !important;
  background: rgba(15, 23, 42, 0.04) !important;
}

html[data-preset="light"] .agency-settings-subnav a,
body[data-preset="light"] .agency-settings-subnav a {
  color: #64748b !important;
}

html[data-preset="light"] .agency-settings-subnav a:hover,
html[data-preset="light"] .agency-settings-subnav a.is-active,
body[data-preset="light"] .agency-settings-subnav a:hover,
body[data-preset="light"] .agency-settings-subnav a.is-active {
  color: #0f172a !important;
  background: rgba(15, 23, 42, 0.07) !important;
}

html[data-preset="light"] .agency-profile-logo-thumb,
body[data-preset="light"] .agency-profile-logo-thumb {
  border-color: rgba(15, 23, 42, 0.12) !important;
  background: rgba(15, 23, 42, 0.04) !important;
}

html[data-preset="light"] .agency-profile-registry-divider,
body[data-preset="light"] .agency-profile-registry-divider {
  border-top-color: rgba(15, 23, 42, 0.1) !important;
}

/* Guida CRM */
html[data-preset="light"] .crm-help-search,
body[data-preset="light"] .crm-help-search {
  color: #0f172a !important;
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

html[data-preset="light"] .crm-help-toc a,
html[data-preset="light"] .crm-help-quick-links a,
html[data-preset="light"] .crm-help-toolbar-btn,
body[data-preset="light"] .crm-help-toc a,
body[data-preset="light"] .crm-help-quick-links a,
body[data-preset="light"] .crm-help-toolbar-btn {
  color: #0f172a !important;
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

html[data-preset="light"] .crm-help-toc a:hover,
html[data-preset="light"] .crm-help-quick-links a:hover,
html[data-preset="light"] .crm-help-toolbar-btn:hover,
body[data-preset="light"] .crm-help-toc a:hover,
body[data-preset="light"] .crm-help-quick-links a:hover,
body[data-preset="light"] .crm-help-toolbar-btn:hover {
  background: #f1f5f9 !important;
}

html[data-preset="light"] .crm-help-faq details,
html[data-preset="light"] .crm-help-path-card,
body[data-preset="light"] .crm-help-faq details,
body[data-preset="light"] .crm-help-path-card {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

html[data-preset="light"] .crm-help-faq-answer,
body[data-preset="light"] .crm-help-faq-answer {
  border-top-color: #e2e8f0 !important;
  color: #475569 !important;
}

html[data-preset="light"] .crm-help-empty,
body[data-preset="light"] .crm-help-empty {
  border-color: #cbd5e1 !important;
  color: #64748b !important;
}

html[data-preset="light"] .crm-help-hint,
body[data-preset="light"] .crm-help-hint {
  background: rgba(15, 23, 42, 0.05) !important;
  color: #475569 !important;
}

html[data-preset="light"] .crm-help-tip,
body[data-preset="light"] .crm-help-tip {
  background: #ecfdf5 !important;
  border-color: #bbf7d0 !important;
  color: #166534 !important;
}

/* Task detail / checklist upload */
html[data-preset="light"] form[action*="/checklist/"][enctype],
body[data-preset="light"] form[action*="/checklist/"][enctype] {
  border-color: rgba(15, 23, 42, 0.12) !important;
  background: rgba(15, 23, 42, 0.03) !important;
}

html[data-preset="light"] form[action*="/checklist/"][enctype] input[type="file"],
body[data-preset="light"] form[action*="/checklist/"][enctype] input[type="file"] {
  color: #334155 !important;
}

html[data-preset="light"] form[action*="/checklist/"][enctype] input[type="file"]::file-selector-button,
html[data-preset="light"] .checklist-attach-upload-form input[type="file"]::file-selector-button,
body[data-preset="light"] form[action*="/checklist/"][enctype] input[type="file"]::file-selector-button,
body[data-preset="light"] .checklist-attach-upload-form input[type="file"]::file-selector-button {
  border-color: rgba(15, 23, 42, 0.14) !important;
  background: #f8fafc !important;
  color: #0f172a !important;
}

html[data-preset="light"] .task-attachment-card,
body[data-preset="light"] .task-attachment-card {
  border-color: rgba(15, 23, 42, 0.1) !important;
  background: rgba(15, 23, 42, 0.03) !important;
}

html[data-preset="light"] .ui-btn.ui-btn-primary.task-attachment-btn,
body[data-preset="light"] .ui-btn.ui-btn-primary.task-attachment-btn {
  background: rgba(15, 23, 42, 0.08) !important;
  border-color: rgba(15, 23, 42, 0.14) !important;
  color: #0f172a !important;
}

html[data-preset="light"] .ui-btn.ui-btn-ghost.task-attachment-btn,
body[data-preset="light"] .ui-btn.ui-btn-ghost.task-attachment-btn {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #334155 !important;
}

/* Import Getrix preview */
html[data-preset="light"] #getrix-preview-upload-card,
body[data-preset="light"] #getrix-preview-upload-card {
  background:
    radial-gradient(circle at 8% 0%, rgba(15, 107, 75, 0.08), transparent 34%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.92)) !important;
  color: #0f172a !important;
  border-color: rgba(15, 23, 42, 0.12) !important;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08) !important;
}

html[data-preset="light"] #getrix-preview-upload-card h2,
body[data-preset="light"] #getrix-preview-upload-card h2 {
  color: #0f172a !important;
}

html[data-preset="light"] #getrix-preview-upload-card .getrix-desc,
html[data-preset="light"] #getrix-preview-upload-card .getrix-kicker,
html[data-preset="light"] #getrix-preview-upload-card .getrix-help,
body[data-preset="light"] #getrix-preview-upload-card .getrix-desc,
body[data-preset="light"] #getrix-preview-upload-card .getrix-kicker,
body[data-preset="light"] #getrix-preview-upload-card .getrix-help {
  color: #64748b !important;
}

html[data-preset="light"] #getrix-preview-upload-card .getrix-mini,
body[data-preset="light"] #getrix-preview-upload-card .getrix-mini {
  background: rgba(15, 23, 42, 0.04) !important;
  border-color: rgba(15, 23, 42, 0.1) !important;
  color: #64748b !important;
}

html[data-preset="light"] #getrix-preview-upload-card .getrix-mini strong,
body[data-preset="light"] #getrix-preview-upload-card .getrix-mini strong {
  color: #0f172a !important;
}

html[data-preset="light"] #getrix-preview-upload-card .getrix-upload-box,
body[data-preset="light"] #getrix-preview-upload-card .getrix-upload-box {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

html[data-preset="light"] #getrix-preview-upload-card .getrix-label,
body[data-preset="light"] #getrix-preview-upload-card .getrix-label {
  color: #334155 !important;
}

html[data-preset="light"] #getrix-preview-upload-card input[type="file"],
body[data-preset="light"] #getrix-preview-upload-card input[type="file"] {
  background: #fff !important;
  border-color: #e2e8f0 !important;
  color: #334155 !important;
}

/* Report venditori — tabella legacy */
html[data-preset="light"] .seller-report-shell .text-slate-400,
body[data-preset="light"] .seller-report-shell .text-slate-400 {
  color: #64748b !important;
}

html[data-preset="light"] .seller-report-shell > .rounded-2xl,
body[data-preset="light"] .seller-report-shell > .rounded-2xl {
  border-color: rgba(15, 23, 42, 0.12) !important;
  background: rgba(255, 255, 255, 0.72) !important;
}

html[data-preset="light"] .seller-report-shell thead,
body[data-preset="light"] .seller-report-shell thead {
  background: rgba(15, 23, 42, 0.05) !important;
  color: #334155 !important;
}

html[data-preset="light"] .seller-report-shell tbody,
body[data-preset="light"] .seller-report-shell tbody {
  color: #0f172a !important;
}

html[data-preset="light"] .seller-report-shell .divide-white\/10 > :not([hidden]) ~ :not([hidden]),
body[data-preset="light"] .seller-report-shell .divide-white\/10 > :not([hidden]) ~ :not([hidden]) {
  border-color: rgba(15, 23, 42, 0.08) !important;
}

/* Blog — badge stato */
html[data-preset="light"] .blog-status--published,
body[data-preset="light"] .blog-status--published {
  color: #166534 !important;
}

html[data-preset="light"] .blog-status--draft,
body[data-preset="light"] .blog-status--draft {
  color: #475569 !important;
}

/* Page hero CRM — preset light soft */
html[data-preset="light"] .app-page-hero,
body[data-preset="light"] .app-page-hero {
  color: #0f172a;
}

html[data-preset="light"] .app-page-hero-brand,
body[data-preset="light"] .app-page-hero-brand {
  color: #64748b !important;
}

html[data-preset="light"] .app-page-hero-title,
body[data-preset="light"] .app-page-hero-title {
  color: #0f172a !important;
}

html[data-preset="light"] .app-page-hero-user,
body[data-preset="light"] .app-page-hero-user {
  color: #475569 !important;
}

/* =============================================================================
   LEGGIBILITÀ GLOBALE — preset light (layer finale, dopo extra_head)
   Corregge utility Tailwind pensate per tema scuro e override bianchi globali.
   ============================================================================= */

/* Badge / chip: annulla body[data-theme] .ui-badge { color:#fff } */
html[data-preset="light"] .ui-badge,
body[data-preset="light"] .ui-badge {
  color: #334155 !important;
  background: rgba(15, 23, 42, 0.06) !important;
  border-color: rgba(15, 23, 42, 0.12) !important;
}

html[data-preset="light"] .ui-badge-success,
body[data-preset="light"] .ui-badge-success {
  color: #166534 !important;
  background: #ecfdf5 !important;
  border-color: rgba(22, 101, 52, 0.22) !important;
}

html[data-preset="light"] .ui-badge-danger,
body[data-preset="light"] .ui-badge-danger {
  color: #b91c1c !important;
  background: #fef2f2 !important;
  border-color: rgba(185, 28, 28, 0.2) !important;
}

html[data-preset="light"] .ui-badge-info,
body[data-preset="light"] .ui-badge-info {
  color: #0e7490 !important;
  background: #ecfeff !important;
  border-color: rgba(14, 116, 144, 0.2) !important;
}

html[data-preset="light"] .ui-badge-warning,
body[data-preset="light"] .ui-badge-warning {
  color: #b45309 !important;
  background: #fffbeb !important;
  border-color: rgba(180, 83, 9, 0.2) !important;
}

html[data-preset="light"] .crm-property-chip,
html[data-preset="light"] .crm-property-deal,
html[data-preset="light"] .crm-property-state-pill,
body[data-preset="light"] .crm-property-chip,
body[data-preset="light"] .crm-property-deal,
body[data-preset="light"] .crm-property-state-pill {
  color: #334155 !important;
}

/* Utility Tailwind «scuro» su superfici chiare */
html[data-preset="light"] main .text-slate-200,
html[data-preset="light"] .ui-card .text-slate-200,
html[data-preset="light"] .ui-panel .text-slate-200,
html[data-preset="light"] .crm-property-fold .text-slate-200,
html[data-preset="light"] .crm-intelligence-modal .text-slate-200,
body[data-preset="light"] main .text-slate-200,
body[data-preset="light"] .ui-card .text-slate-200,
body[data-preset="light"] .ui-panel .text-slate-200,
body[data-preset="light"] .crm-property-fold .text-slate-200,
body[data-preset="light"] .crm-intelligence-modal .text-slate-200 {
  --tw-text-opacity: 1;
  color: rgb(51 65 85 / var(--tw-text-opacity, 1)) !important;
}

html[data-preset="light"] main .text-slate-300,
html[data-preset="light"] .ui-card .text-slate-300,
html[data-preset="light"] .ui-panel .text-slate-300,
html[data-preset="light"] .crm-property-fold .text-slate-300,
html[data-preset="light"] .crm-intelligence-modal .text-slate-300,
html[data-preset="light"] .agency-list-card .text-slate-300,
html[data-preset="light"] .agency-card .text-slate-300,
body[data-preset="light"] main .text-slate-300,
body[data-preset="light"] .ui-card .text-slate-300,
body[data-preset="light"] .ui-panel .text-slate-300,
body[data-preset="light"] .crm-property-fold .text-slate-300,
body[data-preset="light"] .crm-intelligence-modal .text-slate-300,
body[data-preset="light"] .agency-list-card .text-slate-300,
body[data-preset="light"] .agency-card .text-slate-300 {
  --tw-text-opacity: 1;
  color: rgb(71 85 105 / var(--tw-text-opacity, 1)) !important;
}

html[data-preset="light"] main .text-emerald-300,
html[data-preset="light"] .ui-card .text-emerald-300,
html[data-preset="light"] .ui-panel .text-emerald-300,
html[data-preset="light"] .crm-property-fold .text-emerald-300,
html[data-preset="light"] .agency-list-card .text-emerald-300,
body[data-preset="light"] main .text-emerald-300,
body[data-preset="light"] .ui-card .text-emerald-300,
body[data-preset="light"] .ui-panel .text-emerald-300,
body[data-preset="light"] .crm-property-fold .text-emerald-300,
body[data-preset="light"] .agency-list-card .text-emerald-300 {
  --tw-text-opacity: 1;
  color: rgb(4 120 87 / var(--tw-text-opacity, 1)) !important;
}

html[data-preset="light"] main .text-emerald-400,
html[data-preset="light"] .ui-card .text-emerald-400,
html[data-preset="light"] .ui-panel .text-emerald-400,
html[data-preset="light"] .crm-property-fold .text-emerald-400,
body[data-preset="light"] main .text-emerald-400,
body[data-preset="light"] .ui-card .text-emerald-400,
body[data-preset="light"] .ui-panel .text-emerald-400,
body[data-preset="light"] .crm-property-fold .text-emerald-400 {
  --tw-text-opacity: 1;
  color: rgb(5 150 105 / var(--tw-text-opacity, 1)) !important;
}

html[data-preset="light"] main .text-amber-300,
html[data-preset="light"] .ui-card .text-amber-300,
html[data-preset="light"] .ui-panel .text-amber-300,
html[data-preset="light"] .crm-property-fold .text-amber-300,
body[data-preset="light"] main .text-amber-300,
body[data-preset="light"] .ui-card .text-amber-300,
body[data-preset="light"] .ui-panel .text-amber-300,
body[data-preset="light"] .crm-property-fold .text-amber-300 {
  --tw-text-opacity: 1;
  color: rgb(180 83 9 / var(--tw-text-opacity, 1)) !important;
}

html[data-preset="light"] main .text-amber-400,
html[data-preset="light"] .ui-card .text-amber-400,
html[data-preset="light"] .ui-panel .text-amber-400,
html[data-preset="light"] .crm-property-fold .text-amber-400,
body[data-preset="light"] main .text-amber-400,
body[data-preset="light"] .ui-card .text-amber-400,
body[data-preset="light"] .ui-panel .text-amber-400,
body[data-preset="light"] .crm-property-fold .text-amber-400 {
  --tw-text-opacity: 1;
  color: rgb(217 119 6 / var(--tw-text-opacity, 1)) !important;
}

/* Pill stato (Incarico, SEO, agenzie) */
html[data-preset="light"] main [class*="border-emerald-400/20"][class*="text-emerald-300"],
html[data-preset="light"] .ui-card [class*="border-emerald-400/20"][class*="text-emerald-300"],
body[data-preset="light"] main [class*="border-emerald-400/20"][class*="text-emerald-300"],
body[data-preset="light"] .ui-card [class*="border-emerald-400/20"][class*="text-emerald-300"] {
  border-color: rgba(5, 150, 105, 0.28) !important;
  background: rgba(16, 185, 129, 0.12) !important;
  color: #047857 !important;
}

html[data-preset="light"] main [class*="border-amber-400/20"][class*="text-amber-300"],
html[data-preset="light"] .ui-card [class*="border-amber-400/20"][class*="text-amber-300"],
body[data-preset="light"] main [class*="border-amber-400/20"][class*="text-amber-300"],
body[data-preset="light"] .ui-card [class*="border-amber-400/20"][class*="text-amber-300"] {
  border-color: rgba(217, 119, 6, 0.28) !important;
  background: rgba(245, 158, 11, 0.12) !important;
  color: #b45309 !important;
}

html[data-preset="light"] main [class*="bg-white/"][class*="text-slate-"],
html[data-preset="light"] .ui-card [class*="bg-white/"][class*="text-slate-"],
body[data-preset="light"] main [class*="bg-white/"][class*="text-slate-"],
body[data-preset="light"] .ui-card [class*="bg-white/"][class*="text-slate-"] {
  background: rgba(15, 23, 42, 0.06) !important;
  border-color: rgba(15, 23, 42, 0.12) !important;
  color: #334155 !important;
}

/* Pipeline */
html[data-preset="light"] .pipeline-title,
body[data-preset="light"] .pipeline-title {
  color: #0f172a !important;
}

html[data-preset="light"] .pipeline-subtitle,
html[data-preset="light"] .pipeline-card-title,
html[data-preset="light"] .pipeline-card-count,
html[data-preset="light"] .pipeline-card-value,
body[data-preset="light"] .pipeline-subtitle,
body[data-preset="light"] .pipeline-card-title,
body[data-preset="light"] .pipeline-card-count,
body[data-preset="light"] .pipeline-card-value {
  color: #334155 !important;
}

html[data-preset="light"] .pipeline-summary-pill,
html[data-preset="light"] .pipeline-card,
body[data-preset="light"] .pipeline-summary-pill,
body[data-preset="light"] .pipeline-card {
  color: #0f172a !important;
}

/* Lista immobili */
html[data-preset="light"] .crm-property-quality strong,
body[data-preset="light"] .crm-property-quality strong {
  color: #166534 !important;
  text-shadow: none !important;
}

html[data-preset="light"] .crm-property-buyer-alert,
body[data-preset="light"] .crm-property-buyer-alert {
  background: #ecfdf5 !important;
  border-color: rgba(22, 163, 74, 0.28) !important;
  color: #166534 !important;
}

/* Export portali — badge stato e titoli */
html[data-preset="light"] .pe-title,
html[data-preset="light"] .pe-stat-v,
html[data-preset="light"] .pe-annuncio-title,
html[data-preset="light"] .pe-date,
html[data-preset="light"] .pe-count,
html[data-preset="light"] .pe-quality-percent,
html[data-preset="light"] .pe-portal-name,
html[data-preset="light"] .pe-modal-title,
html[data-preset="light"] .pe-notebox-title,
body[data-preset="light"] .pe-title,
body[data-preset="light"] .pe-stat-v,
body[data-preset="light"] .pe-annuncio-title,
body[data-preset="light"] .pe-date,
body[data-preset="light"] .pe-count,
body[data-preset="light"] .pe-quality-percent,
body[data-preset="light"] .pe-portal-name,
body[data-preset="light"] .pe-modal-title,
body[data-preset="light"] .pe-notebox-title {
  color: #0f172a !important;
}

html[data-preset="light"] .pe-eyebrow,
html[data-preset="light"] .pe-sub,
html[data-preset="light"] .pe-stat-k,
html[data-preset="light"] .pe-annuncio-addr,
html[data-preset="light"] .pe-quality-meta,
body[data-preset="light"] .pe-eyebrow,
body[data-preset="light"] .pe-sub,
body[data-preset="light"] .pe-stat-k,
body[data-preset="light"] .pe-annuncio-addr,
body[data-preset="light"] .pe-quality-meta {
  color: #64748b !important;
}

html[data-preset="light"] .pe-status-published,
body[data-preset="light"] .pe-status-published {
  color: #047857 !important;
  background: rgba(16, 185, 129, 0.14) !important;
}

html[data-preset="light"] .pe-status-queued,
body[data-preset="light"] .pe-status-queued {
  color: #b45309 !important;
  background: rgba(245, 158, 11, 0.14) !important;
}

html[data-preset="light"] .pe-status-draft,
body[data-preset="light"] .pe-status-draft {
  color: #1d4ed8 !important;
  background: rgba(59, 130, 246, 0.12) !important;
}

html[data-preset="light"] .pe-status-blocked,
body[data-preset="light"] .pe-status-blocked {
  color: #475569 !important;
  background: rgba(100, 116, 139, 0.12) !important;
}

html[data-preset="light"] .pe-status-error,
body[data-preset="light"] .pe-status-error {
  color: #be123c !important;
  background: rgba(244, 63, 94, 0.12) !important;
}

html[data-preset="light"] .pe-quality-green,
body[data-preset="light"] .pe-quality-green {
  color: #047857 !important;
}

html[data-preset="light"] .pe-quality-yellow,
body[data-preset="light"] .pe-quality-yellow {
  color: #b45309 !important;
}

html[data-preset="light"] .pe-quality-red,
body[data-preset="light"] .pe-quality-red {
  color: #be123c !important;
}

/* Dashboard — pill e badge */
html[data-preset="light"] .dash-shell .dash-pill,
html[data-preset="light"] .dash-shell .dash-badge,
html[data-preset="light"] .dash-shell .dash-group-title,
body[data-preset="light"] .dash-shell .dash-pill,
body[data-preset="light"] .dash-shell .dash-badge,
body[data-preset="light"] .dash-shell .dash-group-title {
  color: #0f172a !important;
  border-color: rgba(15, 23, 42, 0.12) !important;
  background: rgba(255, 255, 255, 0.88) !important;
}

html[data-preset="light"] .dash-shell .dash-badge b,
body[data-preset="light"] .dash-shell .dash-badge b {
  color: #0f172a !important;
}

/* Modali agency credentials */
html[data-preset="light"] .agency-portal-credentials-modal .text-slate-200,
body[data-preset="light"] .agency-portal-credentials-modal .text-slate-200 {
  color: #334155 !important;
  background: rgba(15, 23, 42, 0.04) !important;
  border-color: rgba(15, 23, 42, 0.12) !important;
}
