/* Tokens : DESIGN.md Webside Software V6, §3. Police Inter si installée (pas de CDN), sinon système. */
:root {
  --ws-blue: #00719B; --ws-blue-deep: #005A7C; --ws-blue-wash: #EDF5F8; --ws-on-accent: #FFFFFF;
  --ws-ink: #16212B; --ws-muted: #5C6B77; --ws-bg: #F7F9FA; --ws-surface: #FFFFFF;
  --ws-row-hover: #F1F5F7; --ws-neutral-wash: #EFF2F4; --ws-line: #DDE3E8; --ws-line-control: #84919D;
  --ws-ok: #0E7A4B; --ws-ok-wash: #E7F3EC; --ws-danger: #B3261E; --ws-danger-wash: #FBEAE9;
  --ws-1: 4px; --ws-2: 8px; --ws-3: 12px; --ws-4: 16px; --ws-6: 24px; --ws-8: 32px;
  --ws-radius-field: 3px; --ws-radius-box: 6px; --ws-shadow-overlay: 0 4px 12px rgba(22,33,43,.10);
  --ws-motion: 120ms ease-out; --ws-focus: 2px solid var(--ws-blue);
  --ws-topbar-h: 56px; --ws-row-h: 40px; --ws-touch-min: 44px; --ctl: 36px; /* hauteur des contrôles : 36 px, 44 px au tactile */
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font: 400 14px/1.55 var(--font); color: var(--ws-ink); background: var(--ws-bg); }
:where(a, button, input, select, [tabindex]):focus-visible { outline: var(--ws-focus); outline-offset: 0; }
svg.i { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }

/* Barre du haut : marque, onglets, chrono en cours, compte */
.top { min-height: var(--ws-topbar-h); display: flex; align-items: center; gap: var(--ws-6); padding: 0 var(--ws-6); background: var(--ws-surface); border-bottom: 1px solid var(--ws-line); }
.brand { display: flex; align-items: center; gap: var(--ws-3); }
.logo { height: 28px; width: auto; flex: none; }
.brand b { display: block; font-size: 13px; font-weight: 600; line-height: 1.2; }
.brand small { color: var(--ws-muted); font-size: 12px; }
.tabs { display: flex; gap: var(--ws-1); flex: 1; align-self: stretch; overflow-x: auto; }
.tabs a { display: flex; align-items: center; padding: 0 var(--ws-3); font-size: 14px; font-weight: 500; color: var(--ws-muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; transition: color var(--ws-motion); }
.tabs a:hover { color: var(--ws-ink); }
.tabs a[aria-current="page"] { color: var(--ws-ink); font-weight: 600; border-color: var(--ws-blue); }
.top-r { display: flex; align-items: center; gap: var(--ws-2); }
.top-r .nm { font-size: 13px; color: var(--ws-muted); margin-right: var(--ws-1); }
.chip-run { display: flex; align-items: center; gap: var(--ws-3); padding: var(--ws-1) var(--ws-1) var(--ws-1) var(--ws-3); border: 1px solid var(--ws-blue); background: var(--ws-blue-wash); border-radius: var(--ws-radius-box); font-size: 13px; font-weight: 600; color: var(--ws-blue-deep); }
.chip-run .t { font-size: 18px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ws-ok); box-shadow: 0 0 0 3px var(--ws-ok-wash); flex: none; }

