/* Console agenda — feuille unique, sans dependance. */
:root {
  --encre: #0f172a;
  --gris: #64748b;
  --trait: #e2e8f0;
  --fond: #f8fafc;
  --papier: #fff;
  --accent: #0ea5e9;
  --danger: #dc2626;
  --ok: #059669;
  --rayon: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--encre);
  background: var(--fond);
}

h1 { font-size: 1.15rem; margin: 0; font-weight: 600; }
h2 { font-size: 1.05rem; margin: 0 0 1rem; font-weight: 600; }

/* ------------------------------------------------------------- barre */
.barre {
  display: flex; align-items: center; gap: 1rem;
  padding: .7rem 1rem;
  background: var(--papier);
  border-bottom: 1px solid var(--trait);
  position: sticky; top: 0; z-index: 10;
}
.barre h1 { flex: 1; text-align: center; text-transform: capitalize; }
.nav-jour { display: flex; gap: .4rem; align-items: center; }
.qui { color: var(--gris); font-size: .85rem; }
.qui a { color: var(--gris); }

/* ---------------------------------------------------------- boutons */
button, .bouton {
  font: inherit; cursor: pointer;
  border: 1px solid transparent; border-radius: var(--rayon);
  padding: .45rem .8rem;
  background: var(--accent); color: #fff;
  text-decoration: none; display: inline-block;
}
button.fin, .bouton.fin {
  background: var(--papier); color: var(--encre); border-color: var(--trait);
}
button.fin:hover, .bouton.fin:hover { background: var(--fond); }
button.danger { background: var(--danger); }

input, select {
  font: inherit; width: 100%;
  padding: .45rem .6rem;
  border: 1px solid var(--trait); border-radius: var(--rayon);
  background: var(--papier); color: var(--encre);
}
.nav-jour input[type=date] { width: auto; }
label { display: block; margin-bottom: .8rem; font-size: .85rem; color: var(--gris); }
label input, label select { margin-top: .25rem; color: var(--encre); }

