/*
 * Contraste contextual do sistema.
 * Regra visual: texto claro somente em superfícies escuras; superfícies claras
 * recebem texto escuro e campos compatíveis com o próprio fundo.
 */

/* Cadastro e edição de usuários: janela escura, campos escuros e texto claro. */
.users-access-dialog,
.users-access-dialog form,
.users-access-dialog table {
  color: #edf6ff;
}

.users-access-dialog h2,
.users-access-dialog h3,
.users-access-dialog td,
.users-access-dialog p,
.users-access-dialog [data-note] {
  color: #edf6ff;
}

.users-access-dialog label,
.users-access-dialog .record-form label,
.users-access-dialog small,
.users-access-dialog th {
  color: #b9cde0;
}

.users-access-dialog input:not([type="checkbox"]):not([type="radio"]),
.users-access-dialog select,
.users-access-dialog textarea {
  color-scheme: dark;
  background: #07152d;
  border-color: #4c7097;
  color: #f3f8ff;
}

.users-access-dialog input::placeholder,
.users-access-dialog textarea::placeholder {
  color: #9db1c7;
  opacity: 1;
}

.users-access-dialog select option {
  background: #07152d;
  color: #f3f8ff;
}

.users-access-dialog input[type="checkbox"],
.users-access-dialog input[type="radio"] {
  accent-color: #178cff;
}

/* Formulários gerais e lançamentos financeiros usam cartões escuros. */
.modal,
.record-card {
  color: #edf6ff;
}

.modal h2,
.modal h3,
.record-card h2,
.record-card h3,
.record-card p,
.record-card b,
.record-card a {
  color: #edf6ff;
}

.modal label,
.modal small,
.record-card label,
.record-card small,
.record-form label,
.purchase-grid label {
  color: #b9cde0;
}

.modal input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.modal select,
.modal textarea,
.record-card input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.record-card select,
.record-card textarea {
  color-scheme: dark;
  background: #07152d;
  border-color: #4c7097;
  color: #f3f8ff;
}

.modal input::placeholder,
.modal textarea::placeholder,
.record-card input::placeholder,
.record-card textarea::placeholder {
  color: #9db1c7;
  opacity: 1;
}

.modal select option,
.record-card select option {
  background: #07152d;
  color: #f3f8ff;
}

.modal-close,
.record-close {
  color: #c7d8e8;
}

.record-card .dossier-info span {
  color: #dceafa;
}

/* Financeiro: todo controle branco usa texto escuro e todo controle escuro usa texto claro. */
#financeiro input:not([type="checkbox"]):not([type="radio"]),
#financeiro select,
#financeiro textarea {
  background: #ffffff !important;
  border-color: #b9c9da !important;
  color: #152b42 !important;
  color-scheme: light;
}

#financeiro input::placeholder,
#financeiro textarea::placeholder {
  color: #66798d !important;
  opacity: 1;
}

#financeiro select option {
  background: #ffffff !important;
  color: #152b42 !important;
}

#financeiro .receipt-price-input {
  width: 112px !important;
  margin-top: 0 !important;
  text-align: right;
  font-weight: 800;
}

#financeiro .receipt-price-input:not([readonly]) {
  border: 2px solid #17945b !important;
  box-shadow: 0 0 0 2px rgba(23, 148, 91, 0.12);
}

#financeiro .receipt-price-input[readonly] {
  background: #e7eeea !important;
  color: #355447 !important;
  cursor: not-allowed;
}

.record-card input[type="file"] {
  background: #ffffff !important;
  border: 1px solid #b9c9da !important;
  color: #152b42 !important;
  color-scheme: light;
}

.record-card input[type="file"]::file-selector-button {
  background: #dfeaf5;
  border: 0;
  border-right: 1px solid #b9c9da;
  color: #10263e;
  font-weight: 800;
}

.record-card .selected-expense-list,
.record-card .selected-expense-list p,
.record-card .selected-expense-list span,
.record-card .selected-expense-list b,
.record-card .selected-expense-list strong {
  color: #152b42 !important;
}

.record-card .payment-existing-note,
.record-card .payment-existing-note * {
  color: #175f3d !important;
}

/* Resultados da busca de atletas ficam em painel claro, mesmo dentro dos modais escuros. */
#financeiro .athlete-suggestions,
.record-card .athlete-suggestions {
  background: #ffffff !important;
  border-color: #9fb3c7 !important;
  color-scheme: light;
}

#financeiro .athlete-suggestions button,
.record-card .athlete-suggestions button,
#financeiro .athlete-suggestions button b,
.record-card .athlete-suggestions button b {
  background: #ffffff !important;
  color: #152b42 !important;
}

#financeiro .athlete-suggestions button small,
.record-card .athlete-suggestions button small {
  color: #52677d !important;
}

#financeiro .athlete-suggestions button:hover,
#financeiro .athlete-suggestions button:focus-visible,
.record-card .athlete-suggestions button:hover,
.record-card .athlete-suggestions button:focus-visible {
  background: #e4f3ea !important;
  color: #123d2b !important;
}

