/* Shared light theme, loaded after Bootstrap and the legacy view styles.
   The longer selectors deliberately override embedded legacy styles. */
:root:not([data-bs-theme="dark"]) {
  color-scheme: light;
  --brand-primary:#000978; --brand-primary-hover:#00065E; --brand-primary-active:#000449;
  --brand-accent:#FA3027; --page-bg:#FCF7EF; --surface:#FFFFFF;
  --text-main:#172033; --text-muted:#536074; --divider:#DFE3EA; --field-border:#778397;
  --selected-bg:#EAEEFF; --focus-ring:#3057C5; --disabled-bg:#EEF0F4; --disabled-text:#5D6777;
  --danger:#A92028; --neutral-fg:#465365; --neutral-bg:#EFF2F6;
  --info-fg:#164993; --info-bg:#EAF2FF; --pending-fg:#794700; --pending-bg:#FFF1CE;
  --success-fg:#13623C; --success-bg:#E5F5E9; --return-fg:#623B91; --return-bg:#F3EAFC;
  --error-fg:#A92028; --error-bg:#FDEBED;
  --bs-primary:#000978; --bs-primary-rgb:0,9,120; --bs-body-color:var(--text-main);
  --bs-body-bg:var(--page-bg); --bs-border-color:var(--divider);
  --bs-link-color:var(--brand-primary); --bs-link-hover-color:var(--brand-primary-hover);
}
html:not([data-bs-theme="dark"]) body {
  background:var(--page-bg)!important; color:var(--text-main); font-family:'Segoe UI',Arial,sans-serif;
}
html:not([data-bs-theme="dark"]) body :is(h1,h2,h3,h4,h5,h6,.card-text,.display-6,.text-dark,.text-gray-800) { color:var(--text-main)!important; }
html:not([data-bs-theme="dark"]) body :is(.text-muted,.text-secondary,small,.form-text) { color:var(--text-muted)!important; }
html:not([data-bs-theme="dark"]) body :is(a,.text-primary) { color:var(--brand-primary); }
html:not([data-bs-theme="dark"]) body .text-primary { color:var(--brand-primary)!important; }
html:not([data-bs-theme="dark"]) body :is(.card,.modal-content,.login-container,.invoice-box,.dashboard-card,.stats-card) { background:var(--surface); color:var(--text-main); border-color:var(--divider); }
html:not([data-bs-theme="dark"]) body :is(.card-header,.card-footer,.input-group-text) { background:var(--surface)!important; color:var(--text-main)!important; border-color:var(--divider); }
html:not([data-bs-theme="dark"]) body .card-header :is(h1,h2,h3,h4,h5,h6,i) { color:var(--text-main)!important; }
html:not([data-bs-theme="dark"]) body .btn { border-width:1px; font-weight:600; }
html:not([data-bs-theme="dark"]) body :is(.btn-primary,.btn-gradient,.btn-success,.btn-info,.sidebar-toggle) {
  background:var(--brand-primary)!important; border-color:var(--brand-primary)!important; color:var(--surface)!important;
}
html:not([data-bs-theme="dark"]) body :is(.btn-primary,.btn-gradient,.btn-success,.btn-info,.sidebar-toggle):hover { background:var(--brand-primary-hover)!important; border-color:var(--brand-primary-hover)!important; }
html:not([data-bs-theme="dark"]) body :is(.btn-primary,.btn-gradient,.btn-success,.btn-info):active { background:var(--brand-primary-active)!important; }
html:not([data-bs-theme="dark"]) body :is(.btn-secondary,.btn-light,.btn-outline-primary,.btn-outline-secondary) { background:var(--surface)!important; color:var(--brand-primary)!important; border-color:var(--brand-primary)!important; }
html:not([data-bs-theme="dark"]) body :is(.btn-secondary,.btn-light,.btn-outline-primary,.btn-outline-secondary):hover { background:var(--selected-bg)!important; }
html:not([data-bs-theme="dark"]) body :is(.btn-danger,.btn-outline-danger) { color:var(--danger)!important; border-color:var(--danger)!important; background:var(--surface)!important; }
html:not([data-bs-theme="dark"]) body :is(.btn-danger,.btn-outline-danger):hover { color:var(--surface)!important; background:var(--danger)!important; }
html:not([data-bs-theme="dark"]) body :is(.form-control,.form-select,.form-check-input,.input-group-text) { border-color:var(--field-border); color:var(--text-main); background-color:var(--surface); }
html:not([data-bs-theme="dark"]) body :is(.form-control,.form-select)::placeholder { color:var(--text-muted); opacity:1; }
html:not([data-bs-theme="dark"]) body .form-label { color:var(--text-main); }
html:not([data-bs-theme="dark"]) body .form-check-input:checked { background-color:var(--brand-primary); border-color:var(--brand-primary); }
html:not([data-bs-theme="dark"]) body :is(a,button,input,select,textarea,[tabindex]):focus-visible {
  outline:3px solid var(--focus-ring)!important; outline-offset:2px; box-shadow:0 0 0 2px var(--surface)!important;
}
html:not([data-bs-theme="dark"]) body :is(.is-invalid,[aria-invalid="true"]) { border-color:var(--danger)!important; }
html:not([data-bs-theme="dark"]) body :is(.invalid-feedback,.text-danger) { color:var(--danger)!important; }
html:not([data-bs-theme="dark"]) body :is(.btn:disabled,.btn.disabled,input:disabled,select:disabled,textarea:disabled) { background:var(--disabled-bg)!important; color:var(--disabled-text)!important; border-color:var(--field-border)!important; opacity:1; }
html:not([data-bs-theme="dark"]) body .table { --bs-table-bg:var(--surface); --bs-table-color:var(--text-main); --bs-table-border-color:var(--divider); --bs-table-hover-bg:var(--selected-bg); --bs-table-hover-color:var(--text-main); --bs-table-striped-bg:var(--surface); --bs-table-active-bg:var(--selected-bg); --bs-table-active-color:var(--text-main); }
html:not([data-bs-theme="dark"]) body :is(.table thead th,.table-light) { background:var(--surface)!important; color:var(--text-main)!important; }
html:not([data-bs-theme="dark"]) body tr:has(input[type="checkbox"]:checked) > * { background:var(--selected-bg)!important; }
html:not([data-bs-theme="dark"]) body td a:not(.btn) { color:var(--brand-primary); text-decoration:underline; text-underline-offset:3px; }
html:not([data-bs-theme="dark"]) body :is(.nav-tabs .nav-link,.page-link) { background:var(--surface); color:var(--brand-primary); border-color:var(--divider); }
html:not([data-bs-theme="dark"]) body :is(.nav-tabs .nav-link.active,.page-item.active .page-link) { background:var(--selected-bg); color:var(--brand-primary); border-color:var(--brand-primary); font-weight:700; }
html:not([data-bs-theme="dark"]) body #sidebar { background:var(--brand-primary); color:var(--surface); }
html:not([data-bs-theme="dark"]) body #sidebar .sidebar-header { background:var(--page-bg); margin:0 16px 16px; padding:18px 12px; border-radius:12px; }
html:not([data-bs-theme="dark"]) body #sidebar ul li a { color:var(--surface); }
html:not([data-bs-theme="dark"]) body #sidebar ul li a:hover { background:var(--brand-primary-hover); border-left-color:var(--surface); }
html:not([data-bs-theme="dark"]) body #sidebar ul li a.active { background:var(--selected-bg); color:var(--brand-primary); font-weight:700; border-left-color:var(--surface); }
html:not([data-bs-theme="dark"]) body .brand-wordmark { color:var(--brand-primary); font-size:1.35rem; font-weight:750; display:inline-block; }
html:not([data-bs-theme="dark"]) body .brand-logo { width:150px; height:150px; max-width:100%; max-height:none; object-fit:contain; }
html:not([data-bs-theme="dark"]) body #sidebar .sidebar-header img.brand-logo { width:150px; height:150px; }
html:not([data-bs-theme="dark"]) body .brand-footer { color:var(--text-muted); margin-top:32px; font-size:.875rem; }
html:not([data-bs-theme="dark"]) body.login-page { background:var(--page-bg); padding:24px 0; }
html:not([data-bs-theme="dark"]) body .login-container { overflow:visible; }
html:not([data-bs-theme="dark"]) body .login-header .brand-wordmark { background:var(--page-bg); padding:16px; border-radius:10px; margin-bottom:24px; }
html:not([data-bs-theme="dark"]) body .login-header .brand-logo { width:180px; height:180px; padding:0; max-width:100%; }
html:not([data-bs-theme="dark"]) body .text-center a { color:var(--brand-primary)!important; text-decoration:underline; }
html:not([data-bs-theme="dark"]) body :is(.fa-envelope,.fa-phone-alt) { color:var(--brand-primary)!important; }
html:not([data-bs-theme="dark"]) body .modal-header.bg-info { background:var(--info-bg)!important; color:var(--info-fg)!important; }
html:not([data-bs-theme="dark"]) body .modal-header .btn-close { filter:none; }
html:not([data-bs-theme="dark"]) body .dashboard-card :is(h5,p,i) { color:var(--text-main)!important; }
html:not([data-bs-theme="dark"]) body :is(.welcome-banner,.bg-gradient-primary) { background:var(--brand-primary)!important; color:var(--surface); }
html:not([data-bs-theme="dark"]) body .welcome-banner h1 { color:var(--surface)!important; }
html:not([data-bs-theme="dark"]) body .stats-card { border-left-color:var(--brand-primary); }
html:not([data-bs-theme="dark"]) body #content { min-width:0; }
html:not([data-bs-theme="dark"]) body .table-responsive { max-width:100%; }
@media(max-width:991.98px) {
  html:not([data-bs-theme="dark"]) body #content { padding:76px 12px 32px; }
  html:not([data-bs-theme="dark"]) body #sidebar { padding-top:76px; }
  html:not([data-bs-theme="dark"]) body .sidebar-toggle { z-index:1040; }
  html:not([data-bs-theme="dark"]) body .d-flex.justify-content-between { flex-wrap:wrap; gap:12px; }
  html:not([data-bs-theme="dark"]) body h1 { font-size:1.6rem; }
}
@media(max-width:480px) {
  html:not([data-bs-theme="dark"]) body .login-container { padding:24px 18px; width:calc(100% - 24px); }
  html:not([data-bs-theme="dark"]) body .invoice-box { padding:12px; }
}
@media print {
  html:not([data-bs-theme="dark"]) body { background:white!important; }
  #sidebar,.sidebar-toggle,.brand-footer { display:none!important; }
  #content { padding:0!important; }
  .badge { print-color-adjust:exact; -webkit-print-color-adjust:exact; }
}
@media screen {
  html:not([data-bs-theme="dark"]) body .bordereau-container { width:100%; max-width:210mm; min-height:0; }
}
@media screen and (max-width:480px) {
  html:not([data-bs-theme="dark"]) body .bordereau-container { padding:14px; }
  html:not([data-bs-theme="dark"]) body .bordereau-container .header h1 { font-size:1.6rem; }
  html:not([data-bs-theme="dark"]) body .bordereau-container .section { padding:10px; }
}

