/* Authenticated pages share the public signature's saved day/night choice. */
body .thafat-navigation .app-theme-toggle {
    display: inline-grid; place-items: center; flex: 0 0 42px;
    width: 42px; height: 42px; padding: 8px;
    border: 1px solid #b9cdca; border-radius: 50%;
    background: #f4f8f7; color: #164e50; cursor: pointer;
}
body .thafat-navigation .app-theme-toggle[hidden] { display: none; }
body .thafat-navigation .app-theme-toggle svg { width: 21px; height: 21px; }
body .thafat-navigation .app-theme-sun { display: none; }
html[data-vitrine-theme="night"] body .thafat-navigation .app-theme-moon { display: none; }
html[data-vitrine-theme="night"] body .thafat-navigation .app-theme-sun { display: block; }

html[data-vitrine-theme="night"] {
    color-scheme: dark;
    --gold: #edc878; --gold-dark: #edc878;
    --teal: #8dd8d0; --teal-dark: #b5e8e0;
    --ink: #edf4f1; --muted: #b1c4c2;
    --line: #374b50; --bg: #101e29; --white: #1b2c35;
    --green: #a4dfbd; --amber: #f0ca83; --red: #f4a69c;
    --shadow: 0 12px 30px #0003;
    background: #101e29;
}
html[data-vitrine-theme="night"] body {
    background: #101e29; color: var(--ink);
}
html[data-vitrine-theme="night"] body .app-header.thafat-navigation,
html[data-vitrine-theme="night"] body .thafat-navigation .app-navigation-panel {
    background: #172832; color: var(--ink); border-color: #374b50;
}
html[data-vitrine-theme="night"] body .thafat-navigation .main-nav a { color: #dbeae7; }
html[data-vitrine-theme="night"] body .thafat-navigation .main-nav a.active,
html[data-vitrine-theme="night"] body .thafat-navigation .main-nav a:hover { color: #a5ead8; }
html[data-vitrine-theme="night"] body .thafat-navigation .app-theme-toggle,
html[data-vitrine-theme="night"] body .thafat-navigation .app-menu-toggle,
html[data-vitrine-theme="night"] body .thafat-navigation .user-chip,
html[data-vitrine-theme="night"] body .thafat-navigation .logout-button {
    background: #263b44; color: #eaf5f1; border-color: #547077;
}
html[data-vitrine-theme="night"] body .thafat-navigation .app-locale-switch a { color: #cadbd8; }
html[data-vitrine-theme="night"] body .thafat-navigation .app-locale-switch a.active { color: #f1d18b; }
html[data-vitrine-theme="night"] body .salon-context-nav { color: #a5ead8; }

/* Shared account content, including forms and secondary modules. */
html[data-vitrine-theme="night"] body :is(.panel,.upload-card,.issue-card,.principle-card,.invite-result,.confirm-import,.preview-grid article,.finance-card,.finance-residence-chip,.summary-card:not(.highlight),.issue-panel,.home-action,.pilot-kpi,.actions-popover,.correction-menu form,.ilt-help,.residence-demo-context) {
    background: #1b2c35; color: #edf4f1; border-color: #3c5359;
}
html[data-vitrine-theme="night"] body :is(.rates-head,.preview-card table tfoot td,th,.home-action.future,.workflow-steps li>span,.dropzone,.coowner-details>div,.coowner-reports strong,.coowner-icon,.pilot-kpi.alert,.dashboard-financial-group,.s04-ilt-portfolio-note) {
    background: #263b44; color: #dcebe7; border-color: #3c5359;
}
html[data-vitrine-theme="night"] body :is(td,.issue,.rate-row,.workflow-steps li,.actions-popover form) { border-color: #374b50; }
html[data-vitrine-theme="night"] body :is(.warning-row,.rule-box,.correction-banner,.coowner-details>.has-overdue) {
    background: #3b3327; color: #f5deb0; border-color: #765a31;
}
html[data-vitrine-theme="night"] body :is(input,select,textarea,.finance-form input,.finance-form select,.correction-menu textarea,.pilot-status-form select) {
    background: #142630; color: #edf4f1; border-color: #60777b;
}
html[data-vitrine-theme="night"] body :is(input,select,textarea)::placeholder { color: #afc1bf; }
html[data-vitrine-theme="night"] body :is(.btn-outline,.btn-danger-outline,.home-open,.home-action-icon,.pilot-kpi strong,.preview-grid strong,.coowner-amount,.coowner-shortcut,.coowner-residence-links a,.coowner-reports span:last-child,.residence-summary-return) {
    color: #a5ead8;
}
html[data-vitrine-theme="night"] body :is(.btn-outline,.btn-danger-outline,.btn-muted,.coowner-shortcut,.coowner-reports strong,.home-action-icon) {
    background: #263b44; border-color: #526b70;
}
html[data-vitrine-theme="night"] body :is(.muted,.breadcrumb,.page-head p:not(.eyebrow),td small,.coowner-note,.coowner-balance h2,.pilot-residence-card p:not(.eyebrow),.home-action p,.finance-form label>span:first-child,.rates-head p,.preview-period,.summary-card span,.issue-panel p:not(.eyebrow),.dashboard-ilt-legend) {
    color: #b1c4c2;
}
html[data-vitrine-theme="night"] body :is(.coowner-shortcut:hover,.coowner-reports:hover,.home-action.live:hover) { background: #2b454d; }
html[data-vitrine-theme="night"] body .btn-primary { color: #fff; background: #0d6465; }

/* The ILT explainer deliberately keeps light cards in night mode. */
html[data-vitrine-theme="night"] body .ilt-help-domains li {
    background: #f4f8f6; color: #35484a;
}
html[data-vitrine-theme="night"] body .ilt-help-domains li :is(strong,p) { color: #35484a; }
html[data-vitrine-theme="night"] body .ilt-help-domains li .ilt-help-weight { color: #53676b; }

/* Login and password screens use the same saved choice as the dashboards. */
body .auth-header-actions { display: flex; align-items: center; gap: 12px; }
body .auth-theme-toggle {
    display: inline-grid; place-items: center; flex: 0 0 42px;
    width: 42px; height: 42px; padding: 8px;
    border: 1px solid #b9cdca; border-radius: 50%;
    background: #f4f8f7; color: #164e50; cursor: pointer;
}
body .auth-theme-toggle[hidden] { display: none; }
body .auth-theme-toggle svg { width: 21px; height: 21px; }
body .auth-theme-toggle .app-theme-sun { display: none; }
html[data-vitrine-theme="night"] body .auth-theme-toggle .app-theme-moon { display: none; }
html[data-vitrine-theme="night"] body .auth-theme-toggle .app-theme-sun { display: block; }
html.auth-layout[data-vitrine-theme="night"] {
    --thafat-page: #101e29; --thafat-surface: #1b2c35;
    --thafat-surface-soft: #263b44;
    --thafat-text: #edf4f1; --thafat-text-soft: #b1c4c2;
    --thafat-text-light: #a7bcb9;
    --thafat-border: #3c5359; --thafat-border-strong: #60777b;
    --thafat-gold: #edc878; --thafat-gold-dark: #f1d18b;
    --thafat-gold-soft: #3b3327;
    --thafat-teal: #a5ead8; --thafat-teal-dark: #b5e8e0;
    --thafat-teal-soft: #193a36;
    --thafat-danger: #f4a69c; --thafat-danger-soft: #3b292d;
    --thafat-success: #a4dfbd; --thafat-success-soft: #193a36;
    --thafat-warning: #f0ca83; --thafat-warning-soft: #3b3327;
    --thafat-shadow: 0 24px 70px #0004;
    --thafat-shadow-soft: 0 8px 28px #0003;
}
html[data-vitrine-theme="night"] body .auth-header-bar {
    background: #172832e6; border-color: #374b50;
}
html[data-vitrine-theme="night"] body .auth-theme-toggle {
    background: #263b44; color: #eaf5f1; border-color: #547077;
}
html[data-vitrine-theme="night"] body :is(.language-link:hover,.language-link.is-active,.btn-secondary) {
    background: #314851; color: #a5ead8;
}
html[data-vitrine-theme="night"] body .input {
    background: #142630; color: #edf4f1; border-color: #60777b;
}
html[data-vitrine-theme="night"] body .input::placeholder { color: #afc1bf; }

@media (max-width: 480px) {
    body .auth-header-actions { gap: 7px; }
    body .auth-theme-toggle { flex-basis: 36px; width: 36px; height: 36px; padding: 6px; }
}

/* Promoter portfolio: preserve the 6 / 3 / 2 / 1 order and status meaning. */
html[data-vitrine-theme="night"] body.promoter-command-page {
    --pc-ink: #edf4f1; --pc-muted: #b1c4c2; --pc-line: #3c5359;
    --pc-gold: #f0ce8a; --pc-teal: #a5ead8;
    --pc-green: #a4dfbd; --pc-watch: #f0ca83; --pc-red: #f4a69c;
    background: #101e29; color: var(--pc-ink);
}
html[data-vitrine-theme="night"] body.promoter-command-page :is(.promoter-command-health-strip,.promoter-command-kpis article,.promoter-command-priorities,.promoter-command-residences,.promoter-command-chart-panel,.promoter-command-score,.dashboard-financial-metric) {
    background: #1b2c35; color: var(--pc-ink); border-color: var(--pc-line);
}
html[data-vitrine-theme="night"] body.promoter-command-page .promoter-command-health-counts article:first-child {
    background: transparent; border-color: transparent; box-shadow: none;
}
html[data-vitrine-theme="night"] body.promoter-command-page .promoter-command-health-counts .healthy { background: #193a36; border-color: #34745f; }
html[data-vitrine-theme="night"] body.promoter-command-page .promoter-command-health-counts .watch { background: #3b3327; border-color: #927143; }
html[data-vitrine-theme="night"] body.promoter-command-page .promoter-command-health-counts .difficulty { background: #3b292d; border-color: #91545a; }
html[data-vitrine-theme="night"] body.promoter-command-page .promoter-command-health-counts .unknown { background: #29363d; border-color: #607077; }
html[data-vitrine-theme="night"] body.promoter-command-page .promoter-command-health-counts span { color: #dcebe7; }
html[data-vitrine-theme="night"] body.promoter-command-page .promoter-command-health-counts .healthy strong { color: #a4dfbd; }
html[data-vitrine-theme="night"] body.promoter-command-page .promoter-command-health-counts .watch strong { color: #f0ca83; }
html[data-vitrine-theme="night"] body.promoter-command-page .promoter-command-health-counts .difficulty strong { color: #f4a69c; }
html[data-vitrine-theme="night"] body.promoter-command-page :is(.promoter-command-table thead th,.promoter-command-count,.promoter-command-chart-switch,.metric-buttons button) { background: #263b44; color: #dcebe7; }
html[data-vitrine-theme="night"] body.promoter-command-page :is(.promoter-command-priority:hover,.promoter-command-table tbody tr:hover) { background: #263b44; }
html[data-vitrine-theme="night"] body.promoter-command-page :is(.promoter-command-priority,.promoter-command-table tbody td,.promoter-command-table tbody th) { border-color: #3c5359; }
html[data-vitrine-theme="night"] body.promoter-command-page .promoter-command-priority .open { color: #a5ead8; border-color: #60777b; }
html[data-vitrine-theme="night"] body.promoter-command-page .promoter-command-ilt-global a { color: #a5ead8; }
html[data-vitrine-theme="night"] body.promoter-command-page .promoter-command-table .btn { background: #263b44; color: #a5ead8; border-color: #60777b; }
html[data-vitrine-theme="night"] body.promoter-command-page :is(.promoter-command-score.status-healthy,.promoter-command-score.status-watch,.promoter-command-score.status-difficulty) { background: #263b44; }
html[data-vitrine-theme="night"] body.promoter-command-page .pc-chart-grid { stroke: #496068; }
html[data-vitrine-theme="night"] body.promoter-command-page :is(.pc-chart-label,.pc-chart-status) { fill: #b1c4c2; }
html[data-vitrine-theme="night"] body.promoter-command-page :is(.pc-chart-value,.pc-chart-name) { fill: #edf4f1; }
html[data-vitrine-theme="night"] body.promoter-command-page .dashboard-financial-group.group-interventions { background: #342e2a; }

/* Manager, co-owner and residence summary dashboards. */
html[data-vitrine-theme="night"] body :is(.salon-user-chip,.salon-kpi,.salon-card,.residence-summary-hero,.residence-summary-panel,.dashboard-financial-metric) {
    background: #1b2c35; color: #edf4f1; border-color: #3c5359;
}
html[data-vitrine-theme="night"] body :is(.salon-topbar h1,.salon-user-chip strong,.salon-kpi strong,.salon-card-head h2,.salon-donut-center strong,.salon-health-row strong,.salon-list-primary strong,.salon-list-value strong,.salon-assembly strong,.dashboard-financial-group h2,.dashboard-financial-metric strong,.residence-summary-section-head h2,.residence-summary-priority-content>strong) { color: #edf4f1; }
html[data-vitrine-theme="night"] body :is(.salon-topbar p,.salon-eyebrow,.salon-user-chip small,.salon-kpi span,.salon-card-head p,.salon-legend,.salon-chart-label,.salon-health-row,.salon-list-primary span,.salon-list-value span,.salon-assembly span,.dashboard-financial-group-help,.dashboard-financial-metric>span,.dashboard-financial-metric p,.residence-summary-health,.residence-summary-change) { color: #b1c4c2; }
html[data-vitrine-theme="night"] body :is(.salon-user-avatar,.salon-kpi-icon,.salon-action,.salon-status,.residence-summary-modules a) {
    background: #263b44; color: #a5ead8; border-color: #526b70;
}
html[data-vitrine-theme="night"] body :is(.salon-assembly,.salon-list-item,.salon-bars,.residence-summary-ilt-details) { border-color: #3c5359; }
html[data-vitrine-theme="night"] body .salon-bars { background: repeating-linear-gradient(to top,#1b2c35 0,#1b2c35 44px,#34464e 45px); }
html[data-vitrine-theme="night"] body .salon-donut:after { background: #1b2c35; }
html[data-vitrine-theme="night"] body .salon-action:hover { background: #2b454d; }
html[data-vitrine-theme="night"] body .salon-action.primary { background: #0d6465; color: #fff; }
html[data-vitrine-theme="night"] body .residence-summary-score>strong { color: #b5e8e0; }

/* Account detail pages: avoid bright islands after leaving a dashboard. */
html[data-vitrine-theme="night"] body :is(.debt-summary-card,.debt-lot-card,.debt-footnotes span,.expense-summary-grid article:not(.balance),.expense-create-card>summary,.reminder-summary-grid article,.current-action-card,.waiting-card,.document-summary,.document-current-file,.incident-summary-grid article,.incident-facts>div,.incident-author-box,.incident-result-box,.assembly-facts>div,.assembly-response-box,.assembly-response-summary,.assembly-participation-grid>div,.message-privacy,.message-count,.message-bubble,.dispute-summary-grid article,.dispute-reason-box,.dispute-response-box,.ilt-ops-card,.ilt-ops-stat:not(.primary),.ilt-ops-readonly,.ilt-ops-deadline-watch,.ilt-ops-deadline-stat,.payment-confirmed-card,.payment-confirmed-summary span,.allocation-card,.receipt-card,.cancel-box,.simulation-notice,.wf12-card,.wf12-summary,.salon-readonly) {
    background: #1b2c35; color: #edf4f1; border-color: #3c5359;
}
html[data-vitrine-theme="night"] body :is(.debt-summary-card,.expense-summary-grid article:not(.balance),.reminder-summary-grid article,.incident-summary-grid article,.dispute-summary-grid article,.ilt-ops-deadline-stat) :is(strong,span,small) {
    color: #edf4f1;
}
html[data-vitrine-theme="night"] body :is(.debt-summary-card.danger,.incident-summary-grid article.new) { background: #3b292d; border-color: #91545a; }
html[data-vitrine-theme="night"] body :is(.debt-summary-card.success,.incident-summary-grid article.resolved,.dispute-summary-grid article.resolved) { background: #193a36; border-color: #34745f; }
html[data-vitrine-theme="night"] body :is(.debt-summary-card.warning,.incident-summary-grid article.progress,.dispute-summary-grid article.review) { background: #3b3327; border-color: #927143; }
html[data-vitrine-theme="night"] body .debt-summary-card.neutral { background: #263b44; border-color: #526b70; }
html[data-vitrine-theme="night"] body :is(.debt-detail-row td,.notice-debts-row td,.message-row.has-unread,.message-row:hover,.message-bubble.mine,.ilt-ops-tracked.is-overdue,.ilt-ops-action-form) {
    background: #263b44; color: #edf4f1; border-color: #3c5359;
}
html[data-vitrine-theme="night"] body :is(.debt-warning,.reminder-rule-note,.incident-privacy-promise,.expense-rule-note,.credit-banner,.simulation-errors) {
    background: #3b3327; color: #f5deb0; border-color: #927143;
}
html[data-vitrine-theme="night"] body :is(.incident-privacy-note,.dispute-privacy-note,.document-rule,.document-category,.document-source,.wf12-banner,.salon-receipt) {
    background: #263b44; color: #dcebe7; border-color: #526b70;
}
html[data-vitrine-theme="night"] body :is(.debt-lot-card span,.debt-lot-card small,.debt-footnotes,.expense-create-card>summary small,.current-action-card>p,.reminder-case-data dt,.reminder-case-hero>div span,.document-summary span,.assembly-participation-grid span,.ilt-ops-breadcrumb,.ilt-ops-head p,.ilt-ops-deadline-watch-copy p) { color: #b1c4c2; }
html[data-vitrine-theme="night"] body :is(.ilt-operations-page,.ilt-ops-head h1) { background: #101e29; color: #edf4f1; }
html[data-vitrine-theme="night"] body :is(.ilt-ops-breadcrumb a,.ilt-ops-track-priority summary,.ilt-ops-update-action summary,.message-open,.debt-detail-list .emphasis dd) { color: #a5ead8; }
html[data-vitrine-theme="night"] body .ilt-ops-deadline-watch-copy h2 { color: #edf4f1; }
html[data-vitrine-theme="night"] body :is(.debt-detail-list>div,.payment-steps li,.expense-form,.reminder-case-data>div) { border-color: #3c5359; }
html[data-vitrine-theme="night"] body .payment-steps li.done,
html[data-vitrine-theme="night"] body .payment-steps li.active { color: #a5ead8; }
html[data-vitrine-theme="night"] body .payment-steps li span { background: #263b44; color: #dcebe7; }
html[data-vitrine-theme="night"] body .payment-steps li.active span { background: #0d6465; color: #fff; }

@media (max-width: 1050px) {
    body .thafat-navigation .app-theme-toggle { justify-self: start; }
    html[data-vitrine-theme="night"] body .thafat-navigation .main-nav a { background: #263b44; }
    html[data-vitrine-theme="night"] body .thafat-navigation .main-nav a.active { background: #31574f; }
    html[data-vitrine-theme="night"] body .thafat-navigation .user-actions { border-color: #3c5359; }
}
