/* Modo escuro — paleta derivada do azul da logo do PIT (#33538e). */

.theme-toggle {
    cursor: pointer;
}

.theme-toggle-footer {
    clear: both;
    float: none !important;
    text-align: center;
}

html[data-theme="dark"] {
    color-scheme: dark;
    /* Só os tons usados como texto sobre fundo escuro são clareados;
       --white, --gray-100 e --gray-300 continuam claros porque também
       servem de texto sobre botões e barras coloridas. */
    --black: #f2f5fb;
    --gray-600: #b4bfd6;
    --gray-500: #98a6c3;
    --gray-400: #8795b3;
    --dm-bg: #0e1527;
    --dm-surface: #162038;
    --dm-surface-2: #1c2943;
    --dm-text: #e3e9f5;
    --dm-accent: #8fadea;
    --dm-border: #2b3a5c;
    --dm-logo: #33538e;
}

html[data-theme="dark"] body { background: var(--dm-bg) !important; color: var(--dm-text); }

html[data-theme="dark"] a,
html[data-theme="dark"] a:active { color: var(--dm-accent); }
html[data-theme="dark"] a:hover { color: #fff; }

html[data-theme="dark"] h1,
html[data-theme="dark"] h2 { color: #fff; }
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] fieldset.module h2,
html[data-theme="dark"] .box *+h3,
html[data-theme="dark"] .box *+h3 a,
html[data-theme="dark"] .box .lista h3 a,
html[data-theme="dark"] .box>div.info>h2:first-child a,
html[data-theme="dark"] .box>div.info>h3:first-child a,
html[data-theme="dark"] th a,
html[data-theme="dark"] .pagination li a,
html[data-theme="dark"] .tabs li.active a,
html[data-theme="dark"] .tabs a:hover,
html[data-theme="dark"] .addlink,
html[data-theme="dark"] .changelink,
html[data-theme="dark"] footer nav a,
html[data-theme="dark"] div#changelist-filter li.selected a { color: var(--dm-accent) !important; }
html[data-theme="dark"] .box h3:hover,
html[data-theme="dark"] .box h3:hover a,
html[data-theme="dark"] footer nav a:hover,
html[data-theme="dark"] .addlink:hover,
html[data-theme="dark"] .changelink:hover { color: #fff !important; }
html[data-theme="dark"] .addlink:hover,
html[data-theme="dark"] .changelink:hover { background: var(--dm-logo); }

html[data-theme="dark"] .tabs,
html[data-theme="dark"] fieldset.module h2,
html[data-theme="dark"] .tabs li.active,
html[data-theme="dark"] .box .lista li,
html[data-theme="dark"] .addlink,
html[data-theme="dark"] .changelink,
html[data-theme="dark"] #changelist-filter li.selected { border-color: var(--dm-accent) !important; }
html[data-theme="dark"] .tabs li.active { border-bottom-color: var(--dm-bg) !important; }

/* Cabeçalho: placa clara para manter a logo colorida legível */
html[data-theme="dark"] header { background: #e9eef8; }
html[data-theme="dark"] header h1 a { color: var(--dm-logo); }
html[data-theme="dark"] header h1 a:hover { color: #1f3a6e; }
html[data-theme="dark"] header h1 a span { color: #8d9bb8; }
html[data-theme="dark"] #about,
html[data-theme="dark"] #about a { color: #46567a; }

/* Superfícies */
html[data-theme="dark"] section,
html[data-theme="dark"] .popup,
html[data-theme="dark"] .modalDialog>div,
html[data-theme="dark"] #changelist-filter,
html[data-theme="dark"] .general-box .title,
html[data-theme="dark"] .general-box span.status,
html[data-theme="dark"] .submit-row input[name="_addanother"],
html[data-theme="dark"] .submit-row input[name="_continue"] { background: var(--dm-bg); }
html[data-theme="dark"] fieldset,
html[data-theme="dark"] #changelist #toolbar,
html[data-theme="dark"] .searchbar-and-filters,
html[data-theme="dark"] .box ol li,
html[data-theme="dark"] .tags li,
html[data-theme="dark"] code { background: var(--dm-surface); }
html[data-theme="dark"] code { border-color: var(--dm-border); color: var(--dm-text); }
html[data-theme="dark"] .tags li,
html[data-theme="dark"] dd .tags li { color: var(--dm-text); }
html[data-theme="dark"] .searchbar-and-filters input[type="submit"] { background: var(--dm-logo); }

/* Barras do topo */
html[data-theme="dark"] #user-tools { background: #0a101e; }
html[data-theme="dark"] #user-tools a { color: var(--dm-text); }
html[data-theme="dark"] #user-tools a:hover { color: #b7ea5a; }
html[data-theme="dark"] #user-tools li:last-child a { color: #fff; }
html[data-theme="dark"] #user-tools li:last-child:hover { background: #fff; }
html[data-theme="dark"] #user-tools li:last-child:hover a { color: #c0392b; }
html[data-theme="dark"] #view>div { background: var(--dm-logo); }
html[data-theme="dark"] #view li { border-right-color: var(--dm-bg); }
html[data-theme="dark"] #view li.float-right { border-left-color: var(--dm-bg); }
html[data-theme="dark"] #view li a:hover,
html[data-theme="dark"] #view li.main a:hover { background: var(--dm-bg); color: #fff; }

/* Menu lateral do admin */
html[data-theme="dark"] aside { background-color: #121b30; }
html[data-theme="dark"] aside>ul>li,
html[data-theme="dark"] aside li li { border-color: var(--dm-border); }
html[data-theme="dark"] aside li li a { background: var(--dm-surface); color: var(--dm-text); }
html[data-theme="dark"] aside a:hover { background: var(--dm-surface-2); color: #fff; }

/* Botões */
html[data-theme="dark"] button:hover,
html[data-theme="dark"] input[type="button"]:hover,
html[data-theme="dark"] input[type="submit"]:hover { background: var(--dm-accent); color: var(--dm-bg); }
html[data-theme="dark"] .btn,
html[data-theme="dark"] .object-tools a { color: var(--dm-text); border-color: var(--gray-500); }
html[data-theme="dark"] .btn.primary,
html[data-theme="dark"] .object-tools .primary,
html[data-theme="dark"] #changelist .paginator span { color: var(--dm-accent); border-color: var(--dm-accent); }
html[data-theme="dark"] .btn:hover,
html[data-theme="dark"] .object-tools a:hover,
html[data-theme="dark"] .submit-row input[name="_addanother"]:hover,
html[data-theme="dark"] .submit-row input[name="_continue"]:hover,
html[data-theme="dark"] tr:hover .btn,
html[data-theme="dark"] tr:hover .object-tools a,
html[data-theme="dark"] .primary:hover { background: var(--dm-accent); border-color: var(--dm-accent); color: var(--dm-bg) !important; }
html[data-theme="dark"] .btn.danger,
html[data-theme="dark"] .object-tools .danger { color: #ff8a7d; border-color: #ff8a7d; }
html[data-theme="dark"] .btn.danger:hover,
html[data-theme="dark"] .object-tools .danger:hover { background: #c0392b; border-color: #c0392b !important; color: #fff !important; }

/* Formulários */
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="file"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="date"],
html[data-theme="dark"] input[type="url"],
html[data-theme="dark"] input[type="tel"],
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
    background-color: var(--dm-surface);
    border-color: #3a4866;
    color: var(--dm-text);
}
html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus { border-color: var(--dm-accent); }
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: var(--gray-400); }
html[data-theme="dark"] .toolbar_actions select { background: var(--dm-logo); color: #fff; }
html[data-theme="dark"] .form-row,
html[data-theme="dark"] .ctrlHolder { border-bottom-color: var(--dm-bg) !important; }
html[data-theme="dark"] .form-row.error,
html[data-theme="dark"] .ctrlHolder.error { background: rgba(231, 76, 60, 0.15); }

/* Tabelas */
html[data-theme="dark"] table { border-left-color: var(--dm-border); color: var(--dm-text); }
html[data-theme="dark"] td,
html[data-theme="dark"] th,
html[data-theme="dark"] #changelist table tbody td,
html[data-theme="dark"] #changelist table tbody th { border-color: var(--dm-border); }
html[data-theme="dark"] thead th { background: var(--dm-logo); color: #fff; }
html[data-theme="dark"] thead th a { color: #fff !important; }
html[data-theme="dark"] tr:nth-child(even) { background: rgba(255, 255, 255, 0.03); }
html[data-theme="dark"] table.info tr:nth-child(even),
html[data-theme="dark"] table.info tr:nth-child(odd) { background: rgba(143, 173, 234, 0.07); }
html[data-theme="dark"] tr.selected { background: rgba(241, 196, 15, 0.18); }
html[data-theme="dark"] td.disabled { background: #3a4866; }

/* Bordas claras viram bordas escuras */
html[data-theme="dark"] .box>div,
html[data-theme="dark"] .pagination li,
html[data-theme="dark"] .action-links a,
html[data-theme="dark"] .definition-list>div,
html[data-theme="dark"] .timeline li,
html[data-theme="dark"] ul.actionlist li,
html[data-theme="dark"] aside .etapas { border-color: var(--dm-border); }
html[data-theme="dark"] ul.messagelist li { border-bottom-color: var(--dm-bg); }

/* Avisos e mensagens */
html[data-theme="dark"] ul.messagelist li.error,
html[data-theme="dark"] ul.messagelist li.warning,
html[data-theme="dark"] .errornote,
html[data-theme="dark"] .alert-error { background: rgba(231, 76, 60, 0.18); color: #ff9a8f; }
html[data-theme="dark"] ul.messagelist li.info,
html[data-theme="dark"] .msg.info { background: rgba(143, 173, 234, 0.15); color: #a9c0f0; }
html[data-theme="dark"] .msg.alert,
html[data-theme="dark"] #errorMsg,
html[data-theme="dark"] .msg.alert:hover { background: rgba(241, 196, 15, 0.14); color: #e6c35a; }
html[data-theme="dark"] .errorlist li,
html[data-theme="dark"] .errorField,
html[data-theme="dark"] .asteriskField,
html[data-theme="dark"] .false,
html[data-theme="dark"] .False,
html[data-theme="dark"] .etapa.status_etapaatual,
html[data-theme="dark"] .etapa.status_marcoatual { color: #ff8a7d; }
html[data-theme="dark"] .none,
html[data-theme="dark"] .None { color: #e6c35a; }
html[data-theme="dark"] .box>div.success *+h3,
html[data-theme="dark"] .box>div.success *+h3 a { color: #5fd47a !important; }

html[data-theme="dark"] .formula p:last-child { border-top-color: var(--gray-500); }
html[data-theme="dark"] .breadcrumbs { background: var(--dm-surface); color: var(--gray-600); }

html[data-theme="dark"] .select2-container--default .select2-selection--single,
html[data-theme="dark"] .select2-container--default .select2-selection--multiple,
html[data-theme="dark"] .select2-dropdown { background-color: var(--dm-surface); border-color: #3a4866; }
html[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered,
html[data-theme="dark"] .select2-results__option { color: var(--dm-text); }
