/* ==========================================================
   NINA - APARÊNCIA / THEME SYSTEM
   Baseline: NinaV1Dom61

   This stylesheet is intentionally loaded AFTER module styles.
   It keeps the existing light theme intact and provides a single,
   centralized dark-theme compatibility layer. New UI components should
   prefer the --nina-* semantic tokens below instead of new fixed colors.
   ========================================================== */

:root {
    --nina-page: #F4F7F5;
    --nina-surface: #FFFFFF;
    --nina-surface-soft: #F7FAF8;
    --nina-surface-muted: #EEF3F1;
    --nina-border: #DCE5E1;
    --nina-border-strong: #BCCBC5;
    --nina-text: #17312B;
    --nina-text-secondary: #586963;
    --nina-text-muted: #71807C;
    --nina-accent: #0F5C4D;
    --nina-accent-hover: #083F35;
    --nina-accent-soft: #EAF4F1;
    --nina-success: #2F695B;
    --nina-success-soft: #EAF5EF;
    --nina-danger: #8B3434;
    --nina-danger-soft: #FFF5F5;
    --nina-warning: #806B3D;
    --nina-warning-soft: #FFF6DD;
    --nina-shadow: rgba(22, 49, 43, 0.10);
    --border-color: var(--nina-border);
    --surface: var(--nina-surface);
    --muted-text: var(--nina-text-muted);
}

html[data-theme-effective="dark"] {
    --nina-page: #0E1513;
    --nina-surface: #151F1C;
    --nina-surface-soft: #1A2622;
    --nina-surface-muted: #21302B;
    --nina-border: #344640;
    --nina-border-strong: #49615A;
    --nina-text: #EDF5F2;
    --nina-text-secondary: #B7C5C0;
    --nina-text-muted: #93A59F;
    --nina-accent: #82C7B4;
    --nina-accent-hover: #A2D8C9;
    --nina-accent-soft: #1A3931;
    --nina-success: #8CCCB4;
    --nina-success-soft: #17352B;
    --nina-danger: #F0AAAA;
    --nina-danger-soft: #382123;
    --nina-warning: #E1C681;
    --nina-warning-soft: #3A301B;
    --nina-shadow: rgba(0, 0, 0, 0.34);
    --border-color: var(--nina-border);
    --surface: var(--nina-surface);
    --muted-text: var(--nina-text-muted);
}


/* -------------------------
   Brand / logo
   ------------------------- */

.brand-logo-dark {
    display: none;
}

html[data-theme-effective="dark"] .brand-logo-light {
    display: none;
}

html[data-theme-effective="dark"] .brand-logo-dark {
    display: block;
    height: 48px;
    max-width: 170px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.16));
}

/* -------------------------
   Shared theme controls
   ------------------------- */

/* -------------------------
   Settings feedback
   ------------------------- */

.settings-messages {
    margin: 0 0 16px;
}

.settings-message {
    padding: 10px 12px;
    border: 1px solid var(--nina-border);
    border-radius: 9px;
    background: var(--nina-surface);
    color: var(--nina-text-secondary);
    font-size: 13px;
}


.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.theme-preference-form {
    margin-top: 18px;
}

.theme-choice-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
    border: 0;
}

