/* Moniteur NHO — charte NHO-STD-001 : Arial, navy #1E3A5F, or #E8A838,
   tableaux à en-tête navy et lignes alternées, badges d'état. */
:root {
  --primary: #1E3A5F; --secondary: #2E5A7F; --tertiary: #3E6A8F;
  --accent: #E8A838; --accent-trait: #C4861A;
  --body: #333333; --subtitle: #666666; --muted: #999999; --white: #FFFFFF;
  --table-alt: #F5F8FA; --table-border: #CCCCCC;
  --success: #2E7D32; --warning: #F57F17; --danger: #C62828;
  --fond: #FFFFFF; --grille: #E6EBF0;
  --zone: rgba(198, 40, 40, 0.06); --couloir: rgba(46, 125, 50, 0.10);
  --sigma: rgba(62, 106, 143, 0.16);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fond); color: var(--body); }
body { font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 1.45; }
code, .mono { font-family: Consolas, "Courier New", monospace; font-size: 12.5px; }
a { color: var(--secondary); }
.page { max-width: 1280px; margin: 0 auto; padding: 0 16px 48px; }

/* Bandeau (charte : « NOVAHEIM ORBITALS | type » + filet navy) */
.bandeau { position: sticky; top: 0; z-index: 5; background: var(--white);
  border-bottom: 2px solid var(--primary); }
