/* Couleurs relevées sur le logo TSR : bleu #0E3D8A, turquoise #0393AE, rouge #E94439 */
:root {
  --bleu: #0e3d8a;
  --bleu-fonce: #0a2d68;
  --bleu-clair: #edf2fa;
  --turquoise: #0393ae;
  --rouge: #c8322a;
  --rouge-clair: #fdeceb;
  --vert: #12805c;
  --vert-clair: #e7f5ef;
  --texte: #101828;
  --gris: #667085;
  --bord: #e4e7ec;
  --bord-fort: #d0d5dd;
  --fond: #f6f7f9;
  --ombre: 0 1px 2px rgba(16, 24, 40, .05);
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--texte); background: var(--fond); -webkit-font-smoothing: antialiased; }
header { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; height: 60px; padding: 0 16px; background: #fff; border-bottom: 1px solid var(--bord); }
header .logo { display: flex; align-items: center; gap: 12px; color: var(--gris); text-decoration: none; font-weight: 600; font-size: .95rem; }
header .logo img { height: 28px; width: auto; display: block; }
header .logo span { padding-left: 12px; border-left: 1px solid var(--bord); line-height: 28px; }
header > span { color: var(--gris); font-size: .95rem; }
main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 48px; }
body.public main { max-width: 420px; padding-top: 48px; }
.logo-complet { display: block; width: 220px; height: auto; margin: 0 auto 32px; }
h1 { font-size: 1.5rem; font-weight: 650; letter-spacing: -.01em; margin: 0 0 20px; }
h2 { font-size: 1.05rem; font-weight: 650; margin: 28px 0 10px; }
a { color: var(--bleu); }

