/* ==========================================================================
   No Comment — livre de bord
   Direction : « quart de nuit ». Les instruments de bord passent en rouge et
   ambre la nuit pour preserver la vision nocturne ; le fond n'est pas un noir
   neutre mais un bleu de mer profond. L'ambre porte l'accent, le vert et le
   rouge sont reserves aux feux de bord : vert = pare, rouge = probleme.
   ========================================================================== */

:root {
  --abyss:      #0a141c;
  --abyss-deep: #060d13;
  --hull:       #10202b;
  --hull-high:  #162b38;
  --rail:       #1d3340;
  --rail-soft:  #172a35;

  --foam:       #e6eff4;
  --haze:       #8ca6b6;
  --haze-dim:   #5f7d8e;

  --beacon:     #f2a03d;
  --beacon-dim: #8a5c22;
  --starboard:  #4fb477;
  --port:       #e2564d;

  --font-text: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-data: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --tap: 3rem;
  --radius: 10px;
  --radius-sm: 6px;

  --shell: 60rem;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  /* Confortable a bout de bras, sur un pont qui bouge. */
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-text);
  background: var(--abyss);
  color: var(--foam);
  line-height: 1.55;
  /* Place pour la barre de navigation basse sur mobile. */
  padding-bottom: calc(4.75rem + env(safe-area-inset-bottom));
}

@media (min-width: 46rem) {
  body { padding-bottom: 3rem; }
}

a { color: var(--beacon); text-decoration-thickness: 1px; text-underline-offset: 2px; }

:focus-visible {
  outline: 2px solid var(--beacon);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* --- Enseigne ----------------------------------------------------------- */

.masthead {
  border-bottom: 1px solid var(--rail);
  background: linear-gradient(180deg, var(--abyss-deep), var(--abyss));
}

.masthead__inner {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.masthead__name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.masthead__sub {
  font-family: var(--font-data);
  font-size: 0.7rem;
  color: var(--haze-dim);
  letter-spacing: 0.08em;
  margin-left: auto;
  text-align: right;
}

/* --- Coque de page ------------------------------------------------------ */

.shell {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
}

.eyebrow {
  font-family: var(--font-data);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--haze-dim);
  margin: 0 0 0.35rem;
}

.page-title {
  margin: 0 0 1.25rem;
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.section-title {
  margin: 2rem 0 0.75rem;
  font-size: 0.72rem;
  font-family: var(--font-data);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--haze);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rail);
}

/* --- Bandeau d'etat (accueil) ------------------------------------------- */
/* Lecture instrumentale : ce que l'on veut savoir avant de descendre au port. */

.readout {
  background: var(--abyss-deep);
  border: 1px solid var(--rail);
  border-radius: var(--radius);
  padding: 0.25rem 0.9rem;
  box-shadow: inset 0 1px 0 rgba(242, 160, 61, 0.06);
}

.readout__row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rail-soft);
}
.readout__row:last-child { border-bottom: 0; }

.readout__label {
  font-family: var(--font-data);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--haze-dim);
  flex: 0 0 9.5rem;
}

.readout__value {
  font-family: var(--font-data);
  font-size: 0.95rem;
  color: var(--beacon);
  margin-left: auto;
  text-align: right;
}
.readout__value--ok    { color: var(--starboard); }
.readout__value--alert { color: var(--port); }
.readout__value--none  { color: var(--haze-dim); }

/* --- Cartes et registres ------------------------------------------------ */

.card {
  background: var(--hull);
  border: 1px solid var(--rail);
  border-radius: var(--radius);
  padding: 1rem;
}

.card + .card { margin-top: 0.75rem; }

/* Registre : une entree de livre de bord par ligne. */
.entry {
  background: var(--hull);
  border: 1px solid var(--rail);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  display: block;
  color: inherit;
  text-decoration: none;
}
.entry + .entry { margin-top: 0.6rem; }

.entry__head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.entry__no {
  font-family: var(--font-data);
  font-size: 0.7rem;
  color: var(--beacon-dim);
  letter-spacing: 0.08em;
}

.entry__date {
  font-family: var(--font-data);
  font-size: 0.78rem;
  color: var(--haze);
}

