/* DéRouille web client: sober layout, readable on a tablet in the field. */
:root {
  --encre: #1f2328;
  --fond: #f6f7f9;
  --carte: #ffffff;
  --ligne: #d0d7de;
  --accent: #1f5fae;
  --erreur: #b42318;
  font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans", sans-serif;
  color: var(--encre);
  background: var(--fond);
}
body { margin: 0; }
.bandeau {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 1rem; background: var(--accent); color: #fff;
}
.bandeau a { color: #fff; text-decoration: none; }
.marque { font-weight: 700; font-size: 1.2rem; }
main { max-width: 56rem; margin: 0 auto; padding: 1rem; }
h1 { font-size: 1.4rem; }
.selection { display: grid; gap: 1rem; grid-template-columns: 2fr 1fr; }
@media (max-width: 40rem) { .selection { grid-template-columns: 1fr; } }
.outils, .charger {
  background: var(--carte); border: 1px solid var(--ligne); border-radius: 6px; padding: 1rem;
}
details summary { font-weight: 600; cursor: pointer; }
.outil { display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 0.6rem; margin: 0.6rem 0; }
.outil .nom { font-weight: 600; }
.outil .description { grid-column: 2; color: #57606a; }
.aide { color: #57606a; font-size: 0.9rem; }
.charger label { display: block; font-weight: 600; margin-bottom: 0.5rem; }
.charger input { margin-bottom: 0.6rem; max-width: 100%; }
button {
  font: inherit; padding: 0.4rem 1rem; border: 1px solid var(--accent); border-radius: 4px;
  background: var(--accent); color: #fff; cursor: pointer;
}
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #f0b400; }
.erreur { color: var(--erreur); border-left: 4px solid var(--erreur); padding-left: 0.6rem; }
.version { font-weight: 600; }

/* E1: input panel on the left (300 px minimum, as the original), results on the right. */
.fenetre { display: grid; gap: 1rem; grid-template-columns: minmax(300px, 1fr) minmax(0, 1.6fr); align-items: start; }
/* Tablet in portrait and wider: results stay in view while the input panel scrolls. */
.fenetre .resultats { position: sticky; top: 0.5rem; }
@media (max-width: 40rem) {
  .fenetre { grid-template-columns: 1fr; }
  .fenetre .resultats { position: static; }
}
/* Touch screens: larger targets (WCAG 2.5.8). */
@media (pointer: coarse) {
  button, .bouton, select, input[type="number"], input[type="text"] { min-height: 2.5rem; }
  .barre button, .bouton { padding: 0.5rem 0.8rem; }
}
main:has(.fenetre) { max-width: 80rem; }
.panneau, .resultats {
  background: var(--carte); border: 1px solid var(--ligne); border-radius: 6px; padding: 0.6rem;
}
.panneau details { border-bottom: 1px solid var(--ligne); padding: 0.4rem 0; }
.panneau details.inactif summary { color: #8c959f; pointer-events: none; }
.champs { display: grid; gap: 0.4rem; padding: 0.5rem 0 0.2rem; }
.champs fieldset { border: 1px solid var(--ligne); border-radius: 4px; margin: 0; }
.champs fieldset > label, .champs > label { display: block; margin-top: 0.3rem; }
.champs input[type="number"], .champs select { font: inherit; width: 100%; box-sizing: border-box; }
.champs .choix { display: block; margin: 0.2rem 0; }
.helice { border-collapse: collapse; width: 100%; }
.helice th, .helice td { padding: 0.15rem; font-weight: normal; white-space: nowrap; }
.helice input { width: 100%; min-width: 4.2em; box-sizing: border-box; font: inherit; font-size: 0.9rem; padding: 0.1rem 0.2rem; }
.chantier { color: #57606a; font-style: italic; }

/* Verticals group and point table. */
.verticales { margin-top: 0.6rem; }
.verticales h2 { font-size: 1.05rem; margin: 0.3rem 0; }
.navigation { display: flex; flex-wrap: wrap; gap: 0.25rem; align-items: center; }
.navigation button { padding: 0.2rem 0.5rem; }
.navigation input { width: 4rem; font: inherit; }
button:disabled { opacity: 0.45; cursor: default; }
.points { border-collapse: collapse; width: 100%; margin: 0.5rem 0; }
.points th, .points td { border: 1px solid var(--ligne); padding: 0.15rem 0.3rem; text-align: right; }
.points input { width: 100%; box-sizing: border-box; font: inherit; text-align: right; }
.points .actions { white-space: nowrap; text-align: left; }
.points .actions button { padding: 0.1rem 0.35rem; font-size: 0.85rem; }
.points .nouveau th { color: var(--accent); }
.derniere output { font-variant-numeric: tabular-nums; }
.invisible {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

/* Toolbar, computed discharge and message box. */
.barre { margin-bottom: 0.6rem; }
.debit { display: flex; gap: 0.5rem; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.debit output {
  min-width: 7rem; padding: 0.2rem 0.4rem; border: 1px solid #000; background: #eef0f2;
  font-variant-numeric: tabular-nums; text-align: right; min-height: 1.2em;
}
dialog.message {
  position: fixed; top: 30%; z-index: 10; max-width: 28rem; border: 1px solid var(--ligne);
  border-radius: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); padding: 1rem 1.2rem;
}
dialog.message h2 { font-size: 1.05rem; margin-top: 0; }

/* Plot, tooltip, export. */
.graphe { margin-top: 0.8rem; text-align: center; }
.graphe img { max-width: 100%; height: auto; }
.graphe .vide { color: #57606a; }
.schema { display: block; margin: 0.5rem auto; max-width: 100%; height: auto; border: 1px solid var(--ligne); }
.infobulle {
  position: absolute; z-index: 20; pointer-events: none; background: #ffffe1; border: 1px solid #000;
  padding: 0.2rem 0.4rem; font-size: 0.85rem; white-space: nowrap;
}
.export { margin-top: 0.8rem; display: flex; gap: 0.5rem; align-items: center; justify-content: flex-end; }
.table-points { overflow-x: auto; }

/* Toolbar of the original (Fichier | Traitements | Outils | Accueil) and dialog buttons. */
.barre { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.barre .group { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; padding-right: 0.6rem; border-right: 1px solid var(--ligne); }
.barre .group:last-child { border-right: 0; }
.barre button, .bouton { padding: 0.3rem 0.6rem; font-size: 0.9rem; }
.bouton {
  display: inline-block; border: 1px solid var(--accent); border-radius: 4px; background: var(--accent);
  color: #fff; cursor: pointer;
}
.bouton:focus-within, .bouton:hover { outline: 3px solid #f0b400; }
dialog.message .boutons { display: flex; gap: 0.5rem; margin-top: 0.8rem; }
dialog.message .boutons form { margin: 0; }
dialog.message input[type="text"] { font: inherit; width: 100%; box-sizing: border-box; }
/* Narrow cells (rating equation, point table): no spin arrows, the whole value stays visible. */
.helice input, .points input { appearance: textfield; -moz-appearance: textfield; }
.helice input::-webkit-inner-spin-button, .helice input::-webkit-outer-spin-button,
.points input::-webkit-inner-spin-button, .points input::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0;
}

/* Legend of the plot (checkable, as DEPJAU's), left of the computed discharge. */
.entete-resultats { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; justify-content: space-between; }
.plot-legend { border: 0; margin: 0; padding: 0; display: flex; gap: 1rem; flex-wrap: wrap; }
.plot-legend .swatch { display: inline-block; width: 0.8rem; height: 0.8rem; vertical-align: middle; }
.plot-legend .measures { border: 2px solid #800000; }
.plot-legend .bed { border-bottom: 3px solid #0000ff; height: 0.4rem; }