/* Page */
.content { padding: var(--ws-6); display: flex; flex-direction: column; gap: var(--ws-4); }
.pagehead { display: flex; align-items: center; flex-wrap: wrap; gap: var(--ws-3); }
.pagehead h1 { flex: 1; margin: 0; font-size: clamp(15px, 1.25vw, 18px); font-weight: 600; letter-spacing: -0.02em; }
.pagehead .grow { flex: 1; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--ws-2); min-height: var(--ctl); padding: 0 var(--ws-3); font: 500 13px var(--font); border-radius: var(--ws-radius-field); border: 1px solid var(--ws-line-control); background: var(--ws-surface); color: var(--ws-ink); cursor: pointer; transition: background var(--ws-motion), border-color var(--ws-motion); }
.btn:hover { background: var(--ws-row-hover); }
.btn-primary { background: var(--ws-blue); border-color: var(--ws-blue); color: var(--ws-on-accent); }
.btn-primary:hover { background: var(--ws-blue-deep); border-color: var(--ws-blue-deep); }
.btn-icon { width: var(--ctl); padding: 0; position: relative; }
.btn-icon[data-tip]:hover::after, .btn-icon[data-tip]:focus-visible::after { content: attr(data-tip); position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--ws-ink); color: var(--ws-surface); font-size: 12px; font-weight: 500; padding: var(--ws-1) var(--ws-2); border-radius: var(--ws-radius-field); white-space: nowrap; z-index: 5; }
.top-r .btn-icon[data-tip]:hover::after { left: auto; right: 0; transform: none; }
.btn-row { width: 24px; min-height: 24px; border: 0; background: none; color: var(--ws-muted); padding: 0; }
.btn-row:hover { background: var(--ws-neutral-wash); color: var(--ws-danger); }

/* Champs */
label { font-size: 13px; font-weight: 500; color: var(--ws-muted); display: flex; flex-direction: column; gap: var(--ws-1); }
textarea { width: 100%; padding: var(--ws-2); font: 400 13px/1.5 var(--font); color: var(--ws-ink); background: var(--ws-surface); border: 1px solid var(--ws-line-control); border-radius: var(--ws-radius-field); resize: vertical; }
input, select { min-height: var(--ctl); padding: 0 var(--ws-2); font: 400 13px var(--font); color: var(--ws-ink); background: var(--ws-surface); border: 1px solid var(--ws-line-control); border-radius: var(--ws-radius-field); }
.bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--ws-3); }