.bandeau .interieur { max-width: 1280px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.marque { font-weight: bold; letter-spacing: .14em; color: var(--primary); font-size: 12px; white-space: nowrap; }
.bandeau nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.bandeau nav a { text-decoration: none; color: var(--secondary); padding: 5px 10px; border-radius: 3px; font-size: 13px; }
.bandeau nav a.actif { background: var(--primary); color: var(--white); }
.compte { color: var(--muted); font-size: 12px; white-space: nowrap; }
.compte a { margin-left: 8px; }

h1 { font-size: 26px; color: var(--primary); margin: 24px 0 4px; }
.sous-titre { font-size: 16px; color: var(--subtitle); margin: 0 0 16px; }
h2 { font-size: 18px; color: var(--primary); margin: 30px 0 12px; padding-bottom: 6px;
  border-bottom: 1px solid var(--table-border); }
h3 { font-size: 14px; color: var(--secondary); margin: 0 0 6px; }
.aide { color: var(--subtitle); font-size: 12.5px; margin: 0 0 8px; }
.vide { color: var(--muted); font-style: italic; padding: 12px 0; }

.note { border-left: 4px solid var(--accent); background: #FDF8EE; padding: 10px 14px;
  margin: 14px 0; font-size: 13px; }
.note.direct { border-left-color: var(--warning); background: #FFF6EC; }

table.cartouche { border-collapse: collapse; width: 100%; font-size: 12.5px; }
table.cartouche th { background: var(--primary); color: var(--white); text-align: left;
  padding: 6px 10px; width: 16%; border: 1px solid var(--table-border); }
table.cartouche td { padding: 6px 10px; border: 1px solid var(--table-border); overflow-wrap: anywhere; }
@media (max-width: 640px) { table.cartouche, table.cartouche tbody, table.cartouche tr,
  table.cartouche th, table.cartouche td { display: block; width: 100%; } }

.defile { overflow-x: auto; }
table.donnees { border-collapse: collapse; width: 100%; font-size: 13px; }
table.donnees th { background: var(--primary); color: var(--white); font-weight: bold;
  text-align: center; padding: 7px 8px; border: 1px solid var(--table-border); white-space: nowrap; }
table.donnees th.triable { cursor: pointer; user-select: none; }
table.donnees th.triable::after { content: " ⇅"; color: #9FB3C8; font-weight: normal; }
table.donnees td { padding: 6px 8px; border: 1px solid var(--table-border); white-space: nowrap; }
table.donnees td.texte { white-space: normal; }
table.donnees tbody tr:nth-child(odd) { background: var(--table-alt); }
table.donnees td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.donnees tbody tr.cliquable { cursor: pointer; }
table.donnees tbody tr.cliquable:hover { background: #E3ECF4; }

.badge { display: inline-block; font-size: 11px; font-weight: bold; letter-spacing: .04em;
  padding: 2px 8px; border-radius: 3px; color: var(--white); white-space: nowrap; }
.badge.ok { background: var(--success); }
.badge.ko { background: var(--danger); }
.badge.sans { background: var(--muted); }
.badge.att { background: var(--warning); }
.badge.info { background: var(--tertiary); }
.badge.direct { background: var(--warning); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .badge.direct { animation: none; } }

.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tuile { border: 1px solid var(--table-border); border-top: 3px solid var(--primary); padding: 12px 14px; }
.tuile .valeur { font-size: 26px; font-weight: bold; color: var(--primary); font-variant-numeric: tabular-nums; line-height: 1.1; }
.tuile .valeur small { font-size: 14px; color: var(--subtitle); font-weight: normal; }
.tuile .libelle { font-size: 12px; color: var(--subtitle); margin-top: 4px; }
.tuile .etat { margin-top: 8px; }

.progression { height: 12px; background: var(--table-alt); border: 1px solid var(--table-border);
  border-radius: 6px; overflow: hidden; display: flex; }
.progression span { display: block; height: 100%; }

.grille-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grille-exec { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: 18px; }
@media (max-width: 900px) { .grille-2, .grille-exec { grid-template-columns: 1fr; } }
.carte { border: 1px solid var(--table-border); padding: 12px 14px 8px; min-width: 0; }
.pile { display: grid; gap: 14px; align-content: start; }

.commandes { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 10px; }
button.puce, a.puce { font: inherit; font-size: 12.5px; border: 1px solid var(--table-border); background: var(--white);
  color: var(--secondary); padding: 4px 11px; border-radius: 14px; cursor: pointer; text-decoration: none; display: inline-block; }
button.puce[aria-pressed="true"], button.puce.plein, a.puce.plein { background: var(--primary); border-color: var(--primary); color: var(--white); }
button.puce:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button.puce:disabled { opacity: .45; cursor: default; }
select, input[type=text], input[type=password] { font: inherit; font-size: 13px; padding: 5px 7px;
  border: 1px solid var(--table-border); color: var(--body); background: var(--white); }
input[type=range] { accent-color: var(--primary); }

.graphe { width: 100%; position: relative; }
.graphe svg { display: block; width: 100%; height: auto; overflow: visible; }
.graphe text { font-family: Arial, Helvetica, sans-serif; }
.axe text { font-size: 11px; fill: var(--muted); }
.axe .titre-axe { font-size: 11.5px; fill: var(--subtitle); }
.legende { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--subtitle); margin: 2px 0 6px; }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.legende i { display: inline-block; width: 18px; height: 0; border-top: 2px solid; }
.legende i.pt { width: 9px; height: 9px; border: 0; border-radius: 50%; }
.legende i.bloc { width: 12px; height: 10px; border: 0; }

#bulle { position: fixed; pointer-events: none; z-index: 20; background: var(--white);
  border: 1px solid var(--table-border); border-top: 3px solid var(--primary);
  box-shadow: 0 2px 8px rgba(30,58,95,.15); padding: 7px 10px; font-size: 12px; max-width: 300px; display: none; }
#bulle b { color: var(--primary); }
#bulle .l { display: flex; justify-content: space-between; gap: 14px; }
#bulle .l span:last-child { font-variant-numeric: tabular-nums; }

/* Vue 3D */
.scene3d { position: relative; width: 100%; height: 480px; background: #F5F8FA;
  border: 1px solid var(--table-border); overflow: hidden; }
.scene3d canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.hud { position: absolute; left: 10px; top: 10px; background: rgba(255,255,255,.92);
  border: 1px solid var(--table-border); border-top: 3px solid var(--primary); padding: 6px 10px;
  font-size: 12px; font-variant-numeric: tabular-nums; pointer-events: none; min-width: 190px; }
.hud .l { display: flex; justify-content: space-between; gap: 12px; }
.lecture { display: flex; align-items: center; gap: 10px; margin: 10px 0 4px; flex-wrap: wrap; }
.lecture input[type=range] { flex: 1; min-width: 160px; }
.lecture .temps { font-variant-numeric: tabular-nums; color: var(--subtitle); font-size: 12.5px; min-width: 120px; }

.evenements { max-height: 240px; overflow-y: auto; font-size: 12.5px; }
.evenements table { width: 100%; border-collapse: collapse; }
.evenements td { padding: 3px 6px; border-bottom: 1px solid var(--grille); vertical-align: top; }
.evenements td:first-child { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Connexion */
.connexion { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; }
.connexion form { border: 1px solid var(--table-border); border-top: 3px solid var(--primary); padding: 20px; display: grid; gap: 10px; }
.connexion label { font-size: 12.5px; color: var(--subtitle); display: grid; gap: 4px; }
.connexion button { font: inherit; background: var(--primary); color: var(--white); border: 0; padding: 8px; cursor: pointer; }
.erreur { color: var(--danger); font-size: 13px; min-height: 1em; }

footer { margin-top: 48px; padding-top: 10px; border-top: 1px solid var(--table-border);
  text-align: center; color: var(--muted); font-size: 12px; }

@media print {
  .bandeau, .commandes, .lecture, button, .no-print { display: none !important; }
  .page { max-width: none; padding: 0; }
  .carte, .tuile { break-inside: avoid; }
  h2 { break-after: avoid; }
}