#financeiro .athlete-suggestions .new-athlete-option,
.record-card .athlete-suggestions .new-athlete-option {
  color: #12643f !important;
}

/* Autocadastro: campos claros mantêm texto escuro; o restante acompanha o diálogo escuro. */
.self-registration-dialog,
.self-registration-dialog h2,
.self-registration-dialog h3,
.self-registration-dialog legend {
  color: #edf6ff;
}

.self-registration-dialog label,
.self-registration-dialog [data-content] > p {
  color: #bfd0e1;
}

.self-registration-dialog input:not([type="checkbox"]):not([type="radio"]),
.self-registration-dialog select,
.self-registration-dialog textarea {
  color-scheme: light;
  background: #ffffff;
  border-color: #9fb0c0;
  color: #172c3f;
}

.self-registration-dialog input::placeholder,
.self-registration-dialog textarea::placeholder {
  color: #617487;
  opacity: 1;
}

.self-registration-dialog select option {
  background: #ffffff;
  color: #172c3f;
}

.self-registration-terms,
.self-registration-terms label {
  color: #d8e6f2;
}

.self-registration-pending article,
.registration-request-list article {
  background: #f8fbff;
  border-color: #c8d6e4;
  color: #1b344a;
}

.self-registration-pending article span,
.self-registration-pending article small,
.registration-request-list span,
.registration-request-list small {
  color: #405a70;
}

/* Diálogos escuros auxiliares. */
.account-email-dialog h2,
.account-email-dialog h3,
.access-context-dialog h2,
.access-context-dialog h3,
.user-profile-dialog h2,
.user-profile-dialog h3 {
  color: #f3f8ff;
}

.account-email-dialog label,
.access-context-dialog form label,
.user-profile-dialog label {
  color: #bfd0e1;
}

.account-email-dialog input,
.access-context-dialog form input,
.user-profile-dialog input {
  color-scheme: dark;
  background: #07152d;
  border-color: #4c7097;
  color: #f3f8ff;
}

.account-email-dialog input::placeholder,
.access-context-dialog input::placeholder,
.user-profile-dialog input::placeholder {
  color: #9db1c7;
  opacity: 1;
}

.account-email-dialog p,
.access-context-dialog > div > p,
.access-context-dialog form > p,
.user-profile-dialog p,
.user-profile-dialog dt,
.user-profile-dialog dd {
  color: #b6c9dc;
}

.access-context-card {
  background: #f8fbff;
  border-color: #bfd0df;
  color: #173046;
}

.access-context-card strong,
.access-context-card small {
  color: #28485e;
}

.access-context-card:hover,
.access-context-card:focus-visible {
  background: #eaf4fc;
  color: #102a40;
}

/* Festival: cabeçalhos e barras claras nunca recebem títulos brancos. */
.festival-editor-head,
.festival-toolbar {
  color: #172c3f;
}

.festival-editor-head h2,
.festival-editor-head h3,
.festival-editor-head p,
.festival-editor-head .muted {
  color: #172c3f;
}

.festival-editor input,
.festival-editor select,
.festival-editor textarea,
.festival-sponsors-dialog input,
.festival-sponsors-dialog select,
.festival-sponsors-dialog textarea {
  color-scheme: light;
  background: #ffffff;
  color: #172c3f;
}

.festival-editor input::placeholder,
.festival-editor textarea::placeholder,
.festival-sponsors-dialog input::placeholder,
.festival-sponsors-dialog textarea::placeholder {
  color: #617487;
  opacity: 1;
}

.festival-editor select option,
.festival-sponsors-dialog select option {
  background: #ffffff;
  color: #172c3f;
}

/* Série: elementos claros internos usam tipografia escura. */
.series-dialog input:not([type="checkbox"]),
.series-dialog select,
.series-dialog textarea {
  color-scheme: light;
  background: #ffffff;
  color: #172f21;
}

.series-dialog input::placeholder,
.series-dialog textarea::placeholder {
  color: #607466;
  opacity: 1;
}

.series-dialog select option {
  background: #ffffff;
  color: #172f21;
}

.series-score,
.series-score b,
.series-score span,
.series-score p {
  color: #173524;
}

.series-table-wrap th {
  color: #314f3d;
}

/* Patrocinadores: formulário é uma superfície branca completa. */
.sponsor-modal {
  color-scheme: light;
  color: #172c3f;
}

.sponsor-modal h2,
.sponsor-modal h3,
.sponsor-modal label {
  color: #172c3f;
}

.sponsor-modal .muted,
.sponsor-modal small {
  color: #526a7d;
}

.sponsor-modal input,
.sponsor-modal select,
.sponsor-modal textarea {
  background: #ffffff;
  border-color: #aebdca;
  color: #172c3f;
}

.sponsor-modal input::placeholder,
.sponsor-modal textarea::placeholder {
  color: #617487;
  opacity: 1;
}

.sponsor-modal select option {
  background: #ffffff;
  color: #172c3f;
}

.sponsor-panel .sponsor-table th {
  color: #3e5749;
}

