/* TM Optimizer — thème clair, chargé après le thème sombre.
   Le thème sombre conserve l'intégralité de ses styles existants. */
html[data-tm-theme="light"]{color-scheme:light;background:#f2f5fb;color:#182c47}
html[data-tm-theme="light"] body{background:#f2f5fb;color:#182c47}
html[data-tm-theme="light"] header{background:#e6eef9;color:#173355;border-bottom:1px solid #c8d6e9}
html[data-tm-theme="light"] header p{color:#496480}
html[data-tm-theme="light"] header h1{color:#143253}
html[data-tm-theme="light"] .card{background:#fff;color:#1c304b;border-color:#d5dfec;box-shadow:0 2px 10px #14243b0c}
html[data-tm-theme="light"] h2{border-bottom-color:#ccd8e8}
html[data-tm-theme="light"] button,
html[data-tm-theme="light"] select,
html[data-tm-theme="light"] input,
html[data-tm-theme="light"] textarea{background:#fff;color:#1d3452;border-color:#aebfd5}
html[data-tm-theme="light"] input{color:#1d3452;background:#fff}
html[data-tm-theme="light"] input::placeholder,
html[data-tm-theme="light"] textarea::placeholder{color:#71839c}
html[data-tm-theme="light"] button.primary,
html[data-tm-theme="light"] button.active,
html[data-tm-theme="light"] .active,
html[data-tm-theme="light"] .tm-workspace-tabs .tm-workspace-active{background:#215ba4;color:#fff;border-color:#215ba4}
html[data-tm-theme="light"] button:hover{filter:brightness(.97)}
html[data-tm-theme="light"] .muted,
html[data-tm-theme="light"] small,
html[data-tm-theme="light"] footer,
html[data-tm-theme="light"] .tm-section-note{color:#5a6f88}
html[data-tm-theme="light"] .notice{background:#edf3fb;color:#244362}
html[data-tm-theme="light"] .notice.ok{background:#e0f3e9;color:#19563b}
html[data-tm-theme="light"] .metric{background:#ecf3fc;color:#173b66}
html[data-tm-theme="light"] td,
html[data-tm-theme="light"] th{color:#1f3653;border-bottom-color:#d8e2ee}
html[data-tm-theme="light"] th,
html[data-tm-theme="light"] .tm-table thead th{background:#e7eef8;color:#1d385e}
html[data-tm-theme="light"] .tm-table tbody tr:nth-child(even){background:#f7f9fd}
html[data-tm-theme="light"] tr:hover td{background:#eaf2fd}
html[data-tm-theme="light"] .tm-line{color:#244d80}
html[data-tm-theme="light"] .tm-circle.empty{color:#687d96}
html[data-tm-theme="light"] .tm-sort:hover{background:#d4e5fb}
html[data-tm-theme="light"] .tm-sort-arrow,
html[data-tm-theme="light"] .tm-driver-grid .tm-sort-arrow,
html[data-tm-theme="light"] .tm-table .tm-sort-arrow{color:#305a8d}
html[data-tm-theme="light"] .tm-driver-grid thead th[aria-sort="ascending"],
html[data-tm-theme="light"] .tm-driver-grid thead th[aria-sort="descending"]{background:#c8dff7}
html[data-tm-theme="light"] .tm-driver-grid .tm-proposed-row td{background:#e2effb;color:#173a63}
html[data-tm-theme="light"] .tm-driver-grid .tm-proposed-first td{border-top-color:#5686c2}
html[data-tm-theme="light"] .tm-delta-down,
html[data-tm-theme="light"] .tm-positive{color:#17673c}
html[data-tm-theme="light"] .tm-delta-up{color:#96540b}
html[data-tm-theme="light"] .tm-negative{color:#b32641}
html[data-tm-theme="light"] .tm-delta-same{color:#61758b}
html[data-tm-theme="light"] .tm-help-lead{color:#25415e}
html[data-tm-theme="light"] .tm-help h3{border-bottom-color:#cddbea}
html[data-tm-theme="light"] .tm-help-priorities>div{background:#f2f7fd;border-color:#ccdaec}
html[data-tm-theme="light"] .tm-help-formula{background:#eef5ff;border-left-color:#3578c7}
html[data-tm-theme="light"] #changes .tm-change-grid td.tm-change-highlight{background:#d6f2e2;box-shadow:inset 0 0 0 1px #5cba87}
html[data-tm-theme="light"] .tm-line-change-card{background:#fff;color:#203852;border-color:#c9d7e8;box-shadow:0 2px 8px #182b400b}
html[data-tm-theme="light"] .tm-line-change-card summary{background:#e7f0fb;color:#264768}
html[data-tm-theme="light"] .tm-line-change-card summary strong{color:#173a62}
html[data-tm-theme="light"] .tm-line-change-card[open] summary{background:#dceafb;border-bottom-color:#c9d7e8}
html[data-tm-theme="light"] .tm-line-change-card .tm-slot-change{border-top-color:#d9e3f0}
html[data-tm-theme="light"] .tm-fuel-period-details{border-color:#c5d5e8}
html[data-tm-theme="light"] .tm-fuel-period-details summary{background:#e7f0fb;color:#204168}
html[data-tm-theme="light"] .tm-fuel-period-details[open] summary{border-bottom-color:#c5d5e8}
html[data-tm-theme="light"] .tm-fuel-period-total th,
html[data-tm-theme="light"] .tm-fuel-period-total td{background:#dbeaf9;border-top-color:#7fa5cf}
html[data-tm-theme="light"] .tm-fuel-period-details .tm-fuel-daily-average td{background:#eef5fc;color:#5b7089;border-bottom-color:#bdd2e7}
html[data-tm-theme="light"] .tm-fuel-period-details .tm-fuel-daily-average td:first-child{color:#375576}
html[data-tm-theme="light"] .tm-premium-notice{background:#fff7df;color:#6a471a;border-color:#d6a34b;border-left-color:#d99a28}
html[data-tm-theme="light"] .tm-premium-notice strong{color:#7b470b}
html[data-tm-theme="light"] .tm-onboarding-step{background:#f4f8fe;border-color:#d1dfed}
html[data-tm-theme="light"] .tm-onboarding-step p{color:#4e6682}
html[data-tm-theme="light"] .tm-onboarding-tip{background:#eaf3fd;border-color:#b9d2ed}
html[data-tm-theme="light"] .tm-help-deficit{background:#fff8e9;border-color:#d4ad69;border-left-color:#d99a28}
html[data-tm-theme="light"] .tm-calc-progress{background:#edf4fd;color:#173b62;border-color:#bfcfe4}
html[data-tm-theme="light"] #partialStrategySettings{border-left-color:#d99a28}
html[data-tm-theme="light"] #tmvehicles .tm-table th.tm-period-start,
html[data-tm-theme="light"] #tmvehicles .tm-table td.tm-period-start,
html[data-tm-theme="light"] #changes .tm-change-grid .tm-period-start{border-left-color:#92b1d3}
html[data-tm-theme="light"] .tm-ateliers{background:#a53b23;color:#fff}
html[data-tm-theme="light"] .tm-tag{background:#215ba4;color:#fff}
html[data-tm-theme="light"] .tm-appearance-control{color:#314e70}
.tm-appearance-control{display:inline-flex;align-items:center;gap:9px;font-size:13px;font-weight:650}
.tm-appearance-control select{font-size:13px;padding:6px 10px;min-width:105px;border-radius:9px}
.tm-appearance-toolbar{display:flex;justify-content:flex-end;margin-top:10px}
@media(max-width:560px){.tm-appearance-toolbar{justify-content:flex-start}}

/* v0.13.48 — improve version badge and calculation progress contrast. */
html[data-tm-theme="light"] #appVersion{
 background:#215ba4!important;
 color:#fff!important;
 border:1px solid #184b86;
 font-weight:700;
}
html[data-tm-theme="light"] .tm-calc-progress .tm-progress-done{color:#187344}
html[data-tm-theme="light"] .tm-calc-progress .tm-progress-current{color:#183f70;font-weight:750}
html[data-tm-theme="light"] .tm-calc-progress .tm-progress-pending{color:#647891}

/* Distinguish summary counters from the light-blue notice background. */
html[data-tm-theme="light"] #changes .metrics .metric{
  background:#ffffff;
  color:#183858;
  border:1px solid #c7d7e9;
  box-shadow:0 2px 5px rgba(31,69,113,.09);
}
html[data-tm-theme="light"] #changes .metrics .metric b{color:#174e89}

/* v0.13.50 — compact header shared by light and dark themes. */
.tm-header-layout{display:flex;justify-content:space-between;align-items:center;gap:20px}
.tm-header-intro{min-width:0;flex:1}
.tm-header-intro h1{margin:0}
.tm-header-intro p{margin:5px 0 0}
.tm-header-layout .tm-appearance-toolbar{flex-shrink:0;margin-top:0;justify-content:flex-end}
@media(max-width:640px){
 .tm-header-layout{align-items:flex-start;flex-direction:column;gap:12px}
 .tm-header-layout .tm-appearance-toolbar{justify-content:flex-start}
}

/* Kilométrage par véhicule — clair. */
html[data-tm-theme="light"] .tm-mileage-grid th small{color:#5c738c}
html[data-tm-theme="light"] .tm-mileage-grid .tm-mileage-total th{background:#dceaf9;color:#1b3d64;border-top-color:#81a9d6}
html[data-tm-theme="light"] .tm-mileage-kind{color:#326ba8}
html[data-tm-theme="light"] .tm-mileage-unavailable{color:#a33a28}
html[data-tm-theme="light"] .tm-mileage-detail summary{color:#245b9c}

/* Forum needs import — light theme warnings and verification. */
html[data-tm-theme="light"] .tm-import-warning{background:#fff5df;color:#684315;border-color:#d5a35c;border-left-color:#d48816}
html[data-tm-theme="light"] .tm-import-verify{background:#f0f6fe;border-color:#98b8de;color:#234768}

/* Efficiency gains panel — light theme contrast. */
html[data-tm-theme="light"] .tm-efficiency-summary{background:#f2f9ff;color:#193a5a;border-color:#a8c9e4;border-left-color:#268465}
html[data-tm-theme="light"] .tm-efficiency-summary summary{color:#1e5b9b}
html[data-tm-theme="light"] .tm-efficiency-saving{color:#216b55}

html[data-tm-theme="light"] .tm-efficiency-explain{color:#4c667f}

/* Experimental exact search report (light theme). */
html[data-tm-theme="light"] #tmExact .tm-exact-status{background:#fff7e8;color:#563e1d;border-color:#d6bd8e;border-left-color:#c58926}
html[data-tm-theme="light"] #tmExact .tm-exact-status.tm-exact-proved{background:#e9f8ef;color:#1f593a;border-color:#9bceb1;border-left-color:#278657}

/* Charging switch — light palette. */
html[data-tm-theme="light"] #lignesConfig .tm-charging-track{background:#d9e2ed;border-color:#8ea3bb}
html[data-tm-theme="light"] #lignesConfig .tm-charging-track::before{background:#fff;box-shadow:0 1px 2px #16365733}
html[data-tm-theme="light"] #lignesConfig .tm-charging-checkbox:checked+.tm-charging-track{background:#1968bb;border-color:#1968bb}
html[data-tm-theme="light"] #lignesConfig .tm-charging-checkbox:focus-visible+.tm-charging-track{outline-color:#1b5da3}
html[data-tm-theme="light"] #lignesConfig .tm-charging-state{color:#213b56}
html[data-tm-theme="light"] #lignesConfig .tm-charging-range{color:#526d89}
html[data-tm-theme="light"] #lignesConfig .tm-charging-range strong{color:#244f80}

/* Daily weekday average in the main energy-cost summary (light theme). */
html[data-tm-theme="light"] .tm-fuel-main-daily th,
html[data-tm-theme="light"] .tm-fuel-main-daily td{background:#f0f5fb;color:#415b78;border-bottom-color:#d2dfed}
html[data-tm-theme="light"] .tm-fuel-main-daily strong.tm-positive{color:#187b48}
html[data-tm-theme="light"] .tm-fuel-main-daily strong.tm-negative{color:#b33535}

/* One-day special shuttles: light theme. */
html[data-tm-theme="light"] #tmSpecial .tm-special-table th{color:#1c416c}


/* Forum-only special-line information: light theme. */
html[data-tm-theme="light"] #tmSpecialNotice{background:#e4effd;color:#193b61;border:1px solid #83a9d3;border-radius:9px;box-shadow:0 1px 4px #173e6818}
html[data-tm-theme="light"] #tmSpecial table th{color:#193b61}

/* v0.13.106 — spaced header Drive actions, separate from theme switcher. */
.tm-header-layout .tm-appearance-toolbar{display:flex;align-items:center;justify-content:flex-end;gap:20px;flex-wrap:wrap}
.tm-header-drive-actions{display:inline-flex;align-items:center;gap:12px;padding:5px;border-radius:14px;background:rgba(255,255,255,.055);border:1px solid rgba(161,185,218,.15)}
.tm-header-layout .tm-header-drive-btn{font-size:13px;font-weight:650;line-height:1.25;white-space:nowrap;padding:10px 16px;border-radius:10px;background:#244566;color:#fff;border:1px solid #6482a6;box-shadow:0 2px 6px #0002;cursor:pointer;transition:background .15s ease,border-color .15s ease}
.tm-header-layout .tm-header-drive-btn:hover:not(:disabled){background:#315b87;border-color:#9bb9d9}
.tm-header-layout .tm-header-drive-btn:disabled{cursor:not-allowed}
.tm-header-layout .tm-appearance-control{margin-left:8px;gap:10px}
html[data-tm-theme="light"] .tm-header-drive-actions{background:rgba(41,92,151,.06);border-color:#c4d5e8}
html[data-tm-theme="light"] .tm-header-layout .tm-header-drive-btn{background:#e5effb;color:#1f4c7c;border-color:#a9c2e2;box-shadow:0 2px 5px #24466a12}
html[data-tm-theme="light"] .tm-header-layout .tm-header-drive-btn:hover:not(:disabled){background:#d5e7fa;border-color:#7fa8d5}
@media(max-width:860px){.tm-header-layout .tm-appearance-toolbar{justify-content:flex-start;gap:12px}.tm-header-layout .tm-appearance-control{margin-left:0}}
@media(max-width:420px){.tm-header-drive-actions{gap:8px;padding:4px}.tm-header-layout .tm-header-drive-btn{padding:9px 11px;font-size:12px}}

/* v0.13.109 — clear, accessible Drive status contrast in both themes. */
#tmDriveQuickStatus{font-size:13px;font-weight:650;color:#dceafa;line-height:1.35;max-width:230px}
#tmDriveQuickStatus[data-status-error="true"]{color:#ffb0b9}
html[data-tm-theme="light"] #tmDriveQuickStatus{color:#244b75}
html[data-tm-theme="light"] #tmDriveQuickStatus[data-status-error="true"]{color:#a61e38}

/* v0.13.111 — vehicle / driver subtabs in changes to apply. */
.tm-changes-subtabs{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:16px 0 12px;padding-bottom:10px;border-bottom:1px solid #526781}
.tm-changes-subtabs button{padding:10px 17px;border-radius:10px;border:1px solid #526781;background:#1c2e49;color:#e2ecfc;font-weight:650;cursor:pointer}
.tm-changes-subtabs button.active,.tm-changes-subtabs button[aria-selected="true"]{background:#28629a;color:white;border-color:#80aee1;box-shadow:inset 0 -2px 0 #a5cafd}
.tm-changes-subtabs button:hover:not(.active){border-color:#86a4c8;background:#293f5c}
html[data-tm-theme="light"] .tm-changes-subtabs{border-bottom-color:#cfdaea}
html[data-tm-theme="light"] .tm-changes-subtabs button{background:#f2f6fd;color:#24436c;border-color:#bacde5}
html[data-tm-theme="light"] .tm-changes-subtabs button.active,
html[data-tm-theme="light"] .tm-changes-subtabs button[aria-selected="true"]{background:#215ba4;color:white;border-color:#215ba4}
html[data-tm-theme="light"] .tm-changes-subtabs button:hover:not(.active){background:#e2ebf8}
#changesVehicleTools[hidden]{display:none!important}

/* v0.13.113 — editable individual interim prices before optimization. */
.tm-driver-rates-panel{margin:14px 0}
.tm-driver-rates-panel details{padding:12px 16px;border:1px solid #50698c;border-radius:12px;background:#1a2941;color:#e9f1ff}
.tm-driver-rates-panel summary{cursor:pointer;font-weight:600;padding:3px 0}
.tm-driver-rates-panel .tablewrap{margin:12px 0 4px}
.tm-driver-rates-panel input{max-width:150px}
html[data-tm-theme="light"] .tm-driver-rates-panel details{background:#f3f7fd;color:#1d385a;border-color:#c0d1e4}

/* v0.13.114 — missing interim prices dialog, shown after API sync. */
.tm-rates-dialog{width:min(560px,calc(100vw - 28px));max-height:85vh;overflow-y:auto;padding:22px;border:1px solid #627da4;border-radius:16px;background:#1c2b43;color:#ecf3fe;box-shadow:0 15px 60px #0009}
.tm-rates-dialog::backdrop{background:rgba(5,17,35,.72)}
.tm-rates-dialog h3{margin:0 0 10px;font-size:1.2rem}
.tm-rates-dialog p{line-height:1.5}
.tm-rates-fields{display:grid;gap:10px;max-height:45vh;overflow:auto;margin:15px 0}
.tm-rates-fields label{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:10px;border:1px solid #48627f;border-radius:10px}
.tm-rates-fields label span{display:grid;gap:3px;min-width:0}
.tm-rates-fields label small{font-size:12px;opacity:.8}
.tm-rates-fields input{width:125px;max-width:42%;flex-shrink:0;color:#152943;background:#f7fbff}
.tm-rates-actions{display:flex;justify-content:flex-end;gap:10px;flex-wrap:wrap;margin-top:18px}
.tm-rates-error{color:#ffb6b6;font-weight:600}
html[data-tm-theme="light"] .tm-rates-dialog{background:#fff;color:#243e61;border-color:#b9cde6}
html[data-tm-theme="light"] .tm-rates-fields label{border-color:#d3dfef}
html[data-tm-theme="light"] .tm-rates-error{color:#a51c38}
@media(max-width:420px){.tm-rates-dialog{padding:16px}.tm-rates-fields label{flex-wrap:wrap}.tm-rates-fields input{max-width:100%;width:100%}}

/* v0.13.115 — compact conductor column headings and one-click matricule copying. */
.tm-matricule-copy{display:inline-flex;align-items:center;gap:6px;white-space:nowrap}
.tm-copy-matricule{border:1px solid #6886ab;border-radius:6px;background:#243f60;color:#f1f6ff;cursor:pointer;padding:2px 6px;font-size:13px;line-height:1.2;min-width:27px;min-height:25px}
.tm-copy-matricule:hover,.tm-copy-matricule:focus-visible{background:#356594;border-color:#abc6e8}
#changesContent th small{display:block;font-size:11px;font-weight:500;white-space:nowrap;opacity:.82}
html[data-tm-theme="light"] .tm-copy-matricule{background:#e6eef9;color:#24446e;border-color:#a7bddb}
html[data-tm-theme="light"] .tm-copy-matricule:hover,html[data-tm-theme="light"] .tm-copy-matricule:focus-visible{background:#cce1f9;border-color:#709ccc}