.entry__title {
  font-weight: 600;
  margin: 0.15rem 0 0;
  width: 100%;
}

.entry__meta {
  margin: 0.45rem 0 0;
  font-size: 0.85rem;
  color: var(--haze);
}

.entry__data {
  margin: 0.5rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  font-family: var(--font-data);
  font-size: 0.78rem;
  color: var(--haze);
}

/* --- Etiquettes d'etat --------------------------------------------------- */

.tag {
  display: inline-block;
  font-family: var(--font-data);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid currentColor;
}
.tag--done    { color: var(--starboard); }
.tag--todo    { color: var(--port); }
.tag--running { color: var(--beacon); }
.tag--quiet   { color: var(--haze-dim); }

/* --- Check-list : le tableau de bord ------------------------------------ */
/* Element signature. Rangees pleine largeur, frappe au pouce, chaque ligne
   s'allume au vert quand elle est faite. */

.checklist { margin: 0; padding: 0; list-style: none; }

.check {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  min-height: var(--tap);
  padding: 0.7rem 0.9rem;
  margin: 0 0 0.5rem;
  background: var(--hull);
  border: 1px solid var(--rail);
  border-left: 3px solid var(--rail);
  border-radius: var(--radius);
  color: var(--foam);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.check:hover { background: var(--hull-high); }

.check__lamp {
  flex: 0 0 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  border: 2px solid var(--haze-dim);
  position: relative;
}

.check__label { flex: 1; }

.check__flag {
  font-family: var(--font-data);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--beacon-dim);
}

.check.is-done {
  border-left-color: var(--starboard);
  background: var(--hull-high);
}

.check.is-done .check__lamp {
  border-color: var(--starboard);
  background: var(--starboard);
  box-shadow: 0 0 10px rgba(79, 180, 119, 0.45);
}

.check.is-done .check__lamp::after {
  content: "";
  position: absolute;
  left: 0.33rem;
  top: 0.1rem;
  width: 0.3rem;
  height: 0.6rem;
  border: solid var(--abyss-deep);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.check.is-done .check__label { color: var(--haze); }

/* Verdict d'appareillage : colle en bas de l'ecran pendant la ronde. */
.verdict {
  position: sticky;
  bottom: calc(4.75rem + env(safe-area-inset-bottom));
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--rail);
  background: var(--abyss-deep);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 -8px 24px rgba(6, 13, 19, 0.9);
}

@media (min-width: 46rem) {
  .verdict { bottom: 1rem; }
}

.verdict__state {
  font-family: var(--font-data);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--port);
}

.verdict.is-ready { border-color: var(--starboard); }
.verdict.is-ready .verdict__state { color: var(--starboard); }

.verdict__count {
  margin-left: auto;
  font-family: var(--font-data);
  font-size: 0.8rem;
  color: var(--haze);
}

/* --- Formulaires --------------------------------------------------------- */

.field { margin-bottom: 0.9rem; }

.field > label {
  display: block;
  font-family: var(--font-data);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--haze);
  margin-bottom: 0.35rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 0.6rem 0.7rem;
  background: var(--abyss-deep);
  border: 1px solid var(--rail);
  border-radius: var(--radius-sm);
  color: var(--foam);
  font: inherit;
}

.field textarea { min-height: 6rem; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--beacon); }

.field__hint {
  margin: 0.3rem 0 0;
  font-size: 0.8rem;
  color: var(--haze-dim);
}

.field-row { display: grid; gap: 0.9rem; }
@media (min-width: 34rem) {
  .field-row { grid-template-columns: 1fr 1fr; }
}

/* --- Boutons ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--tap);
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--rail);
  background: var(--hull-high);
  color: var(--foam);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover { border-color: var(--haze-dim); }

.btn--primary {
  background: var(--beacon);
  border-color: var(--beacon);
  color: var(--abyss-deep);
  font-weight: 600;
}
.btn--primary:hover { filter: brightness(1.08); }

.btn--danger { color: var(--port); border-color: var(--beacon-dim); background: transparent; }
.btn--wide { width: 100%; }

.btn-row { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem; }

/* --- Messages ------------------------------------------------------------ */

