/* ==========================================================================
   Clairances - Port de Gustavia
   Design system 2026 - ecrit de zero, sans dependance UI externe.
   Fichier volontairement 100% ASCII (base latin1 / iso-8859-1).
   ========================================================================== */

/* La fonte Inter, celle sur laquelle la maquette a ete dessinee. Sans elle
   le navigateur retombe sur Segoe UI, dont les lettres ne font pas la meme
   largeur : les libelles d'etapes s'allongent, les pastilles se decalent et
   le bateau ne tombe plus en face d'elles.
   Hebergee sur le serveur (css/fonts/, licence SIL OFL 1.1) et non chez
   Google : certains postes de la capitainerie n'ont volontairement pas acces
   a Internet, et l'appel a Google Fonts ralentissait chaque page jusqu'a
   l'echec. Fonte variable : un seul fichier couvre les graisses 400 a 700.
   Deux sous-ensembles, comme Google les decoupe : latin (francais, anglais)
   et latin etendu (noms etrangers des passagers et des navires). */
@font-face {
   font-family: "Inter";
   font-style: normal;
   font-weight: 100 900;
   font-display: swap;
   src: url("fonts/inter-latin.woff2") format("woff2");
   unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
   font-family: "Inter";
   font-style: normal;
   font-weight: 100 900;
   font-display: swap;
   src: url("fonts/inter-latin-ext.woff2") format("woff2");
   unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
   /* Palette neutre.
      Les ecrans de travail sont poses sur un fond CLAIR : la surface est donc
      du blanc franc, et c'est le fond de page (--bg) qui, legerement teinte,
      detache les cartes. Le champ de saisie est blanc lui aussi ; ce qui le
      designe comme zone ou l'on ecrit, c'est sa bordure et son ombre interne,
      pas sa couleur. */
   --bg:              #eef2f7;
   --bg-2:            #f7f9fc;
   --bg-subtle:       #e4eaf2;
   --surface:         #ffffff;
   --surface-2:       #f3f6fb;
   --surface-3:       #e7edf5;
   --field:           #ffffff;

   --border:          #dde4ed;
   --border-strong:   #b6c2d2;
   --border-input:    #c2ccdb;

   --fg:              #0e1726;
   --fg-muted:        #4d5765;
   --fg-subtle:       #6b7585;
   --fg-inverse:      #ffffff;

   /* Bleu profond "port" */
   --primary:         #0b57a4;
   --primary-hover:   #094a8d;
   --primary-active:  #073d75;
   --primary-soft:    #e6effb;
   --primary-soft-fg: #0a4a8c;
   --primary-ring:    rgba(11, 87, 164, .26);

   /* Accents. Poses sur du blanc, les teintes "soft" peuvent redevenir de
      vrais pastels : le texte fonce qu'elles portent garde un contraste
      superieur a 4.5:1 dans chaque cas. */
   --success:         #05633c;
   --success-soft:    #e6f5ed;
   --success-border:  #a8dcc2;

   --warning:         #93400a;
   --warning-soft:    #fdf3e4;
   --warning-border:  #f0cf9f;

   --danger:          #a71d13;
   --danger-hover:    #8c170f;
   --danger-soft:     #fdeceb;
   --danger-border:   #f2bcb7;

   --info:            #0b57a4;
   --info-soft:       #e6effb;
   --info-border:     #b8d4ef;

   /* Le bassin du fil d'etapes. Le bleu du port, tres desature : la mer est
      une atmosphere sous le fil, elle ne doit jamais concurrencer la
      pastille de l'etape courante. */
   --water-line:      rgba(72, 140, 201, .85);
   --water-faint:     rgba(95, 157, 212, .38);
   --water-body:      rgba(95, 157, 212, .22);
   --water-deep:      rgba(95, 157, 212, .13);
   --quay:            #94a3b4;
   --quay-top:        #b6c2d2;
   --beacon:          #c9852b;
   /* La voile d'avant, dans l'ombre de la grand-voile. Bleu propre au bateau
      et non --primary-soft, qui est trois tons plus pale : la maquette la
      veut lisible contre le blanc de la grand-voile. */
   --sail-shade:      #cfe0f5;

   /* Typo */
   --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                "Helvetica Neue", Arial, sans-serif;
   --font-mono: "SFMono-Regular", ui-monospace, Menlo, Consolas,
                "Liberation Mono", monospace;

   /* Echelle typographique. Un cran au-dessus de la precedente : l'application
      est utilisee sur des postes de comptoir et sur telephone, souvent en
      lumiere du jour, et 13,5 px etait trop juste pour lire un tableau de
      clairances sans se pencher. */
   --fs-xs:   12px;
   --fs-sm:   13px;
   --fs-base: 14.5px;
   --fs-md:   16px;
   --fs-lg:   18px;
   --fs-xl:   22px;
   --fs-2xl:  27px;
   --fs-3xl:  33px;

   /* Rayons */
   --r-sm: 5px;
   --r:    8px;
   --r-md: 10px;
   --r-lg: 14px;
   --r-xl: 18px;
   --r-full: 999px;

   /* Ombres, version fond clair : discretes, c'est la bordure qui dessine la
      carte et l'ombre qui la souleve d'un cran. Les ecrans poses sur la photo
      du port (body.has-photo) les remplacent par des valeurs plus franches,
      seule facon d'y detacher une surface claire. */
   --sh-xs: 0 1px 2px rgba(16, 30, 54, .06);
   --sh-sm: 0 1px 3px rgba(16, 30, 54, .10), 0 1px 2px rgba(16, 30, 54, .06);
   --sh:    0 4px 12px -2px rgba(16, 30, 54, .12), 0 2px 4px -2px rgba(16, 30, 54, .08);
   --sh-md: 0 12px 24px -8px rgba(16, 30, 54, .18), 0 4px 8px -4px rgba(16, 30, 54, .10);
   --sh-lg: 0 24px 48px -14px rgba(16, 30, 54, .28);

   /* Transitions */
   --t-fast: 110ms cubic-bezier(.4, 0, .2, 1);
   --t:      170ms cubic-bezier(.4, 0, .2, 1);
   --t-slow: 260ms cubic-bezier(.16, 1, .3, 1);

   /* Layout */
   --header-h: 56px;
   --nav-h:    44px;

   /* Chrome de l'application (en-tete + navigation). Il reste bleu nuit sur
      tous les ecrans : c'est lui qui porte l'identite du port et qui separe
      nettement la barre de commandes de la zone de travail. */
   --chrome:    #122740;
   --chrome-2:  #0d1e33;
   --chrome-br: rgba(255, 255, 255, .12);

   /* Fond photographique (port de Gustavia), traite en voile SOMBRE.
      Une seule valeur a regler : l'alpha de --veil. Plus il est bas, plus la
      photo du port ressort. --veil-base est la couleur sous la photo (bord de
      page, rebond de defilement). */
   --veil:      rgba(10, 17, 28, .62);
   --veil-base: #0a111c;
   --veil-solid: #101a29;   /* repli quand backdrop-filter n'existe pas */

   /* Chrome translucide pose sur le voile : en-tete, navigation, pied. */
   --glass:        rgba(12, 20, 33, .52);
   --glass-strong: rgba(12, 20, 33, .66);
   --glass-blur:   saturate(115%) blur(16px);

   /* Texte, bordures et survols poses DIRECTEMENT sur le voile sombre.
      Les cartes, tableaux, formulaires et panneaux flottants restent clairs
      et gardent --fg / --fg-muted / --fg-subtle. */
   --on-veil:        #eef2f7;
   --on-veil-muted:  rgba(226, 233, 242, .78);
   --on-veil-subtle: rgba(219, 228, 239, .58);
   --on-veil-border: rgba(255, 255, 255, .16);
   --on-veil-fill:   rgba(255, 255, 255, .07);
   --on-veil-hover:  rgba(255, 255, 255, .12);

   /* Les QUATRE roles de texte de l'application. Ils ne sont pas des couleurs
      mais des roles : leur valeur depend du fond sur lequel le texte se pose.
      --ink (texte courant), --muted (secondaire), --subtle (tertiaire) et
      --link (lien). .app-main les bascule en clair pour le voile sombre, et
      chaque surface claire les rebascule en sombre (cf. le garde-fou plus
      bas). C'est ce mecanisme qui evite d'avoir a reprendre les 28 modules
      un par un : les variables se transmettent par heritage. */
   --ink:        var(--fg);
   --muted:      var(--fg-muted);
   --subtle:     var(--fg-subtle);
   --link:       var(--primary);
   --link-hover: var(--primary-hover);
   /* Le bleu de l'application est trop sombre sur le voile : version eclaircie
      reservee aux accents poses dessus (onglet actif, filet de titre). */
   --accent-on-veil: #8cc0f0;
}

/* --------------------------------------------------------------------------
   2. Reset
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
   -webkit-text-size-adjust: 100%;
   text-size-adjust: 100%;
   /* La page ne defile jamais horizontalement.

      L'en-tete et la barre de navigation sont "sticky" : ils se calent sur la
      fenetre, pas sur le contenu. Si un seul element deborde a droite - un
      tableau, un panneau, un mot insecable - la page devient plus large que
      l'ecran, et en faisant defiler vers la droite on sort du bandeau bleu :
      il s'arrete net et le fond apparait derriere. C'est le defaut signale sur
      telephone.

      "clip" et non "hidden" : clip ne cree pas de conteneur de defilement, donc
      "position: sticky" continue de fonctionner a l'interieur. Le contenu large
      n'est pas perdu pour autant - il defile dans .table-wrap, qui a son propre
      defilement horizontal. */
   overflow-x: clip;
}

body {
   margin: 0;
   /* Un mot insecable (chemin de fichier d'un message d'erreur PHP, URL, ...)
      ne doit jamais faire deborder la page horizontalement sur mobile. */
   overflow-wrap: break-word;
   /* Fond de travail clair. Le degrade est volontairement tres court : il
      donne juste assez de profondeur pour que le blanc des cartes se lise
      comme un premier plan, sans jamais concurrencer le contenu. */
   background: var(--bg);
   background-image: linear-gradient(180deg, var(--bg-2) 0, var(--bg) 220px);
   background-attachment: fixed;
   color: var(--fg);
   font-family: var(--font-sans);
   font-size: var(--fs-base);
   line-height: 1.5;
   -webkit-font-smoothing: antialiased;
   -moz-osx-font-smoothing: grayscale;
   font-variant-numeric: tabular-nums;
}

/* La photo du port n'habille plus que les ecrans "vitrine" - accueil, choix du
   type de navire, remerciement d'impression, connexion, mentions - ou elle
   sert d'accueil et non de fond de travail. home.php pose alors la classe
   .has-photo sur <body>.

   Ailleurs - recherche, facturation, saisie de clairance, statistiques - le
   fond redevient clair. C'est le point le plus important de cette revision :
   sur ces ecrans, l'information est dense et doit se lire sans que l'oeil ait
   a la separer d'une photographie.

   Une seule valeur a regler pour la vitrine, l'alpha de --veil : plus elle est
   basse, plus la photo ressort. */
body.has-photo {
   background: var(--veil-base);
   background-image: none;
   color: var(--on-veil);
   /* Sur la photo, c'est l'ombre - pas la bordure - qui detache une surface. */
   --sh-xs: 0 1px 2px rgba(4, 10, 20, .22);
   --sh-sm: 0 2px 5px rgba(4, 10, 20, .26), 0 1px 2px rgba(4, 10, 20, .18);
   --sh:    0 6px 14px -3px rgba(4, 10, 20, .34), 0 2px 5px -2px rgba(4, 10, 20, .22);
   --sh-md: 0 14px 26px -8px rgba(4, 10, 20, .42), 0 5px 10px -5px rgba(4, 10, 20, .28);
   --sh-lg: 0 28px 56px -14px rgba(4, 10, 20, .55);
}
body.has-photo::before,
body.has-photo::after {
   content: "";
   position: fixed;
   inset: 0;
   pointer-events: none;
}
body.has-photo::before {
   z-index: -2;
   background: url(../img/fond-port.jpg) center top / cover no-repeat;
}
body.has-photo::after {
   z-index: -1;
   background: var(--veil);
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote { margin: 0; }
ul, ol { margin: 0; padding: 0; }

img, svg { vertical-align: middle; max-width: 100%; }

a { color: var(--link, var(--primary)); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--link-hover, var(--primary-hover)); text-decoration: underline; }

hr {
   border: 0;
   border-top: 1px solid var(--border);
   margin: 20px 0;
}

::selection { background: var(--primary-soft); color: var(--primary-soft-fg); }

/* Focus visible unifie */
:focus { outline: none; }
:focus-visible {
   outline: 2px solid var(--primary);
   outline-offset: 2px;
   border-radius: var(--r-sm);
}
/* Sur le chrome sombre, le bleu de l'application ne se voit pas : on prend sa
   version eclaircie. */
.app-header :focus-visible,
.app-nav :focus-visible,
.app-footer :focus-visible { outline-color: var(--accent-on-veil); }

/* Scrollbars discretes */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
   background: var(--border-strong);
   border-radius: var(--r-full);
   border: 3px solid var(--bg);
}
*::-webkit-scrollbar-thumb:hover { background: var(--fg-subtle); }

/* Sur la vitrine, la barre de defilement de la page se pose sur le voile
   sombre et doit donc s'inverser. */
html:has(body.has-photo) { scrollbar-color: rgba(255, 255, 255, .28) transparent; }
body.has-photo::-webkit-scrollbar-thumb {
   background: rgba(255, 255, 255, .22);
   border-color: var(--veil-base);
}
body.has-photo::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .34); }

