/* TCHIL V20 — Shared semantic palette. Dark mode retains each original declaration fallback. */
:root[data-tchil-theme="light"]{
 --t20-page:#f6f8fb;--t20-surface:#fff;--t20-surface-muted:#f0f4f8;--t20-surface-raised:#edf3f7;--t20-surface-hover:#eaf1f7;--t20-surface-selected:#e2edf5;--t20-field:#fff;
 --t20-text-primary:#182636;--t20-text-secondary:#586a7c;--t20-text-muted:#607183;--t20-text-disabled:#7b8b9a;--t20-text-inverse:#fff;
 --t20-border:#d7e0e7;--t20-border-strong:#adc1d0;--t20-primary:#3c6284;--t20-primary-hover:#31516e;--t20-accent:#7ba8c9;--t20-focus:#3c6284;
 --t20-shadow:#1826361f;--t20-overlay:#12263666;--t20-success-bg:#edf8f1;--t20-success-text:#205c3d;--t20-success-border:#b5d8c3;
 --t20-warning-bg:#fff7e7;--t20-warning-text:#75521a;--t20-warning-border:#e5cc96;--t20-error-bg:#fff1ef;--t20-error-text:#8d302b;--t20-error-border:#e6b9b4;
 --t20-info-bg:#edf4fa;--t20-info-text:#315d80;--t20-info-border:#bed2e1;--t20-scheme:light;--tchil-color-scheme:light;color-scheme:light;
 --background:#f6f8fb;--foreground:#182636;--card:#fff;--card-foreground:#182636;--popover:#fff;--popover-foreground:#182636;--primary:#3c6284;--primary-foreground:#fff;
 --secondary:#edf3f7;--secondary-foreground:#182636;--muted:#f0f4f8;--muted-foreground:#586a7c;--accent:#e2edf5;--accent-foreground:#182636;--border:#d7e0e7;--input:#adc1d0;--ring:#3c6284;
 --sidebar:#3c6284;--sidebar-foreground:#fff;--sidebar-primary:#fff;--sidebar-primary-foreground:#3c6284;--sidebar-accent:#31516e;--sidebar-accent-foreground:#fff;--sidebar-border:#6887a1;--sidebar-ring:#c6dfef;
 --solution-background:#f6f8fb;--solution-surface:#fff;--solution-accent:#3c6284;--solution-text:#182636;--solution-muted:#586a7c;--solution-border:#d7e0e7;
}
:root[data-tchil-theme="dark"]{--t20-scheme:dark;--tchil-color-scheme:dark;color-scheme:dark}
/* Legacy solution effects write these variables on body; inherit the owned light palette. */
:root[data-tchil-theme="light"] body{--solution-background:var(--t20-page)!important;--solution-surface:var(--t20-surface)!important;--solution-accent:var(--t20-accent)!important}
/* A fresh light account must win over existing root-local editor theme variables. */
:root[data-tchil-theme="light"] :is(.tchil-workspace,.tchil-compta-shell,[data-tchil-dark]){
 --background:#f6f8fb!important;--foreground:#182636!important;--card:#fff!important;--card-foreground:#182636!important;--popover:#fff!important;--popover-foreground:#182636!important;
 --primary:#3c6284!important;--primary-foreground:#fff!important;--secondary:#edf3f7!important;--secondary-foreground:#182636!important;--muted:#f0f4f8!important;--muted-foreground:#586a7c!important;
 --accent:#e2edf5!important;--accent-foreground:#182636!important;--border:#d7e0e7!important;--input:#adc1d0!important;--ring:#3c6284!important;
 --tchil-edge:#d7e0e7;--tchil-soft:#586a7c;--tchil-blue:#3c6284;--tchil-raised:#edf3f7;
}
:root[data-tchil-theme="light"] :is(.tchil-workspace,.tchil-compta-shell){color:#182636!important;background:#f6f8fb!important}
:root[data-tchil-theme="light"] .tchil-workspace>main,
:root[data-tchil-theme="light"] .tchil-workspace #module-panel{background:#f6f8fb!important;background-image:none!important}
/* Navigation is the slate structure from the form; portalled menus stay on white. */
:root[data-tchil-theme="light"] :is(.tchil-utility-header,.tchil-workspace .tchil-mobile-nav,.tchil-compta-shell>header){
 --t20-page:#3c6284;--t20-surface:#3c6284;--t20-surface-raised:#31516e;--t20-surface-hover:#31516e;--t20-surface-selected:#294a66;
 --t20-text-primary:#fff;--t20-text-secondary:#e0eaf2;--t20-text-muted:#d4e3ed;--t20-text-disabled:#b8ccda;--t20-border:#6988a2;--t20-border-strong:#8da9bd;--t20-primary:#d9eaf5;--t20-focus:#c7e0ef;
 color:#fff!important;background:#3c6284!important;border-color:#6887a1!important;box-shadow:0 3px 12px #18263612;
}
:root[data-tchil-theme="light"] .tchil-primary-nav button{color:#e9f1f7!important}
:root[data-tchil-theme="light"] .tchil-primary-nav button:hover,
:root[data-tchil-theme="light"] .tchil-primary-nav button[data-state="open"]{color:#fff!important;background:#31516e!important}
:root[data-tchil-theme="light"] .tchil-primary-nav button[aria-current="page"],
:root[data-tchil-theme="light"] .tchil-primary-nav button[aria-label^="Rubrique"][data-state="open"]{color:#fff!important;background:#294a66!important;box-shadow:inset 0 -2px #b4d3e8}
:root[data-tchil-theme="light"] .tchil-workspace .tchil-mobile-nav button{color:#e5eff5!important}
:root[data-tchil-theme="light"] .tchil-workspace .tchil-mobile-nav button[aria-current="page"]{color:#fff!important;background:#294a66!important}
:root[data-tchil-theme="light"] .tchil-header-search{border-color:#91aebf!important;background:#ffffff14!important;color:#fff!important}
:root[data-tchil-theme="light"] .tchil-launch-countdown{border-color:#d7e0e7}
/* Primary actions have a complete, contrasted pair; accent is reserved for highlights. */
:root[data-tchil-theme="light"] :is(.dv19-primary,.dashboard-primary-action,.bg-primary){
 --t20-text-primary:#fff;--t20-text-secondary:#e5eef5;--t20-accent:#3c6284;
 background-color:#3c6284!important;border-color:#3c6284!important;color:#fff!important;
}
:root[data-tchil-theme="light"] :is(.dv19-primary,.dashboard-primary-action,.bg-primary):hover:not(:disabled){background-color:#31516e!important;border-color:#31516e!important}
:root[data-tchil-theme="light"] :is(.dashboard-hero,.dashboard-metric,.dashboard-panel){background:#fff;background-image:none}
:root[data-tchil-theme="light"] .dashboard-hero{box-shadow:0 5px 20px #1826360f}
/* Print assets and editor previews retain their own configured design, including utility fallbacks. */
:root[data-tchil-theme="light"] :is([data-brand-preview],[data-card-preview],[data-site-preview],[data-qr-preview],[data-appearance-preview],[data-signature-paper],.qr-print-sheet,.public-root){
 --t20-page:initial;--t20-surface:initial;--t20-surface-muted:initial;--t20-surface-raised:initial;--t20-surface-hover:initial;--t20-surface-selected:initial;--t20-field:initial;
 --t20-text-primary:initial;--t20-text-secondary:initial;--t20-text-muted:initial;--t20-text-disabled:initial;--t20-text-inverse:initial;--t20-border:initial;--t20-border-strong:initial;
 --t20-primary:initial;--t20-primary-hover:initial;--t20-accent:initial;--t20-focus:initial;--t20-shadow:initial;--t20-overlay:initial;
 --t20-success-bg:initial;--t20-success-text:initial;--t20-success-border:initial;--t20-warning-bg:initial;--t20-warning-text:initial;--t20-warning-border:initial;
 --t20-error-bg:initial;--t20-error-text:initial;--t20-error-border:initial;--t20-info-bg:initial;--t20-info-text:initial;--t20-info-border:initial;
}
/* All native controls remain readable; semantic statuses and data series keep their meaning. */
:root[data-tchil-theme] :is(button,a,input,textarea,select,[role="button"],[role="switch"]):focus-visible{outline:3px solid var(--t20-focus,#6eaacc);outline-offset:3px}
:root[data-tchil-theme] :is(input[type="checkbox"],input[type="radio"]){accent-color:var(--t20-primary,#6eaacc)}
:root[data-tchil-theme="light"] ::selection{background:#c7ddec;color:#182636}
/* The theme control is one action, not another settings screen. */
.t20-toggle{position:relative;display:inline-grid;place-items:center;flex:0 0 44px;width:44px;min-width:44px;height:44px;min-height:44px;padding:10px;border:1px solid var(--t20-border,#395669);border-radius:11px;background:var(--t20-surface,#172937);color:var(--t20-text-primary,#e9f4fa);cursor:pointer;vertical-align:middle;touch-action:manipulation;line-height:1;transition:background-color .14s,border-color .14s}
.t20-toggle svg{display:block;width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.t20-toggle:hover{background:var(--t20-surface-hover,#233e50);border-color:var(--t20-primary,#6eaacc)}
.t20-toggle:focus-visible{outline:3px solid var(--t20-focus,#9fcce5);outline-offset:3px}
.t20-toggle[aria-busy="true"]:after{position:absolute;right:4px;top:4px;width:5px;height:5px;content:"";border-radius:50%;background:var(--t20-primary,#9fcce5)}
.t20-toggle[data-placement="fallback"]{position:fixed;right:16px;top:calc(12px + env(safe-area-inset-top));z-index:70;box-shadow:0 3px 14px #0002}
:root[data-tchil-theme="light"] :is(.tchil-utility-header,.tchil-compta-shell>header) .t20-toggle{background:#ffffff12;border-color:#9bb6c9;color:#fff}
:root[data-tchil-theme="light"] :is(.tchil-utility-header,.tchil-compta-shell>header) .t20-toggle:hover{background:#ffffff25;border-color:#d9e9f4}
.t20-toast{position:fixed;right:20px;bottom:20px;z-index:2147482000;display:flex;align-items:center;flex-wrap:wrap;gap:8px;max-width:min(470px,calc(100vw - 28px));padding:12px 14px;border:1px solid var(--t20-border,#466174);border-radius:12px;background:var(--t20-surface,#142a39);color:var(--t20-text-primary,#e7f2f8);box-shadow:0 10px 35px var(--t20-shadow,#0004);font:13px/1.55 Inter,'Segoe UI',Arial,sans-serif}
.t20-toast-message{flex:1;min-width:150px;overflow-wrap:anywhere}
.t20-toast[data-error="true"],.t20-toast[data-unsaved="true"],.t20-toast[data-state="error"],.t20-toast[data-state="unsaved"]{background:var(--t20-warning-bg,#362d1c);border-color:var(--t20-warning-border,#816436);color:var(--t20-warning-text,#f4cc8b)}
.t20-toast[data-state="saved"]{border-color:var(--t20-success-border,#385d56)}
.t20-retry,.t20-dismiss{flex:none;min-height:36px;border:1px solid currentColor;border-radius:7px;background:transparent;color:inherit;padding:6px 10px;font:inherit;font-size:12px;cursor:pointer}
.t20-dismiss{display:grid;place-items:center;min-width:36px;padding:4px;border-color:transparent;font-size:19px;line-height:1}
.t20-retry:hover,.t20-dismiss:hover{background:#6eaacc19}
@media(max-width:600px){.t20-toggle{flex-basis:44px;width:44px;min-width:44px;height:44px;min-height:44px;padding:10px}.t20-toggle[data-placement="fallback"]{right:10px;top:calc(9px + env(safe-area-inset-top))}.t20-toast{left:12px;right:12px;bottom:calc(12px + env(safe-area-inset-bottom));max-width:none;padding:11px 12px;font-size:12px}.t20-toast-message{min-width:130px}.t20-retry{font-size:11px}}
@media(prefers-reduced-motion:reduce){.t20-toggle{transition:none}}

/* Moving the same control into a modal keeps it inside its keyboard focus scope. */
.t20-toggle[data-placement="dialog"]{position:absolute;top:10px;right:56px;z-index:1001}
.t20-toggle[data-placement="dialog-header"]{margin-left:auto;align-self:center}
[role="dialog"]:has(> .t20-toggle[data-placement="dialog"]) > [data-slot="dialog-header"]{padding-right:52px}
/* Header actions own their intrinsic width, including the theme control. */
@media(min-width:1280px){
 :root[data-tchil-theme] .tchil-main-header{grid-template-columns:minmax(88px,1fr) minmax(0,auto) max-content}
 :root[data-tchil-theme] .tchil-primary-nav{max-width:100%;min-width:0}
 :root[data-tchil-theme] .tchil-primary-nav>div{max-width:100%;min-width:0;overflow-x:auto;scrollbar-width:thin}
}
/* Preserve the actual masked Group mark's original white/blue paint on slate. */
:root[data-tchil-theme="light"] .tchil-utility-header span[role="img"][aria-label="Logo Tchil Group"]{--t20-surface:#f5f9fc;--t20-accent:#6eaacc}
/* The page is blue-grey; the saved dashboard's cards are white surfaces. */
:root[data-tchil-theme="light"] .dv19-root{--dv19-surface:#ffffff;--dv19-raised:#edf3f7}
/* Keep retry and dismissal reachable inside the modal's own focus scope. */
.t20-toast[data-placement="dialog"]{position:relative;inset:auto;transform:none;width:auto;max-width:none;margin:10px 14px;flex:none;z-index:1002}

/* The legacy live footer effect writes inline dark paint; keep the owned light surface explicit. */
:root[data-tchil-theme="light"] .tchil-workspace footer{background:#ffffff!important;background-color:#ffffff!important;color:#586a7c!important;border-color:#d7e0e7!important}
/* Shared form controls use the form reference's white field surface, including portalled dialogs. */
:root[data-tchil-theme="light"] :is([data-slot="input"],[data-slot="textarea"],[data-slot="select-trigger"]):not(:is([data-brand-preview],[data-brand-preview] *,[data-card-preview],[data-card-preview] *,[data-site-preview],[data-site-preview] *,[data-qr-preview],[data-qr-preview] *,[data-appearance-preview],[data-appearance-preview] *,[data-signature-paper],[data-signature-paper] *,.qr-print-sheet,.qr-print-sheet *)){background:#ffffff!important;background-color:#ffffff!important;color:#182636!important;border-color:#d7e0e7!important}