.sponsor-panel .sponsor-empty,
.sponsor-panel .sponsor-empty h3 {
  color: #dceafa;
}

/* Configurações financeiras permanecem claras com conteúdo escuro. */
.finance-config,
.new-config-panel {
  color-scheme: light;
  color: #172c3f;
}

.finance-config h2,
.finance-config h3,
.finance-config h4,
.finance-config b,
.new-config-panel h2,
.new-config-panel h3,
.new-config-panel h4,
.new-config-panel b {
  color: #172c3f;
}

.finance-config .config-heading p,
.finance-config .config-item small,
.finance-config .empty-line,
.finance-config .history-head,
.new-config-panel p,
.new-config-panel small,
.new-config-panel label {
  color: #526a7d;
}

/* Textos auxiliares do editor de Festival ficam sobre o painel noturno. */
.festival-editor .festival-section p,
.festival-editor .festival-section .muted {
  color: #b9cde0;
}

/* Organizações são cartões claros dentro do painel administrativo escuro. */
.organization-card,
.organization-card.active {
  color-scheme: light;
  background: #f8fbff;
  border-color: #c6d5e2;
  color: #172c3f;
}

.organization-card.active {
  background: #eaf6ef;
  border-color: #2c8a5c;
}

.organization-card strong,
.organization-card b,
.organization-card small,
.organization-card > span:not(.organization-card-state),
.organization-card em {
  color: #29485d;
}

.organization-card-state {
  background: #e4ebf1;
  color: #40586b;
}

.organization-panel-head label {
  color: #b8cde0;
}

.users-access-table th button[data-sort-users] {
  color: #a9c2da;
}

.users-access-table th button[data-direction="asc"],
.users-access-table th button[data-direction="desc"] {
  color: #75c0ff;
}

/* Cartões de time e opções de campeonato que usam fundo noturno. */
.team-empty,
.team-empty p,
.new-champ,
.new-champ small,
.champ-info p {
  color: #aec4d9;
}

.team-empty h3,
.team-card-body h3,
.team-summary b,
.new-champ b {
  color: #f4f9ff;
}

.team-card-body p,
.team-summary span {
  color: #a9bfd5;
}

/* Súmula: toda superfície clara usa texto escuro; instruções no painel noturno usam texto claro. */
.match-editor .match-side > h3 {
  color: #18364a;
}

.match-editor .match-side th,
.match-editor .match-side th label,
.match-editor .match-side th span {
  color: #294e68;
}

.match-editor .match-goal,
.match-editor .match-goal span,
.match-editor .match-goal b,
.match-editor .match-goal label {
  color: #173348;
}

.match-editor .match-goals > p {
  color: #b9cde0;
}

.match-editor .match-form > p,
.match-editor .lineup-manager > p,
.match-editor .tactical-team-heading small,
.match-editor .lineup-events,
.match-editor .lineup-events [data-events] {
  color: #b9cde0;
}

.match-editor .lineup-events h3 {
  color: #f4f9ff;
}

.match-editor .match-item-tools,
.match-editor .match-item-tools small,
.match-editor .pending-assist,
.match-editor .pending-assist small {
  color: #294e3d;
}

.match-editor .lineup-out,
.match-editor .lineup-out h3,
.match-editor .lineup-out [data-slots]:empty::after {
  color: #68352f;
}

.match-editor > label,
.match-editor .match-form > label {
  color: #c1d3e4;
}

/* Visão geral da súmula da Série: contraste consistente entre faixas claras e o painel noturno. */
.series-overview-summary p {
  color: #b9cde0;
}

.classification-panel > h3 {
  color: #f4f9ff;
}

.classification-season,
.classification-season span,
.classification-season strong,
.classification-season small {
  color: #183247;
}

.classification-season strong {
  font-weight: 800;
}

.classification-panel thead th {
  color: #b9cde0;
  font-weight: 800;
}

.classification-panel tbody th,
.classification-panel tbody td,
.classification-panel .classification-club,
.classification-panel .classification-club > span:last-child {
  color: #edf6ff;
}

.classification-panel .classification-rank {
  color: #b8cce0;
}

.classification-panel th,
.classification-panel td {
  border-bottom-color: #416181;
}

.classification-panel .classification-legend,
.classification-panel .classification-note {
  color: #bdd0e2;
}

.classification-panel .classification-club small {
  color: #82d9ad;
}

.ranking-card h3 {
  color: #174d37;
}

.ranking-card thead th {
  color: #b9cde0;
  font-weight: 800;
}

.ranking-card tbody th,
.ranking-card tbody td {
  color: #edf6ff;
}

.ranking-card th,
.ranking-card td {
  border-bottom-color: #416181;
}

.ranking-card .ranking-value {
  color: #8ed0ff;
}

.ranking-card p {
  color: #bdd0e2;
}

/* Cabeçalhos claros genéricos usados por tabelas dentro do tema noturno. */
.sponsor-table th,
.series-table-wrap th,
.cup-dialog table thead th,
.recent-finance-table thead th {
  font-weight: 800;
}

@media (max-width: 680px) {
  .users-access-dialog {
    padding: 18px;
  }
}