/* --------------------------------------------------------------------------
   3. Neutralisation du balisage legacy
   Certaines vues conservent des attributs HTML historiques ; on les desamorce
   pour qu'aucun ecran ne retombe dans l'ancien style.
   -------------------------------------------------------------------------- */
.app-main [bgcolor],
.app-main font[size],
.app-main font[color] {
   background-color: transparent !important;
   color: inherit !important;
   font-size: inherit !important;
}
.app-main font { font-size: inherit !important; }
.app-main center { text-align: center; }
.app-main blockquote { margin: 0; padding: 0; }
.app-main br + br { display: none; }

/* --------------------------------------------------------------------------
   4. Shell applicatif
   -------------------------------------------------------------------------- */
.app-header {
   position: sticky;
   top: 0;
   z-index: 60;
   display: flex;
   align-items: center;
   gap: 12px;
   height: var(--header-h);
   padding: 0 16px;
   background: linear-gradient(180deg, var(--chrome) 0, var(--chrome-2) 100%);
   color: var(--on-veil);
   border-bottom: 1px solid rgba(0, 0, 0, .3);
   box-shadow: 0 1px 3px rgba(10, 20, 35, .22);
}
/* Sur la vitrine, le chrome se fond dans la photo plutot que de la barrer. */
@supports (backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px)) {
   body.has-photo .app-header {
      background: var(--glass-strong);
      -webkit-backdrop-filter: var(--glass-blur);
      backdrop-filter: var(--glass-blur);
   }
}

.app-brand {
   display: flex;
   align-items: center;
   gap: 10px;
   min-width: 0;
   color: var(--on-veil);
   text-decoration: none;
   flex-shrink: 0;
}
.app-brand:hover { text-decoration: none; color: #fff; }
.app-brand img { height: 30px; width: auto; display: block; }
.app-brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.app-brand-title {
   font-size: var(--fs-base);
   font-weight: 650;
   letter-spacing: -.01em;
   white-space: nowrap;
   overflow: hidden;
   text-overflow: ellipsis;
}
.app-brand-sub {
   font-size: var(--fs-xs);
   color: var(--on-veil-muted);
   white-space: nowrap;
}

.app-header-spacer { flex: 1 1 auto; min-width: 0; }

.app-header-meta {
   display: flex;
   align-items: center;
   gap: 14px;
   font-size: var(--fs-sm);
   color: var(--on-veil-muted);
   white-space: nowrap;
}
.app-header-date { display: none; }
@media (min-width: 900px) { .app-header-date { display: inline; } }

.app-user {
   display: inline-flex;
   align-items: center;
   gap: 8px;
   padding: 4px 10px 4px 4px;
   border: 1px solid var(--on-veil-border);
   border-radius: var(--r-full);
   background: var(--on-veil-fill);
   font-size: var(--fs-sm);
   font-weight: 550;
   color: var(--on-veil);
}
.app-user-avatar {
   width: 24px; height: 24px;
   border-radius: var(--r-full);
   background: var(--accent-on-veil);
   color: #0a2a4a;
   font-size: 10.5px;
   font-weight: 700;
   letter-spacing: .02em;
   display: grid;
   place-items: center;
   flex-shrink: 0;
}

/* --- Navigation principale --- */
.app-nav {
   position: sticky;
   top: var(--header-h);
   z-index: 55;
   background: var(--chrome-2);
   border-bottom: 1px solid rgba(0, 0, 0, .3);
   box-shadow: 0 1px 3px rgba(10, 20, 35, .16);
}
@supports (backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px)) {
   body.has-photo .app-nav {
      background: var(--glass);
      -webkit-backdrop-filter: var(--glass-blur);
      backdrop-filter: var(--glass-blur);
   }
}
.app-nav-inner {
   display: flex;
   align-items: stretch;
   /* Pas de scroll horizontal ici : un conteneur qui defile rogne les
      sous-menus deroulants. Les entrees passent a la ligne si besoin. */
   flex-wrap: wrap;
   overflow: visible;
   gap: 2px;
   padding: 0 10px;
   min-height: var(--nav-h);
}

.nav-item { position: relative; display: flex; flex-shrink: 0; }
.nav-link {
   display: inline-flex;
   align-items: center;
   gap: 6px;
   padding: 0 12px;
   height: var(--nav-h);
   font-size: var(--fs-sm);
   font-weight: 550;
   color: var(--on-veil-muted);
   white-space: nowrap;
   border-bottom: 2px solid transparent;
   transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
   border-radius: var(--r-sm) var(--r-sm) 0 0;
}
.nav-link:hover {
   color: #fff;
   background: var(--on-veil-hover);
   text-decoration: none;
}
.nav-item.is-active > .nav-link,
.nav-link.is-active {
   color: var(--accent-on-veil);
   border-bottom-color: var(--accent-on-veil);
}
.nav-caret {
   width: 8px; height: 8px;
   border-right: 1.6px solid currentColor;
   border-bottom: 1.6px solid currentColor;
   transform: rotate(45deg) translate(-2px, -2px);
   opacity: .55;
   transition: transform var(--t-fast);
}
.nav-item:hover > .nav-link .nav-caret,
.nav-item.is-open > .nav-link .nav-caret { transform: rotate(225deg) translate(-1px, -1px); }

/* Sous-menus */
.nav-menu {
   position: absolute;
   top: 100%;
   left: 0;
   min-width: 220px;
   padding: 5px;
   background: var(--surface);
   border: 1px solid var(--border);
   border-radius: var(--r-md);
   box-shadow: var(--sh-md);
   list-style: none;
   opacity: 0;
   visibility: hidden;
   transform: translateY(-4px);
   transition: opacity var(--t-fast), transform var(--t-fast), visibility var(--t-fast);
   z-index: 70;
}
.nav-item:hover > .nav-menu,
.nav-item.is-open > .nav-menu,
.nav-sub:hover > .nav-menu,
.nav-sub.is-open > .nav-menu {
   opacity: 1;
   visibility: visible;
   transform: translateY(0);
}
.nav-sub { position: relative; }
.nav-sub > .nav-menu { top: -5px; left: calc(100% - 4px); }
.nav-menu a {
   display: flex;
   align-items: center;
   justify-content: space-between;
   gap: 10px;
   padding: 7px 10px;
   border-radius: var(--r-sm);
   color: var(--fg);
   font-size: var(--fs-sm);
   font-weight: 500;
   white-space: nowrap;
}
.nav-menu a:hover { background: var(--primary-soft); color: var(--primary-soft-fg); text-decoration: none; }
.nav-menu .nav-caret-right {
   width: 6px; height: 6px;
   border-right: 1.6px solid currentColor;
   border-top: 1.6px solid currentColor;
   transform: rotate(45deg);
   opacity: .5;
}

/* Bouton menu mobile */
.nav-toggle {
   display: none;
   align-items: center;
   justify-content: center;
   width: 36px; height: 36px;
   border: 1px solid var(--on-veil-border);
   border-radius: var(--r);
   background: var(--on-veil-fill);
   cursor: pointer;
   flex-shrink: 0;
   transition: background var(--t-fast), border-color var(--t-fast);
}
.nav-toggle:hover { background: var(--on-veil-hover); }
.nav-toggle span {
   display: block;
   position: relative;
   width: 16px; height: 1.8px;
   background: var(--on-veil);
   border-radius: 2px;
   transition: background var(--t-fast);
}
.nav-toggle span::before,
.nav-toggle span::after {
   content: "";
   position: absolute;
   left: 0;
   width: 16px; height: 1.8px;
   background: var(--on-veil);
   border-radius: 2px;
   transition: transform var(--t);
}
.nav-toggle span::before { top: -5px; }
.nav-toggle span::after  { top:  5px; }
.nav-toggle.is-open span { background: transparent; }
.nav-toggle.is-open span::before { transform: translateY(5px) rotate(45deg); }
.nav-toggle.is-open span::after  { transform: translateY(-5px) rotate(-45deg); }

/* --- Contenu --- */
.app-main {
   min-height: calc(100vh - var(--header-h) - var(--nav-h) - 46px);
   padding: 24px 18px 60px;
}
/* Sur la vitrine seulement, le texte pose directement sur le voile sombre est
   clair ; les surfaces claires juste en dessous le remettent en sombre.
   Sur les ecrans de travail, ce basculement n'a plus lieu d'etre : le fond est
   deja clair, --ink garde sa valeur normale, et un libelle sans classe reste
   lisible ou qu'il se trouve. */
body.has-photo .app-main {
   color: var(--on-veil);
   --ink:        var(--on-veil);
   --muted:      var(--on-veil-muted);
   --subtle:     var(--on-veil-subtle);
   --link:       var(--accent-on-veil);
   --link-hover: #b9d8f7;
}

/* Garde-fou : toute surface claire (carte, tableau, panneau flottant) reprend
   la couleur de texte normale, et ses quatre roles de texte avec elle. Sans
   cette regle, un libelle sans classe herite du clair de .app-main et
   disparait sur fond blanc casse. Un seul niveau de declaration suffit pour
   tout le contenu de la surface, aussi profond soit-il. */
.app-main .card,
.app-main .stat,
.app-main .table-wrap,
.app-main table.table,
.app-main table.table-form,
.app-main .check-card,
.app-main .alert,
.app-main .notice,
.app-main .btn-kiosk,
.app-main .ui-suggest,
.app-main .ui-cal,
.nav-menu,
.ui-dialog,
.ui-toast,
.ui-palette {
   --ink:        var(--fg);
   --muted:      var(--fg-muted);
   --subtle:     var(--fg-subtle);
   --link:       var(--primary);
   --link-hover: var(--primary-hover);
}
/* Le texte courant lui-meme ne se remet en sombre que sur les surfaces
   claires : .alert, .notice, .hero et .btn-kiosk imposent deja leur propre
   couleur et sont exclus, sinon on ecraserait leur teinte. */
.app-main .card,
.app-main .stat,
.app-main .table-wrap,
.app-main table.table,
.app-main table.table-form,
.app-main .check-card,
.app-main .ui-suggest,
.app-main .ui-cal,
.nav-menu,
.ui-dialog,
.ui-toast,
.ui-palette { color: var(--fg); }

/* Le bandeau et les grandes cartes tactiles sont sur fond sombre ou colore :
   leurs liens et nuances restent clairs. */
