/* Shared theme tokens; no filters applied to images or event banners. */
:root[data-theme="light"]{color-scheme:light;--bg:#f5f6fa;--bg-deep:#eef1f7;--surface:#fff;--surface-2:#f1f3f9;--surface-glass:rgba(255,255,255,.97);--surface-soft:#f7f8fc;--line:#d7ddea;--line-strong:#8b9bb7;--text:#202c40;--muted:#52627a;--muted-2:#59677c;--icon-on-dark-filter:none;--icon-on-dark-opacity:1;--shadow-sm:0 8px 24px #2434520c;--shadow-md:0 20px 50px #24345214;--theme-accent:#61269d;--theme-accent-soft:#f2eafa}
:root[data-theme="dark"]{color-scheme:dark;--home-ink:#f8fafc;--home-muted:#a5b4c8;--home-border:#334155;--home-surface:#0b172a;--theme-accent:#d0b1ff;--theme-accent-soft:#241b3c}
.theme-toggle{display:inline-flex;align-items:center;justify-content:center;gap:7px;flex-shrink:0;min-height:44px;padding:8px 12px;border:1px solid var(--line);border-radius:var(--r-sm);background:var(--surface);color:var(--text);font:inherit;font-size:13px;cursor:pointer;white-space:nowrap}.theme-toggle:focus-visible{outline:3px solid var(--theme-accent);outline-offset:3px}.theme-auth{display:flex;justify-content:flex-end;padding:12px 20px}
html[data-theme] body{background:var(--bg);color:var(--text)}
html[data-theme] .public-header,html[data-theme] .topbar{background:var(--surface-glass);border-color:var(--line);color:var(--text)}
html[data-theme] .public-header .public-actions{flex-wrap:wrap}
html[data-theme] .public-header .public-action,html[data-theme] .public-header .public-profile-trigger{color:var(--text)}
html[data-theme] .public-header .public-header-inner{min-width:0}
html[data-theme="light"] :is(.sidebar,.panel,.table-card,.modal-content,.profile-menu,.search-autocomplete){background:var(--surface);color:var(--text);border-color:var(--line)}
html[data-theme="light"] :is(.input,.select,.search,.textarea){background:var(--surface);color:var(--text);border-color:var(--line)}
html[data-theme="light"] :is(.nav-item,.profile-trigger,.profile-copy strong,.page-title,.panel-title,.table-card th,.table-card td){color:var(--text)}
html[data-theme="light"] :is(.flash,.field-help,.empty-state){color:var(--muted)}
html[data-theme="dark"] body.public-page{color-scheme:dark}
html[data-theme="dark"] :is(.public-search,.public-input,.public-profile-menu){background:var(--surface-2);color:var(--text);border-color:var(--line)}
html[data-theme="dark"] :is(.public-event-card,.public-event-body,.public-agenda,.public-filters,.public-category-card){background:var(--surface);color:var(--text);border-color:var(--line)}
@media(max-width:600px){.topbar-right{gap:6px;flex-wrap:wrap}.theme-toggle{padding:8px}.public-header .theme-toggle{font-size:12px}}
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
html[data-theme] .public-header .public-profile-link{color:var(--text)}
@media(min-width:901px) and (max-width:1400px){.topbar{grid-template-columns:auto minmax(120px,1fr) auto;gap:16px}.topbar .profile-copy{max-width:145px}.topbar .profile-copy strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block}}
@media(max-width:600px){.topbar .theme-toggle [data-theme-label]{display:none}.topbar .theme-toggle{min-width:44px}.topbar-right{flex-wrap:nowrap}}

/* Revisão 2: superfícies e estados compartilhados, sem inverter imagens. */
:root[data-theme="light"]{--on-action:#fff;--link:#50308e;--positive:#14633b;--positive-bg:#e8f5ed;--warning-ink:#795000;--warning-bg:#fff4d6;--negative:#a82039;--negative-bg:#fff0f2;--info-ink:#155876;--info-bg:#e7f3fa;--purple-ink:#62348e;--purple-bg:#f2eafa;--neutral-ink:#475569;--neutral-bg:#edf1f6;--hover:#edf1f9;--focus:#6e40bd}
:root[data-theme="dark"]{--on-action:#fff;--link:#d0b1ff;--positive:#9af4b8;--positive-bg:#143b30;--warning-ink:#ffe084;--warning-bg:#3c321c;--negative:#ff9aae;--negative-bg:#401e2b;--info-ink:#8de7ff;--info-bg:#12384a;--purple-ink:#d5b6ff;--purple-bg:#302147;--neutral-ink:#c6d2e3;--neutral-bg:#233047;--hover:#182b45;--focus:#c5a2ff}
html[data-theme] :is(.glass,.event-card,.event-body,.form-card,.table-card,.state-empty,.state-error,.modal-card,.modal-body,.modal-header,.modal-footer,.dialog,.lang-menu,.profile-menu,.search-autocomplete){background:var(--surface);color:var(--text);border-color:var(--line)}
html[data-theme] :is(.event-body h3,.event-body h4,.field label,.form-label,.state-title,.modal-title,.section-title,.toolbar strong,.panel h2,.profile-item,.lang-item){color:var(--text)}
html[data-theme] :is(.event-meta,.event-meta span,.field-help,.state-desc,.form-hint,.page-head p,.nav-title,.sidebar-card p,.sidebar-footer,.table-hint,.text-muted){color:var(--muted)}
html[data-theme] :is(.event-foot,.modal-header,.modal-footer,.form-actions){border-color:var(--line)}
html[data-theme] :is(.sidebar .nav a,.sidebar .nav-group-toggle){color:var(--text)}
html[data-theme] :is(.sidebar .nav a:hover,.sidebar .nav-group-toggle:hover,.profile-item:hover,.lang-item:hover){background:var(--hover);color:var(--text)}
html[data-theme] :is(.sidebar .nav a.active,.sidebar .nav-sub-item.active>a:not(.nav-sub-add),.lang-item.is-active){background:var(--theme-accent-soft);color:var(--link);border-color:var(--line-strong);box-shadow:none}
html[data-theme] :is(.sidebar-card,.nav-group-indicator,.nav-sub-add,.kbd,.lang-code){background:var(--surface-2);color:var(--muted);border-color:var(--line)}
html[data-theme] .sidebar-card h4{color:var(--text)}
html[data-theme="light"] .brand img{background:#101d32;border-radius:10px;padding:6px;height:50px;max-width:100%;object-fit:contain}
/* O logo administrativo possui letras claras. A placa preserva sua imagem original. */
html[data-theme] :is(.btn-primary,.btn-purple){background:#61269d;color:#fff;border-color:#61269d;box-shadow:none}
html[data-theme] .btn-secondary{background:#146776;color:#fff;border-color:#146776;box-shadow:none}
html[data-theme] .btn-orange{background:#a34700;color:#fff;border-color:#a34700;box-shadow:none}
html[data-theme] :is(.btn-ghost,.btn-outline-blue,.action-dots,.view-toggle .btn){background:var(--surface-2);color:var(--text);border-color:var(--line-strong)}
html[data-theme] :is(.view-toggle .btn.active,.view-toggle .btn.is-active,.view-toggle [aria-pressed="true"]){background:var(--theme-accent-soft);color:var(--link);border-color:var(--theme-accent)}
html[data-theme] .btn:disabled{opacity:.55;transform:none;filter:none}
html[data-theme] :is(.badge-success,.btn-success,.flash.badge-success){color:var(--positive);background:var(--positive-bg);border-color:var(--positive)}
html[data-theme] :is(.badge-warning,.badge-orange,.flash.badge-warning){color:var(--warning-ink);background:var(--warning-bg);border-color:var(--warning-ink)}
html[data-theme] :is(.badge-danger,.btn-danger,.flash.badge-danger){color:var(--negative);background:var(--negative-bg);border-color:var(--negative)}
html[data-theme] .badge-info{color:var(--info-ink);background:var(--info-bg);border-color:var(--info-ink)}
html[data-theme] .badge-violet{color:var(--purple-ink);background:var(--purple-bg);border-color:var(--purple-ink)}
html[data-theme] :is(.badge-neutral,.badge-muted){color:var(--neutral-ink);background:var(--neutral-bg);border-color:var(--line-strong)}
html[data-theme] :is(.text-success){color:var(--positive)}html[data-theme] .text-warning{color:var(--warning-ink)}html[data-theme] :is(.text-danger,.field-error){color:var(--negative)}
html[data-theme] :is(.btn-primary,.btn-purple,.btn-secondary,.btn-orange) .icon{filter:brightness(0) invert(1);opacity:1}
html[data-theme] .profile-avatar{color:#fff}
html[data-theme="light"] .event-cover{background:linear-gradient(135deg,#e9edf7,#eee5f8)}
html[data-theme="light"] .event-cover:has(>img){background:#f1f3f9}
/* Cartões de pessoas sem foto: evita um grande bloco vazio em degradê. */
html[data-theme] :is(#jurados-cards,#usuarios-cards) .event-cover--quadrado:not(:has(img)){aspect-ratio:16/9}
html[data-theme] :is(input.input,select.select,textarea.input,textarea.textarea,.search,.ts-wrapper .ts-control,.ts-wrapper.single.input-active .ts-control,.ts-wrapper.single.focus .ts-control,.ts-wrapper.focus .ts-control){background:var(--surface);color:var(--text);border-color:var(--line-strong)}
html[data-theme] .ts-wrapper.select{background:transparent;border:0}
html[data-theme] :is(input,textarea)::placeholder{color:var(--muted);opacity:1}
html[data-theme] :is(select option,.ts-dropdown,.ts-dropdown .ts-dropdown-content,.ts-dropdown .optgroup-header){background:var(--surface);color:var(--text)}
html[data-theme] :is(.ts-wrapper.multi .ts-control>div,.ts-wrapper .ts-control .item,.ts-dropdown .option.active,.ts-dropdown .option:hover){background:var(--theme-accent-soft);color:var(--link);border-color:var(--line-strong)}
html[data-theme] :is(input,select,textarea):disabled{background:var(--surface-2);color:var(--muted);opacity:1}
html[data-theme] :is(.input.is-invalid,.select.is-invalid,[aria-invalid="true"]){border-color:var(--negative)}
html[data-theme] :is(.data-table,.main .tabulator,.main .tabulator .tabulator-tableholder,.main .tabulator .tabulator-footer){background:var(--surface);color:var(--text);border-color:var(--line)}
html[data-theme] :is(.data-table th,.main .tabulator .tabulator-header,.main .tabulator .tabulator-header .tabulator-col,.main .tabulator .tabulator-footer .tabulator-page){background:var(--surface-2);color:var(--text);border-color:var(--line)}
html[data-theme] :is(.data-table td,.main .tabulator .tabulator-cell){color:var(--text);border-color:var(--line)}
html[data-theme] .main .tabulator .tabulator-row{background:var(--surface)!important;color:var(--text)}
html[data-theme] .main .tabulator .tabulator-row.tabulator-row-even{background:var(--surface-2)!important}
html[data-theme] .main .tabulator .tabulator-row:hover{background:var(--hover)!important}
html[data-theme] .main .tabulator .tabulator-row.tabulator-selected{background:var(--theme-accent-soft)!important}
html[data-theme] .main .tabulator .tabulator-footer .tabulator-page.active{color:var(--link);border-color:var(--theme-accent)}
html[data-theme] .finance-management-report .finance-entry{--entry-color:var(--neutral-ink);--entry-bg:var(--neutral-bg)}
html[data-theme] .finance-management-report .finance-entry--received{--entry-color:var(--positive);--entry-bg:var(--positive-bg)}
html[data-theme] .finance-management-report .finance-entry--pending{--entry-color:var(--warning-ink);--entry-bg:var(--warning-bg)}
html[data-theme] .finance-management-report .finance-entry--overdue{--entry-color:var(--negative);--entry-bg:var(--negative-bg)}
html[data-theme] .finance-management-report .finance-entry--review{--entry-color:var(--info-ink);--entry-bg:var(--info-bg)}
html[data-theme] .finance-management-report .finance-entry--reversed{--entry-color:var(--purple-ink);--entry-bg:var(--purple-bg)}
html[data-theme] :is(.btn,a,input,select,textarea,summary,[tabindex]):focus-visible{outline:3px solid var(--focus);outline-offset:3px}
/* Área pública: compras, cadastro, conta e acordos acompanham a mesma paleta. */
html[data-theme] :is(.public-event,.public-event-body,.public-service-card,.public-category-card,.public-login-card,.security-card,.public-registration-shell,.public-registration-total,.integrante-bloco,.my-registration-card,.my-registration-detail__section,.my-registration-detail__summary,.my-registration-member,.my-registrations__filters,.my-registrations__empty,.participant-agreement,.participant-agreements__filters,.agreement-installment,.agreement-payment-panel,.agreement-open-installment,.agreement-financial-details dl,.agreement-installment__facts>div,.public-profile-form,.public-profile-notifications,.discover-card,.discover-producer,.public-account-dropdown,.public-auth-split,.public-register-card .doc-item){background:var(--surface);color:var(--text);border-color:var(--line)}
html[data-theme] :is(.public-event-body,.public-login-card,.security-card,.public-registration-shell,.my-registration-card,.my-registration-detail,.participant-agreement,.public-profile-form,.discover-card) :is(h1,h2,h3,h4,label,dt,dd,strong){color:var(--text)}
html[data-theme] :is(.public-event-body,.public-login-card,.security-card,.public-registration-shell,.my-registration-card,.my-registration-detail,.participant-agreement,.public-profile-form,.discover-card) :is(p,small){color:var(--muted)}
html[data-theme] :is(.public-account-dropdown a,.public-account-dropdown button){color:var(--text)}
html[data-theme] :is(.public-account-dropdown a:hover,.public-account-dropdown button:hover){background:var(--hover)}
html[data-theme] :is(.public-home .public-input,.public-field input,.public-field select,.public-login-form .public-input,.public-auth-split .public-login-form .public-input,.my-registrations__filters input,.my-registrations__filters select,.participant-agreements__filters select,.public-profile-form .input,.discover-search input,.agreement-pix__code input){background:var(--surface);color:var(--text);border-color:var(--line-strong)}
html[data-theme] body.public-page :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),select,textarea){background:var(--surface);color:var(--text);border-color:var(--line-strong)}
html[data-theme] :is(.public-secondary-button,.cart-button--secondary,.cart-button--ghost,.my-registration-button--secondary,.public-card-action--edit,.discover-button--light,.discover-button--outline,.discover-controls button,.agreement-quick-filters a,.home-carousel-arrow,.home-shelf-arrow,.public-home .category-chip){background:var(--surface-2);color:var(--text);border-color:var(--line-strong)}
html[data-theme] :is(.my-registration-status--warning,.participant-agreement__status[data-status="ativo"]){color:var(--warning-ink);background:var(--warning-bg)}
html[data-theme] :is(.my-registration-status--danger,.participant-agreement__status[data-status="cancelado"],.my-registration-button--danger){color:var(--negative);background:var(--negative-bg)}
html[data-theme] .my-registration-status--neutral{color:var(--neutral-ink);background:var(--neutral-bg)}
/* QR codes precisam de fundo branco para leitura, em ambos os temas. */
html[data-theme] :is(.agreement-pix>img,.pix-result-card__qr,[data-totp-qr]){background:#fff;padding:12px;border-radius:8px}
@media print{html[data-theme] body{background:#fff;color:#111}html[data-theme] .theme-toggle{display:none}html[data-theme] .finance-management-report .finance-status{color:#111;background:#fff;border-color:#777}}
html[data-theme] :is(.modal,.ux-status-dialog,.report-pivot,.file-dropzone__surface){background:var(--surface);color:var(--text);border-color:var(--line)}
html[data-theme] .finance-management-report .finance-entry--cancelled{--entry-color:var(--neutral-ink);--entry-bg:var(--neutral-bg)}
html[data-theme] .report-warning{background:var(--warning-bg);color:var(--warning-ink);border-color:var(--warning-ink)}
html[data-theme] .public-header :is(.public-profile-name,.public-profile-link){color:var(--text)}

/* Revisão 3: indicadores e gráficos do dashboard, inclusive painéis antigos. */
html[data-theme] :is(.kpi,.chart-card,.mini-stat,.dash-count,.dash-shortcut-grid a){background:var(--surface);color:var(--text);border-color:var(--line)}
html[data-theme] :is(.kpi-label,.kpi-value,.mini-stat strong,.chart-card h2,.chart-card h3,.dash-count strong){color:var(--text)}
html[data-theme] :is(.kpi-sub,.mini-stat span,.chart-sub,.chart-legend,.dash-count span,.dash-count small){color:var(--muted)}
html[data-theme] .trend{color:var(--positive);background:var(--positive-bg)}
html[data-theme] .trend.down{color:var(--negative);background:var(--negative-bg)}
html[data-theme] .kpi-actions .btn{background:var(--surface-2);color:var(--text);border-color:var(--line-strong)}
html[data-theme="light"] .kpi-icon{background:var(--surface-2);border-color:var(--line-strong);box-shadow:none}
html[data-theme="light"] .kpi-icon .icon-lg{background-color:var(--link)}
html[data-theme="light"] .sparkline polyline{stroke:var(--link);filter:none}
html[data-theme="light"] .kpi::after{background:var(--line);filter:none}
html[data-theme] .kpi-actions .btn:hover{background:var(--hover)}

/* Revisão 4: a home de descoberta define suas próprias cores locais. */
html[data-theme] .discovery-home{--discover-ink:var(--text);--discover-muted:var(--muted);--discover-purple:var(--link);--discover-line:var(--line);color:var(--text)}
html[data-theme] .discovery-home :is(h1,h2,h3,h4,.discover-search label){color:var(--text)}
html[data-theme] .discovery-home :is(.discover-intro p,.discover-search small,.discover-card__location p,.discover-card__location small,.discover-producer__resources p,.discover-producer__resources article>span){color:var(--muted)}
html[data-theme] .discovery-home :is(.discover-search>div,.discover-category-grid a,.discover-card__body,.discover-card__art,.discover-banner__copy,.discover-producer,.discover-empty){background:var(--surface);color:var(--text);border-color:var(--line)}
html[data-theme] .discovery-home :is(.discover-category-grid a:hover,.discover-category-grid a[aria-current="true"],.discover-filter-state a){background:var(--theme-accent-soft);color:var(--link);border-color:var(--line-strong)}
html[data-theme] .discovery-home :is(.discover-search input,.discover-controls button){background:var(--surface);color:var(--text);border-color:var(--line-strong)}
html[data-theme] .discovery-home :is(.discover-search button,.discover-button:not(.discover-button--light):not(.discover-button--outline)){background:#61269d;color:#fff;border-color:#61269d}
html[data-theme="dark"] .public-logo img{background:#fff;border-radius:8px;padding:4px;object-fit:contain}
html[data-theme] .public-header{height:auto;min-height:58px}
html[data-theme] .public-header .public-header-inner{padding-top:8px;padding-bottom:8px}
html[data-theme] .discovery-home :is(.discover-eyebrow,.discover-card time,.discover-card__price,.discover-reset){color:var(--link)}
html[data-theme] .discovery-home :is(.discover-account,.discover-producer__resources article){border-color:var(--line)}
/* Central de músicas e manutenção seguem a paleta compartilhada. */
html[data-theme] .music-page{color:var(--text)}
html[data-theme] .music-page :is(h1,h2,h3,label,strong,summary){color:var(--text)}
html[data-theme] .music-page :is(p,small){color:var(--muted)}
html[data-theme] :is(.music-filters,.music-summary a,.student-music-card,.music-page tbody tr){background:var(--surface);color:var(--text);border-color:var(--line)}
html[data-theme] .music-page :is(input,select,textarea){background:var(--surface);color:var(--text);border:1px solid var(--line-strong);border-radius:8px;padding:10px;width:100%;box-sizing:border-box}
html[data-theme] .music-page textarea{min-height:80px;resize:vertical}
html[data-theme] .music-page :is(th,.music-pagination a){background:var(--surface-2);color:var(--text);border-color:var(--line)}
html[data-theme] .music-page :is(td,th){border-color:var(--line)}
html[data-theme] .music-page .music-state--enviada{color:var(--positive);background:var(--positive-bg)}
html[data-theme] .music-page :is(.music-state--pendente,.music-state--externa){color:var(--warning-ink);background:var(--warning-bg)}
html[data-theme] .music-page .music-state--indisponivel{color:var(--negative);background:var(--negative-bg)}