html:not([data-bs-theme="dark"]) body :is(.status-neutral,.badge.bg-secondary,.alert-secondary,.icon-circle.bg-secondary,.icon-circle.bg-gradient-secondary) { color:var(--neutral-fg)!important; background:var(--neutral-bg)!important; border-color:var(--neutral-fg); }

html:not([data-bs-theme="dark"]) body :is(.status-info,.badge.bg-info,.badge.bg-primary,.alert-info,.alert-primary,.icon-circle.bg-info,.icon-circle.bg-primary,.icon-circle.bg-gradient-info,.icon-circle.bg-gradient-primary) { color:var(--info-fg)!important; background:var(--info-bg)!important; border-color:var(--info-fg); }

html:not([data-bs-theme="dark"]) body :is(.status-pending,.badge.bg-warning,.alert-warning,.icon-circle.bg-warning,.icon-circle.bg-gradient-warning) { color:var(--pending-fg)!important; background:var(--pending-bg)!important; border-color:var(--pending-fg); }

html:not([data-bs-theme="dark"]) body :is(.status-success,.badge.bg-success,.alert-success,.icon-circle.bg-success,.icon-circle.bg-gradient-success) { color:var(--success-fg)!important; background:var(--success-bg)!important; border-color:var(--success-fg); }

html:not([data-bs-theme="dark"]) body :is(.status-return) { color:var(--return-fg)!important; background:var(--return-bg)!important; border-color:var(--return-fg); }