.app-main .hero { --ink: #fff; --muted: rgba(255, 255, 255, .82); --subtle: rgba(255, 255, 255, .64); --link: #fff; }
.container   { width: 100%; max-width: 1360px; margin: 0 auto; }
.container-sm { width: 100%; max-width: 620px;  margin: 0 auto; }
.container-md { width: 100%; max-width: 900px;  margin: 0 auto; }
.container-lg { width: 100%; max-width: 1120px; margin: 0 auto; }

.app-footer {
   padding: 14px 16px 22px;
   text-align: center;
   font-size: var(--fs-xs);
   color: var(--fg-subtle);
   border-top: 1px solid var(--border);
   background: transparent;
}
.app-footer a { color: var(--fg-muted); }
.app-footer a:hover { color: var(--primary); }

body.has-photo .app-footer {
   color: var(--on-veil-subtle);
   border-top-color: var(--on-veil-border);
   background: var(--veil-solid);
}
@supports (backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px)) {
   body.has-photo .app-footer {
      background: var(--glass);
      -webkit-backdrop-filter: var(--glass-blur);
      backdrop-filter: var(--glass-blur);
   }
}
body.has-photo .app-footer a { color: var(--on-veil-muted); }
body.has-photo .app-footer a:hover { color: #fff; }

/* --------------------------------------------------------------------------
   5. Typographie applicative
   -------------------------------------------------------------------------- */
.page-head {
   display: flex;
   align-items: flex-start;
   justify-content: space-between;
   gap: 16px;
   flex-wrap: wrap;
   margin-bottom: 18px;
}
/* Ces trois-la servent aussi bien dans une carte que directement sur le voile
   (recapitulatif de facture, en-tete d'assistant) : ils passent donc par les
   roles --ink / --muted / --subtle. */
.page-title {
   font-size: var(--fs-xl);
   font-weight: 680;
   letter-spacing: -.02em;
   line-height: 1.25;
   color: var(--ink, var(--fg));
}
.page-subtitle {
   margin-top: 3px;
   font-size: var(--fs-sm);
   color: var(--muted, var(--fg-muted));
   font-weight: 450;
}
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.section-title {
   font-size: var(--fs-xs);
   font-weight: 700;
   letter-spacing: .07em;
   text-transform: uppercase;
   color: var(--subtle, var(--fg-subtle));
}

/* --muted / --subtle valent le gris habituel sur une surface claire et une
   nuance de blanc sur le voile sombre (cf. .app-main et son garde-fou). */
.text-muted   { color: var(--muted, var(--fg-muted)); }
.text-subtle  { color: var(--subtle, var(--fg-subtle)); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.text-left    { text-align: left; }
.text-sm      { font-size: var(--fs-sm); }
.text-xs      { font-size: var(--fs-xs); }
.text-lg      { font-size: var(--fs-lg); }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mono   { font-family: var(--font-mono); font-size: .94em; letter-spacing: -.01em; }
.nowrap { white-space: nowrap; }

.mt-0 { margin-top: 0; }    .mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; }
.mt-4 { margin-top: 26px; } .mt-5 { margin-top: 36px; }
.mb-0 { margin-bottom: 0; }    .mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.mb-4 { margin-bottom: 26px; } .mb-5 { margin-bottom: 36px; }

.stack   { display: flex; flex-direction: column; gap: 18px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.row     { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* Deux champs qui vont ensemble - nom et prenom de l'agent - et qui doivent
   rester cote a cote y compris sur telephone, ou une largeur maximale les
   aurait sinon renvoyes l'un sous l'autre. Ils se partagent la place. */
.row-pair { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; }
.row-pair > .input { flex: 1 1 0; min-width: 0; max-width: none; }
.row-end { display: flex; align-items: center; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.row-center { display: flex; align-items: center; gap: 10px; justify-content: center; flex-wrap: wrap; }
.spacer  { flex: 1 1 auto; }

/* --------------------------------------------------------------------------
   6. Cartes
   -------------------------------------------------------------------------- */
.card {
   background: var(--surface);
   border: 1px solid var(--border);
   border-radius: var(--r-lg);
   box-shadow: var(--sh-xs);
   overflow: hidden;
}
.card + .card { margin-top: 18px; }

.card-header {
   display: flex;
   align-items: center;
   justify-content: space-between;
   gap: 12px;
   flex-wrap: wrap;
   padding: 13px 18px;
   border-bottom: 1px solid var(--border);
   background: var(--surface-2);
}
.card-title {
   font-size: var(--fs-md);
   font-weight: 620;
   letter-spacing: -.01em;
   color: var(--fg);
}
.card-desc { font-size: var(--fs-sm); color: var(--fg-muted); margin-top: 1px; }
.card-body { padding: 18px; }
.card-body-flush { padding: 0; }
.card-footer {
   display: flex;
   align-items: center;
   justify-content: flex-end;
   gap: 10px;
   flex-wrap: wrap;
   padding: 13px 18px;
   border-top: 1px solid var(--border);
   background: var(--surface-2);
}
.card-footer.is-split { justify-content: space-between; }

/* Statistiques */
.stat-grid {
   display: grid;
   grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
   gap: 12px;
}
.stat {
   padding: 14px 16px;
   background: var(--surface);
   border: 1px solid var(--border);
   border-radius: var(--r-md);
   box-shadow: var(--sh-xs);
}
.stat-label {
   font-size: var(--fs-xs);
   font-weight: 600;
   letter-spacing: .05em;
   text-transform: uppercase;
   color: var(--fg-subtle);
}
.stat-value {
   margin-top: 4px;
   font-size: var(--fs-2xl);
   font-weight: 700;
   letter-spacing: -.03em;
   line-height: 1.1;
}
.stat-hint { margin-top: 3px; font-size: var(--fs-sm); color: var(--fg-muted); }

/* --------------------------------------------------------------------------
   7. Boutons
   -------------------------------------------------------------------------- */
/* Un seul selecteur de classe, volontairement.

   La regle listait aussi "button.btn" et "input.btn", ce qui lui donnait une
   specificite superieure a celle des variantes .btn-sm et .btn-icon. Sur un
   <button class="btn btn-icon btn-sm">, la hauteur et surtout le
   "padding: 0 15px" de base l'emportaient donc sur le "padding: 0" de
   .btn-icon : dans une boite de 30 px, la zone de contenu devenait nulle et
   l'icone etait ecrasee a zero pixel de large. Les boutons "Imprimer" et
   "Agent maritime" de la recherche de clairances apparaissaient vides.

   Les styles par defaut du navigateur pour <button> et <input> n'ont qu'une
   specificite d'element : une simple classe suffit a les couvrir. */
.btn {
   position: relative;
   display: inline-flex;
   align-items: center;
   justify-content: center;
   gap: 7px;
   height: 36px;
   padding: 0 15px;
   font-family: inherit;
   font-size: var(--fs-sm);
   font-weight: 580;
   line-height: 1;
   letter-spacing: -.005em;
   white-space: nowrap;
   border: 1px solid transparent;
   border-radius: var(--r);
   cursor: pointer;
   user-select: none;
   text-decoration: none;
   transition: background var(--t-fast), border-color var(--t-fast),
               color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
   -webkit-appearance: none;
   appearance: none;
}
.btn:hover { text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(.5px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
.btn:disabled,
.btn[disabled],
.btn.is-disabled {
   opacity: .5;
   cursor: not-allowed;
   transform: none !important;
   box-shadow: none;
}

.btn-primary {
   background: var(--primary);
   color: #fff;
   box-shadow: var(--sh-xs);
}
.btn-primary:hover:not(:disabled)  { background: var(--primary-hover); color: #fff; }
.btn-primary:active:not(:disabled) { background: var(--primary-active); }

/* Le bouton secondaire est pose la plupart du temps sur une carte blanche :
   il lui faut son propre gris, sinon il ne se lit plus que par sa bordure. */
.btn-secondary {
   background: var(--surface-2);
   color: var(--fg);
   border-color: var(--border-input);
   box-shadow: var(--sh-xs);
}
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); color: var(--fg); border-color: var(--border-strong); }

.btn-ghost { background: transparent; color: var(--fg-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--fg); }

.btn-danger { background: var(--danger); color: #fff; box-shadow: var(--sh-xs); }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); color: #fff; }
.btn-danger:focus-visible { box-shadow: 0 0 0 3px rgba(180, 35, 24, .28); }

.btn-danger-soft { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.btn-danger-soft:hover:not(:disabled) { background: #eec8c3; color: var(--danger); }

.btn-success { background: var(--success); color: #fff; box-shadow: var(--sh-xs); }
.btn-success:hover:not(:disabled) { background: #05603a; color: #fff; }

.btn-soft { background: var(--primary-soft); color: var(--primary-soft-fg); border-color: transparent; }
.btn-soft:hover:not(:disabled) { background: #c9dbf0; color: var(--primary-soft-fg); }

.btn-sm { height: 30px; padding: 0 11px; font-size: var(--fs-xs); border-radius: var(--r-sm); gap: 5px; }
.btn-lg { height: 44px; padding: 0 22px; font-size: var(--fs-md); border-radius: var(--r-md); }
.btn-block { width: 100%; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn-icon svg { width: 16px; height: 16px; }
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

/* Bouton "borne" plein ecran tactile (accueil public)
   Chaque carte porte sa propre couleur d'accent via --k-accent / --k-soft :
   par defaut le bleu de l'application, redefinie par les variantes plus bas. */
.btn-kiosk {
   --k-accent: var(--primary);
   --k-soft:   var(--primary-soft);
   --k-ring:   var(--primary-ring);
   position: relative;
   overflow: hidden;
   display: flex;
   flex-direction: column;
   align-items: center;
   justify-content: flex-start;
   gap: 4px;
   min-height: 168px;
   width: 100%;
   padding: 26px 18px 22px;
   background: var(--surface);
   border: 1px solid var(--border);
   border-radius: var(--r-xl);
   box-shadow: var(--sh-sm);
   cursor: pointer;
   font-family: inherit;
   color: var(--fg);
   text-align: center;
   transition: transform var(--t), box-shadow var(--t), border-color var(--t), background var(--t);
}
/* Lisere de couleur en haut de carte : c'est lui qui distingue les types
   au premier coup d'oeil, avant meme l'icone. */
.btn-kiosk::before {
   content: "";
   position: absolute;
   top: 0; left: 0; right: 0;
   height: 5px;
   background: var(--k-accent);
}
.btn-kiosk:hover {
   transform: translateY(-3px);
   box-shadow: var(--sh-md);
   border-color: var(--k-accent);
   background: var(--surface);
   text-decoration: none;
   color: var(--fg);
}
.btn-kiosk:active { transform: translateY(-1px); }
.btn-kiosk:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--k-ring), var(--sh-md); }
.btn-kiosk-icon {
   width: 62px; height: 62px;
   display: grid; place-items: center;
   border-radius: var(--r-lg);
   background: var(--k-soft);
   color: var(--k-accent);
   margin-bottom: 10px;
   transition: transform var(--t);
}
.btn-kiosk:hover .btn-kiosk-icon { transform: scale(1.06); }
.btn-kiosk-icon svg { width: 36px; height: 36px; }
.btn-kiosk-title {
   font-size: var(--fs-xl);
   font-weight: 700;
   letter-spacing: -.02em;
   line-height: 1.15;
   color: var(--fg);
}
.btn-kiosk-sub {
   font-size: var(--fs-base);
   font-weight: 500;
   color: var(--fg-muted);
   font-style: italic;
}

/* Variantes de couleur par type de navire (accueil) */
.btn-kiosk.is-plaisance { --k-accent: #0b57a4; --k-soft: #e8f1fb; --k-ring: rgba(11, 87, 164, .28); }
.btn-kiosk.is-cargo     { --k-accent: #b54708; --k-soft: #fdf1e3; --k-ring: rgba(181, 71, 8, .26); }
.btn-kiosk.is-paquebot  { --k-accent: #6941c6; --k-soft: #f0ebfd; --k-ring: rgba(105, 65, 198, .26); }
.btn-kiosk.is-charter   { --k-accent: #0e7490; --k-soft: #e0f3f7; --k-ring: rgba(14, 116, 144, .26); }
.btn-kiosk.is-peche     { --k-accent: #067647; --k-soft: #e7f6ee; --k-ring: rgba(6, 118, 71, .26); }

/* Cartes a photo (accueil) : la photo remplace l'icone, le lisere de couleur
   passe sous la photo et le libelle s'aligne a gauche. */
.btn-kiosk.has-photo {
   padding: 0;
   gap: 0;
   min-height: 0;
   align-items: stretch;
   text-align: left;
}
.btn-kiosk.has-photo::before { display: none; }
.btn-kiosk-photo {
   display: block;
   width: 100%;
   aspect-ratio: 6 / 5;
   object-fit: cover;
   background: var(--k-soft);
}
.btn-kiosk-body {
   display: flex;
   flex-direction: column;
   gap: 2px;
   padding: 14px 16px 16px;
   border-top: 4px solid var(--k-accent);
}
.btn-kiosk.has-photo .btn-kiosk-sub { font-style: normal; }

/* Variantes entree / sortie (ecran par type de navire) */
.btn-kiosk.is-in  { --k-accent: var(--success); --k-soft: var(--success-soft); --k-ring: rgba(6, 118, 71, .26); }
.btn-kiosk.is-out { --k-accent: var(--warning); --k-soft: var(--warning-soft); --k-ring: rgba(181, 71, 8, .26); }

.kiosk-grid {
   display: grid;
   grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
   gap: 14px;
}
/* Les cinq types de navire : 3 puis 2, jamais une rangee de cinq vignettes
   ecrasees. */
.kiosk-grid.is-types { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; }
.kiosk-grid.is-types > * { grid-column: span 2; }
/* La deuxieme rangee ne compte que deux cartes : on la recentre. */
.kiosk-grid.is-types > :nth-child(4) { grid-column: 2 / span 2; }
@media (max-width: 780px) {
   .kiosk-grid.is-types { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
   .kiosk-grid.is-types > *,
   .kiosk-grid.is-types > :nth-child(4) { grid-column: auto; }
}
/* Sur telephone les cartes deviennent des lignes : le lisere passe a gauche,
   l'icone se place a cote du libelle. */
@media (max-width: 460px) {
   .kiosk-grid.is-types { grid-template-columns: 1fr; gap: 10px; }
   .kiosk-grid.is-types > * { grid-column: auto; }
   .btn-kiosk {
      min-height: 0;
      padding: 14px 16px 14px 20px;
      display: grid;
      grid-template-columns: auto minmax(0, 1fr);
      column-gap: 14px;
      align-items: center;
      justify-items: start;
      text-align: left;
      border-radius: var(--r-lg);
   }
   .btn-kiosk::before { right: auto; bottom: 0; width: 5px; height: auto; }
   .btn-kiosk-icon { grid-row: 1 / span 2; width: 46px; height: 46px; margin-bottom: 0; }
   .btn-kiosk-icon svg { width: 27px; height: 27px; }
   .btn-kiosk-title { grid-column: 2; font-size: var(--fs-lg); }
   .btn-kiosk-sub   { grid-column: 2; }
   .btn-kiosk:hover { transform: none; }
   /* Carte a photo : vignette a gauche, lisere entre la vignette et le texte. */
   .btn-kiosk.has-photo {
      padding: 0;
      grid-template-columns: 112px minmax(0, 1fr);
      column-gap: 0;
      align-items: stretch;
      justify-items: stretch;
   }
   .btn-kiosk-photo { height: 100%; aspect-ratio: auto; min-height: 80px; }
   .btn-kiosk-body {
      grid-column: 2;
      justify-content: center;
      border-top: 0;
      border-left: 4px solid var(--k-accent);
   }
}
/* Ecran large : les cinq cartes a photo tiennent sur une seule rangee,
   comme sur la maquette validee. */
@media (min-width: 1100px) {
   .kiosk-grid.is-types.is-row5 { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 20px; }
   .kiosk-grid.is-types.is-row5 > *,
   .kiosk-grid.is-types.is-row5 > :nth-child(4) { grid-column: auto; }
}

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--r) 0 0 var(--r); margin-left: 0; }
.btn-group .btn:last-child  { border-radius: 0 var(--r) var(--r) 0; }
.btn-group .btn:focus-visible { z-index: 2; }

/* --------------------------------------------------------------------------
   8. Formulaires
   -------------------------------------------------------------------------- */
.form-grid {
   display: grid;
   grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr));
   gap: 14px 18px;
   align-items: start;
}
.form-grid > .field-full,
.form-grid > .form-section,
.form-grid > .form-note,
.form-grid > .form-actions,
.form-grid > .form-sep { grid-column: 1 / -1; }

/* Un champ peut demander plusieurs colonnes. Ces classes remplacent l'ancien
   "style=grid-column:span N" ecrit en ligne dans les modules : une valeur en
   ligne n'est pas reprise par les points de rupture, et un "span 2" qui
   survivait dans la grille a UNE colonne du telephone y creait une colonne
   implicite. La grille repassait alors a deux colonnes et tous les champs se
   retrouvaient a moitie larges - c'est la cause des champs minuscules sur les
   ecrans de recherche. En dessous du point de rupture, un champ large reprend
   donc toute la ligne. */
.form-grid > .span-2 { grid-column: span 2; }
.form-grid > .span-3 { grid-column: span 3; }
.form-grid > .span-4 { grid-column: span 4; }
@media (max-width: 860px) {
   .form-grid > .span-2,
   .form-grid > .span-3,
   .form-grid > .span-4 { grid-column: 1 / -1; }
   /* Garde-fou : si un module reintroduit un span en ligne, il est neutralise
      plutot que de casser la grille. */
   .form-grid > [style*="grid-column"] { grid-column: 1 / -1 !important; }
}

.form-section {
   display: flex;
   align-items: center;
   gap: 10px;
   margin-top: 4px;
}
.form-grid > .form-section:first-child { margin-top: 0; }
.form-section-label {
   font-size: var(--fs-xs);
   font-weight: 700;
   letter-spacing: .07em;
   text-transform: uppercase;
   color: var(--primary);
   white-space: nowrap;
}
.form-section-rule { flex: 1 1 auto; height: 1px; background: var(--border); }

.form-sep { height: 1px; background: var(--border); margin: 2px 0; }

.form-note {
   padding: 9px 12px;
   border-radius: var(--r);
   background: var(--warning-soft);
   border: 1px solid var(--warning-border);
   color: var(--warning);
   font-size: var(--fs-sm);
   font-weight: 550;
   line-height: 1.45;
}

.form-actions {
   display: flex;
   align-items: center;
   gap: 10px;
   flex-wrap: wrap;
   margin-top: 6px;
}
.form-actions.is-center { justify-content: center; }
.form-actions.is-right  { justify-content: flex-end; }

/* Champ */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-label {
   display: inline-flex;
   align-items: baseline;
   gap: 4px;
   font-size: var(--fs-sm);
   font-weight: 560;
   color: var(--ink, var(--fg));
   line-height: 1.35;
}
.field-req { color: var(--danger); font-weight: 700; }
.field-hint { font-size: var(--fs-xs); color: var(--subtle, var(--fg-subtle)); }
.field-suffix { font-size: var(--fs-sm); color: var(--muted, var(--fg-muted)); white-space: nowrap; }
.field-control { display: flex; align-items: center; gap: 8px; min-width: 0; }
.field-control > .input,
.field-control > .select-wrap { flex: 1 1 auto; min-width: 0; }

/* Controles */
.input,
input[type="text"].input,
input[type="password"].input,
input[type="email"].input,
input[type="number"].input,
input[type="search"].input,
input[type="tel"].input,
textarea.input,
select.input {
   width: 100%;
   min-width: 0;
   height: 36px;
   padding: 0 11px;
   font-family: inherit;
   font-size: var(--fs-base);
   color: var(--fg);
   background: var(--field);
   border: 1px solid var(--border-input);
   border-radius: var(--r);
   box-shadow: inset 0 1px 2px rgba(16, 24, 40, .06);
   transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
   -webkit-appearance: none;
   appearance: none;
}
textarea.input {
   height: auto;
   min-height: 76px;
   padding: 9px 11px;
   line-height: 1.5;
   resize: vertical;
}
.input::placeholder { color: var(--fg-subtle); }
.input:hover:not(:disabled):not([readonly]) { border-color: var(--border-strong); }
.input:focus {
   border-color: var(--primary);
   box-shadow: 0 0 0 3px var(--primary-ring);
   background: var(--field);
}
.input:disabled,
.input[readonly] {
   background: var(--surface-3);
   color: var(--fg-muted);
   cursor: default;
   box-shadow: none;
}
.input:disabled { opacity: .75; }
.input.is-invalid {
   border-color: var(--danger);
   box-shadow: 0 0 0 3px rgba(180, 35, 24, .16);
}
.input.is-valid { border-color: var(--success-border); }

.input-sm { height: 30px; font-size: var(--fs-sm); padding: 0 9px; border-radius: var(--r-sm); }
.input-lg { height: 44px; font-size: var(--fs-md); padding: 0 14px; border-radius: var(--r-md); }
.input-num    { text-align: right; font-variant-numeric: tabular-nums; }
.input-center { text-align: center; }
.input-upper  { text-transform: uppercase; }

/* Largeurs : traduction de l'ancien attribut "size" en largeur maximale.
   Le champ reste fluide (donc lisible sur mobile) mais ne s'etire plus. */
.w-auto { width: auto !important; }
.w-3  { max-width: 76px; }
.w-4  { max-width: 96px; }
.w-5  { max-width: 122px; }
.w-6  { max-width: 158px; }
.w-8  { max-width: 210px; }
.w-10 { max-width: 270px; }
.date-field.w-6 { max-width: 168px; }
@media (max-width: 620px) {
   .w-3, .w-4, .w-5, .w-6, .w-8, .w-10 { max-width: 100%; }
}

/* Select */
.select-wrap { position: relative; display: block; min-width: 0; }
.select-wrap::after {
   content: "";
   position: absolute;
   right: 12px;
   top: 50%;
   width: 7px; height: 7px;
   border-right: 1.7px solid var(--fg-subtle);
   border-bottom: 1.7px solid var(--fg-subtle);
   transform: translateY(-70%) rotate(45deg);
   pointer-events: none;
   transition: border-color var(--t-fast);
}
.select-wrap:hover::after { border-color: var(--fg-muted); }
select.input { padding-right: 30px; cursor: pointer; }
select.input[size]:not([size="1"]) {
   height: auto;
   padding: 5px;
   cursor: default;
}
select.input[size]:not([size="1"]) option { padding: 5px 8px; border-radius: var(--r-sm); }
.select-wrap.is-list::after { display: none; }

/* Groupe input + addon */
.input-group { display: flex; align-items: stretch; min-width: 0; }
.input-group > .input { border-radius: var(--r) 0 0 var(--r); }
.input-group > .input:not(:first-child) { border-radius: 0; margin-left: -1px; }
.input-group > .input:focus { z-index: 2; }
.input-addon {
   display: inline-flex;
   align-items: center;
   padding: 0 11px;
   margin-left: -1px;
   background: var(--surface-3);
   border: 1px solid var(--border-input);
   border-radius: 0 var(--r) var(--r) 0;
   font-size: var(--fs-sm);
   color: var(--fg-muted);
   white-space: nowrap;
}
.input-group > .btn { margin-left: -1px; border-radius: 0 var(--r) var(--r) 0; }

/* Case a cocher / radio */
.check {
   display: inline-flex;
   align-items: flex-start;
   gap: 9px;
   cursor: pointer;
   font-size: var(--fs-base);
   line-height: 1.45;
   user-select: none;
}
.check input[type="checkbox"],
.check input[type="radio"],
input.check-box,
input.check-radio {
   flex-shrink: 0;
   position: relative;
   width: 18px;
   height: 18px;
   margin: 1px 0 0;
   background: var(--field);
   border: 1.5px solid var(--border-strong);
   border-radius: var(--r-sm);
   cursor: pointer;
   transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
   -webkit-appearance: none;
   appearance: none;
}
.check input[type="radio"],
input.check-radio { border-radius: var(--r-full); }

.check input:hover:not(:disabled),
input.check-box:hover:not(:disabled),
input.check-radio:hover:not(:disabled) { border-color: var(--primary); }

.check input:focus-visible,
input.check-box:focus-visible,
input.check-radio:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }

.check input[type="checkbox"]:checked,
input.check-box:checked {
   background: var(--primary);
   border-color: var(--primary);
}
.check input[type="checkbox"]:checked::after,
input.check-box:checked::after {
   content: "";
   position: absolute;
   left: 5px; top: 1.5px;
   width: 5px; height: 10px;
   border: solid #fff;
   border-width: 0 2px 2px 0;
   transform: rotate(43deg);
}
.check input[type="radio"]:checked,
input.check-radio:checked { border-color: var(--primary); border-width: 5px; }

.check input:disabled { opacity: .5; cursor: not-allowed; }
.check-text { min-width: 0; }
.check-title { font-weight: 550; }
.check-sub { display: block; font-size: var(--fs-sm); color: var(--muted, var(--fg-muted)); font-style: italic; }

.check-list { display: flex; flex-direction: column; gap: 10px; }
.check-inline { display: flex; flex-wrap: wrap; gap: 10px 22px; }

/* Grande carte a cocher (ecrans publics) */
.check-card {
   display: flex;
   align-items: flex-start;
   gap: 12px;
   padding: 14px 16px;
   background: var(--surface-2);
   border: 1px solid var(--border);
   border-radius: var(--r-md);
   cursor: pointer;
   transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
.check-card:hover { border-color: var(--border-strong); background: var(--surface-3); }
.check-card:has(input:checked) {
   border-color: var(--primary);
   background: var(--primary-soft);
   box-shadow: 0 0 0 1px var(--primary) inset;
}
.check-card input { width: 20px; height: 20px; margin-top: 0; }
.check-card .check-text { font-size: var(--fs-base); }

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

/* --------------------------------------------------------------------------
   9. Tableaux de donnees
   -------------------------------------------------------------------------- */
.table-wrap {
   width: 100%;
   overflow-x: auto;
   border-radius: var(--r-lg);
   border: 1px solid var(--border);
   background: var(--surface);
   box-shadow: var(--sh-xs);
   /* Ombres de defilement : quand le tableau deborde a droite (ou a gauche),
      un lisere sombre apparait de ce cote. C'est la seule indication que des
      colonnes restent hors champ, et elle compte beaucoup sur telephone. */
   background-image:
      linear-gradient(90deg,  var(--surface) 40%, rgba(255, 255, 255, 0)),
      linear-gradient(270deg, var(--surface) 40%, rgba(255, 255, 255, 0)),
      radial-gradient(farthest-side at 0 50%,   rgba(14, 23, 38, .16), rgba(14, 23, 38, 0)),
      radial-gradient(farthest-side at 100% 50%, rgba(14, 23, 38, .16), rgba(14, 23, 38, 0));
   background-position: left center, right center, left center, right center;
   background-size: 28px 100%, 28px 100%, 13px 100%, 13px 100%;
   background-repeat: no-repeat;
   background-attachment: local, local, scroll, scroll;
}
.card .table-wrap { border: 0; border-radius: 0; box-shadow: none; }

/* Liste longue : on borne la hauteur pour que l'en-tete de colonnes reste
   visible pendant le defilement. Sans cette borne, .table-wrap n'a pas de
   hauteur propre et le "position: sticky" du thead ne se declenche jamais. */
.table-wrap.is-tall {
   max-height: min(72vh, 720px);
   overflow: auto;
}
/* Sur telephone le tableau devient une liste de fiches : un second niveau de
   defilement imbrique dans la page y serait un piege, on le desactive. */
@media (max-width: 620px) {
   .table-wrap.is-tall { max-height: none; overflow-x: auto; overflow-y: visible; }
}

table.table {
   width: 100%;
   border-collapse: separate;
   border-spacing: 0;
   font-size: var(--fs-sm);
}
table.table th,
table.table td {
   padding: 10px 14px;
   text-align: left;
   vertical-align: middle;
   border-bottom: 1px solid var(--border);
   background-color: transparent;
}
table.table thead th {
   position: sticky;
   top: 0;
   z-index: 2;
   background: var(--surface-3);
   font-size: var(--fs-xs);
   font-weight: 700;
   letter-spacing: .045em;
   text-transform: uppercase;
   color: var(--fg-muted);
   white-space: nowrap;
   /* Le trait est double d'une ombre interne : une bordure de cellule collante
      peut se derober au defilement selon le navigateur, l'ombre non. */
   border-bottom: 1px solid var(--border-strong);
   box-shadow: inset 0 -1px 0 var(--border-strong);
}
/* Zebrure. Sur une liste de clairances de trente lignes et huit colonnes,
   c'est ce qui permet de suivre une ligne du regard jusqu'au bout sans
   deraper sur la voisine. Les lignes de rupture et de total portent deja
   leur propre fond : elles sont exclues. */
table.table tbody tr { transition: background var(--t-fast); }
table.table tbody tr:nth-of-type(even):not(.row-sep):not(.row-total) > td {
   background: var(--surface-2);
}
table.table tbody tr:hover:not(.row-sep):not(.row-total) > td { background: var(--primary-soft); }
table.table tbody tr:last-child > td { border-bottom: 0; }
table.table tbody tr.is-muted > td { color: var(--fg-subtle); }

table.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.table .mid { text-align: center; }
table.table .actions { text-align: right; white-space: nowrap; width: 1%; }
table.table .actions .btn + .btn { margin-left: 4px; }

/* Les boutons d'action sont poses sur une ligne dont le fond change : blanc,
   gris de la zebrure, bleu du survol. Or .btn-secondary a exactement le gris
   d'une ligne paire et .btn-soft exactement le bleu d'une ligne survolee - le
   bouton s'y fondait et on ne distinguait plus son icone (c'etait le cas de
   "Imprimer" et de "Agent maritime" dans la recherche de clairances).
   Dans une cellule d'actions, ces boutons reprennent donc le blanc de la
   surface et portent leur couleur sur la bordure et l'icone. */
table.table .actions .btn-secondary {
   background: var(--surface);
   border-color: var(--border-strong);
}
table.table .actions .btn-secondary:hover:not(:disabled) { background: var(--surface-3); }
table.table .actions .btn-soft {
   background: var(--surface);
   color: var(--primary);
   border-color: var(--border-strong);
}
table.table .actions .btn-soft:hover:not(:disabled) { background: var(--primary-soft); border-color: var(--primary); }
table.table .actions .btn-danger-soft {
   background: var(--surface);
   border-color: var(--danger-border);
}
table.table .actions .btn-danger-soft:hover:not(:disabled) { background: var(--danger-soft); }

table.table tr.row-sep > td {
   background: var(--primary-soft);
   font-weight: 700;
   font-size: var(--fs-xs);
   letter-spacing: .05em;
   text-transform: uppercase;
   color: var(--primary-soft-fg);
   border-bottom-color: var(--info-border);
}
table.table tfoot td,
table.table tr.row-total > td,
table.table tr.row-total > th {
   background: var(--surface-3);
   font-weight: 700;
   font-size: var(--fs-base);
   color: var(--fg);
   border-top: 2px solid var(--border-strong);
   border-bottom: 0;
}
table.table.is-compact th,
table.table.is-compact td { padding: 7px 10px; }
table.table.is-fixed { table-layout: fixed; }

/* Sur telephone, un tableau non converti en fiches doit defiler
   horizontalement plutot que d'ecraser ses colonnes jusqu'a l'illisible.
   La largeur plancher force ce defilement, que les ombres de .table-wrap
   signalent.

   .is-fit exempte de ce plancher les tableaux qui tiennent nativement dans un
   telephone - deux ou trois colonnes courtes, un libelle et un compte, comme
   les repartitions des statistiques. Sans cette exemption, un tableau de 340 px
   etait etire a 560 px et sa colonne de chiffres partait hors de l'ecran :
   l'utilisateur ne voyait plus que les libelles. */
@media (max-width: 620px) {
   .table-wrap > table.table:not(.is-stacked):not(.is-fit),
   .table-wrap > form > table.table:not(.is-stacked):not(.is-fit) { min-width: 560px; }
}

/* Tableau de saisie (facturation, equipage) */
table.table-form { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
table.table-form th,
table.table-form td {
   padding: 7px 8px;
   border-bottom: 1px solid var(--border);
   vertical-align: middle;
   background-color: transparent;
}
table.table-form thead th,
table.table-form th.rowhead {
   background: var(--surface-3);
   font-size: var(--fs-xs);
   font-weight: 700;
   letter-spacing: .03em;
   text-transform: uppercase;
   color: var(--fg-muted);
   text-align: left;
   white-space: nowrap;
}
table.table-form thead th { position: sticky; top: 0; z-index: 2; border-bottom: 1px solid var(--border-strong); }
table.table-form th.rowhead { text-transform: none; font-size: var(--fs-sm); color: var(--fg); white-space: normal; }
table.table-form tbody tr:hover > td { background: var(--surface-2); }
/* Zebrure de la grille de facturation (.is-zebra) : une ligne sur deux grisee,
   libelle compris, pour suivre une prestation jusqu'a sa derniere colonne sans
   saisir sur la voisine. Les lignes de rupture et de total sont ignorees dans
   le decompte, et chaque groupe de lignes (tbody) repart sur une ligne grisee. */
table.table-form.is-zebra th.rowhead { background: transparent; }
table.table-form.is-zebra tbody tr:nth-child(odd of :not(.row-sep, .row-total)) > * {
   background: var(--surface-3);
}
table.table-form.is-zebra tbody tr:not(.row-sep):not(.row-total):hover > * { background: var(--primary-soft); }
table.table-form .input { height: 32px; font-size: var(--fs-sm); }
table.table-form td.num { text-align: right; }
table.table-form td.mid { text-align: center; }
/* L'en-tete se cale sur le contenu de sa colonne. Sans cela, "Tarif basse
   saison" restait a gauche pendant que le champ etait pousse a droite, et la
   colonne semblait pleine de vide. */
table.table-form thead th.num { text-align: right; }
table.table-form thead th.mid { text-align: center; }

/* Champ suivi de son unite - "12.00 &euro;", "50.00 &euro;/h".
   L'unite est un simple texte pose apres l'input dans le balisage ; comme
   l'input est en width:100%, il remplissait la cellule et rejetait le symbole
   a la ligne suivante. Le champ reprend donc sa largeur propre (bornee par la
   classe .w-*), la cellule ne se coupe plus, et une demi-espace le separe de
   son unite - sans l'y coller. */
table.table-form td.num { white-space: nowrap; }
table.table-form td.num > .input { width: auto; margin-right: 5px; }

/* Largeur plancher des champs de saisie en tableau.

   Sans elle, un tableau de huit colonnes rendu a 100% de la largeur du
   conteneur distribuait 25 px a chaque champ des que l'ecran passait sous
   ~1100 px : sur la facturation, "9.75" s'affichait "9.7" et la saisie
   devenait impossible. Une largeur minimale sur le champ remonte dans la
   largeur minimale de sa colonne, donc dans celle du tableau ; le tableau
   depasse alors .table-wrap, qui le fait defiler horizontalement. Un tableau
   qui defile se lit ; un tableau qui comprime ses champs, non.

   Les valeurs suivent l'echelle w-* (ancien attribut "size") : un champ de
   trois caracteres n'a pas besoin d'autant de place qu'un nom de famille.

   Les bornes hautes sont rappelees ici parce que le point de rupture telephone
   relache les .w-* a 100% : utile pour un champ seul dans un formulaire a une
   colonne, nuisible dans un tableau, ou un champ de trois caracteres se serait
   alors mis a occuper deux cents pixels. */
table.table-form .input { min-width: 118px; }
table.table-form .input.w-3 { min-width: 70px;  max-width: 80px; }
table.table-form .input.w-4 { min-width: 82px;  max-width: 96px; }
table.table-form .input.w-5 { min-width: 92px;  max-width: 122px; }
table.table-form .input.w-6 { min-width: 112px; max-width: 158px; }
/* Une liste deroulante affiche un libelle entier ("Ne paye pas", un pays) :
   elle a besoin d'un peu plus. */
table.table-form select.input { min-width: 132px; }
table.table-form .date-field { min-width: 132px; }

.empty-state {
   padding: 44px 20px;
   text-align: center;
   color: var(--muted, var(--fg-muted));
}
.empty-state-icon {
   width: 44px; height: 44px;
   margin: 0 auto 12px;
   display: grid; place-items: center;
   border-radius: var(--r-full);
   background: var(--surface-3);
   color: var(--fg-subtle);
}
.empty-state-title { font-size: var(--fs-md); font-weight: 600; color: var(--ink, var(--fg)); }
.empty-state-desc { margin-top: 4px; font-size: var(--fs-sm); }

/* --------------------------------------------------------------------------
   10. Badges / puces
   -------------------------------------------------------------------------- */
.badge {
   display: inline-flex;
   align-items: center;
   gap: 5px;
   padding: 2px 8px;
   border-radius: var(--r-full);
   border: 1px solid transparent;
   font-size: var(--fs-xs);
   font-weight: 620;
   line-height: 1.5;
   white-space: nowrap;
}
.badge-neutral { background: var(--surface-3); color: var(--fg-muted); border-color: var(--border); }
.badge-primary { background: var(--primary-soft); color: var(--primary-soft-fg); border-color: var(--info-border); }
.badge-success { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-border); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger);  border-color: var(--danger-border); }
.badge-dot { width: 6px; height: 6px; border-radius: var(--r-full); background: currentColor; }

.badge-in  { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.badge-out { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-border); }

/* Repartition par pays (statistiques) : une case par pays, les pays decoches
   sont cumules dans la ligne Divers, depliable (cf. initRepartitions). */
.repart-actions { display: flex; gap: 4px; flex-wrap: wrap; }
table.repart .check { align-items: center; font-size: inherit; }
table.repart .check input { margin: 0; }
table.repart tr.repart-divers > td {
   background: var(--surface-3);
   font-weight: 650;
   border-top: 1px solid var(--border-strong);
}
.repart-toggle {
   display: inline-flex;
   align-items: center;
   gap: 6px;
   padding: 0;
   font: inherit;
   color: var(--fg);
   background: transparent;
   border: 0;
   cursor: pointer;
}
.repart-toggle::before {
   content: "";
   width: 6px; height: 6px;
   margin: 0 6px 0 5px;
   border: solid currentColor;
   border-width: 0 1.5px 1.5px 0;
   transform: rotate(-45deg);
   transition: transform var(--t-fast);
}
.repart-toggle[aria-expanded="true"]::before { transform: rotate(45deg); }
.repart-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); border-radius: var(--r-sm); }
.repart-count { font-weight: 400; color: var(--fg-muted); }
table.repart tbody.repart-others > tr > td { color: var(--fg-muted); }
table.repart tbody.repart-others > tr > td:first-child { padding-left: 28px; }

.kbd {
   display: inline-block;
   padding: 1px 5px;
   font-family: var(--font-mono);
   font-size: 11px;
   color: var(--fg-muted);
   background: var(--surface-3);
   border: 1px solid var(--border-strong);
   border-bottom-width: 2px;
   border-radius: var(--r-sm);
   line-height: 1.5;
}

/* --------------------------------------------------------------------------
   11. Alertes
   -------------------------------------------------------------------------- */
.alert {
   display: flex;
   align-items: flex-start;
   gap: 11px;
   padding: 12px 14px;
   border: 1px solid var(--border);
   border-radius: var(--r-md);
   background: var(--surface);
   font-size: var(--fs-base);
   line-height: 1.5;
}
.alert-icon { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }
.alert-body { min-width: 0; flex: 1 1 auto; }
.alert-title { font-weight: 640; margin-bottom: 2px; }
.alert-text  { color: inherit; }
.alert-text em { font-style: italic; opacity: .85; display: block; margin-top: 3px; }

.alert-info    { background: var(--info-soft);    border-color: var(--info-border);    color: var(--info); }
.alert-success { background: var(--success-soft); border-color: var(--success-border); color: var(--success); }
.alert-warning { background: var(--warning-soft); border-color: var(--warning-border); color: var(--warning); }
.alert-danger  { background: var(--danger-soft);  border-color: var(--danger-border);  color: var(--danger); }
.alert-neutral { background: var(--surface-2);    border-color: var(--border);         color: var(--fg); }

.alert-lg { padding: 16px 18px; font-size: var(--fs-md); border-radius: var(--r-lg); }
.alert-lg .alert-icon { width: 22px; height: 22px; }

/* Bandeau critique (regles du port, avertissements publics) */
.notice {
   padding: 16px 18px;
   border-radius: var(--r-lg);
   border: 1px solid var(--danger-border);
   background: var(--danger-soft);
   color: var(--danger);
   text-align: center;
   font-size: var(--fs-md);
   font-weight: 600;
   line-height: 1.55;
}
.notice em { display: block; margin-top: 6px; font-weight: 500; font-style: italic; opacity: .9; }
.notice-title {
   display: block;
   margin-bottom: 8px;
   font-size: var(--fs-xs);
   font-weight: 700;
   letter-spacing: .09em;
   text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   12. Etapes (assistant de clairance)
   -------------------------------------------------------------------------- */
/* La zone qui defile. Quand le parcours tient a l'ecran elle ne fait rien ;
   quand il deborde (telephone), app.js la fait suivre le bateau. */
.steps-scroll {
   overflow-x: auto;
   scrollbar-width: none;
   overscroll-behavior-x: contain;
   -webkit-overflow-scrolling: touch;
   margin: 0 -8px 14px;
}
.steps-scroll::-webkit-scrollbar { display: none; }
/* Repere de la mer, du bateau et du quai : tout y est positionne en absolu. */
.steps-wrap {
   position: relative;
   width: max-content;
   min-width: 100%;
}
.steps {
   display: flex;
   align-items: center;
   gap: 0;
   /* overflow-x:auto sur le parent force overflow-y a "auto" : le halo de
      l'etape courante (box-shadow de 4px autour de la pastille) etait rogne
      au ras du bord et le cercle apparaissait carre. On lui reserve la place
      ici ; .steps-scroll rattrape le retrait pour que la premiere pastille
      reste alignee sur le bord des cartes. */
   padding: 8px 8px 10px;
}
/* Le fil d'etapes est pose directement sur le fond de page, pas dans une
   carte : il suit donc le fond de l'ecran courant. Clair par defaut, inverse
   sur la vitrine. */
.step {
   display: flex;
   align-items: center;
   gap: 8px;
   flex-shrink: 0;
   font-size: var(--fs-sm);
   color: var(--fg-subtle);
   font-weight: 550;
}
.step-num {
   width: 26px; height: 26px;
   display: grid; place-items: center;
   border-radius: var(--r-full);
   border: 1.5px solid var(--border-strong);
   background: var(--surface);
   font-size: var(--fs-xs);
   font-weight: 700;
   color: var(--fg-muted);
   flex-shrink: 0;
   /* 350ms, et sur les quatre proprietes nommees : c'est le reglage de la
      maquette. Le raccourci "all var(--t)" faisait deux choses de travers --
      170ms, la pastille claquait au lieu de s'allumer, et "all" laissait
      transiter la geometrie elle-meme, que le bateau lit a chaque image. */
   transition: background .35s ease, border-color .35s ease,
               color .35s ease, box-shadow .35s ease;
}
.step-line {
   /* 46px : l'ecartement de la maquette validee. Le bateau, la houle et la
      duree de traversee y ont ete regles ; le resserrer change le rapport
      entre la longueur d'onde et la longueur du fil. */
   width: 46px;
   height: 2px;
   background: var(--border-strong);
   margin: 0 10px;
   flex-shrink: 0;
   border-radius: var(--r-full);
}
.step.is-done .step-num { background: var(--success); border-color: var(--success); color: #fff; }
.step.is-done { color: var(--fg-muted); }
.step.is-current .step-num {
   background: var(--primary);
   border-color: var(--primary);
   color: #fff;
   box-shadow: 0 0 0 4px var(--primary-ring);
}
.step.is-current { color: var(--fg); font-weight: 660; }
.step-label { white-space: nowrap; }

body.has-photo .step { color: var(--on-veil-subtle); }
body.has-photo .step-num {
   border-color: var(--on-veil-border);
   background: var(--on-veil-fill);
   color: var(--on-veil-muted);
}
body.has-photo .step-line { background: var(--on-veil-border); }
body.has-photo .step.is-done { color: var(--on-veil-muted); }
body.has-photo .step.is-current { color: #fff; }
body.has-photo .step.is-current .step-num {
   border-color: var(--accent-on-veil);
   box-shadow: 0 0 0 4px rgba(140, 192, 240, .26);
}
@media (max-width: 700px) {
   .step-label { display: none; }
   .step.is-current .step-label { display: inline; }
   .step-line { width: 30px; margin: 0 7px; }
}

/* --------------------------------------------------------------------------
   12 bis. Le bateau du fil d'etapes

   Injecte par app.js sur .steps-wrap : sans JavaScript, aucune de ces regles
   ne trouve d'element et le fil reste celui d'au-dessus. Le bateau n'a pas
   d'animation CSS propre -- sa hauteur et sa gite sont calculees image par
   image sur la meme sinusoide que la vague, dans app.js.
   -------------------------------------------------------------------------- */
.steps-wrap.has-sea {
   /* La maquette reserve 52px entre le bas des pastilles et le bas du fil.
      .steps en fournit deja 10 (la place du halo de l'etape courante), d'ou
      42 ici : au total 52, et la mer se retrouve a la meme hauteur sous les
      pastilles que dans la maquette. */
   padding-bottom: 42px;
   /* de quoi loger le quai au-dela de la derniere pastille */
   padding-right: 86px;
}

.steps-sea {
   position: absolute;
   left: 0; right: 0; bottom: 6px;
   height: 30px;
   overflow: hidden;
   pointer-events: none;
   z-index: 1;
   /* Pas de mask-image ici : un masque force le navigateur a re-rasteriser
      toute la bande a chaque image, et la houle se met a saccader. Le motif
      SVG deborde deja du fil et overflow:hidden le coupe net -- c'est ainsi
      dans la maquette validee. */
}
.steps-sea svg {
   position: absolute; top: 0; left: 0; display: block;
   /* Indispensable : la regle generale img, svg { max-width: 100% } du debut
      de cette feuille est ecrite pour les icones, et elle ecrase la largeur
      que app.js donne au trace. Or ce trace deborde volontairement du fil
      d'une longueur d'onde et demie. Ramene a la largeur du fil, le SVG est
      mis a l'echelle : une vague ne mesure plus 68px a l'ecran, alors que le
      defilement, lui, translate bien de 68px avant de revenir a zero -- d'ou
      un saut de la mer a chaque tour. Le trace est aussi recentre en hauteur,
      donc la ligne d'eau dessinee ne tombe plus a 11px et le bateau, calcule
      sur la vraie sinusoide, cesse de suivre l'eau. Enfin la mer remplie vit
      dans .steps-basin dont la largeur change a chaque image : son echelle
      changerait 60 fois par seconde. */
   max-width: none;
   /* Pas de will-change ici. La maquette n'en a nulle part et ne saccade pas.
      Surtout, le trace rempli vit dans .steps-basin, dont app.js reecrit la
      largeur a chaque image : promouvoir une couche dont le cadre de coupe
      bouge 60 fois par seconde fait retravailler l'arbre de couches a chaque
      image, au lieu de laisser passer une simple translation. */
}
/* La part du bassin deja parcourue : meme trace que la mer ouverte, mais
   remplie. Sa largeur suit le bateau. */
.steps-basin {
   position: absolute;
   left: 0; top: 0; bottom: 0;
   width: 0;
   overflow: hidden;
}
.sea-back  { fill: var(--water-deep); }
.sea-body  { fill: var(--water-body); }
.sea-crest { fill: none; stroke: var(--water-line); stroke-width: 2; stroke-linecap: round; }
.sea-open  { fill: none; stroke: var(--water-faint); stroke-width: 2; stroke-linecap: round; }

.steps-boat {
   position: absolute;
   left: 0;
   width: 32px; height: 25px;
   pointer-events: none;
   z-index: 3;
   will-change: transform;
}
.steps-boat > span {
   display: block;
   width: 100%; height: 100%;
   transform-origin: 50% 90%;
   will-change: transform;
}
.steps-boat svg { display: block; width: 100%; height: 100%; overflow: visible; }
.boat-hull { fill: var(--primary); }
.boat-main { fill: var(--surface); stroke: var(--primary); stroke-width: 1.4; stroke-linejoin: round; }
.boat-jib  { fill: var(--sail-shade); }
.boat-mast { stroke: var(--primary); stroke-width: 1.5; stroke-linecap: round; }

/* Sillage lache au moment de l'appareillage. */
.steps-wake {
   position: absolute;
   width: 16px; height: 5px;
   border-radius: 50%;
   border: 1.5px solid var(--water-line);
   opacity: 0;
   pointer-events: none;
   animation: steps-wake 950ms ease-out forwards;
}
@keyframes steps-wake {
   0%   { opacity: .7; transform: scale(.3); }
   100% { opacity: 0;  transform: scale(2); }
}

/* Le quai : en filigrane pendant tout le parcours, net a l'accostage. */
.steps-harbor {
   position: absolute;
   width: 62px; height: 48px;
   opacity: .32;
   transition: opacity .6s ease;
   pointer-events: none;
   z-index: 2;
}
.steps-wrap.is-docked .steps-harbor { opacity: 1; }
.steps-harbor svg { display: block; width: 100%; height: 100%; }
.quay-block { fill: var(--quay); }
.quay-edge  { fill: var(--quay-top); }
.beacon-body  { fill: var(--surface); stroke: var(--quay); stroke-width: 1.4; }
.beacon-band  { fill: var(--beacon); }
.beacon-light { fill: var(--beacon); opacity: 0; }
.steps-wrap.is-docked .beacon-light {
   opacity: 1;
   animation: steps-beacon 2.8s ease-in-out infinite;
}
@keyframes steps-beacon {
   0%, 100%  { opacity: .2; }
   45%, 55%  { opacity: 1; }
}
.steps-dock {
   position: absolute;
   font-size: 10.5px;
   font-weight: 700;
   letter-spacing: .09em;
   text-transform: uppercase;
   color: var(--success);
   background: var(--success-soft);
   border-radius: var(--r-full);
   padding: 3px 9px;
   white-space: nowrap;
   opacity: 0;
   transform: translateY(4px);
   transition: opacity .45s ease .3s, transform .45s ease .3s;
   z-index: 4;
}
.steps-wrap.is-docked .steps-dock { opacity: 1; transform: translateY(0); }

/* Sur la vitrine, la mer se pose sur la photo du port. */
body.has-photo .sea-crest { stroke: rgba(255, 255, 255, .8); }
body.has-photo .sea-open  { stroke: rgba(255, 255, 255, .38); }
body.has-photo .sea-body  { fill: rgba(255, 255, 255, .16); }
body.has-photo .sea-back  { fill: rgba(255, 255, 255, .09); }
body.has-photo .boat-hull { fill: #fff; }
body.has-photo .boat-main { fill: #fff; stroke: var(--primary); }
body.has-photo .boat-jib  { fill: rgba(255, 255, 255, .62); }
body.has-photo .boat-mast { stroke: #fff; }

/* Le phare clignote en boucle : coupe pour qui demande moins d'animation.
   La traversee et la houle sont coupees dans app.js. */
@media (prefers-reduced-motion: reduce) {
   .steps-wrap.is-docked .beacon-light { animation: none; }
   .steps-wake { display: none; }
}

/* --------------------------------------------------------------------------
   13. Boite de dialogue
   -------------------------------------------------------------------------- */
.ui-overlay {
   position: fixed;
   inset: 0;
   z-index: 900;
   display: flex;
   align-items: center;
   justify-content: center;
   padding: 20px;
   background: rgba(4, 10, 20, .62);
   backdrop-filter: blur(2px);
   -webkit-backdrop-filter: blur(2px);
   opacity: 0;
   animation: ui-fade-in var(--t) forwards;
   overflow-y: auto;
}
.ui-overlay.is-closing { animation: ui-fade-out var(--t-fast) forwards; }

.ui-dialog {
   width: 100%;
   max-width: 460px;
   margin: auto;
   background: var(--surface);
   border-radius: var(--r-xl);
   box-shadow: var(--sh-lg);
   overflow: hidden;
   transform: scale(.96) translateY(6px);
   opacity: 0;
   animation: ui-pop-in var(--t-slow) forwards;
}
.ui-overlay.is-closing .ui-dialog { animation: ui-pop-out var(--t-fast) forwards; }
.ui-dialog.is-md { max-width: 580px; }
.ui-dialog.is-lg { max-width: 760px; }

.ui-dialog-head {
   display: flex;
   align-items: flex-start;
   gap: 12px;
   padding: 18px 20px 0;
}
.ui-dialog-icon {
   width: 38px; height: 38px;
   flex-shrink: 0;
   display: grid; place-items: center;
   border-radius: var(--r-full);
   background: var(--primary-soft);
   color: var(--primary);
}
.ui-dialog-icon svg { width: 20px; height: 20px; }
.ui-dialog-icon.is-danger  { background: var(--danger-soft);  color: var(--danger); }
.ui-dialog-icon.is-warning { background: var(--warning-soft); color: var(--warning); }
.ui-dialog-icon.is-success { background: var(--success-soft); color: var(--success); }

.ui-dialog-title {
   font-size: var(--fs-md);
   font-weight: 650;
   letter-spacing: -.01em;
   padding-top: 8px;
}
.ui-dialog-body {
   padding: 12px 20px 4px;
   font-size: var(--fs-base);
   color: var(--fg-muted);
   line-height: 1.55;
   max-height: 62vh;
   overflow-y: auto;
}
.ui-dialog-head + .ui-dialog-body { padding-left: 70px; }
.ui-dialog-body em { display: block; margin-top: 4px; font-style: italic; opacity: .9; }
.ui-dialog-body .field { margin-bottom: 12px; }
.ui-dialog-foot {
   display: flex;
   align-items: center;
   justify-content: flex-end;
   gap: 8px;
   padding: 16px 20px 18px;
   flex-wrap: wrap;
}
.ui-dialog-foot .btn { min-width: 92px; }

@keyframes ui-fade-in  { to { opacity: 1; } }
@keyframes ui-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes ui-pop-in   { to { transform: scale(1) translateY(0); opacity: 1; } }
@keyframes ui-pop-out  { from { transform: scale(1); opacity: 1; } to { transform: scale(.97); opacity: 0; } }

/* --------------------------------------------------------------------------
   14. Notifications (toasts)
   -------------------------------------------------------------------------- */
.ui-toasts {
   position: fixed;
   right: 16px;
   bottom: 16px;
   z-index: 950;
   display: flex;
   flex-direction: column;
   gap: 8px;
   max-width: min(380px, calc(100vw - 32px));
   pointer-events: none;
}
.ui-toast {
   display: flex;
   align-items: flex-start;
   gap: 10px;
   padding: 11px 13px;
   background: var(--surface);
   border: 1px solid var(--border);
   border-left: 3px solid var(--primary);
   border-radius: var(--r-md);
   box-shadow: var(--sh-md);
   font-size: var(--fs-sm);
   pointer-events: auto;
   transform: translateX(12px);
   opacity: 0;
   animation: ui-toast-in var(--t-slow) forwards;
}
.ui-toast.is-closing { animation: ui-toast-out var(--t-fast) forwards; }
.ui-toast.is-success { border-left-color: var(--success); }
.ui-toast.is-danger  { border-left-color: var(--danger); }
.ui-toast.is-warning { border-left-color: var(--warning); }
.ui-toast-icon { flex-shrink: 0; width: 16px; height: 16px; margin-top: 1px; color: var(--primary); }
.ui-toast.is-success .ui-toast-icon { color: var(--success); }
.ui-toast.is-danger  .ui-toast-icon { color: var(--danger); }
.ui-toast.is-warning .ui-toast-icon { color: var(--warning); }
.ui-toast-body { flex: 1 1 auto; min-width: 0; line-height: 1.45; }
.ui-toast-close {
   flex-shrink: 0;
   width: 20px; height: 20px;
   display: grid; place-items: center;
   border: 0;
   background: transparent;
   color: var(--fg-subtle);
   border-radius: var(--r-sm);
   cursor: pointer;
   font-size: 15px;
   line-height: 1;
   transition: background var(--t-fast), color var(--t-fast);
}
.ui-toast-close:hover { background: var(--surface-3); color: var(--fg); }

@keyframes ui-toast-in  { to { transform: translateX(0); opacity: 1; } }
@keyframes ui-toast-out { to { transform: translateX(12px); opacity: 0; } }

/* --------------------------------------------------------------------------
   15. Combobox / suggestions
   -------------------------------------------------------------------------- */
.ui-suggest {
   position: absolute;
   z-index: 800;
   min-width: 200px;
   max-height: 300px;
   overflow-y: auto;
   padding: 4px;
   background: var(--surface);
   border: 1px solid var(--border);
   border-radius: var(--r-md);
   box-shadow: var(--sh-md);
   font-size: var(--fs-sm);
   animation: ui-suggest-in var(--t-fast) forwards;
}
@keyframes ui-suggest-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

.ui-suggest-item {
   display: block;
   width: 100%;
   padding: 7px 10px;
   border: 0;
   border-radius: var(--r-sm);
   background: transparent;
   text-align: left;
   font-family: inherit;
   font-size: var(--fs-sm);
   color: var(--fg);
   cursor: pointer;
   line-height: 1.4;
   transition: background var(--t-fast);
}
.ui-suggest-item:hover,
.ui-suggest-item.is-active { background: var(--primary-soft); color: var(--primary-soft-fg); text-decoration: none; }
.ui-suggest-item small { display: block; color: var(--fg-subtle); font-size: var(--fs-xs); }
.ui-suggest-item.is-active small { color: var(--primary-soft-fg); opacity: .8; }
.ui-suggest-empty { padding: 10px; color: var(--fg-subtle); text-align: center; font-size: var(--fs-sm); }

/* Zone de suggestions historique (divs #navire_search, #search_nom_pass_N) */
.suggest-anchor { position: relative; }
/* "top: 100%" n'est pas decoratif, il est indispensable. .field est une boite
   flex en colonne, et la position statique d'un enfant absolu dans une boite
   flex n'est pas l'endroit ou il se trouvait dans le flux : la specification
   le renvoie au coin de depart du conteneur. Sans "top", la liste des navires
   remontait donc se poser sur le label et sur le champ de saisie au lieu de
   pendre en dessous. On ancre explicitement sous le champ. */
[id^="navire_search"]:not(:empty),
[id^="search_nom_pass_"]:not(:empty) {
   position: absolute;
   z-index: 800;
   top: 100%;
   left: 0;
   right: 0;
   margin-top: 4px;
   padding: 4px;
   background: var(--surface);
   border: 1px solid var(--border) !important;
   border-radius: var(--r-md);
   box-shadow: var(--sh-md);
   max-height: 280px;
   overflow-y: auto;
   text-align: left;
   font-size: var(--fs-sm);
}
[id^="navire_search"] a,
[id^="search_nom_pass_"] a {
   display: block;
   padding: 7px 10px;
   border-radius: var(--r-sm);
   color: var(--fg);
   font-weight: 500;
}
[id^="navire_search"] a:hover,
[id^="search_nom_pass_"] a:hover { background: var(--primary-soft); color: var(--primary-soft-fg); text-decoration: none; }
[id^="navire_search"] br,
[id^="search_nom_pass_"] br { display: none; }

/* La card coupe ce qui depasse d'elle (overflow: hidden, pour que l'entete et
   le pied ne debordent pas des angles arrondis). Une liste de suggestions,
   elle, a le droit de pendre plus bas que la card qui la contient : sinon la
   moitie des navires trouves est tranchee net au ras du pied de page. On rend
   donc le debordement visible aux seules cards qui portent une zone de
   suggestions, et on redonne a la main les angles que le rognage assurait. */
.card:has(.suggest-anchor) { overflow: visible; }
.card:has(.suggest-anchor) > .card-header { border-radius: var(--r-lg) var(--r-lg) 0 0; }
.card:has(.suggest-anchor) > .card-footer { border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* --------------------------------------------------------------------------
   16. Calendrier
   -------------------------------------------------------------------------- */
.ui-cal {
   position: absolute;
   z-index: 860;
   width: 268px;
   padding: 10px;
   background: var(--surface);
   border: 1px solid var(--border);
   border-radius: var(--r-lg);
   box-shadow: var(--sh-md);
   font-size: var(--fs-sm);
   animation: ui-suggest-in var(--t-fast) forwards;
   user-select: none;
}
.ui-cal-head {
   display: flex;
   align-items: center;
   gap: 6px;
   margin-bottom: 8px;
}
.ui-cal-nav {
   width: 28px; height: 28px;
   display: grid; place-items: center;
   border: 1px solid var(--border);
   background: var(--surface);
   border-radius: var(--r-sm);
   cursor: pointer;
   color: var(--fg-muted);
   font-size: 13px;
   line-height: 1;
   transition: background var(--t-fast), color var(--t-fast);
   flex-shrink: 0;
}
.ui-cal-nav:hover { background: var(--surface-3); color: var(--fg); }
.ui-cal-selects { display: flex; gap: 5px; flex: 1 1 auto; min-width: 0; }
.ui-cal-selects select {
   flex: 1 1 auto;
   min-width: 0;
   height: 28px;
   padding: 0 6px;
   font-family: inherit;
   font-size: var(--fs-sm);
   font-weight: 600;
   color: var(--fg);
   background: var(--surface);
   border: 1px solid var(--border);
   border-radius: var(--r-sm);
   cursor: pointer;
}
.ui-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.ui-cal-dow {
   text-align: center;
   font-size: 10.5px;
   font-weight: 700;
   letter-spacing: .04em;
   text-transform: uppercase;
   color: var(--fg-subtle);
   padding: 4px 0;
}
.ui-cal-day {
   height: 32px;
   border: 0;
   background: transparent;
   border-radius: var(--r-sm);
   font-family: inherit;
   font-size: var(--fs-sm);
   font-weight: 500;
   color: var(--fg);
   cursor: pointer;
   transition: background var(--t-fast), color var(--t-fast);
}
.ui-cal-day:hover:not(:disabled) { background: var(--surface-3); }
.ui-cal-day.is-out { color: var(--fg-subtle); opacity: .55; }
.ui-cal-day.is-today { box-shadow: inset 0 0 0 1.5px var(--border-strong); font-weight: 700; }
.ui-cal-day.is-selected { background: var(--primary); color: #fff; font-weight: 650; }
.ui-cal-day.is-selected:hover { background: var(--primary-hover); }
.ui-cal-foot {
   display: flex;
   gap: 6px;
   margin-top: 8px;
   padding-top: 8px;
   border-top: 1px solid var(--border);
}
.ui-cal-foot .btn { flex: 1 1 0; }

/* Bouton calendrier attache a un champ date.
   Le champ reserve 36 px a droite pour le bouton : en dessous de ~130 px, le
   masque "JJ/MM/AAAA" passe dessous. On l'empeche de descendre plus bas. */
.date-field { position: relative; min-width: 130px; }
.date-field .input { padding-right: 36px; cursor: pointer; }
.date-btn {
   position: absolute;
   right: 4px;
   top: 50%;
   transform: translateY(-50%);
   width: 28px; height: 28px;
   display: grid; place-items: center;
   border: 0;
   background: transparent;
   border-radius: var(--r-sm);
   color: var(--fg-subtle);
   cursor: pointer;
   transition: background var(--t-fast), color var(--t-fast);
}
.date-btn:hover { background: var(--surface-3); color: var(--primary); }
.date-btn svg { width: 15px; height: 15px; }

/* Champ mot de passe avec oeil afficher / masquer */
.pass-field { position: relative; display: block; min-width: 0; }
.pass-field input.input { width: 100%; padding-right: 38px; }
.pass-btn {
   position: absolute;
   right: 4px;
   top: 50%;
   transform: translateY(-50%);
   width: 30px; height: 30px;
   display: grid; place-items: center;
   border: 0;
   background: transparent;
   border-radius: var(--r-sm);
   color: var(--fg-subtle);
   cursor: pointer;
   transition: background var(--t-fast), color var(--t-fast);
}
.pass-btn:hover { background: var(--surface-3); color: var(--primary); }
.pass-btn[aria-pressed="true"] { color: var(--primary); }
.pass-btn svg { width: 17px; height: 17px; }

/* Champ heure */
.time-field { display: flex; align-items: center; gap: 5px; }
.time-field .select-wrap { flex: 1 1 0; min-width: 0; }
.time-sep { color: var(--fg-subtle); font-weight: 700; }

/* --------------------------------------------------------------------------
   17. Recherche rapide (palette Ctrl+K)
   -------------------------------------------------------------------------- */
.ui-palette {
   width: 100%;
   max-width: 560px;
   margin: 8vh auto auto;
   background: var(--surface);
   border-radius: var(--r-xl);
   box-shadow: var(--sh-lg);
   overflow: hidden;
   transform: scale(.97) translateY(-6px);
   opacity: 0;
   animation: ui-pop-in var(--t-slow) forwards;
}
.ui-palette-input {
   width: 100%;
   height: 50px;
   padding: 0 18px;
   border: 0;
   border-bottom: 1px solid var(--border);
   font-family: inherit;
   font-size: var(--fs-md);
   color: var(--fg);
   background: transparent;
}
.ui-palette-input:focus { outline: none; }
.ui-palette-list { max-height: 340px; overflow-y: auto; padding: 6px; }
.ui-palette-item {
   display: flex;
   align-items: center;
   justify-content: space-between;
   gap: 10px;
   width: 100%;
   padding: 9px 12px;
   border: 0;
   border-radius: var(--r);
   background: transparent;
   font-family: inherit;
   font-size: var(--fs-base);
   color: var(--fg);
   text-align: left;
   cursor: pointer;
}
.ui-palette-item:hover,
.ui-palette-item.is-active { background: var(--primary-soft); color: var(--primary-soft-fg); text-decoration: none; }
.ui-palette-item small { color: var(--fg-subtle); font-size: var(--fs-xs); }
.ui-palette-foot {
   display: flex;
   align-items: center;
   gap: 12px;
   padding: 8px 14px;
   border-top: 1px solid var(--border);
   background: var(--surface-2);
   font-size: var(--fs-xs);
   color: var(--fg-subtle);
}

.search-trigger {
   display: none;
   align-items: center;
   gap: 8px;
   height: 32px;
   padding: 0 10px;
   border: 1px solid var(--on-veil-border);
   border-radius: var(--r);
   background: var(--on-veil-fill);
   color: var(--on-veil-subtle);
   font-family: inherit;
   font-size: var(--fs-sm);
   cursor: pointer;
   transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.search-trigger:hover {
   background: var(--on-veil-hover);
   border-color: rgba(255, 255, 255, .28);
   color: var(--on-veil);
}
/* La touche Ctrl K affichee dans l'en-tete est sur fond sombre, pas sur une
   surface claire comme dans le reste de l'application. */
.app-header .kbd {
   color: var(--on-veil-muted);
   background: rgba(255, 255, 255, .10);
   border-color: var(--on-veil-border);
}
@media (min-width: 1000px) { .search-trigger { display: inline-flex; } }

/* --------------------------------------------------------------------------
   18. Divers
   -------------------------------------------------------------------------- */
.spinner {
   width: 15px; height: 15px;
   border: 2px solid currentColor;
   border-right-color: transparent;
   border-radius: var(--r-full);
   animation: ui-spin .6s linear infinite;
   display: inline-block;
}
@keyframes ui-spin { to { transform: rotate(360deg); } }

.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
   content: "";
   position: absolute;
   width: 15px; height: 15px;
   border: 2px solid rgba(255, 255, 255, .55);
   border-right-color: transparent;
   border-radius: var(--r-full);
   animation: ui-spin .6s linear infinite;
}
.btn-secondary.is-loading::after,
.btn-ghost.is-loading::after { border-color: rgba(16, 24, 40, .35); border-right-color: transparent; }

.sr-only {
   position: absolute;
   width: 1px; height: 1px;
   padding: 0; margin: -1px;
   overflow: hidden;
   clip: rect(0, 0, 0, 0);
   white-space: nowrap;
   border: 0;
}

/* Bandeau de titre. Sur fond clair c'est un panneau bleu nuit franc, seul
   aplat sombre de l'ecran, avec une arete haute lumineuse pour le relief. Sur
   la vitrine il redevient un panneau de verre, sans quoi il percerait la
   photo. */
.hero {
   position: relative;
   overflow: hidden;
   padding: 36px 26px 34px;
   border-radius: var(--r-xl);
   background: linear-gradient(155deg, #1b3859 0, #0e2138 55%, #0b1a2c 100%);
   border: 1px solid rgba(255, 255, 255, .10);
   color: #fff;
   text-align: center;
   box-shadow: var(--sh), inset 0 1px 0 rgba(255, 255, 255, .16);
}
body.has-photo .hero {
   background: linear-gradient(160deg, rgba(26, 47, 76, .58), rgba(8, 15, 26, .44));
   border-color: var(--on-veil-border);
   -webkit-backdrop-filter: saturate(120%) blur(12px);
   backdrop-filter: saturate(120%) blur(12px);
   box-shadow: var(--sh), inset 0 1px 0 rgba(255, 255, 255, .13);
}
/* Halo froid en haut a gauche, tres retenu : le bandeau respire sans briller. */
.hero::after {
   content: "";
   position: absolute;
   inset: 0;
   pointer-events: none;
   background: radial-gradient(115% 150% at 15% -20%, rgba(140, 192, 240, .17), rgba(140, 192, 240, 0) 62%);
}
.hero > * { position: relative; z-index: 1; }
/* Bandeau illustre (.has-cover) : la photo du type de clairance occupe tout
   le bandeau, le titre se pose en bas sur un degrade sombre qui le garde
   lisible quelle que soit l'image. */
.hero.has-cover,
body.has-photo .hero.has-cover {
   min-height: 230px;
   display: flex;
   flex-direction: column;
   justify-content: flex-end;
   background: #0b1a2c;
   -webkit-backdrop-filter: none;
   backdrop-filter: none;
}
.hero > .hero-cover {
   position: absolute;
   inset: 0;
   z-index: 0;
   background-position: center;
   background-size: cover;
   background-repeat: no-repeat;
}
.hero > .hero-cover::after {
   content: "";
   position: absolute;
   inset: 0;
   background: linear-gradient(180deg, rgba(8, 15, 26, .05) 15%, rgba(8, 15, 26, .55) 55%, rgba(8, 15, 26, .88) 100%);
}
.hero.has-cover::after { display: none; }
.hero.has-cover .hero-title { text-shadow: 0 1px 3px rgba(0, 0, 0, .6), 0 0 22px rgba(0, 0, 0, .45); }
.hero-eyebrow {
   font-size: var(--fs-xs);
   font-weight: 700;
   letter-spacing: .16em;
   text-transform: uppercase;
   color: var(--accent-on-veil);
   margin-bottom: 12px;
}
.hero-title {
   font-size: var(--fs-2xl);
   font-weight: 700;
   letter-spacing: -.025em;
   line-height: 1.2;
   text-shadow: 0 1px 3px rgba(0, 0, 0, .38);
}
.hero-sub {
   margin-top: 7px;
   font-size: var(--fs-md);
   font-style: italic;
   color: rgba(255, 255, 255, .78);
}

.photo-grid {
   display: grid;
   grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
   gap: 12px;
}
.photo-grid img {
   width: 100%;
   height: auto;
   border-radius: var(--r-lg);
   border: 1px solid var(--border);
   display: block;
}

.legal { font-size: var(--fs-base); color: var(--muted, var(--fg-muted)); line-height: 1.65; }
.legal p + p { margin-top: 12px; }

.divider-label {
   display: flex;
   align-items: center;
   gap: 12px;
   font-size: var(--fs-xs);
   font-weight: 700;
   letter-spacing: .07em;
   text-transform: uppercase;
   color: var(--subtle, var(--fg-subtle));
   margin: 4px 0;
}
.divider-label::before,
.divider-label::after {
   content: "";
   flex: 1 1 auto;
   height: 1px;
   background: currentColor;
   opacity: .3;
}

/* Titre de la question posee a l'accueil. Il se detache sur la photo du port :
   texte clair et ombre portee sombre pour rester lisible quelle que soit la
   zone de l'image derriere. */
.choice-head { text-align: center; }
.choice-head-fr {
   font-size: var(--fs-xl);
   font-weight: 700;
   color: var(--ink, var(--fg));
   letter-spacing: -.015em;
   line-height: 1.25;
}
.choice-head-en {
   margin-top: 3px;
   font-size: var(--fs-md);
   font-style: italic;
   color: var(--muted, var(--fg-muted));
}
/* Sur la photo, le titre a besoin d'une ombre portee pour rester lisible quelle
   que soit la zone de l'image derriere. */
body.has-photo .choice-head-fr {
   color: #fff;
   text-shadow: 0 1px 2px rgba(0, 0, 0, .55), 0 0 24px rgba(0, 0, 0, .45);
}
body.has-photo .choice-head-en {
   text-shadow: 0 1px 2px rgba(0, 0, 0, .55), 0 0 18px rgba(0, 0, 0, .45);
}
.choice-head-rule {
   width: 54px;
   height: 3px;
   margin: 12px auto 0;
   border-radius: var(--r-full);
   background: var(--primary);
   opacity: .9;
}
body.has-photo .choice-head-rule { background: var(--accent-on-veil); }

/* Deux colonnes entrees/sorties */
.split-2 {
   display: grid;
   grid-template-columns: 1fr 1fr;
   gap: 18px;
}
@media (max-width: 900px) { .split-2 { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------------------
   19. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 860px) {
   .form-grid { --cols: 1 !important; }
   .app-main { padding: 16px 12px 44px; }
   .card-body { padding: 14px; }
   .card-header, .card-footer { padding: 11px 14px; }
   .page-title { font-size: var(--fs-lg); }
   .hero { padding: 22px 16px; }
   .hero-title { font-size: var(--fs-xl); }
}

@media (max-width: 780px) {
   .nav-toggle { display: inline-flex; }
   .app-nav {
      position: fixed;
      top: var(--header-h);
      left: 0;
      right: auto;
      bottom: 0;
      width: min(320px, 86vw);
      z-index: 80;
      background: var(--surface);
      -webkit-backdrop-filter: none;
      backdrop-filter: none;
      border-bottom: 0;
      border-right: 1px solid var(--border);
      overflow-y: auto;
      transform: translateX(-100%);
      transition: transform var(--t-slow);
      box-shadow: var(--sh-lg);
   }
   .app-nav.is-open { transform: translateX(0); }
   /* Le tiroir mobile est un panneau clair, pas du chrome pose sur le voile :
      les entrees y reprennent les couleurs de texte normales. */
   .app-nav .nav-link { color: var(--fg-muted); }
   .app-nav .nav-link:hover { color: var(--fg); background: var(--surface-3); }
   .app-nav-inner {
      flex-direction: column;
      flex-wrap: nowrap;
      align-items: stretch;
      padding: 10px;
      gap: 2px;
      overflow: visible;
   }
   .nav-item { flex-direction: column; align-items: stretch; }
   .nav-link {
      height: auto;
      padding: 11px 12px;
      font-size: var(--fs-md);
      border-bottom: 0;
      border-radius: var(--r);
      justify-content: space-between;
   }
   .nav-item.is-active > .nav-link { background: var(--primary-soft); color: var(--primary-soft-fg); }
   /* Sur les ecrans a photo, le voile sombre traverse aussi le tiroir : les
      entrees non selectionnees y reprennent le clair du bandeau desktop,
      sinon elles restent en gris fonce sur fond fonce. L'entree active garde
      sa pastille claire. */
   body.has-photo .app-nav .nav-link { color: var(--on-veil-muted); }
   body.has-photo .app-nav .nav-link:hover {
      color: #fff;
      background: var(--on-veil-hover);
   }
   body.has-photo .app-nav .nav-item.is-active > .nav-link {
      background: var(--primary-soft);
      color: var(--primary-soft-fg);
   }
   .nav-menu {
      position: static;
      opacity: 1;
      visibility: visible;
      transform: none;
      box-shadow: none;
      border: 0;
      border-left: 2px solid var(--border);
      border-radius: 0;
      margin: 0 0 4px 14px;
      padding: 2px 0 2px 6px;
      display: none;
      min-width: 0;
   }
   .nav-item.is-open > .nav-menu,
   .nav-sub.is-open > .nav-menu { display: block; }
   .nav-item:hover > .nav-menu,
   .nav-sub:hover > .nav-menu { display: none; }
   .nav-item.is-open:hover > .nav-menu,
   .nav-sub.is-open:hover > .nav-menu { display: block; }
   .nav-sub > .nav-menu { left: auto; top: auto; }
   .nav-menu a { padding: 9px 10px; font-size: var(--fs-base); }
   .app-nav-scrim {
      position: fixed;
      inset: var(--header-h) 0 0;
      z-index: 75;
      background: rgba(4, 10, 20, .58);
      opacity: 0;
      animation: ui-fade-in var(--t) forwards;
   }
   body.nav-open { overflow: hidden; }
}

/* Confort tactile. Deux points, tous deux invisibles au bureau et penibles au
   quotidien sur le terrain :
   - un champ dont le texte fait moins de 16 px declenche un zoom automatique
     de Safari iOS a chaque prise de focus, et il faut ensuite depincer pour
     revenir. Toute la saisie de clairance passe par la ;
   - une cible de 36 px de haut est en dessous du seuil confortable au doigt.
     On passe tout ce qui se touche a 44 px. */
@media (max-width: 780px) {
   .input,
   input[type="text"].input,
   input[type="password"].input,
   input[type="email"].input,
   input[type="number"].input,
   input[type="search"].input,
   input[type="tel"].input,
   select.input { height: 44px; font-size: 16px; }
   textarea.input { font-size: 16px; }
   .input-sm { height: 38px; font-size: 15px; }
   .input-lg { height: 50px; }

   /* Meme raison que plus haut : une seule classe, sinon .btn-icon et .btn-sm
      ne peuvent plus rien redefinir sur un <button>. */
   .btn { height: 44px; padding: 0 18px; font-size: var(--fs-base); }
   .btn-sm { height: 38px; padding: 0 13px; font-size: var(--fs-sm); }
   .btn-lg { height: 52px; }
   .btn-icon { width: 44px; padding: 0; }
   .btn-icon.btn-sm { width: 38px; }

   .check input[type="checkbox"],
   .check input[type="radio"],
   input.check-box,
   input.check-radio { width: 22px; height: 22px; }
   .check input[type="checkbox"]:checked::after,
   input.check-box:checked::after { left: 7px; top: 3px; width: 5px; height: 11px; }
   .check-list { gap: 14px; }

   /* Le tableau de saisie garde des champs a la bonne taille, sinon la ligne
      devient plus haute que l'ecran. */
   table.table-form .input { height: 40px; font-size: 16px; }
   table.table-form th,
   table.table-form td { padding: 8px 8px; }

   .app-nav .nav-link { padding: 12px 12px; }
   .nav-menu a { padding: 11px 10px; }
}

@media (max-width: 620px) {
   :root { --fs-base: 15px; --fs-sm: 13.5px; --fs-xs: 12px; }
   .app-brand-sub { display: none; }
   .app-header-meta { gap: 8px; }
   .app-user span:not(.app-user-avatar) { display: none; }
   .app-user { padding: 3px; border: 0; background: transparent; }
   .ui-toasts { left: 12px; right: 12px; bottom: 12px; max-width: none; }
   .form-actions .btn { flex: 1 1 auto; }
   .card-footer .btn { flex: 1 1 auto; }

   /* Tableaux en mode fiches */
   table.table.is-stacked thead { display: none; }
   table.table.is-stacked,
   table.table.is-stacked tbody,
   table.table.is-stacked tr,
   table.table.is-stacked td { display: block; width: 100%; }
   table.table.is-stacked tr {
      border: 1px solid var(--border);
      border-radius: var(--r-md);
      margin-bottom: 8px;
      background: var(--surface);
      overflow: hidden;
   }
   table.table.is-stacked td {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 8px 12px;
      text-align: right;
      border-bottom: 1px solid var(--border);
   }
   table.table.is-stacked td:last-child { border-bottom: 0; }
   table.table.is-stacked td::before {
      content: attr(data-label);
      flex-shrink: 0;
      font-size: var(--fs-xs);
      font-weight: 700;
      letter-spacing: .03em;
      text-transform: uppercase;
      color: var(--fg-muted);
      text-align: left;
   }
   table.table.is-stacked td:empty { display: none; }

   /* En mode fiches, chaque ligne est deja une carte : la zebrure ferait
      croire a deux natures de fiches differentes. */
   table.table.is-stacked tbody tr:nth-of-type(even) > td,
   table.table.is-stacked tbody tr:hover > td { background: transparent; }

   /* La ligne de rupture (un mois, une categorie) redevient un intitule de
      groupe pleine largeur, aligne a gauche comme un titre. */
   table.table.is-stacked tr.row-sep {
      border: 0;
      border-radius: 0;
      background: transparent;
      margin: 14px 0 6px;
   }
   table.table.is-stacked tr.row-sep > td {
      display: block;
      text-align: left;
      padding: 0 2px;
      border: 0;
      background: transparent;
   }
   table.table.is-stacked tr.row-sep > td::before { content: none; }

   /* Les actions passent en pied de fiche, sur toute la largeur : le doigt
      trouve un bouton pleine cible plutot qu'un bouton perdu a droite. */
   table.table.is-stacked td.actions {
      justify-content: stretch;
      gap: 8px;
      background: var(--surface-2);
      padding: 10px 12px;
   }
   table.table.is-stacked td.actions::before { content: none; }
   table.table.is-stacked td.actions .btn { flex: 1 1 auto; margin-left: 0; }

   /* Le total de la liste se lit comme un total, pas comme une fiche de plus. */
   table.table.is-stacked tr.row-total {
      border-color: var(--border-strong);
      background: var(--surface-3);
   }
}

/* --------------------------------------------------------------------------
   20. Impression
   -------------------------------------------------------------------------- */
@media print {
   .app-header, .app-nav, .app-footer, .page-actions,
   .btn, .form-actions, .ui-toasts, .nav-toggle, .repart-actions { display: none !important; }
   table.repart .check input { display: none; }
   /* Le voile sombre disparait a l'impression : le texte doit redevenir noir,
      sinon les libelles clairs sortent blancs sur blanc. */
   body { background: #fff; color: #000; }
   body::before, body::after { display: none !important; }
   .app-main { padding: 0; color: #000; }
   .card { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
   table.table thead th { position: static; }
}

/* Respect des preferences de mouvement */
@media (prefers-reduced-motion: reduce) {
   *, *::before, *::after {
      animation-duration: .01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: .01ms !important;
   }
}