/* --------------------------------------------------------- messages */
.alerte {
  margin: .8rem 1rem; padding: .6rem .9rem;
  border-radius: var(--rayon); font-size: .9rem;
}
.alerte.ok { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alerte.erreur { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.aide { color: var(--gris); font-size: .85rem; }
.petit { font-size: .78rem; }

/* ---------------------------------------------------------- agenda */
.cadre-agenda { overflow-x: auto; padding: 0 1rem 3rem; }
.agenda { border-collapse: collapse; width: 100%; min-width: 900px; }
.agenda th, .agenda td { border: 1px solid var(--trait); }

.agenda thead th {
  background: var(--papier); padding: .5rem;
  font-size: .9rem; font-weight: 600;
  border-bottom: 3px solid var(--teinte, var(--trait));
  position: sticky; top: 52px; z-index: 5;
}
.agenda thead th span {
  display: block; font-weight: 400; font-size: .75rem; color: var(--gris);
}

.col-heure {
  width: 58px; background: var(--fond);
  font-size: .75rem; color: var(--gris); font-weight: 400;
  text-align: right; padding-right: .5rem; vertical-align: top;
}
.agenda tbody tr { height: 22px; }
.agenda tbody tr.heure-pleine td { border-top: 1px solid #cbd5e1; }

td.libre { padding: 0; background: var(--papier); }
td.libre button.creer {
  width: 100%; height: 100%; min-height: 22px;
  background: none; color: transparent; border: none; padding: 0;
  border-radius: 0; font-size: .8rem;
}
td.libre:hover button.creer { color: var(--accent); background: #f0f9ff; }

td.prise { padding: 1px; vertical-align: top; }
button.rdv {
  width: 100%; height: 100%; text-align: left;
  background: color-mix(in srgb, var(--teinte) 12%, white);
  border-left: 3px solid var(--teinte);
  color: var(--encre); padding: .2rem .4rem; border-radius: 3px;
  display: flex; flex-direction: column; gap: 1px; overflow: hidden;
}
button.rdv:hover { background: color-mix(in srgb, var(--teinte) 22%, white); }
button.rdv b { font-size: .82rem; font-weight: 600; }
button.rdv span { font-size: .72rem; color: var(--gris); }
button.rdv i { font-size: .72rem; font-style: normal; color: var(--gris); }
button.rdv em {
  font-style: normal; font-size: .62rem; text-transform: uppercase;
  letter-spacing: .04em; color: var(--gris);
}
em.canal-telephone { color: #b45309; }
em.canal-whatsapp { color: #059669; }
em.canal-web { color: #0369a1; }
em.tenu { color: var(--danger); font-weight: 600; }

/* --------------------------------------------------- glisser-deposer */
button.rdv { cursor: grab; }
button.rdv:active { cursor: grabbing; }
button.rdv.en-vol { opacity: .35; }
button.rdv.en-attente { opacity: .5; pointer-events: none; }

/* Pendant le glissement, les cases libres se signalent. */
body.en-glissement td.libre { background: #f0fdfa; }
body.en-glissement td.libre button.creer { display: none; }
td.libre.cible {
  background: #ccfbf1;
  outline: 2px solid #0d9488; outline-offset: -2px;
}

#bulle {
  position: fixed; left: 50%; bottom: -80px; transform: translateX(-50%);
  padding: .6rem 1.1rem; border-radius: 999px;
  font-size: .9rem; z-index: 50; opacity: 0;
  transition: bottom .25s ease, opacity .25s ease;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .2);
  max-width: 90vw; text-align: center;
}
#bulle.visible { bottom: 24px; opacity: 1; }
#bulle.ok { background: #065f46; color: #fff; }
#bulle.ko { background: #991b1b; color: #fff; }

/* --------------------------------------------------------- dialogues */
dialog {
  border: none; border-radius: 12px; padding: 1.5rem;
  width: min(480px, 92vw);
  box-shadow: 0 20px 50px rgba(15, 23, 42, .25);
}
dialog::backdrop { background: rgba(15, 23, 42, .45); }
dialog menu {
  display: flex; gap: .5rem; justify-content: flex-end;
  margin: 1.2rem 0 0; padding: 0;
}
fieldset {
  border: 1px solid var(--trait); border-radius: var(--rayon);
  padding: .8rem; margin: 0 0 .8rem;
}
legend { font-size: .8rem; color: var(--gris); padding: 0 .4rem; }
.grille2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .6rem; }
.grille2 label:last-child { grid-column: 1 / -1; }
details summary { cursor: pointer; font-size: .85rem; color: var(--accent); }
.annulation { margin-top: 1rem; border-top: 1px solid var(--trait); padding-top: 1rem; }

#resultats-patient { list-style: none; margin: .4rem 0 0; padding: 0; }
#resultats-patient li {
  padding: .4rem .5rem; border-radius: var(--rayon); cursor: pointer;
  display: flex; align-items: baseline; gap: .4rem; font-size: .85rem;
}
#resultats-patient li:hover { background: var(--fond); }
#resultats-patient li span { color: var(--gris); font-size: .78rem; flex: 1; }
#resultats-patient li i {
  font-style: normal; font-size: .7rem; color: var(--gris);
  background: var(--fond); padding: 0 .3rem; border-radius: 4px;
}
#resultats-patient li.vide { color: var(--gris); cursor: default; }

/* ------------------------------------------------- pages autonomes */
.centre {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
}
.carte {
  background: var(--papier); border: 1px solid var(--trait);
  border-radius: 12px; padding: 1.8rem; width: min(430px, 100%);
}
.carte h1 { margin-bottom: .3rem; font-size: 1.25rem; }
.carte button[type=submit] { width: 100%; margin-top: .5rem; }
.connexion .aide { margin-top: 0; }

/* ==================================================== pages de config */
.page { max-width: 68rem; margin: 0 auto; padding: 1.2rem 1rem 4rem; }
.page > .aide { margin-bottom: 1.5rem; }

.cartes {
  display: grid; gap: .9rem;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
}
.carte-praticien {
  display: block; text-decoration: none; color: inherit;
  background: var(--papier); border: 1px solid var(--trait);
  border-left: 4px solid var(--teinte, var(--accent));
  border-radius: var(--rayon); padding: 1rem 1.1rem;
  transition: box-shadow .15s, transform .1s;
}
.carte-praticien:hover {
  box-shadow: 0 4px 16px rgba(15, 23, 42, .08); transform: translateY(-1px);
}
.carte-praticien h2 { margin: 0; font-size: 1rem; }
.carte-praticien .specialite { margin: .1rem 0 .8rem; font-size: .8rem; color: var(--gris); }
.carte-praticien dl { margin: 0 0 .8rem; font-size: .82rem; }
.carte-praticien dl > div { display: flex; justify-content: space-between; padding: .12rem 0; }
.carte-praticien dt { color: var(--gris); }
.carte-praticien dd { margin: 0; font-weight: 600; }
.carte-praticien .etat { margin: 0; font-size: .78rem; color: var(--gris); }
.pastille {
  display: inline-block; width: .55rem; height: .55rem; border-radius: 50%;
  margin-right: .3rem;
}
.pastille.ouverte { background: var(--ok); }
.pastille.fermee { background: #cbd5e1; }

.bloc {
  background: var(--papier); border: 1px solid var(--trait);
  border-radius: var(--rayon); padding: 1.2rem; margin-bottom: 1.2rem;
}
.bloc h2 { font-size: 1rem; margin-bottom: .4rem; }
.bloc > .aide { margin: 0 0 1.2rem; }

.semaine {
  display: grid; gap: .6rem;
  /* Les champs d'heure ont une largeur minimale incompressible : sous
     13rem par colonne, les cartes debordent et se chevauchent. */
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}
fieldset.jour {
  border: 1px solid var(--trait); border-radius: var(--rayon);
  padding: .7rem; margin: 0; background: var(--papier);
  min-width: 0;   /* autorise la colonne a se comprimer */
}
fieldset.jour.inactif { background: var(--fond); opacity: .62; }
fieldset.jour legend { padding: 0 .3rem; }
fieldset.jour label { margin-bottom: .45rem; font-size: .75rem; min-width: 0; }
fieldset.jour input[type=time] {
  width: 100%; min-width: 0; padding: .3rem .35rem; font-size: .8rem;
}
.etiquette {
  margin: .6rem 0 .3rem; font-size: .68rem; color: var(--gris);
  text-transform: uppercase; letter-spacing: .04em;
}
.paire { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; min-width: 0; }
.paire > * { min-width: 0; }
.paire label { margin-bottom: 0; }

.bascule { display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; }
.bascule input { width: auto; }
.bascule span { font-size: .85rem; color: var(--encre); font-weight: 600; }
.bascule.large { grid-column: 1 / -1; }

.reglages { display: grid; gap: .8rem 1.2rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
.reglages small { display: block; margin-top: .2rem; font-size: .72rem; color: var(--gris); }
.reglages .pleine { grid-column: 1 / -1; }
.reglages textarea {
  width: 100%; font: inherit; padding: .45rem .6rem; margin-top: .25rem;
  border: 1px solid var(--trait); border-radius: var(--rayon); color: var(--encre);
}
.actions { text-align: right; margin: 0 0 1.5rem; }

.ligne-absence {
  display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap;
  padding-bottom: 1rem; border-bottom: 1px solid var(--trait); margin-bottom: 1rem;
}
.ligne-absence label { margin-bottom: 0; }
.ligne-absence .grand { flex: 1; min-width: 12rem; }

table.liste { width: 100%; border-collapse: collapse; font-size: .87rem; }
table.liste th {
  text-align: left; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .04em; color: var(--gris); font-weight: 500;
  padding: .3rem .5rem; border-bottom: 1px solid var(--trait);
}
table.liste td { padding: .45rem .5rem; border-bottom: 1px solid var(--fond); }
table.liste .fin-ligne { text-align: right; }
button.lien-danger {
  background: none; border: none; color: var(--danger);
  font: inherit; font-size: .8rem; cursor: pointer; padding: 0;
  text-decoration: underline;
}
