/* Interface de régulation Lyvia : pensée pour l'iPad (zones tactiles larges, deux colonnes en paysage) */
:root {
  --ink: #0f2a4a; --muted: #4d6380; --bg: #f2f6fb; --surface: #fff; --line: #d6e0ee;
  --brand: #1f5fd6; --brand-soft: #e3ecfb; --go: #0b8a5f; --go-soft: #dcf3ee; --warn: #b45309; --warn-soft: #fdf0dc;
  --alert: #c2261d; --alert-soft: #fbe5e3; --navy: #0c2246;
  --font: "Atkinson Hyperlegible", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font); }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

.btn { min-height: 44px; padding: .55rem 1rem; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 700; cursor: pointer; }
.btn:hover { border-color: var(--brand); }
.btn-principal { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-go { background: var(--go); border-color: var(--go); color: #fff; }
.btn-danger { color: var(--alert); border-color: var(--alert); }
.btn-discret { border-color: transparent; background: transparent; color: var(--muted); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.connexion { min-height: 100%; display: grid; place-items: center; padding: 1rem; }
.carte { background: var(--surface); border-radius: 16px; padding: 2rem; width: min(380px, 100%); display: grid; gap: .6rem; box-shadow: 0 10px 30px rgba(15,42,74,.12); }
.carte h1 { margin: 0; font-size: 1.5rem; }
.discret { color: var(--muted); margin: 0 0 .5rem; font-size: .95rem; }
.erreur { color: var(--alert); font-weight: 700; margin: 0; min-height: 1.4em; }

.app { min-height: 100%; display: flex; flex-direction: column; }
.barre { background: var(--navy); color: #fff; display: flex; align-items: center; gap: 1rem; padding: .7rem 1rem; flex-wrap: wrap; }
.barre .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.barre .btn-discret { border-color: transparent; color: #c9d6ea; }
.barre-actions { margin-left: auto; display: flex; gap: .5rem; }
.supervision { display: flex; gap: .5rem; flex-wrap: wrap; font-size: .85rem; }
.pastille { padding: .25rem .6rem; border-radius: 999px; background: rgba(255,255,255,.12); white-space: nowrap; }
.pastille.ok { background: rgba(95,211,166,.2); }
.pastille.ko { background: rgba(255,120,110,.3); }

.onglets { display: flex; gap: .25rem; padding: .5rem 1rem 0; background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; }
.onglets button { min-height: 44px; padding: .5rem 1rem; border: 0; background: none; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.onglets button.actif { color: var(--brand); border-bottom-color: var(--brand); }
.onglets span:not(:empty) { background: var(--alert); color: #fff; border-radius: 999px; padding: 0 .5rem; font-size: .8rem; margin-left: .3rem; }

.corps { flex: 1; display: grid; grid-template-columns: minmax(280px, 360px) 1fr; min-height: 0; }
@media (max-width: 820px) { .corps { grid-template-columns: 1fr; } .corps.detail-ouvert .liste { display: none; } .corps:not(.detail-ouvert) .detail { display: none; } }
.liste { border-right: 1px solid var(--line); overflow-y: auto; background: var(--surface); }
.item { display: grid; gap: .15rem; width: 100%; text-align: left; padding: .85rem 1rem; border: 0; border-bottom: 1px solid var(--line); background: none; cursor: pointer; }
.item:hover, .item.actif { background: var(--brand-soft); }
.item .l1 { display: flex; justify-content: space-between; gap: .5rem; font-weight: 700; }
.item .l2, .item .l3 { color: var(--muted); font-size: .9rem; }
.etiquette { display: inline-block; font-size: .75rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; background: var(--bg); color: var(--muted); }
.etiquette.vert { background: var(--go-soft); color: var(--go); }
.etiquette.rouge { background: var(--alert-soft); color: var(--alert); }
.etiquette.orange { background: var(--warn-soft); color: var(--warn); }
.etiquette.bleu { background: var(--brand-soft); color: var(--brand); }
.vide { color: var(--muted); padding: 2rem 1rem; text-align: center; }

.detail { overflow-y: auto; padding: 1rem 1.25rem 6rem; }
.entete { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.entete h2 { margin: 0; font-size: 1.3rem; }
.retour-liste { display: none; }
@media (max-width: 820px) { .retour-liste { display: inline-flex; } }
.bloc { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1rem; margin-bottom: 1rem; }
.bloc h3 { margin: 0 0 .75rem; font-size: 1rem; }
.alerte-manques { background: var(--warn-soft); border-color: transparent; }
.alerte-manques ul { margin: .25rem 0 0; padding-left: 1.2rem; }
.demande-site { background: var(--brand-soft); border-color: transparent; }
.demande-site dl { display: grid; grid-template-columns: max-content 1fr; gap: .25rem .75rem; margin: 0; font-size: .95rem; }
.demande-site dt { color: var(--muted); }
.demande-site dd { margin: 0; font-weight: 700; }
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .75rem; }
.champ { display: grid; gap: .25rem; }
.champ.large { grid-column: 1 / -1; }
.champ label { font-size: .85rem; font-weight: 700; color: var(--muted); }
input, select, textarea { min-height: 44px; padding: .5rem .7rem; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; width: 100%; }
textarea { min-height: 80px; resize: vertical; }
.case { display: flex; gap: .5rem; align-items: center; min-height: 44px; font-weight: 700; }
.case input { width: 1.3rem; min-height: 0; height: 1.3rem; }
.actions { position: sticky; bottom: 0; display: flex; gap: .5rem; flex-wrap: wrap; padding: .75rem; background: rgba(242,246,251,.95); border-top: 1px solid var(--line); margin: 0 -1.25rem; }
.suivi { display: grid; gap: .4rem; }
.etapes { display: flex; gap: .3rem; flex-wrap: wrap; }
.etapes span { padding: .3rem .6rem; border-radius: 8px; background: var(--bg); font-size: .85rem; color: var(--muted); }
.etapes span.fait { background: var(--go-soft); color: var(--go); font-weight: 700; }
.histo { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; font-size: .9rem; }
.histo li { display: flex; gap: .75rem; }
.histo time { color: var(--muted); white-space: nowrap; }
.docs { list-style: none; margin: 0 0 .5rem; padding: 0; display: grid; gap: .3rem; }
.toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: .75rem 1.2rem; border-radius: 12px; font-weight: 700; z-index: 10; max-width: calc(100% - 2rem); }
.toast.ko { background: var(--alert); }
.barre a.lien-accueil { text-decoration: none; display: inline-flex; align-items: center; }