.theme-choice {
    position: relative;
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    margin: 0;
    padding: 10px 11px;
    border: 1px solid var(--nina-border);
    border-radius: 10px;
    background: var(--nina-surface-soft);
    color: var(--nina-text-secondary);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.theme-choice:hover {
    border-color: var(--nina-accent);
}

.theme-choice:has(input:checked) {
    border-color: var(--nina-accent);
    background: var(--nina-accent-soft);
    color: var(--nina-text);
}

.theme-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.theme-choice:has(input:focus-visible) {
    outline: 3px solid color-mix(in srgb, var(--nina-accent) 30%, transparent);
    outline-offset: 2px;
}

.theme-choice-swatch {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    border: 1px solid var(--nina-border-strong);
    border-radius: 50%;
    box-shadow: 0 1px 3px var(--nina-shadow);
}

.theme-choice-swatch-light {
    background: #FFFFFF;
}

.theme-choice-swatch-dark {
    background: #15201D;
}

.theme-choice-swatch-system {
    background: linear-gradient(90deg, #FFFFFF 0 50%, #15201D 50% 100%);
}

.theme-save-button {
    width: auto !important;
    margin-top: 12px;
    border: 0;
    border-radius: 9px;
    background: var(--nina-accent) !important;
    color: #FFFFFF !important;
    padding: 9px 14px !important;
    font-size: 13px;
    font-weight: 700;
}

.theme-save-button:hover {
    background: var(--nina-accent-hover) !important;
}

/* -------------------------
   Dark mode: base shell
   ------------------------- */

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

html[data-theme-effective="dark"] .app-header,
html[data-theme-effective="dark"] .app-footer {
    background: #111B18 !important;
    border-color: var(--nina-border) !important;
}

html[data-theme-effective="dark"] h1,
html[data-theme-effective="dark"] h2,
html[data-theme-effective="dark"] h3,
html[data-theme-effective="dark"] h4,
html[data-theme-effective="dark"] h5,
html[data-theme-effective="dark"] h6,
html[data-theme-effective="dark"] strong,
html[data-theme-effective="dark"] .user-name,
html[data-theme-effective="dark"] .field-label,
html[data-theme-effective="dark"] .summary-value,
html[data-theme-effective="dark"] .summary-label,
html[data-theme-effective="dark"] .dashboard-kpi-value,
html[data-theme-effective="dark"] .dashboard-kpi-label,
html[data-theme-effective="dark"] .dashboard-legend-name,
html[data-theme-effective="dark"] .dashboard-legend-value,
html[data-theme-effective="dark"] .account-action-title,
html[data-theme-effective="dark"] .account-legal-copy strong,
html[data-theme-effective="dark"] .category-name,
html[data-theme-effective="dark"] .money-value,
html[data-theme-effective="dark"] .amount-main,
html[data-theme-effective="dark"] .transaction-date,
html[data-theme-effective="dark"] .project-card-kicker,
html[data-theme-effective="dark"] .wishlist-detail-panel-total {
    color: var(--nina-text) !important;
}

html[data-theme-effective="dark"] p,
html[data-theme-effective="dark"] .field-help,
html[data-theme-effective="dark"] .help,
html[data-theme-effective="dark"] .help-text,
html[data-theme-effective="dark"] .meta,
html[data-theme-effective="dark"] .type-meta,
html[data-theme-effective="dark"] .asset-meta,
html[data-theme-effective="dark"] .summary-note,
html[data-theme-effective="dark"] .summary-helper,
html[data-theme-effective="dark"] .dashboard-kpi-note,
html[data-theme-effective="dark"] .dashboard-context-note,
html[data-theme-effective="dark"] .progress-note,
html[data-theme-effective="dark"] .account-action-text,
html[data-theme-effective="dark"] .account-legal-copy span,
html[data-theme-effective="dark"] .not-informed,
html[data-theme-effective="dark"] .optional-label {
    color: var(--nina-text-secondary) !important;
}

html[data-theme-effective="dark"] .section-eyebrow,
html[data-theme-effective="dark"] .eyebrow,
html[data-theme-effective="dark"] .dashboard-panel-kicker,
html[data-theme-effective="dark"] .legal-eyebrow,
html[data-theme-effective="dark"] .login-eyebrow,
html[data-theme-effective="dark"] .signup-eyebrow,
html[data-theme-effective="dark"] .users-eyebrow,
html[data-theme-effective="dark"] .budget-modal-eyebrow {
    color: var(--nina-text-muted) !important;
}

html[data-theme-effective="dark"] a,
html[data-theme-effective="dark"] .main-nav a,
html[data-theme-effective="dark"] .account-legal-link,
html[data-theme-effective="dark"] .wealth-link,
html[data-theme-effective="dark"] .action-link,
html[data-theme-effective="dark"] .edit-link,
html[data-theme-effective="dark"] .settings-link,
html[data-theme-effective="dark"] .dashboard-secondary-link,
html[data-theme-effective="dark"] .dashboard-projection-link {
    color: var(--nina-accent) !important;
}

html[data-theme-effective="dark"] a:hover,
html[data-theme-effective="dark"] .main-nav a:hover {
    color: var(--nina-accent-hover) !important;
}

html[data-theme-effective="dark"] .nav-link-active {
    color: var(--nina-text) !important;
}

html[data-theme-effective="dark"] .user-area,
html[data-theme-effective="dark"] .contextual-navigation,
html[data-theme-effective="dark"] .account-action-item,
html[data-theme-effective="dark"] .account-legal-item,
html[data-theme-effective="dark"] .account-legal-history,
html[data-theme-effective="dark"] .account-danger-area {
    border-color: var(--nina-border) !important;
}

/* -------------------------
   Dark mode: surfaces/cards/panels
   ------------------------- */

html[data-theme-effective="dark"] :is(
    .module-card,
    .finance-menu-card,
    .panel,
    .list-panel,
    .bulk-edit-panel,
    .import-panel,
    .preview-panel,
    .exchange-filter-panel,
    .projects-panel,
    .projects-form-panel,
    .wishlist-panel,
    .wishlist-form-panel,
    .wishlist-list-panel,
    .wishlist-detail-panel,
    .projection-ledger-panel,
    .dashboard-panel,
    .dashboard-expense-panel,
    .dashboard-budget-panel,
    .dashboard-accounts-panel,
    .dashboard-projects-panel,
    .dashboard-transactions-panel,
    .dashboard-wishlist-panel,
    .dashboard-standalone-panel,
    .summary-card,
    .wishlist-summary-card,
    .projects-summary-card,
    .projection-summary-card,
    .dashboard-kpi-card,
    .dashboard-expense-kpi-card,
    .auth-card,
    .login-card,
    .signup-card,
    .legal-card,
    .error-card,
    .access-denied-card,
    .cancel-delete-card,
    .delete-account-card,
    .reactivate-card,
    .users-card,
    .card-item,
    .project-card,
    .journey-card,
    .box,
    .message-box,
    .plan-popover,
    .delete-modal,
    .budget-modal,
    .undo-modal,
    .user-modal
) {
    background: var(--nina-surface) !important;
    border-color: var(--nina-border) !important;
    box-shadow: 0 12px 32px var(--nina-shadow) !important;
}

html[data-theme-effective="dark"] :is(
    .panel-header,
    .panel-head,
    .dashboard-panel-header,
    .users-card-header,
    .projects-panel-header,
    .wishlist-panel-header,
    .wishlist-detail-panel-header,
    .project-card-header,
    .budget-modal-header
) {
    border-color: var(--nina-border) !important;
}

html[data-theme-effective="dark"] :is(
    .panel-header,
    .panel-head,
    .projection-ledger-heading,
    .bulk-toolbar,
    .delete-modal-actions,
    .month-navigation,
    .users-card-header,
    .projects-panel-header,
    .wishlist-panel-header,
    .wishlist-detail-panel-header,
    .budget-modal-header
) {
    background: var(--nina-surface-soft) !important;
    border-color: var(--nina-border) !important;
}

html[data-theme-effective="dark"] .panel-header h2,
html[data-theme-effective="dark"] .panel-head h2,
html[data-theme-effective="dark"] .projection-ledger-heading h2 {
    color: var(--nina-text) !important;
}

html[data-theme-effective="dark"] .panel-header p,
html[data-theme-effective="dark"] .panel-head p,
html[data-theme-effective="dark"] .projection-ledger-heading p {
    color: var(--nina-text-secondary) !important;
}

html[data-theme-effective="dark"] :is(
    .asset-checkbox-list,
    .bulk-field,
    .dashboard-budget-stats > div,
    .dashboard-period-badge,
    .projection-summary-card-emphasis,
    .empty-state-icon,
    .bulk-confirm-icon
) {
    background: var(--nina-surface-muted) !important;
    border-color: var(--nina-border) !important;
    color: var(--nina-text-secondary) !important;
}

html[data-theme-effective="dark"] .finance-menu-link:hover {
    background: var(--nina-surface-soft) !important;
    border-color: var(--nina-border-strong) !important;
}

html[data-theme-effective="dark"] .plan-popover::before {
    background: var(--nina-surface) !important;
    border-color: var(--nina-border) !important;
}

html[data-theme-effective="dark"] .transactions-table th.actions-column {
    background: #1B2925 !important;
}

html[data-theme-effective="dark"] .transactions-table td.actions-column {
    background: var(--nina-surface) !important;
}

html[data-theme-effective="dark"] .transactions-table tbody tr:hover td.actions-column {
    background: #1B2925 !important;
}

html[data-theme-effective="dark"] .page-message {
    background: var(--nina-surface-soft) !important;
    border-color: var(--nina-border) !important;
    color: var(--nina-text-secondary) !important;
}

html[data-theme-effective="dark"] .page-message.success {
    background: var(--nina-success-soft) !important;
    border-color: #2D594B !important;
    color: var(--nina-success) !important;
}

html[data-theme-effective="dark"] .page-message.error {
    background: var(--nina-danger-soft) !important;
    border-color: #684044 !important;
    color: var(--nina-danger) !important;
}

html[data-theme-effective="dark"] :is(.status-planned, .competence-settlement) {
    background: var(--nina-warning-soft) !important;
    color: var(--nina-warning) !important;
}

html[data-theme-effective="dark"] :is(
    .dashboard-empty-state,
    .dashboard-empty-state-compact,
    .empty-state,
    .projects-empty-state,
    .wishlist-empty-state,
    .users-empty,
    .month-empty-space,
    .dashboard-account-summary,
    .dashboard-closing-summary-item,
    .dashboard-expense-summary-block,
    .account-legal-history-entry,
    .delete-summary,
    .undo-summary,
    .filter-summary,
    .preview-summary,
    .projection-detail-summary
) {
    background: var(--nina-surface-soft) !important;
    border-color: var(--nina-border) !important;
    color: var(--nina-text-secondary) !important;
}

/* -------------------------
   Dark mode: forms
   ------------------------- */

html[data-theme-effective="dark"] label {
    color: var(--nina-text-secondary) !important;
}

html[data-theme-effective="dark"] input:not([type="checkbox"]):not([type="radio"]),
html[data-theme-effective="dark"] select,
html[data-theme-effective="dark"] textarea,
html[data-theme-effective="dark"] .transaction-filter-control,
html[data-theme-effective="dark"] .user-plan-select {
    background: #111B18 !important;
    border-color: var(--nina-border-strong) !important;
    color: var(--nina-text) !important;
}

html[data-theme-effective="dark"] input::placeholder,
html[data-theme-effective="dark"] textarea::placeholder {
    color: #7F918B !important;
}

html[data-theme-effective="dark"] input:focus,
html[data-theme-effective="dark"] select:focus,
html[data-theme-effective="dark"] textarea:focus {
    border-color: var(--nina-accent) !important;
    box-shadow: 0 0 0 3px rgba(130, 199, 180, 0.16) !important;
}

html[data-theme-effective="dark"] select option {
    background: #111B18;
    color: var(--nina-text);
}

html[data-theme-effective="dark"] input[type="checkbox"],
html[data-theme-effective="dark"] input[type="radio"] {
    accent-color: var(--nina-accent);
}

/* -------------------------
   Dark mode: buttons/navigation
   ------------------------- */

html[data-theme-effective="dark"] :is(
    .logout-button,
    .cancel-button,
    .secondary-button,
    .modal-cancel-button,
    .modal-secondary-button,
    .account-action-button,
    .back-link,
    .contextual-back-link,
    .dashboard-secondary-link,
    .wishlist-cancel-link,
    .projects-cancel-link
) {
    background: var(--nina-surface-soft) !important;
    border-color: var(--nina-border-strong) !important;
    color: var(--nina-text-secondary) !important;
}

html[data-theme-effective="dark"] :is(
    .logout-button,
    .cancel-button,
    .secondary-button,
    .modal-cancel-button,
    .account-action-button,
    .contextual-back-link
):hover {
    background: var(--nina-surface-muted) !important;
    color: var(--nina-text) !important;
}

html[data-theme-effective="dark"] :is(
    .submit-button,
    .primary-button,
    .btn-primary,
    .auth-button,
    .login-button,
    .signup-button,
    .projects-primary-button,
    .wishlist-primary-button,
    .replicate-button,
    .month-go-button,
    .theme-save-button
) {
    background: #397B69 !important;
    color: #FFFFFF !important;
    border-color: #4B927F !important;
}

/* -------------------------
   Dark mode: status/tags
   ------------------------- */

html[data-theme-effective="dark"] .module-features span,
html[data-theme-effective="dark"] .badge,
html[data-theme-effective="dark"] .nature-badge,
html[data-theme-effective="dark"] .type-badge,
html[data-theme-effective="dark"] .cash-badge,
html[data-theme-effective="dark"] .competence-badge,
html[data-theme-effective="dark"] .cycle-badge,
html[data-theme-effective="dark"] .imported-badge,
html[data-theme-effective="dark"] .tracking-badge {
    background: var(--nina-surface-muted) !important;
    border-color: var(--nina-border) !important;
    color: var(--nina-text-secondary) !important;
}

html[data-theme-effective="dark"] .status-active,
html[data-theme-effective="dark"] .user-status-active,
html[data-theme-effective="dark"] .wishlist-ok-message {
    background: var(--nina-success-soft) !important;
    color: var(--nina-success) !important;
    border-color: #2D594B !important;
}

html[data-theme-effective="dark"] .status-soon,
html[data-theme-effective="dark"] .status-inactive,
html[data-theme-effective="dark"] .user-status-inactive {
    background: var(--nina-surface-muted) !important;
    color: var(--nina-text-muted) !important;
    border-color: var(--nina-border) !important;
}

html[data-theme-effective="dark"] .plan-badge-free,
html[data-theme-effective="dark"] .admin-badge {
    background: var(--nina-accent-soft) !important;
    color: var(--nina-accent) !important;
    border-color: #315C50 !important;
}

/* -------------------------
   Dark mode: tables
   ------------------------- */

html[data-theme-effective="dark"] :is(
    .table-wrapper,
    .table-wrap,
    .exchange-table-wrap,
    .goals-table-wrap,
    .projection-ledger-table-wrap,
    .users-table-wrapper,
    .wishlist-table-wrap
) {
    border-color: var(--nina-border) !important;
    background: var(--nina-surface) !important;
}

html[data-theme-effective="dark"] table {
    color: var(--nina-text-secondary) !important;
    background: var(--nina-surface) !important;
}

html[data-theme-effective="dark"] th {
    background: #1B2925 !important;
    color: var(--nina-text-muted) !important;
    border-color: var(--nina-border) !important;
}

html[data-theme-effective="dark"] td {
    background: var(--nina-surface) !important;
    color: var(--nina-text-secondary) !important;
    border-color: var(--nina-border) !important;
}

html[data-theme-effective="dark"] tbody tr:hover td {
    background: #1B2925 !important;
}

html[data-theme-effective="dark"] .numeric,
html[data-theme-effective="dark"] .money,
html[data-theme-effective="dark"] .wishlist-table-money,
html[data-theme-effective="dark"] .wishlist-table-number {
    color: var(--nina-text) !important;
}

/* -------------------------
   Dark mode: dashboards/charts/progress
   ------------------------- */

html[data-theme-effective="dark"] .dashboard-donut-center {
    background: var(--nina-surface) !important;
    color: var(--nina-text) !important;
}

html[data-theme-effective="dark"] :is(
    .dashboard-account-row,
    .dashboard-wealth-hero,
    .dashboard-payment-budget-item,
    .dashboard-wishlist-item,
    .dashboard-transaction-date,
    .dashboard-closing-kpi,
    .dashboard-closing-summary-item,
    .dashboard-closing-readiness-item
) {
    background: var(--nina-surface-soft) !important;
    border-color: var(--nina-border) !important;
}

html[data-theme-effective="dark"] :is(
    .dashboard-account-row span,
    .dashboard-account-balance-item small,
    .dashboard-wealth-hero span,
    .dashboard-wealth-hero small,
    .dashboard-wealth-comparison > span,
    .dashboard-goal-details,
    .dashboard-payment-budget-topline > div > span,
    .dashboard-transaction-date span
) {
    color: var(--nina-text-muted) !important;
}

html[data-theme-effective="dark"] :is(
    .dashboard-wealth-hero strong,
    .dashboard-wealth-comparison > strong,
    .dashboard-goal-topline strong,
    .dashboard-goal-topline span,
    .dashboard-payment-budget-topline > div > strong,
    .dashboard-transaction-date strong,
    .dashboard-wishlist-item
) {
    color: var(--nina-text) !important;
}

html[data-theme-effective="dark"] .dashboard-goal-summary span {
    background: var(--nina-surface-muted) !important;
    color: var(--nina-text-secondary) !important;
}

html[data-theme-effective="dark"] .dashboard-transaction-row,
html[data-theme-effective="dark"] .dashboard-account-summary-projected,
html[data-theme-effective="dark"] .dashboard-account-balance-projected {
    border-color: var(--nina-border) !important;
}

html[data-theme-effective="dark"] .dashboard-closing-notice {
    background: var(--nina-surface-soft) !important;
    color: var(--nina-text-secondary) !important;
}

html[data-theme-effective="dark"] .dashboard-closing-notice-attention {
    background: var(--nina-warning-soft) !important;
    color: var(--nina-warning) !important;
}

html[data-theme-effective="dark"] .goal-title {
    color: #F3F8F6 !important;
}

html[data-theme-effective="dark"] .goal-subtitle {
    color: var(--nina-text-secondary) !important;
}


html[data-theme-effective="dark"] :is(
    .dashboard-progress-track,
    .progress-track,
    .project-progress-track
) {
    background: #2A3A35 !important;
}

html[data-theme-effective="dark"] :is(
    .dashboard-progress-fill,
    .progress-fill,
    .project-progress-fill
) {
    background: #5FA58F !important;
}

html[data-theme-effective="dark"] .dashboard-value-positive,
html[data-theme-effective="dark"] .projection-value-positive {
    color: #8CCCB4 !important;
}

html[data-theme-effective="dark"] .dashboard-value-negative,
html[data-theme-effective="dark"] .projection-value-negative {
    color: #F0AAAA !important;
}

/* -------------------------
   Dark mode: errors/warnings/destructive
   ------------------------- */

html[data-theme-effective="dark"] :is(
    .field-error,
    .form-error,
    .form-errors,
    .auth-errors,
    .auth-error,
    .login-error,
    .signup-error,
    .signup-form-errors,
    .legal-error,
    .error,
    .preview-summary-error
) {
    background: var(--nina-danger-soft) !important;
    border-color: #684044 !important;
    color: var(--nina-danger) !important;
}

html[data-theme-effective="dark"] :is(
    .delete-warning,
    .delete-modal-warning,
    .wishlist-alert-message,
    .wishlist-detail-alert-banner,
    .warning-note,
    .preview-summary-warning
) {
    background: var(--nina-warning-soft) !important;
    border-color: #65552D !important;
    color: var(--nina-warning) !important;
}

html[data-theme-effective="dark"] :is(
    .account-danger-title,
    .account-danger-text,
    .account-delete-link,
    .delete-button,
    .modal-delete-button,
    .user-action-button-danger,
    .deactivate-user-button
) {
    color: var(--nina-danger) !important;
}

html[data-theme-effective="dark"] :is(
    .account-delete-link,
    .delete-button,
    .modal-delete-button,
    .user-action-button-danger,
    .deactivate-user-button
) {
    background: var(--nina-danger-soft) !important;
    border-color: #684044 !important;
}

/* -------------------------
   Dark mode: public/auth/legal pages
   ------------------------- */

html[data-theme-effective="dark"] :is(
    .auth-page,
    .login-page,
    .signup-page,
    .legal-page,
    .error-page,
    .access-denied-page,
    .cancel-delete-page,
    .delete-account-page,
    .reactivate-page,
    .users-page
) {
    background: var(--nina-page) !important;
}

html[data-theme-effective="dark"] .legal-highlight,
html[data-theme-effective="dark"] .auth-note,
html[data-theme-effective="dark"] .signup-note,
html[data-theme-effective="dark"] .reactivate-note,
html[data-theme-effective="dark"] .delete-account-description,
html[data-theme-effective="dark"] .cancel-delete-description,
html[data-theme-effective="dark"] .reactivate-description {
    background: var(--nina-surface-soft) !important;
    border-color: var(--nina-border) !important;
    color: var(--nina-text-secondary) !important;
}

/* -------------------------
   System preference fallback when JS is disabled.
   ------------------------- */

@media (prefers-color-scheme: dark) {
    html[data-theme="system"]:not([data-theme-effective]) {
        color-scheme: dark;
    }
}

@media (max-width: 760px) {
    .theme-choice-group {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================
   Dark mode: Orçamento
   Dom61 - cobre superfícies específicas de budget.css que não
   podem permanecer claras quando o tema efetivo é escuro.
   ========================================================== */

html[data-theme-effective="dark"] .budget-replication-bar {
    background: var(--nina-surface-soft) !important;
    border-color: var(--nina-border) !important;
    color: var(--nina-text) !important;
}

html[data-theme-effective="dark"] .budget-replication-bar strong {
    color: var(--nina-text) !important;
}

html[data-theme-effective="dark"] .budget-replication-bar p {
    color: var(--nina-text-secondary) !important;
}

html[data-theme-effective="dark"] :is(
    .budget-message,
    .replication-option,
    .replication-safety-note
) {
    background: var(--nina-surface-soft) !important;
    border-color: var(--nina-border) !important;
    color: var(--nina-text-secondary) !important;
}

html[data-theme-effective="dark"] .budget-message.success {
    background: var(--nina-success-soft) !important;
    border-color: #2D594B !important;
    color: var(--nina-success) !important;
}

html[data-theme-effective="dark"] :is(.budget-message.warning, .budget-message.error) {
    background: var(--nina-warning-soft) !important;
    border-color: #66542A !important;
    color: var(--nina-warning) !important;
}

html[data-theme-effective="dark"] .budget-modal-body,
html[data-theme-effective="dark"] .budget-modal-actions {
    background: var(--nina-surface) !important;
    border-color: var(--nina-border) !important;
}

html[data-theme-effective="dark"] .budget-modal-intro,
html[data-theme-effective="dark"] .replication-option small,
html[data-theme-effective="dark"] .replication-safety-note {
    color: var(--nina-text-secondary) !important;
}

html[data-theme-effective="dark"] .replication-option strong {
    color: var(--nina-text) !important;
}

html[data-theme-effective="dark"] .budget-modal-close {
    background: var(--nina-surface-muted) !important;
    color: var(--nina-text-secondary) !important;
}

html[data-theme-effective="dark"] .month-arrow {
    background: var(--nina-surface-muted) !important;
    border-color: var(--nina-border) !important;
    color: var(--nina-accent) !important;
}

html[data-theme-effective="dark"] .month-arrow:hover {
    background: #2A3A35 !important;
    border-color: var(--nina-border-strong) !important;
    color: var(--nina-accent-hover) !important;
}

html[data-theme-effective="dark"] :is(.month-title, .summary-value, .category-name, .money-value-realized) {
    color: var(--nina-text) !important;
}

html[data-theme-effective="dark"] :is(.month-label-small, .summary-label, .summary-helper, .previous-value, .percentage-no-budget) {
    color: var(--nina-text-muted) !important;
}

html[data-theme-effective="dark"] .form-actions {
    border-color: var(--nina-border) !important;
}

html[data-theme-effective="dark"] .cancel-link {
    color: var(--nina-text-secondary) !important;
}

html[data-theme-effective="dark"] .cancel-link:hover {
    color: var(--nina-text) !important;
}

html[data-theme-effective="dark"] .budget-table tbody tr.budget-row-zero td {
    background: #182433 !important;
}

html[data-theme-effective="dark"] .budget-table tbody tr.budget-row-zero:hover td {
    background: #1D2B3D !important;
}

html[data-theme-effective="dark"] .budget-table tbody tr.budget-row-zero .money-value-realized,
html[data-theme-effective="dark"] .budget-table tbody tr.budget-row-zero .percentage-number {
    color: #9DBCE8 !important;
}

html[data-theme-effective="dark"] .budget-table tbody tr.budget-row-within td {
    background: #162720 !important;
}

html[data-theme-effective="dark"] .budget-table tbody tr.budget-row-within:hover td {
    background: #1B3027 !important;
}

html[data-theme-effective="dark"] .budget-table tbody tr.budget-row-within .money-value-realized,
html[data-theme-effective="dark"] .budget-table tbody tr.budget-row-within .percentage-number {
    color: var(--nina-success) !important;
}

html[data-theme-effective="dark"] .budget-table tbody tr.budget-row-over td {
    background: #321E20 !important;
}

html[data-theme-effective="dark"] .budget-table tbody tr.budget-row-over:hover td {
    background: #3C2427 !important;
}

html[data-theme-effective="dark"] .budget-table tbody tr.budget-row-over .money-value-realized,
html[data-theme-effective="dark"] .budget-table tbody tr.budget-row-over .percentage-number,
html[data-theme-effective="dark"] .percentage-number.over-budget {
    color: var(--nina-danger) !important;
}

html[data-theme-effective="dark"] .percentage-bar {
    background: #2A3A35 !important;
}

html[data-theme-effective="dark"] .table-total-row td {
    background: var(--nina-surface-muted) !important;
    border-color: var(--nina-border) !important;
    color: var(--nina-text) !important;
}

html[data-theme-effective="dark"] .form-errors {
    background: var(--nina-danger-soft) !important;
    border-color: #684044 !important;
    color: var(--nina-danger) !important;
}

html[data-theme-effective="dark"] .field-error {
    color: var(--nina-danger) !important;
}

/* -------------------------
   Dark mode: patrimônio - ações da tabela
   ------------------------- */
html[data-theme-effective="dark"] .wealth-table .action-link {
    background: #397B69 !important;
    border-color: #4B927F !important;
    color: #FFFFFF !important;
}

html[data-theme-effective="dark"] .wealth-table .action-link:hover {
    background: #2F6A5A !important;
    border-color: #5AA18D !important;
    color: #FFFFFF !important;
}