/* Cartes et tableaux */
.card { background: var(--ws-surface); border: 1px solid var(--ws-line); border-radius: var(--ws-radius-box); }
.card > h2 { margin: 0; padding: var(--ws-4) var(--ws-4) var(--ws-3); font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--ws-line); }
.card > h2:empty { display: none; }
.card .pad { padding: var(--ws-4); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--ws-4); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; background: var(--ws-bg); color: var(--ws-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding: 6px var(--ws-4); border-bottom: 1px solid var(--ws-line); }
td { height: var(--ws-row-h); padding: 6px var(--ws-4); border-bottom: 1px solid var(--ws-line); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--ws-row-hover); }
th.r, td.r { text-align: right; font-variant-numeric: tabular-nums; }
td.act { width: 1%; }
td .btn-row { visibility: hidden; }
tr:hover .btn-row, .btn-row:focus-visible { visibility: visible; }
@media (pointer: coarse) { td .btn-row { visibility: visible; } }
.empty { padding: var(--ws-6) var(--ws-4); color: var(--ws-muted); text-align: center; }
.badge { display: inline-flex; align-items: center; min-height: 20px; padding: 2px var(--ws-2); font-size: 12px; font-weight: 500; border-radius: var(--ws-radius-field); background: var(--ws-ok-wash); color: var(--ws-ok); }
.timer { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.muted { color: var(--ws-muted); font-size: 13px; }
.msg { padding: var(--ws-2) var(--ws-3); border-radius: var(--ws-radius-field); background: var(--ws-danger-wash); color: var(--ws-danger); font-size: 13px; }

/* Bande d'action de la semaine : boutons client au repos, aplat bleu quand ça tourne (le seul de l'écran) */
.chips { display: flex; flex-wrap: wrap; gap: var(--ws-2); }
.run { display: flex; align-items: center; flex-wrap: wrap; gap: var(--ws-4); padding: var(--ws-4) var(--ws-6); background: var(--ws-blue); color: var(--ws-on-accent); border-radius: var(--ws-radius-box); }
.run small { display: block; font-size: 13px; opacity: .85; }
.run b { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.run .t { margin-left: auto; font-size: 40px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.run .btn { background: var(--ws-surface); border-color: var(--ws-surface); color: var(--ws-ink); min-height: var(--ws-touch-min); font-size: 14px; }
.run .btn:hover { background: var(--ws-blue-wash); }

/* Grille de semaine */
.wk { display: flex; align-items: center; gap: var(--ws-2); }
.wk b { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; min-width: 200px; text-align: center; }
.tot { font-size: 18px; }
.sum { display: flex; gap: var(--ws-6); align-items: baseline; flex-wrap: wrap; }
.sum b { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.sum span { color: var(--ws-muted); font-size: 13px; margin-left: var(--ws-1); }
.scroll { overflow-x: auto; }
.grid { min-width: 860px; table-layout: fixed; }
.grid th, .grid td { text-align: center; padding: 0 var(--ws-2); }
.grid th:first-child, .grid td:first-child { text-align: left; width: 220px; padding-left: var(--ws-4); }
.grid th:last-child, .grid td:last-child { width: 90px; font-weight: 600; }
.grid th small { display: block; font-size: 12px; letter-spacing: 0; text-transform: none; font-weight: 500; }
.grid td { height: 56px; font-variant-numeric: tabular-nums; }
.grid tbody tr:hover { background: none; }
.grid .today { background: var(--ws-blue-wash); }
.grid th.today { color: var(--ws-blue-deep); }
.grid .none { color: var(--ws-line-control); }
.grid td.live { background: var(--ws-blue); color: var(--ws-on-accent); font-weight: 600; }
.grid td.live .dot { background: #fff; box-shadow: none; display: inline-block; margin-right: 6px; }
.grid td:has(.cellbtn) { padding: 0; }
.cellbtn { width: 100%; height: 55px; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; transition: background var(--ws-motion); }
.cellbtn:hover { background: var(--ws-row-hover); }
td.live .cellbtn:hover { background: var(--ws-blue-deep); }
.grid tfoot td { height: 44px; background: var(--ws-bg); font-weight: 600; border-top: 1px solid var(--ws-line); }
.cl { display: flex; align-items: center; gap: var(--ws-3); font-weight: 500; }
.ini { width: 32px; height: 32px; border-radius: var(--ws-radius-field); background: var(--ws-neutral-wash); display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }

/* Lignes de clients (mini-fenêtre) */
.row { display: flex; align-items: center; gap: var(--ws-3); min-height: 52px; padding: var(--ws-2) var(--ws-4); border-bottom: 1px solid var(--ws-line); }
.row:last-child { border-bottom: 0; }
.row .nm { flex: 1; min-width: 0; font-weight: 500; font-size: 13px; line-height: 1.3; overflow-wrap: anywhere; }
.row .nm small { display: block; color: var(--ws-muted); font-weight: 400; font-size: 12px; }
.row.go { cursor: pointer; transition: background var(--ws-motion); }
.row.go:hover { background: var(--ws-row-hover); }
.row.on { background: var(--ws-blue-wash); }
.row.on .ini { background: var(--ws-blue); color: var(--ws-on-accent); }
.row .timer { font-size: 18px; }

/* Mini-fenêtre */
.mini { margin: var(--ws-3); background: var(--ws-surface); border: 1px solid var(--ws-line); border-radius: var(--ws-radius-box); overflow: hidden; }
.mini .brand { height: var(--ws-topbar-h); padding: 0 var(--ws-4); border-bottom: 1px solid var(--ws-line); }
.mini .rows { max-height: calc(100vh - var(--ws-topbar-h) - 2 * var(--ws-3) - 2px); overflow-y: auto; }

/* Dialogue modal (DESIGN.md §7.11) : rayon boîte, ombre overlay, pied d'actions */
.dlg { width: min(440px, calc(100vw - 32px)); padding: 0; color: var(--ws-ink); background: var(--ws-surface); border: 1px solid var(--ws-line); border-radius: var(--ws-radius-box); box-shadow: var(--ws-shadow-overlay); }
.dlg::backdrop { background: rgba(22, 33, 43, .4); }
.dlg form { padding: var(--ws-6); display: flex; flex-direction: column; gap: var(--ws-3); }
.dlg h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.dlg p { margin: calc(-1 * var(--ws-2)) 0 0; }
.dlg .foot { display: flex; justify-content: flex-end; gap: var(--ws-2); margin-top: var(--ws-2); }

/* Connexion */
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--ws-4); }
.login .card { width: min(480px, 100%); padding: 48px 48px 40px; display: flex; flex-direction: column; gap: 20px; }
.login .logo { height: 80px; align-self: center; }
.login h1 { margin: 0; text-align: center; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.login p { margin: calc(-1 * var(--ws-3)) 0 var(--ws-2); text-align: center; font-size: 14px; }
.login label { font-size: 14px; }
.login input { min-height: 48px; font-size: 15px; padding: 0 var(--ws-3); }
.login .btn { min-height: 48px; font-size: 15px; margin-top: var(--ws-2); }
@media (max-width: 520px) { .login .card { padding: var(--ws-8) var(--ws-4) var(--ws-6); } }

@media (max-width: 1024px), (pointer: coarse) { :root { --ctl: var(--ws-touch-min); } .btn-row { width: var(--ws-touch-min); min-height: var(--ws-touch-min); } }
@media (max-width: 768px) {
  .top { flex-wrap: wrap; gap: var(--ws-2) var(--ws-3); padding: var(--ws-2) var(--ws-4); }
  .top-r { margin-left: auto; }
  .tabs { order: 3; flex-basis: 100%; min-height: 40px; }
  .brand small { display: none; }
  .content { padding: var(--ws-4); }
  .grid2 { grid-template-columns: 1fr; }
  .wk { width: 100%; } .wk b { flex: 1; min-width: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .top, .bar, .btn, .wk { display: none !important; } body { background: #fff; font-size: 11pt; } }

/* Sélecteurs : la liste ouverte suit le design (DESIGN.md §7.3) */
@supports (appearance: base-select) {
  select, select::picker(select) { appearance: base-select; }
  select { align-items: center; justify-content: space-between; gap: var(--ws-2); cursor: pointer; }
  select::picker(select) { margin-top: var(--ws-1); padding: var(--ws-1); background: var(--ws-surface); border: 1px solid var(--ws-line); border-radius: var(--ws-radius-box); box-shadow: var(--ws-shadow-overlay); }
  select option { display: flex; align-items: center; min-height: var(--ctl); padding: 0 var(--ws-2); border-radius: var(--ws-radius-field); font-size: 13px; }
  select option:hover { background: var(--ws-row-hover); }
  select option:checked { background: var(--ws-blue-wash); color: var(--ws-blue-deep); font-weight: 500; }
  select option::checkmark { display: none; }
}

/* Secondes discretes dans les durees (:ss attenue) */
.s { color: var(--ws-muted); font-size: 11px; font-weight: 400; letter-spacing: 0; }
td.live .s { color: var(--ws-on-accent); opacity: .75; }
.sum .s, .tot .s { font-size: .6em; }

/* Wizard d'arrêt (dialogue large) : puces de récapitulatif + liste filtrable */
.dlg-wide { width: min(520px, calc(100vw - 32px)); }
.dlg .dlgbody { padding: var(--ws-6); display: flex; flex-direction: column; gap: var(--ws-3); }
.dlg .dlgbody h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.dlg .dlgbody p { margin: 2px 0 0; }
.crumbs { display: flex; flex-wrap: wrap; gap: var(--ws-2); }
.crumb { display: inline-flex; align-items: center; gap: var(--ws-2); min-height: 28px; padding: 0 var(--ws-3); border-radius: var(--ws-radius-field); font: 400 13px var(--font); border: 1px solid var(--ws-line); background: var(--ws-bg); color: var(--ws-muted); }
button.crumb { cursor: pointer; }
button.crumb:hover { border-color: var(--ws-line-control); }
.crumb b { color: var(--ws-ink); font-weight: 600; }
.crumb.now { border-color: var(--ws-blue); background: var(--ws-blue-wash); color: var(--ws-blue-deep); font-weight: 600; }
.optlist { border: 1px solid var(--ws-line); border-radius: var(--ws-radius-box); max-height: 232px; overflow-y: auto; }
.optlist button { display: flex; align-items: center; gap: var(--ws-3); width: 100%; min-height: 40px; padding: 0 var(--ws-3); border: 0; border-bottom: 1px solid var(--ws-line); background: var(--ws-surface); font: 400 13px var(--font); color: var(--ws-ink); text-align: left; cursor: pointer; }
.optlist button:last-child { border-bottom: 0; }
.optlist button:hover { background: var(--ws-row-hover); }
.optlist button.on { background: var(--ws-blue-wash); color: var(--ws-blue-deep); font-weight: 600; }
.optlist small { margin-left: auto; color: var(--ws-muted); font-weight: 400; font-size: 12px; }
.optlist .rd { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ws-line-control); flex: none; }
.optlist .on .rd { border-color: var(--ws-blue); background: radial-gradient(var(--ws-blue) 45%, transparent 50%); }
.none-msg { padding: var(--ws-4); text-align: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.hd2 { display: flex; align-items: center; justify-content: space-between; }

/* Clients : trois colonnes Clients › Catégories › Projets, sur toute la hauteur de l'écran */
.mc { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--ws-4); }
.mc .col { display: flex; flex-direction: column; height: calc(100vh - var(--ws-topbar-h) - 2 * var(--ws-6) - 52px); min-height: 380px; overflow: hidden; }
.mc .hd { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 var(--ws-4); border-bottom: 1px solid var(--ws-line); font-size: 13px; font-weight: 600; }
.mc .hd small { color: var(--ws-muted); font-weight: 400; font-size: 12px; }
.mc .body { flex: 1; overflow-y: auto; }
.mrow { display: flex; align-items: center; gap: var(--ws-3); min-height: 44px; padding: 0 var(--ws-4); border-bottom: 1px solid var(--ws-line); font-size: 13px; }
.mrow[data-pick] { cursor: pointer; transition: background var(--ws-motion); }
.mrow[data-pick]:hover { background: var(--ws-row-hover); }
.mrow.on { background: var(--ws-blue-wash); color: var(--ws-blue-deep); font-weight: 600; }
.mrow .nm { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mrow small { color: var(--ws-muted); font-weight: 400; font-size: 12px; white-space: nowrap; }
.mrow .ini { width: 28px; height: 28px; font-size: 11px; }
.mrow .btn-row { visibility: hidden; }
.mrow:hover .btn-row, .mrow:focus-within .btn-row, .mrow.on .btn-row { visibility: visible; }
@media (pointer: coarse) { .mrow .btn-row { visibility: visible; } }
.mc .add { display: flex; gap: var(--ws-2); padding: var(--ws-3); border-top: 1px solid var(--ws-line); }
.mc .add input { flex: 1; min-width: 0; }
@media (max-width: 900px) { .mc { grid-template-columns: 1fr; } .mc .col { height: auto; min-height: 0; max-height: 60vh; } }

/* Fenetres moyennes : les onglets passent sous la marque au lieu d'etre coupes par le chrono et les boutons */
@media (max-width: 1100px) {
  .top { flex-wrap: wrap; gap: var(--ws-2) var(--ws-4); padding: var(--ws-2) var(--ws-4); }
  .top-r { margin-left: auto; }
  .tabs { order: 3; flex-basis: 100%; min-height: 40px; }
}
@media (max-width: 1100px) and (min-width: 901px) { .mc .col { height: calc(100vh - 220px); } } /* barre du haut sur deux lignes */

/* Nom de l'utilisateur = bouton « changer mon mot de passe » ; confirmation verte */
.top-r button.nm { background: none; border: 0; padding: 0 var(--ws-1); font: 400 13px var(--font); cursor: pointer; border-radius: var(--ws-radius-field); }
.top-r button.nm:hover { color: var(--ws-ink); text-decoration: underline; }
.okmsg { background: var(--ws-ok-wash); color: var(--ws-ok); }