html:not([data-bs-theme="dark"]) body :is(.status-error,.badge.bg-danger,.alert-danger,.icon-circle.bg-danger,.icon-circle.bg-gradient-danger) { color:var(--error-fg)!important; background:var(--error-bg)!important; border-color:var(--error-fg); }

html:not([data-bs-theme="dark"]) body .icon-circle i { color:inherit!important; }
html:not([data-bs-theme="dark"]) body :is(.stat-card,.stat-value,.stat-label) { color:var(--text-main)!important; }
html:not([data-bs-theme="dark"]) body .stat-card { background:var(--surface)!important; border:1px solid var(--divider); }
html:not([data-bs-theme="dark"]) body .nav-tabs .nav-link.active { background:var(--selected-bg)!important; color:var(--brand-primary)!important; }
html:not([data-bs-theme="dark"]) body .nav-tabs .nav-link:hover { background:var(--selected-bg); }
html:not([data-bs-theme="dark"]) body .brand-field-error { display:block; flex-basis:100%; color:var(--danger); font-size:.875rem; margin-top:6px; }

html:not([data-bs-theme="dark"]) body .text-warning { color:var(--pending-fg)!important; }

html:not([data-bs-theme="dark"]) body .text-success { color:var(--success-fg)!important; }

html:not([data-bs-theme="dark"]) body .text-info { color:var(--info-fg)!important; }