label { display: block; margin: 0 0 16px; font-weight: 550; font-size: .95rem; }
input, select, textarea { display: block; width: 100%; margin-top: 6px; padding: 11px 12px; font: inherit; font-weight: 400; color: var(--texte); border: 1px solid var(--bord-fort); border-radius: 8px; background: #fff; box-shadow: var(--ombre); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--turquoise); box-shadow: 0 0 0 3px rgba(3, 147, 174, .18); }
textarea { min-height: 6em; }
fieldset { border: 0; padding: 0; margin: 0 0 16px; }
legend { font-weight: 550; font-size: .95rem; margin-bottom: 8px; }

button, .bouton { display: inline-block; padding: 11px 18px; font: inherit; font-weight: 600; border: 1px solid var(--bleu); border-radius: 8px; background: var(--bleu); color: #fff; text-decoration: none; text-align: center; cursor: pointer; box-shadow: var(--ombre); }
button:hover, .bouton:hover { background: var(--bleu-fonce); border-color: var(--bleu-fonce); }
button:focus-visible, .bouton:focus-visible, a:focus-visible { outline: 3px solid rgba(3, 147, 174, .35); outline-offset: 2px; }
.grand { display: block; width: 100%; padding: 16px; font-size: 1.1rem; }
.secondaire { background: #fff; color: var(--texte); border-color: var(--bord-fort); }
.secondaire:hover { background: var(--fond); border-color: var(--bord-fort); }
.danger { background: #fff; color: var(--rouge); border-color: #f0b4af; }
.danger:hover { background: var(--rouge-clair); border-color: var(--rouge); }
button.lien, button.lien:hover { background: none; border: 0; box-shadow: none; color: var(--gris); padding: 8px 0; text-decoration: underline; font-weight: 400; }

/* Accueil : l'action principale en bleu, les autres en tuiles */
.menu { display: grid; gap: 10px; }
.menu .bouton:not(.grand) { display: flex; justify-content: space-between; align-items: center; padding: 16px; background: #fff; color: var(--texte); border-color: var(--bord); text-align: left; }
.menu .bouton:not(.grand)::after { content: "›"; color: var(--gris); font-size: 1.4rem; line-height: 1; }
.menu .bouton:not(.grand):hover { border-color: var(--bord-fort); background: #fff; }
.menu .grand { margin-bottom: 6px; }
.discret { margin-top: 32px; }

.ok, .erreur { padding: 12px 14px; border-radius: 8px; border: 1px solid; }
.ok { background: var(--vert-clair); color: var(--vert); border-color: #b7e2cf; }
.erreur { background: var(--rouge-clair); color: var(--rouge); border-color: #f6c7c3; }
.alerte { color: var(--rouge); font-weight: 600; }
.gris { color: var(--gris); }

.numero { font-size: 3rem; font-weight: 750; letter-spacing: -.02em; text-align: center; margin: 24px 0 8px; color: var(--bleu); }
.aide { margin: -10px 0 16px; font-size: .9rem; }
.deux { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; }

/* Choix à toucher : la case est cachée, l'étiquette entière est la touche */
.choix-deux { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choix, .case, .photo { display: flex; align-items: center; gap: 8px; margin: 0; padding: 14px; border: 1px solid var(--bord-fort); border-radius: 10px; background: #fff; font-weight: 550; cursor: pointer; box-shadow: var(--ombre); }
.choix { justify-content: center; text-align: center; min-height: 72px; }
.choix input, .case input { width: auto; margin: 0; box-shadow: none; accent-color: var(--bleu); }
.choix input { position: absolute; opacity: 0; }
.choix:has(input:checked), .case:has(input:checked), .photo.prise { border-color: var(--bleu); background: var(--bleu-clair); box-shadow: 0 0 0 1px var(--bleu); }
.choix:has(input:focus-visible) { outline: 3px solid rgba(3, 147, 174, .35); outline-offset: 2px; }
.cases { display: grid; gap: 8px; }
.case { font-weight: 400; padding: 12px; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo { flex-direction: column; justify-content: center; min-height: 72px; position: relative; color: var(--gris); border-style: dashed; }
.photo.prise { color: var(--bleu); border-style: solid; }
.photo input { position: absolute; inset: 0; opacity: 0; margin: 0; padding: 0; }
.photo.prise span::after { content: " ✓"; }
@media (min-width: 700px) { .cases { grid-template-columns: 1fr 1fr; } }

.suggestions { list-style: none; margin: -10px 0 16px; padding: 0; border: 1px solid var(--bord); border-radius: 8px; overflow: hidden; box-shadow: 0 4px 12px rgba(16, 24, 40, .08); }
.suggestions button { display: block; width: 100%; text-align: left; border: 0; border-radius: 0; background: #fff; color: var(--texte); border-bottom: 1px solid var(--bord); font-weight: 400; box-shadow: none; }
.suggestions button:hover { background: var(--bleu-clair); }
.suggestions:empty { display: none; }

.choix-trois { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.choix-trois .choix { min-height: 52px; padding: 8px; }
.en-ligne { display: flex; gap: 8px; align-items: center; }
.en-ligne input { margin: 0; flex: 1 1 160px; width: auto; }
details.bloc { margin: 12px 0; }
details.bloc > summary { list-style: none; display: block; }
details.bloc > summary::-webkit-details-marker { display: none; }
details.bloc[open] > summary { margin-bottom: 12px; }
details.passage { padding: 12px 14px; margin-bottom: 8px; background: #fff; border: 1px solid var(--bord); border-radius: 10px; box-shadow: var(--ombre); }
details.passage > summary { cursor: pointer; }
details.passage form { margin-top: 12px; }
form.erreur { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.fiche { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; padding: 16px; background: #fff; border: 1px solid var(--bord); border-radius: 10px; box-shadow: var(--ombre); }
.fiche dt { color: var(--gris); }
.fiche dd { margin: 0; }
.vignettes { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.vignettes img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--bord); }
.historique { padding-left: 18px; font-size: .92rem; }
.historique li { margin-bottom: 6px; }

.liste { list-style: none; padding: 0; }
.liste a { display: block; padding: 14px 16px; margin-bottom: 8px; background: #fff; border: 1px solid var(--bord); border-radius: 10px; text-decoration: none; color: var(--texte); box-shadow: var(--ombre); }
.liste a:hover { border-color: var(--bord-fort); }

.navigation { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 16px; }
.carte { display: block; padding: 12px 14px; margin-bottom: 8px; background: #fff; border: 1px solid var(--bord); border-left: 3px solid var(--turquoise); border-radius: 8px; text-decoration: none; color: var(--texte); box-shadow: var(--ombre); }
a.carte:hover { border-color: var(--bord-fort); border-left-color: var(--turquoise); }
.carte.termine { border-left-color: var(--vert); opacity: .7; }
article.carte h2 { margin: 4px 0 8px; }
article.carte p { margin: 6px 0; }
.defile { overflow-x: auto; background: #fff; border: 1px solid var(--bord); border-radius: 10px; box-shadow: var(--ombre); }
.planning { border-collapse: collapse; width: 100%; min-width: 720px; }
.planning th, .planning td { border-bottom: 1px solid var(--bord); border-right: 1px solid var(--bord); padding: 8px; vertical-align: top; text-align: left; }
.planning tr > :last-child { border-right: 0; }
.planning tr:last-child > * { border-bottom: 0; }
.planning th { background: var(--fond); font-size: .85rem; font-weight: 600; color: var(--gris); }
.planning td { width: 18%; }
.planning th.aujourdhui { background: var(--bleu-clair); color: var(--bleu); }
.planning .carte { font-size: .88rem; padding: 6px 8px; box-shadow: none; }

/* Repères de lecture */
.tuile small { color: var(--gris); font-weight: 400; font-size: .88rem; }
.pastille { display: inline-block; min-width: 22px; padding: 0 7px; border-radius: 11px; background: var(--bleu); color: #fff; font-size: .8rem; line-height: 22px; text-align: center; vertical-align: 1px; }
.consigne { display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 6px; background: #fff6e5; color: #8a4b00; font-size: .88rem; }
.consigne::before { content: "Consigne : "; font-weight: 600; }
.encart { padding: 14px 16px; margin: 0 0 16px; background: #fff; border: 1px solid var(--bord); border-left: 3px solid var(--turquoise); border-radius: 8px; box-shadow: var(--ombre); }
.encart > :last-child { margin-bottom: 0; }
.encart input { margin-bottom: 12px; }
.centre { text-align: center; }
.etat { display: inline-block; padding: 1px 8px; margin-right: 4px; border-radius: 6px; font-size: .85rem; font-weight: 600; background: var(--bleu-clair); color: var(--bleu); }
.etat.termine { background: var(--vert-clair); color: var(--vert); }
.etat.annule { background: var(--fond); color: var(--gris); }
.onglets { display: flex; gap: 4px; margin-bottom: 16px; padding: 4px; background: #eceff3; border-radius: 10px; }
.onglets a { flex: 1; padding: 8px; border-radius: 7px; text-align: center; text-decoration: none; color: var(--gris); font-weight: 600; font-size: .92rem; }
.onglets a.actif { background: #fff; color: var(--texte); box-shadow: var(--ombre); }
.en-ligne { flex-wrap: wrap; }
.actions { margin-top: 10px; }
.actions button { padding: 8px 12px; font-size: .9rem; }
code { padding: 1px 5px; border-radius: 4px; background: #eceff3; font-size: .85em; }
.en-ligne + .aide, .en-ligne + p.gris { margin-top: 6px; }
.encart.important { background: #fff6e5; border-color: #f5d9a8; border-left-color: #e8a33d; color: #5c3500; }
.carte .fiche { padding: 0; border: 0; box-shadow: none; }

/* Grand écran : barre latérale, listes en colonnes, fiche dossier sur deux colonnes. Sous 960 px rien ne change. */
.tete { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
.tete h1 { margin: 0; }
.retour { display: inline-block; margin-bottom: 8px; color: var(--gris); text-decoration: none; font-size: .9rem; }
.retour:hover { color: var(--bleu); }
.retour::before { content: "← "; }
.barre, .titres, .bureau { display: none; }
.liste .c-num::after { content: " · "; }
.liste a > span, .equipe li > span { display: block; }
.liste .c-num, .liste .c-client, .liste .c-etat { display: inline; }
.liste .c-alerte:empty { display: none; }
.c-alerte .alerte { display: block; }
.equipe { list-style: none; padding: 0; }
.encart .en-ligne { margin-bottom: 12px; }
.encart .en-ligne input { margin: 0; }
.en-ligne input { min-width: 0; }
.liste.jour .consigne::before { content: none; }
.num, .pastille, .planning th, .historique .gris, .liste .gris { font-variant-numeric: tabular-nums; }
kbd { padding: 0 6px; border: 1px solid var(--bord-fort); border-bottom-width: 2px; border-radius: 4px; font: 600 .75rem/1.6 inherit; color: var(--gris); background: #fff; }
.ok[data-flash] { transition: opacity .4s, transform .4s; }
.ok.parti { opacity: 0; transform: translateY(8px); }
.dossier .gauche, .dossier .droite { display: contents; }
.z-fiche { order: 1; } .z-interventions { order: 2; } .z-sage { order: 3; } .z-corriger { order: 4; } .z-cloturer { order: 5; } .z-historique { order: 6; }
.dossier { display: flex; flex-direction: column; }
.planning td.aujourdhui { background: #f7faff; }

@media (min-width: 960px) {
  body { font-size: 15px; }
  body.avec-barre > header { display: none; }
  body.avec-barre main { max-width: 1240px; margin: 0 0 0 240px; padding: 28px 40px 64px; }
  .barre { display: flex; flex-direction: column; gap: 14px; position: fixed; inset: 0 auto 0 0; width: 240px; padding: 18px 14px; background: #fff; border-right: 1px solid var(--bord); overflow-y: auto; }
  .barre .logo { display: flex; align-items: center; gap: 10px; padding: 0 6px 6px; color: var(--gris); text-decoration: none; font-weight: 600; }
  .barre .logo img { height: 26px; }
  .barre .logo span { padding-left: 10px; border-left: 1px solid var(--bord); line-height: 26px; }
  .barre > .bouton { padding: 9px 12px; }
  .barre > .bouton::before { content: "+ "; }
  .recherche { position: relative; }
  .recherche input { margin: 0; padding: 8px 32px 8px 10px; font-size: .9rem; background: var(--fond); box-shadow: none; }
  .recherche input:focus { background: #fff; }
  .recherche kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); pointer-events: none; }
  .recherche input:focus + kbd { display: none; }
  .barre nav { display: grid; gap: 2px; }
  .barre nav a { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border-radius: 7px; color: #344054; text-decoration: none; font-weight: 550; font-size: .92rem; }
  .barre nav a:hover { background: var(--fond); }
  .barre nav a[aria-current] { background: var(--bleu-clair); color: var(--bleu); }
  .moi { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 12px 6px 0; border-top: 1px solid var(--bord); font-size: .88rem; font-weight: 550; }
  .moi small { display: block; color: var(--gris); font-weight: 400; }
  .moi form { margin-left: auto; }
  .moi button.lien { font-size: .82rem; padding: 4px 0; }
  .avatar { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--bleu-clair); color: var(--bleu); font-weight: 650; }
  h1 { font-size: 1.55rem; }
  input, select, textarea { padding: 9px 12px; }
  button, .bouton { padding: 9px 16px; }
  .grand { padding: 12px; font-size: 1rem; }
  main > form, details.bloc > form, .etroit { max-width: 720px; }
  .ok[data-flash] { position: fixed; right: 24px; bottom: 24px; z-index: 20; max-width: 420px; margin: 0; box-shadow: 0 8px 24px rgba(16, 24, 40, .14); }

  /* Accueil gestionnaire : chiffres du jour à la place des tuiles (la barre fait le menu) */
  .bureau { display: block; }
  .avec-barre .telephone { display: none; }
  .menu { max-width: 560px; }
  .chiffres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 8px; }
  .chiffres a { display: block; padding: 16px 18px; background: #fff; border: 1px solid var(--bord); border-radius: 10px; color: var(--gris); text-decoration: none; box-shadow: var(--ombre); font-size: .9rem; }
  .chiffres a:hover { border-color: var(--bord-fort); }
  .chiffres strong { display: block; color: var(--texte); font-size: 1.8rem; font-weight: 650; line-height: 1.2; font-variant-numeric: tabular-nums; }

  /* Listes : une ligne par dossier, colonnes alignées, la ligne entière est le lien */
  .liste { background: #fff; border: 1px solid var(--bord); border-radius: 10px; box-shadow: var(--ombre); overflow: hidden; }
  .liste li + li { border-top: 1px solid var(--bord); }
  .liste a, .titres { display: grid; grid-template-columns: 120px minmax(0, 2fr) minmax(0, 1.1fr) minmax(0, 1.6fr); gap: 16px; align-items: center; margin: 0; padding: 11px 16px; border: 0; border-radius: 0; box-shadow: none; }
  .liste a:hover { background: #f9fafb; }
  .liste a > span, .liste .c-num, .liste .c-client, .liste .c-etat { display: block; }
  .liste .c-num::after { content: none; }
  .liste .c-alerte:empty { display: block; }
  .titres { color: var(--gris); font-size: .8rem; font-weight: 600; background: var(--fond); }
  .liste.jour a, .liste.jour .titres { grid-template-columns: 110px 160px minmax(0, 2fr) minmax(0, 2fr); }

  .gauche details.bloc > summary.bouton, main > details.bloc > summary.bouton { display: inline-block; }
  .paire { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .vignettes img { width: 120px; height: 120px; }

  /* Mes interventions : la semaine en colonnes, la journée avec la fiche à côté */
  .semaine { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 12px; }
  .semaine h2 { margin-top: 0; font-size: .95rem; }
  .semaine h2 a { text-decoration: none; color: var(--texte); }
  .semaine .aujourdhui h2 a { color: var(--turquoise); }
  .semaine .carte { font-size: .9rem; }
  article.carte { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; padding: 18px 20px; }
  .planning th:first-child { position: sticky; left: 0; background: var(--fond); }
}

/* Fiche sur deux colonnes et équipe en grille : seulement quand la place suffit (portables à 1 024 px exclus) */
@media (min-width: 1200px) {
  /* Fiche dossier : l'information à gauche, les gestes à droite */
  .dossier { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
  .dossier .gauche, .dossier .droite { display: block; }
  .droite > section { padding: 16px; margin-bottom: 16px; background: #fff; border: 1px solid var(--bord); border-radius: 10px; box-shadow: var(--ombre); }
  .droite h2 { margin-top: 0; }
  .droite .historique { margin: 0; max-height: 420px; overflow-y: auto; }
  .gauche > section:first-child h2 { margin-top: 0; }
  .equipe { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content; column-gap: 24px; }
  .equipe li { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center; }
  .equipe .actions { margin: 0; justify-content: flex-end; }
}

@media print {
  header, .barre, .droite, details.bloc, button, .bouton, .retour { display: none !important; }
  body, .liste, .fiche { background: #fff; box-shadow: none; }
  main { margin: 0 !important; padding: 0 !important; }
}