.notice {
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--rail);
  border-left: 3px solid var(--beacon);
  background: var(--hull);
  margin-bottom: 1rem;
}
.notice--error { border-left-color: var(--port); }
.notice--ok    { border-left-color: var(--starboard); }

.empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--haze);
  border: 1px dashed var(--rail);
  border-radius: var(--radius);
}
.empty p { margin: 0 0 1rem; }

/* --- Calendrier ---------------------------------------------------------- */

.month {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  background: var(--rail);
  border: 1px solid var(--rail);
  border-radius: var(--radius);
  overflow: hidden;
}

.month__dow {
  background: var(--abyss-deep);
  color: var(--haze-dim);
  font-family: var(--font-data);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  padding: 0.4rem 0;
}

.day {
  background: var(--hull);
  min-height: 3.1rem;
  padding: 0.3rem 0.35rem;
  font-family: var(--font-data);
  font-size: 0.78rem;
  color: var(--haze);
}
.day--pad { background: var(--abyss-deep); }
.day--today { box-shadow: inset 0 0 0 1px var(--beacon); }
.day--booked { background: var(--hull-high); border-left: 3px solid var(--beacon); }

.day__who {
  display: block;
  margin-top: 0.2rem;
  font-family: var(--font-text);
  font-size: 0.68rem;
  color: var(--beacon);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Galerie ------------------------------------------------------------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.6rem;
}

.shot {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--rail);
  background: var(--abyss-deep);
}

.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }

.shot__caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 0.35rem 0.5rem;
  font-size: 0.72rem;
  background: linear-gradient(180deg, transparent, rgba(6, 13, 19, 0.92));
  color: var(--foam);
}

.doc {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  background: var(--hull);
  border: 1px solid var(--rail);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
}
.doc + .doc { margin-top: 0.5rem; }
.doc__size { margin-left: auto; font-family: var(--font-data); font-size: 0.72rem; color: var(--haze-dim); }

/* --- Navigation ---------------------------------------------------------- */
/* Sur telephone : barre basse, atteignable au pouce d'une seule main.
   Sur ecran large : bandeau sous l'enseigne. */

.nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  background: var(--abyss-deep);
  border-top: 1px solid var(--rail);
  padding-bottom: env(safe-area-inset-bottom);
}

.nav__link {
  flex: 1;
  min-height: var(--tap);
  padding: 0.5rem 0.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  color: var(--haze-dim);
  text-decoration: none;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-align: center;
}

.nav__link svg { width: 1.3rem; height: 1.3rem; stroke: currentColor; fill: none; stroke-width: 1.6; }
.nav__link[aria-current="page"] { color: var(--beacon); }

@media (min-width: 46rem) {
  .nav {
    position: sticky;
    top: 0;
    bottom: auto;
    border-top: 0;
    border-bottom: 1px solid var(--rail);
    max-width: var(--shell);
    margin: 0 auto;
    padding: 0;
  }
  .nav__link {
    flex: 0 0 auto;
    flex-direction: row;
    gap: 0.45rem;
    padding: 0.7rem 0.95rem;
    font-size: 0.8rem;
    min-height: 0;
  }
  .nav__link[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--beacon); }
}

/* --- Connexion ----------------------------------------------------------- */

.gate {
  min-height: 82vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.gate__panel {
  width: 100%;
  max-width: 22rem;
  background: var(--hull);
  border: 1px solid var(--rail);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.gate__name {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.gate__sub {
  font-family: var(--font-data);
  font-size: 0.7rem;
  color: var(--haze-dim);
  letter-spacing: 0.1em;
  margin: 0.2rem 0 1.5rem;
}

/* --- Divers -------------------------------------------------------------- */

.stack > * + * { margin-top: 0.6rem; }
.muted { color: var(--haze); }
.data  { font-family: var(--font-data); }
.right { text-align: right; }

.table-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Numero d'etape de la procedure -------------------------------------- */
/* La procedure papier est numerotee : l'ordre est une information reelle. */

.check__no {
  flex: 0 0 1.6rem;
  font-family: var(--font-data);
  font-size: 0.7rem;
  color: var(--beacon-dim);
  text-align: right;
}

.check--static { cursor: default; }
.check--static:hover { background: var(--hull); }

.check__tools {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.check__tools .btn {
  min-height: 2.2rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
}
