/* Shared Multifact purple tokens — match Calculadoras in light and dark. */
:root {
    --mf-purple: #5d5abf;
    --mf-purple-600: #4f46e5;
    --mf-purple-700: #4338ca;
    --mf-purple-900: #312e81;
    --mf-purple-50: #eef2ff;
    --mf-purple-100: #e0e7ff;
    --mf-purple-200: #c7d2fe;
    --mf-purple-300: #a5b4fc;
    --mf-card-border: #c7d2fe;
    --mf-card-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    --mf-soft-bg: #eef2ff;
    --mf-chip-bg: #fff;
    --mf-chip-text: #312e81;
}

.dark {
    --mf-purple-50: rgba(99, 102, 241, 0.16);
    --mf-purple-100: rgba(99, 102, 241, 0.22);
    --mf-purple-200: #4f46e5;
    --mf-purple-300: #a5b4fc;
    --mf-purple-900: #c7d2fe;
    --mf-card-border: #4338ca;
    --mf-soft-bg: rgba(99, 102, 241, 0.16);
    --mf-chip-bg: #1f2937;
    --mf-chip-text: #c7d2fe;
}

/* Cards, sections, widgets, tables, modals */
.fi-section,
.fi-section-content-ctn,
.fi-ta-ctn,
.fi-wi-widget > section,
.fi-wi-widget > .fi-section,
.fi-wi-stats-overview-stat,
.fi-fo-repeater-item,
.fi-fo-builder-item,
.fi-modal-window,
.fi-dropdown-panel,
.fi-simple-page-content,
.admin-alerts-dropdown {
    border-color: var(--mf-card-border) !important;
    --tw-ring-color: var(--mf-card-border) !important;
}

.fi-section,
.fi-ta-ctn,
.fi-wi-stats-overview-stat,
.fi-modal-window {
    box-shadow: var(--mf-card-shadow), 0 0 0 1px var(--mf-card-border) !important;
}

.fi-section-header {
    border-bottom-color: var(--mf-card-border) !important;
}

.fi-section-header-icon,
.fi-wi-stats-overview-stat-icon,
.fi-header-icon {
    color: var(--mf-purple-600) !important;
}

.dark .fi-section-header-icon,
.dark .fi-wi-stats-overview-stat-icon,
.dark .fi-header-icon {
    color: var(--mf-purple-300) !important;
}

/* Icon tiles like calculator cards */
.fi-wi-stats-overview-stat-icon,
.fi-section-header-icon {
    background: var(--mf-soft-bg);
    border-radius: 0.6rem;
}

/* Focus rings and selected fields */
.fi-input-wrp:focus-within,
.fi-select-wrp:focus-within,
.fi-fo-rich-editor:focus-within,
.fi-ta-search-field .fi-input-wrp:focus-within,
input:focus,
select:focus,
textarea:focus {
    --tw-ring-color: var(--mf-purple-600) !important;
    border-color: var(--mf-purple-600) !important;
}

/* Tabs, pagination, links */
.fi-tabs-item.fi-active,
.fi-tabs-tab[aria-selected='true'],
.fi-pagination-item-active button,
.fi-pagination-item[aria-current='page'] {
    background-color: var(--mf-purple) !important;
    color: #fff !important;
    border-color: var(--mf-purple) !important;
}

.fi-link,
a.fi-ac-link,
.fi-ta-record-content a {
    color: var(--mf-purple-600);
}

.dark .fi-link,
.dark a.fi-ac-link,
.dark .fi-ta-record-content a {
    color: var(--mf-purple-300);
}

/* Table headers on standard Filament lists */
.fi-page:not(:has(.excel-ops)):not(:has(.fo-sheet)):not(:has(.cvb-sheet)):not(:has(.scb-sheet)):not(:has(.da-sheet)) .fi-ta-header-cell,
.fi-page:not(:has(.excel-ops)):not(:has(.fo-sheet)):not(:has(.cvb-sheet)):not(:has(.scb-sheet)):not(:has(.da-sheet)) thead th.fi-ta-header-cell {
    background-color: var(--mf-soft-bg) !important;
    color: var(--mf-purple-900) !important;
}

/* Checkboxes / radios already use primary; keep selected rows on-brand */
.fi-ta-row.fi-selected,
.fi-ta-row[data-selected='true'] {
    background-color: var(--mf-soft-bg) !important;
}

/* Language switch already uses purple; keep alerts dropdown on-token */
.admin-alerts-dropdown {
    border: 1px solid var(--mf-card-border) !important;
}

.admin-language-switch a.is-active {
    background-color: var(--mf-purple) !important;
}

/* Excel-like sheets: purple outer frame only, keep cell grid readable */
.cvb-sheet,
.cvb-summary,
.scb-sheet,
.da-sheet,
.fo-sheet .fi-ta-ctn,
.fi-page:has(.excel-ops) .fi-ta-ctn,
.fi-page:has(.excel-ops) .fi-section,
.fi-page:has(.excel-ops) .fi-section-content-ctn {
    border-color: var(--mf-card-border) !important;
}

.dark .cvb-sheet,
.dark .cvb-summary,
.dark .scb-sheet,
.dark .da-sheet,
.dark .fo-sheet .fi-ta-ctn {
    border-color: var(--mf-card-border) !important;
}

/* Searchable selects */
.legacy-searchable-select-toggle:focus,
.legacy-searchable-select-search:focus {
    outline: none;
    border-color: var(--mf-purple-600) !important;
    box-shadow: 0 0 0 1px var(--mf-purple-600);
}

.legacy-table-search {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 16rem;
}

.legacy-table-search span {
    font-size: 0.78rem;
    font-weight: 600;
    color: #312e81;
}

.dark .legacy-table-search span {
    color: #c7d2fe;
}

.legacy-table-search input[type='search'] {
    border: 1px solid var(--mf-card-border, #c7d2fe);
    border-radius: 0.375rem;
    padding: 0.45rem 0.6rem;
    font-size: 0.875rem;
    background: #fff;
    color: #111827;
}

.dark .legacy-table-search input[type='search'] {
    background: #1f2937;
    color: #f9fafb;
}

/* Allow selecting/copying table cell text; row click still opens the record unless text is selected. */
.fi-ta-cell,
.fi-ta-col-wrp,
.fi-ta-col-wrp a,
.fi-ta-text,
.fi-ta-text-item-label,
.fi-infolist-entry-content,
.legacy-dashboard-table,
.cvb-table,
.scb-table,
.da-table,
.fo-sheet {
    -webkit-user-select: text !important;
    user-select: text !important;
}
