/* ============================================
   ProdOrder - Style principal
   Les règles et jetons IXIDIA (docs/ixidia/regles-interface.md, jetons.md), aux
   couleurs et au logo de SoundMark (docs/ixidia/charte-soundmark.md).
   Barre latérale blanche, titres en Plus Jakarta Sans, cartes arrondies,
   badges en pastilles. L'indigo porte le logo ET les actions (choix
   du 28/10/2026) ; l'encre et les gris sont communs à la famille IXIDIA.
   ============================================ */

/* --- Polices (servies par l'appli, pas d'appel à un tiers) --- */
/* Graisses de docs/ixidia/jetons.md (Typographie), fichiers @fontsource :
   Inter 400, 500, 600, 700 ; Plus Jakarta Sans 700 et 800 (titres). */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("../fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/inter-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/plus-jakarta-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 800; font-display: swap;
  src: url("../fonts/plus-jakarta-sans-latin-800-normal.woff2") format("woff2"); }

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Indigo SoundMark. #fff dessus = 6,0:1 : il porte du texte blanc sans
       variante assombrie. --brand (décoratif) et --brand-ink (porteur de
       texte) ont donc la même valeur ; on garde les deux noms. */
    --indigo-50: #F3F1FE;     /* rubrique active, fond très léger */
    --indigo-100: #E7E4FD;
    --indigo-500: #5B4BDB;    /* logo, boutons, liens */
    --indigo-700: #4536B8;    /* survol, texte sur indigo-50 (7,6:1) */
    --brand: var(--indigo-500);
    --brand-ink: var(--indigo-500);      /* fond des boutons : le même en clair et en sombre */
    --brand-ink-hover: #4536B8;
    --link: var(--indigo-500);           /* liens et textes d'action ; plus clair en sombre */
    --brand-word: var(--indigo-500);     /* « Sound » du nom de marque */
    --avatar: #12313B;                   /* rond d'initiales */
    --neutre: #4F6268;                   /* état sans enjeu, filtres inactifs */
    --brand-ring: rgba(91, 75, 219, 0.5);   /* anneau de focus : 3 px à 50 % (jetons.md) */
    --brand-ring-soft: rgba(91, 75, 219, 0.3); /* recherche */
    --brand-tint: var(--indigo-50);

    /* Encre et gris : communs à la famille IXIDIA (jetons.md). */
    --ink: #12313B;
    --gris-50: #F6F8F9;       /* fond de page */
    --gris-100: #EDF1F3;      /* fonds secondaires, filets de ligne */
    --gris-200: #DCE3E6;      /* bordures de carte */
    --gris-300: #C3CDD2;      /* bordures de champ */
    --gris-400: #94A3A9;      /* décor uniquement (chevrons) */
    --gris-500: #5B6B71;      /* texte secondaire, 5,5:1 sur blanc */
    --gris-700: #2E434A;

    /* États (jetons.md) */
    --success: #15803D;
    --success-bg: #DCFCE7;
    --warning: #B45309;
    --warning-bg: #FEF3C7;
    --warning-text: #92400E;
    --danger: #B91C1C;
    --danger-bg: #FEE2E2;
    --danger-text: #7F1D1D;
    /* Info : la teinte de la famille (jetons.md) */
    --info: var(--indigo-700);
    --info-bg: var(--indigo-50);

    /* Noms historiques, conservés : tout le code (et app.js) s'en sert. */
    --bg-main: var(--gris-50);
    --bg-white: #ffffff;
    --bg-hover: var(--gris-50);
    --text-dark: var(--ink);
    --text-muted: var(--gris-500);
    --border-color: var(--gris-200);

    --sidebar-width: 232px;
    --sidebar-rail: 72px;      /* barre réduite aux icônes (tablette) */
    --tabbar-height: 49px;     /* barre d'onglets du téléphone (règles §3) */
    --env-banner-height: 0px;  /* passe à 20px en recette */

    --radius-sm: 6px;
    --radius: 10px;            /* boutons, champs, rubriques */
    --radius-lg: 14px;         /* cartes, tableaux, modales */

    --font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                   "Helvetica Neue", Arial, sans-serif;
    --font-title: "Plus Jakarta Sans", var(--font-family);
    --font-size: 14px;

    /* Échelle typographique : six pas, aucun entre-deux (14 px
       de base, titres de page à 28 px). */
    --fs-1: 12px;   /* surtitre en capitales, méta serrée */
    --fs-2: 13px;   /* secondaire, dates, boutons compacts */
    --fs-3: 14px;   /* corps, tableaux, navigation */
    --fs-4: 16px;   /* titre de modale, de carte */
    --fs-5: 19px;   /* nom de marque, icônes */
    --fs-6: 28px;   /* titre de page, chiffre de statistique */

    /* Couleurs d'étape (Kanban, grands chiffres, points). L'état
       « en validation » quitte le violet, trop proche de l'indigo de marque. */
    --badge-draft: #4F6268;
    --badge-submitted: #1E40AF;
    --badge-production: #B45309;
    --badge-review: #A2367C;
    --badge-revision: #A16207;
    --badge-delivered: #15803D;
    --badge-scheduled: #0F766E;
    --badge-cancelled: #B91C1C;
}

html, body {
    min-height: 100%;
    font-family: var(--font-family);
    font-size: var(--font-size);
    line-height: 1.5;
    color: var(--text-dark);
    background: var(--bg-main);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: var(--font-title);
}

/* Chiffres en colonne seulement (.col-date, .col-ref…) : appliqués à tout le
   tableau, les chiffres à chasse fixe d'Inter élargissaient aussi les traits
   d'union des noms (« Arts - Loi », « Anne - Catherine »). */

/* L'attribut hidden gagne toujours, même sur un élément stylé en flex/block */
[hidden] {
    display: none !important;
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* --- Focus clavier visible --- */
:focus-visible {
    outline: 3px solid var(--brand-ring);   /* au clavier seulement : un clic ne laisse pas d'anneau (§19) */
    outline-offset: 1px;
}

/* Les champs ont déjà leur propre anneau (bordure + ombre) : pas de double contour */
.form-group input:focus-visible,
.form-group select:focus-visible,
.form-group textarea:focus-visible,
.search-box input:focus-visible {
    outline: none;
}

/* --- Respect de « réduire les animations » --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================
   LOGIN PAGE (fond clair,
   logo au-dessus d'une carte qui porte le titre)
   ============================================ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    padding: 40px 16px;
    background: var(--bg-main);
}

.login-logo {
    width: 200px;
    height: auto;
}

.login-box {
    background: var(--bg-white);
    border: 1px solid var(--gris-200);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 1px 2px rgba(18, 49, 59, 0.05);
}

.login-heading {
    text-align: center;
    margin-bottom: 24px;
}

.login-title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.2;
    color: var(--ink);
}

.login-desc {
    margin-top: 8px;
    font-size: var(--fs-3);
    color: var(--gris-500);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    margin-bottom: 18px;
}

/* Libellés en casse de phrase (règles §21) */
.form-group label,
.form-group .form-label {
    display: block;
    font-size: var(--fs-3);
    font-weight: 500;
    color: var(--ink);
    margin-bottom: 8px;
}

/* Valeur qui ne se modifie pas : du texte, pas un champ désactivé (règles §5) */
.form-group .form-text {
    margin: 0 0 6px;
    color: var(--ink);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    min-height: 40px;
    padding: 9px 12px;
    border: 1px solid var(--gris-300);
    border-radius: var(--radius);
    font-size: var(--fs-3);
    font-family: var(--font-family);
    transition: border-color 0.15s, box-shadow 0.15s;
    background: var(--bg-white);
    color: var(--text-dark);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--gris-500);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-ring);
}

.form-group textarea {
    resize: vertical;
    min-height: 88px;
}

/* Validation temps réel */
.field-error {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.12) !important;
}

.field-error-msg {
    color: var(--danger);
    font-size: var(--fs-2);
    margin-top: 6px;
}

.field-valid {
    border-color: var(--success) !important;
}

/* --- Boutons (jetons.md : 40 px, arrondi 10 px) --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: var(--fs-3);
    font-weight: 600;
    font-family: var(--font-family);
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background: var(--brand-ink);
    color: #fff;
}

.btn-primary:hover {
    background: var(--brand-ink-hover);
}

.btn-danger {
    background: #B91C1C;
    color: #fff;
}

.btn-danger:hover {
    background: #991B1B;
}

/* Secondaire = « outline » : fond blanc, bordure de champ */
.btn-secondary {
    background: var(--bg-white);
    border-color: var(--gris-300);
    color: var(--ink);
}

.btn-secondary:hover {
    background: var(--gris-50);
}

.btn-sm {
    min-height: 36px;
    padding: 0 12px;
    font-size: var(--fs-2);
}

.btn-block {
    width: 100%;
    min-height: 44px;
}

.login-error,
.login-success {
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: var(--fs-3);
    font-weight: 500;
    margin-bottom: 18px;
}

.login-error {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.login-success {
    background: var(--success-bg);
    color: #14532D;
}

.forgot-password-link {
    text-align: center;
    margin-top: 18px;
}

.forgot-password-link a {
    font-size: var(--fs-3);
    color: var(--link);
    font-weight: 500;
}

/* ============================================
   LAYOUT : barre latérale + contenu
   ≥ 1025 px : barre de 232 px ; 769–1024 px : réduite aux icônes (72 px) ;
   ≤ 768 px : absente, remplacée par l'en-tête et la barre d'onglets du
   téléphone (le menu complet s'ouvre en tiroir).
   ============================================ */

/* --- Bandeau de recette --- */
.env-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 300;
    height: 20px;
    background: #B91C1C;  /* blanc dessus = 6,5:1, aussi en mode sombre */
    color: #fff;
    text-align: center;
    font-size: 11px;
    line-height: 20px;
    font-weight: 700;
    letter-spacing: 1px;
}

.env-banner ~ .app-layout,
.env-banner ~ .login-wrapper {
    --env-banner-height: 20px;
    padding-top: 20px;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* --- Barre latérale (blanche) --- */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--bg-white);
    border-right: 1px solid var(--gris-200);
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 20px 14px 16px;
    position: sticky;
    top: calc(var(--env-banner-height) + var(--topbar-height));
    height: calc(100vh - var(--env-banner-height) - var(--topbar-height));
    overflow-y: auto;
    z-index: 100;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    color: inherit;
}

.topbar-brand:hover {
    text-decoration: none;
}

.brand-symbol {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Le nom suit la construction du logo : « Sound » indigo, « Mark » encre */
.brand-name {
    font-family: var(--font-title);
    font-size: var(--fs-5);
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 24px;
    color: var(--ink);
}

.brand-name-accent {
    color: var(--brand-word);
}

.brand-sub {
    font-size: var(--fs-1);
    font-weight: 600;
    line-height: 16px;
    color: var(--gris-500);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 0 10px;
    border-radius: var(--radius);
    color: var(--gris-700);
    font-size: var(--fs-3);
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s;
}

.nav-item:hover {
    background: var(--gris-100);
    text-decoration: none;
}

.nav-item .nav-icon {
    font-size: 18px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.nav-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-item.active {
    background: var(--indigo-50);
    color: var(--indigo-700);
    font-weight: 600;
}

/* Une vraie file d'attente : pastille rouge pâle */
.nav-item .nav-badge {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    background: var(--danger-bg);
    color: var(--danger);
    font-size: var(--fs-1);
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 999px;
}

/* Administration : surtitre de groupe, séparé du menu principal */
.nav-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 16px;
}

.nav-group-label {
    padding: 4px 10px;
    font-size: var(--fs-1);
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--gris-500);
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: auto;
}

/* Carte compte : avatar, nom, société ; ouvre « Paramètres du profil » */
.account-card {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 12px;
    background: var(--gris-50);
    font-family: var(--font-family);
    text-align: left;
    color: inherit;
    cursor: pointer;
    transition: background 0.15s;
}

.account-card:hover {
    background: var(--gris-100);
}

.account-avatar {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--avatar);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-2);
    font-weight: 700;
}

.account-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.account-name,
.account-sub {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-name {
    font-size: var(--fs-2);
    font-weight: 600;
    color: var(--ink);
}

.account-sub {
    font-size: var(--fs-1);
    color: var(--gris-500);
}

.by-ixidia {
    padding: 4px 4px 0;
    font-size: var(--fs-1);
    color: var(--gris-500);
}

.by-ixidia strong {
    font-weight: 700;
    letter-spacing: 1px;
}

/* La carte compte est un lien vers Mon compte (compte.php) */
a.account-card,
a.account-card:hover {
    text-decoration: none;
}

.account-card.active {
    background: var(--indigo-50);
}

.account-card.active .account-name {
    color: var(--indigo-700);
}

/* --- Menu du compte (barre latérale, arbitrage 14) : la carte l'ouvre au-dessus d'elle --- */
.account-menu {
    position: relative;
}

.account-menu > summary {
    list-style: none;
}

.account-menu > summary::-webkit-details-marker {
    display: none;
}

.account-menu-list {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 60;
    width: 240px;
    padding: 6px;
    background: var(--bg-white);
    border: 1px solid var(--gris-200);
    border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(18, 49, 59, 0.14);
}

.account-menu-who {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px 10px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--gris-200);
}

.account-menu-name {
    font-size: var(--fs-2);
    font-weight: 600;
    color: var(--ink);
}

.account-menu-sub {
    font-size: var(--fs-1);
    color: var(--gris-500);
    overflow-wrap: anywhere;
}

.account-menu-list .row-menu-item {
    width: 100%;
    text-decoration: none;
}

/* ============================================
   MON COMPTE (compte.php) — gabarit « Mon compte et réglages » (§5,
   arbitrage 14) : sections sur filet dans une colonne d'environ 640 px,
   libellé à gauche et valeur à droite ; sur zone étroite, libellé au-dessus.
   ============================================ */
.compte-page {
    max-width: 640px;
    display: flex;
    flex-direction: column;
    gap: 36px;
}

.compte-section {
    scroll-margin-top: 24px;
}

.compte-section .section-head {
    margin-bottom: 8px;
}

.compte-row {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 6px 24px;
    align-items: start;
    margin: 0;
    padding: 12px 0;
}

.compte-row > label,
.compte-label {
    padding-top: 10px;
    margin: 0;
    font-size: var(--fs-2);
    font-weight: 500;
    color: var(--neutre);
}

.compte-value {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
}

.compte-value > input {
    width: 100%;
}

.compte-text {
    margin: 0;
    padding-top: 10px;
    color: var(--ink);
}

.compte-value .form-hint {
    margin: 0;
}

.compte-section .segmented {
    margin-bottom: 0;
}

.compte-section .segmented button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

@container (max-width: 639.98px) {
    .compte-row {
        grid-template-columns: minmax(0, 1fr);
        padding: 8px 0;
    }

    .compte-row > label,
    .compte-label,
    .compte-text {
        padding-top: 0;
    }

    .compte-row-actions > span:empty {
        display: none;
    }
}

/* --- Contenu --- */
.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Titre de page posé sur le fond, sans bandeau (règles §4) */
.content-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 28px 32px 0;
    max-width: 1600px;
    width: 100%;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.header-title {
    font-family: var(--font-title);
    font-size: var(--fs-6);
    font-weight: 800;
    letter-spacing: -0.6px;
    line-height: 1.2;
    color: var(--ink);
}

.header-sub {
    font-size: var(--fs-3);
    color: var(--gris-500);
}

.page-content {
    flex: 1;
    width: 100%;
    max-width: 1600px;
    padding: 24px 32px 32px;
}

/* Zones qui décident de la forme de leurs composants (règles IXIDIA §16) :
   tableau ↔ cartes, colonnes masquées, deux colonnes ↔ une se règlent sur la
   largeur de la zone (@container), jamais sur celle de l'écran. Les @media qui
   restent ne portent que la navigation et la mise en page générale.
   Paliers de zone, les mêmes dans toutes les applications (docs/ixidia/jetons.md) :
   étroit sous 640 px (cartes ou lignes compactes, une colonne de champs),
   deux colonnes à partir de 880 px (fiche et formulaire), large à partir de
   1200 px (tableaux à toutes leurs colonnes). Aucun autre palier. */
.page-content,
.fiche-subject,
.fiche-aside,
.order-messages,
.order-thread,
.form-steps {
    container-type: inline-size;
}

/* En-tête et barre d'onglets du téléphone : absents sur grand écran */
.mobile-header,
.tabbar {
    display: none;
}

/* Badges de rôle */
/* Un rôle n'est pas un état : pastille neutre, sans point ni couleur d'alerte */
.badge-role-admin { background: var(--avatar); color: #fff; }
.badge-role-production { background: var(--indigo-50); color: var(--indigo-700); }
.badge-role-client { background: var(--gris-100); color: var(--gris-700); }

/* ============================================
   ONGLETS
   ============================================ */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.tab-item {
    padding: 10px 14px;
    font-size: var(--fs-3);
    font-weight: 600;
    color: var(--gris-500);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
}

.tab-item:hover {
    color: var(--ink);
    text-decoration: none;
}

.tab-item.active {
    color: var(--indigo-700);
    border-bottom-color: var(--brand);
}

.tab-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Compteur d'onglet : « Terminées · 3 », en texte, jamais dans une pastille
   (règles §8 et §14) */
.tab-item .tab-count {
    margin-left: -2px; /* l'écart de l'onglet + « · » suffisent */
    font-size: inherit;
    font-weight: 500;
    color: var(--gris-500);
    font-variant-numeric: tabular-nums;
}

.tab-item.active .tab-count {
    color: var(--indigo-700);
}

/* La barre d'onglets défile au lieu de passer à la ligne */
.tabs {
    overflow-x: auto;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

/* Téléphone : onglets en pastilles (règles §8) */
@media (max-width: 768px) {
    .tabs {
        border-bottom: 0;
        gap: 6px;
        margin: 0 -16px 16px;
        padding: 0 16px;
    }

    .tab-item {
        min-height: 36px;
        padding: 0 12px;
        border: 1px solid var(--gris-200);
        border-radius: 999px;
        background: var(--bg-white);
        color: var(--neutre);
        margin-bottom: 0;
    }

    .tab-item.active {
        border-color: var(--indigo-100);
        background: var(--indigo-50);
        color: var(--indigo-700);
    }

}

/* ============================================
   TABLEAUX DE DONNÉES (en-têtes en capitales grises, lignes aérées)
   ============================================ */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-3);
}

.data-table thead th {
    padding: 10px 16px;
    text-align: left;
    font-weight: 600;
    font-size: var(--fs-1);
    color: var(--gris-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--gris-50);
    border-bottom: 1px solid var(--gris-200);
    white-space: nowrap;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--gris-100);
    transition: background 0.1s;
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: var(--gris-50);
}

.data-table tbody td {
    padding: 11px 16px;
    vertical-align: middle;
}

.data-table .col-date {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-size: var(--fs-2);
    color: var(--gris-500);
}

/* ============================================
   BADGES : pastilles arrondies avec point, un état = un badge
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: var(--fs-1);
    font-weight: 600;
    line-height: 18px;
    white-space: nowrap;
    background: var(--gris-100);
    color: var(--neutre);
}

.badge-draft,
.badge-submitted,
.badge-production,
.badge-review,
.badge-revision,
.badge-delivered,
.badge-scheduled,
.badge-cancelled {
    background: var(--chip-bg);
    color: var(--chip-fg);
}

/* Le point reprend la couleur d'étape : le statut se lit sans le mot */
.badge-draft::before,
.badge-submitted::before,
.badge-production::before,
.badge-review::before,
.badge-revision::before,
.badge-delivered::before,
.badge-scheduled::before,
.badge-cancelled::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.badge-draft      { --chip-bg: #EDF1F3; --chip-fg: #4F6268; }
.badge-submitted  { --chip-bg: #DBEAFE; --chip-fg: #1E40AF; }
.badge-production { --chip-bg: #FEF3C7; --chip-fg: #92400E; }
.badge-review     { --chip-bg: #FCE7F3; --chip-fg: #9D174D; }
.badge-revision   { --chip-bg: #FEF9C3; --chip-fg: #854D0E; }
.badge-delivered  { --chip-bg: #DCFCE7; --chip-fg: #166534; }
.badge-scheduled  { --chip-bg: #CCFBF1; --chip-fg: #115E59; }
.badge-cancelled  { --chip-bg: #FEE2E2; --chip-fg: #991B1B; }

/* ============================================
   BARRE D'OUTILS (recherche, filtres)
   ============================================ */

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-white);
    border: 1px solid var(--gris-300);
    border-radius: var(--radius);
    min-height: 40px;
    padding: 0 12px;
    flex: 1;
    max-width: 420px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.search-box:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-ring-soft);
}

.search-box input {
    border: none;
    outline: none;
    font-size: var(--fs-3);
    width: 100%;
    background: transparent;
    font-family: var(--font-family);
    color: var(--ink);
}

.search-icon {
    color: var(--gris-500);
    font-size: 16px;
}

/* ============================================
   CARTES
   ============================================ */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gris-200);
    margin-bottom: 20px;
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 200;
    align-items: center;
    justify-content: center;
    -webkit-overflow-scrolling: touch;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-white);
    border: 1px solid var(--gris-200);
    border-radius: var(--radius);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(18, 49, 59, 0.22);
}

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--gris-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 18px;
    color: var(--ink);
}

.modal-header i {
    color: var(--gris-500);
}

/* Titre = l'action ; dessous, en texte secondaire et sans cadre, l'objet
   concerné (règles §10, arbitrage 20). */
.modal-heading {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.modal-sub {
    font-family: var(--font-family);
    font-weight: 400;
    font-size: var(--fs-2);
    color: var(--gris-500);
    overflow-wrap: break-word;
}

.modal-sub:empty {
    display: none;
}

.modal-header .close-btn {
    width: 44px;
    height: 44px;
    margin: -10px -14px -10px 0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: var(--radius);
    font-size: 22px;
    cursor: pointer;
    color: var(--gris-500);
    line-height: 1;
}

.modal-header .close-btn:hover {
    background: var(--gris-100);
    color: var(--ink);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gris-100);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}


/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 14px;
    max-width: 356px;
    width: calc(100% - 64px);
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 16px;
    border-radius: 8px;
    font-size: var(--fs-2);
    font-weight: 500;
    background: var(--bg-white);
    border: 1px solid var(--gris-200);
    color: var(--ink);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    animation: toastSlideIn 0.2s ease-out;
    transition: opacity 0.2s, transform 0.2s; /* règles §19 : 0,1 à 0,2 s */
    cursor: pointer; /* un clic le ferme : pas de bouton dans un toast (règles §12) */
}

.toast.toast-hiding {
    opacity: 0;
    transform: translateY(12px);
}

.toast-icon {
    flex-shrink: 0;
    font-size: 16px;
    line-height: 1.3;
}

.toast-body {
    flex: 1;
    line-height: 1.4;
}

/* Pas de barre de progression */
.toast-progress {
    display: none;
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* Legacy .alert kept for static info blocks (e.g. admin_clients info box, api_keys warning) */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: var(--fs-3);
    font-weight: 500;
    margin-bottom: 16px;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.alert-info {
    background: var(--info-bg);
    color: var(--info);
}

/* ============================================
   RESPONSIVE
   ============================================ */
/* --- Tablette (769–1024 px) : barre réduite aux icônes
   (règles §3). Les libellés passent dans l'infobulle (title). --- */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: var(--sidebar-rail);
        padding: 20px 12px 16px;
        align-items: stretch;
    }

    .nav-label,
    .nav-group-label,
    .by-ixidia {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: 0;
    }

    /* Le nombre devient un point : il n'y a plus la place de l'écrire */
    .nav-item {
        position: relative;
    }

    .nav-item .nav-badge {
        position: absolute;
        top: 7px;
        right: 9px;
        width: 8px;
        height: 8px;
        padding: 0;
        font-size: 0;
        background: var(--danger);
    }

    .nav-group {
        border-top: 1px solid var(--gris-200);
        padding-top: 12px;
    }

    .content-header {
        padding: 24px 24px 0;
    }

    .page-content {
        padding: 20px 24px 28px;
    }
}

@container (min-width: 640px) and (max-width: 1199.98px) {

    /* Les tableaux larges défilent dans leur carte au lieu d'être coupés */
    .card {
        overflow-x: auto;
    }

    .data-table thead th,
    .data-table tbody td {
        padding-left: 12px;
        padding-right: 12px;
    }
}

@media (max-width: 768px) {
    /* --- Pas de barre latérale : l'onglet « Menu » mène à menu.php (règles §3) --- */
    .sidebar {
        display: none;
    }

    /* --- En-tête du téléphone : symbole et titre de la page --- */
    .mobile-header {
        display: flex;
        align-items: center;
        gap: 12px;
        position: sticky;
        top: var(--env-banner-height);
        z-index: 50;
        padding: calc(18px + env(safe-area-inset-top)) 16px 12px;
        background: var(--bg-white);
        border-bottom: 1px solid var(--gris-200);
    }

    .mobile-header-symbol {
        width: 30px;
        height: 30px;
        flex-shrink: 0;
    }

    .mobile-header-title {
        font-family: var(--font-title);
        font-size: 24px;
        font-weight: 800;
        letter-spacing: -0.6px;
        line-height: 1.2;
        color: var(--ink);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Le grand titre est déjà dans l'en-tête : il reste pour les lecteurs d'écran */
    .header-title {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .content-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 16px 16px 0;
    }

    .content-header .header-left:not(:has(.header-sub)) {
        display: none;
    }

    /* L'action passe dans l'en-tête, en bouton rond (voir .mobile-header-action) */
    .content-header .header-right {
        display: none;
    }

    .mobile-header-action {
        margin-left: auto;
        flex-shrink: 0;
    }

    /* Le libellé reste dans le bouton (nom accessible), mais ne s'affiche pas */
    .mobile-header-action .btn {
        width: 44px;
        min-height: 44px;
        height: 44px;
        padding: 0;
        border-radius: 999px;
        font-size: 0;
        gap: 0;
    }

    .mobile-header-action .btn .ic {
        font-size: 20px;
    }

    .page-content {
        padding: 16px 16px calc(var(--tabbar-height) + env(safe-area-inset-bottom) + 20px);
    }

    /* --- Barre d'onglets du bas --- */
    .tabbar {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: 1fr;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 150;
        height: calc(var(--tabbar-height) + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        background: var(--bg-white);
        border-top: 1px solid var(--gris-200);
    }

    .tabbar-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        border: none;
        background: none;
        font-family: var(--font-family);
        font-size: 10px;
        font-weight: 600;
        line-height: 13px;
        color: var(--gris-500);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .tabbar-item:hover {
        text-decoration: none;
    }

    .tabbar-item.active {
        color: var(--indigo-700);
    }

    .tabbar-icon {
        position: relative;
        font-size: 22px;
        line-height: 1;
    }

    .tabbar-badge {
        position: absolute;
        top: -4px;
        right: -12px;
        min-width: 16px;
        padding: 0 4px;
        border-radius: 999px;
        background: var(--danger);
        color: #fff;
        font-size: 10px;
        font-weight: 700;
        line-height: 16px;
        text-align: center;
        font-variant-numeric: tabular-nums;
    }

    .toast-container {
        bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom) + 16px);
        left: 16px;
        right: 16px;
        width: auto;
        max-width: none;
    }

    /* --- Modals --- */
    .modal {
        max-width: 95vw;
        max-height: 90vh;
        margin: 8px;
    }

    .modal-header {
        padding: 14px 16px;
        font-size: var(--fs-4);
    }

    .modal-body {
        padding: 16px;
    }

    .modal-footer {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .modal-footer .btn {
        flex: 1;
        min-width: 0;
        text-align: center;
    }

    /* Modal overlay mobile */
    .modal-overlay.active {
        align-items: flex-start;
        padding: 16px 8px;
        overflow-y: auto;
    }

    /* --- Login --- */
    .login-box {
        margin: 16px;
        padding: 24px;
    }

    .form-group label,
    .form-group .form-label {
        font-size: var(--fs-2);
    }

    /* iOS Safari zoome la page à chaque focus si la police fait moins de 16px.
       Le formulaire de commande sautait donc à chaque champ sur iPhone. */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px;
        padding: 8px 10px;
    }

    /* --- Badges --- */
    .badge {
        padding: 2px 8px;
    }
}

@container (max-width: 639.98px) {

    /* --- Tables : transformation en cards --- */

    .data-table {
        border: none;
    }

    .data-table thead {
        display: none;
    }

    .data-table tbody tr,
    .data-table tbody tr:last-child {
        display: block;
        background: var(--bg-white);
        border: 1px solid var(--gris-200);
        border-radius: var(--radius-lg);
        padding: 12px 14px;
        margin-bottom: 10px;
    }

    .data-table tbody tr:hover {
        background: var(--bg-white);
    }

    /* Dans une carte, les lignes deviennent une liste : pas de carte dans la carte */
    .card .data-table tbody tr,
    .card .data-table tbody tr:last-child {
        border: none;
        border-bottom: 1px solid var(--gris-100);
        border-radius: 0;
        margin: 0;
        padding: 14px 16px;
    }

    .card .data-table tbody tr:last-child {
        border-bottom: none;
    }

    .data-table tbody td {
        display: block;
        padding: 2px 0;
        text-align: left;
        font-size: var(--fs-3);
    }

    .data-table tbody td::before {
        content: attr(data-label);
        display: inline-block;
        font-weight: 600;
        font-size: var(--fs-1);
        color: var(--text-muted);
        text-transform: uppercase;
        margin-right: 6px;
        min-width: 70px;
    }

    .data-table tbody td:empty {
        display: none;
    }

    /* Colonnes masquées sur mobile */
    .data-table .col-hide-mobile {
        display: none !important;
    }

    /* Dates */
    .data-table .col-date {
        font-size: var(--fs-2);
        color: var(--text-muted);
    }

    /* Actions : flex wrap */

    .data-table .btn-sm {
        min-height: 36px;
    }

    /* --- Forms --- */
    .form-row {
        grid-template-columns: 1fr !important;
    }

    /* --- Pagination --- */
    .pagination {
        flex-wrap: wrap;
        gap: 4px;
        justify-content: center;
    }

    .pagination-btn {
        min-width: 36px;
        height: 36px;
    }

    .pagination-info {
        width: 100%;
        text-align: center;
        font-size: var(--fs-1);
    }
}

@container (max-width: 639.98px) {

    .data-table tbody tr {
        padding: 10px;
    }

    .data-table .btn-sm {
        padding: 0 10px;
    }
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px 0 8px;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--gris-300);
    border-radius: 8px;
    background: var(--bg-white);
    color: var(--text-dark);
    font-size: var(--fs-3);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.pagination-btn:hover:not(.active):not(.disabled) {
    background: var(--bg-hover);
    border-color: var(--brand);
}

.pagination-btn.active {
    background: var(--brand-ink);
    border-color: var(--brand-ink);
    color: #fff;
    cursor: default;
}

.pagination-btn.disabled {
    opacity: 0.4;
    cursor: default;
}

.pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--text-muted);
    font-size: var(--fs-3);
}

.pagination-info {
    margin-left: 12px;
    font-size: var(--fs-2);
    color: var(--text-muted);
}

@container (max-width: 639.98px) {
    .pagination {
        flex-wrap: wrap;
        gap: 2px;
    }
    .pagination-btn {
        min-width: 28px;
        height: 28px;
        font-size: var(--fs-2);
    }
}

/* ============================================
   PLANNING DE DIFFUSION (fenêtre, includes/schedule_modal.php)
   Forme IXIDIA (29/10/2026) : rappel de la commande sous le titre (.modal-sub),
   une seule navigation de mois, les jours diffusés en cartes qu'on touche
   (§6), le détail d'un jour en sections sur filet, chiffres en colonnes (§14).
   ============================================ */
.modal-schedule {
    max-width: 720px; /* le pied tient sur une ligne : deux téléchargements et Fermer */
}

.schedule-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.schedule-nav-label {
    flex: 1;
    margin: 0;
    font-family: var(--font-title);
    font-size: var(--fs-4);
    font-weight: 700;
    color: var(--ink);
    text-align: center;
}

.schedule-nav-btn {
    width: 40px;
    padding: 0;
    justify-content: center;
    flex-shrink: 0;
}

/* Aux bornes, la flèche disparaît (on ne grise pas, règles §9) mais garde sa place ;
   désactivée, elle sort aussi de l'ordre du clavier */
.schedule-nav-btn:disabled {
    visibility: hidden;
}

.schedule-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}

/* En-têtes des jours : surtitre (§6) */
.schedule-grid .day-header {
    padding: 4px 0 6px;
    text-align: center;
    font-size: var(--fs-1);
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--gris-500);
}

.schedule-grid .day-cell {
    display: flex;
    min-height: 52px;
}

/* Jour sans diffusion : le numéro seul, sans cadre */
.schedule-grid .day-cell.is-empty {
    align-items: center;
    justify-content: center;
    font-size: var(--fs-2);
    color: var(--gris-500);
}

/* Jour diffusé : une carte qu'on touche pour voir les heures */
.day-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 2px;
    background: var(--bg-white);
    border: 1px solid var(--gris-200);
    border-radius: var(--radius);
    font: inherit;
    color: var(--ink);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.day-card:hover {
    background: var(--brand-tint);
    border-color: var(--link);
}

.day-card .day-num {
    font-size: var(--fs-2);
}

.day-card .day-count {
    font-size: var(--fs-2);
    font-weight: 600;
    color: var(--link);
    font-variant-numeric: tabular-nums;
}

/* Détail d'un jour */
.schedule-back {
    margin: 0 0 12px -12px;
}

.schedule-day-detail .section-head {
    margin-bottom: 16px;
}

.schedule-lang + .schedule-lang {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--gris-100);
}

.schedule-lang-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.schedule-times {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 6px 12px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: var(--fs-3);
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}

/* Pied : les téléchargements à gauche, Fermer à droite ; ils passent à la ligne si besoin */
.modal-schedule .modal-footer {
    flex-wrap: wrap;
}

.schedule-export-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-right: auto;
}

.schedule-export-actions .btn {
    text-decoration: none;
}

@media (pointer: coarse) {
    .schedule-nav-btn {
        width: 44px;
    }
}

@media (max-width: 768px) {
    .modal-schedule {
        max-width: 95vw;
    }

    .schedule-grid .day-cell {
        min-height: 44px;
    }

    .day-card {
        padding: 4px 1px;
    }

    /* Peu de gras sur téléphone (§16) */
    .day-card .day-count {
        font-weight: 500;
    }

    /* Les deux téléchargements en pleine largeur ; la croix suffit pour fermer */
    .schedule-export-actions {
        flex-direction: column;
        width: 100%;
    }

    .modal-schedule .modal-footer .schedule-close {
        display: none;
    }
}

/* Alert warning (for API key display) */
.alert-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
}

/* Texte destiné aux lecteurs d'écran : la couleur ou la forme seule
   ne doit jamais porter l'information. */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   BANDE DE VOIX
   Une puce par langue de la commande.
   Pleine = audio livré, évidée = en attente.
   La langue devient un signe typographique, pas une couleur : cela
   supprime une palette entière (les langues sont configurables en base,
   et leurs couleurs entraient en collision avec celles des statuts).
   ============================================ */
.voices {
    display: inline-flex;
    gap: 3px;
    vertical-align: middle;
}

.voice {
    min-width: 28px;
    height: 19px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-1);
    font-weight: 700;
    letter-spacing: 0.06em;
    border: 1px solid var(--gris-300);
    border-radius: 6px;
    color: var(--gris-500);
    background: transparent;
}

.voice-done {
    background: var(--indigo-50);
    border-color: var(--indigo-100);
    color: var(--indigo-700);
}

/* ============================================
   CONTRÔLE SEGMENTÉ
   Un choix exclusif entre plusieurs vues. Remplace deux interrupteurs
   iOS qui se comportaient comme des boutons radio : un interrupteur
   annonce « je m'active indépendamment », ce qui était faux.
   ============================================ */
.segmented {
    display: inline-flex;
    gap: 4px;
    background: var(--gris-100);
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: 16px;
}

.segmented a,
.segmented button {
    border: none;
    background: none;
    font-family: var(--font-family);
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 7px;
    font-size: var(--fs-2);
    font-weight: 600;
    color: var(--neutre);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.segmented a:hover,
.segmented button:hover {
    color: var(--text-dark);
    text-decoration: none;
}

.segmented a[aria-current="true"],
.segmented button[aria-current="true"] {
    background: var(--bg-white);
    color: var(--text-dark);
    box-shadow: 0 1px 2px rgba(18, 49, 59, 0.12);
}

/* --- Responsive des composants ci-dessus (après leurs règles de base) --- */

@media (max-width: 768px) {
    .header-right {
        width: 100%;
    }

    .segmented {
        width: 100%;
    }

    .segmented a,
    .segmented button {
        flex: 1;
        text-align: center;
        min-height: 34px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ============================================
   LISTES ET ACTIONS (règles §8 et §9)
   Une ligne se lit d'un bloc et s'ouvre d'un clic : intitulé en gras,
   référence et contexte en dessous, chevron à droite. Les actions rares
   passent dans le menu « ⋯ » ; les boutons visibles disent ce qu'ils font.
   ============================================ */
.cell-title {
    display: block;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.35;
}

.cell-meta {
    display: block;
    margin-top: 2px;
    font-size: var(--fs-2);
    color: var(--gris-500);
}

.cell-meta s {
    opacity: 0.7;
}

.data-table tr.row-link {
    cursor: pointer;
}

.data-table .col-chevron {
    width: 40px;
    padding-left: 0;
    text-align: right;
    color: var(--gris-400);
    font-size: var(--fs-4);
}

.data-table .col-actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.row-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

/* Place vide du « ⋯ » sur une ligne qui n'a pas de menu : ses boutons restent
   alignés sur ceux des autres lignes */
.row-menu-spacer {
    width: 34px;
    flex-shrink: 0;
}

.data-table thead th.col-actions,
.data-table thead th.col-chevron {
    text-align: right;
}

/* Bouton d'icône discret : téléchargement, planning, menu */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: none;
    color: var(--gris-500);
    font-size: 16px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.btn-icon:hover {
    background: var(--gris-100);
    color: var(--ink);
    text-decoration: none;
}

/* Bouton fantôme : action tertiaire, sans bordure */
.btn-ghost {
    background: none;
    color: var(--link);
}

.btn-ghost:hover {
    background: var(--indigo-50);
    color: var(--indigo-700);
}

/* --- Menu « ⋯ » (un <details>, ouvert au clic, fermé par app.js) --- */
.row-menu {
    position: relative;
    display: inline-block;
}

.row-menu > summary {
    list-style: none;
}

.row-menu > summary::-webkit-details-marker {
    display: none;
}

.row-menu[open] > summary {
    background: var(--gris-100);
    color: var(--ink);
}

/* app.js le place en position fixe sous le bouton : il n'est ainsi jamais
   coupé par une carte ou un tableau qui défile. */
.row-menu-list {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 120;
    min-width: 220px;
    padding: 6px;
    background: var(--bg-white);
    border: 1px solid var(--gris-200);
    border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(18, 49, 59, 0.14);
    text-align: left;
}

.row-menu-list form {
    margin: 0;
}

.row-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 7px;
    background: none;
    font-family: var(--font-family);
    font-size: var(--fs-3);
    font-weight: 500;
    color: var(--ink);
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}

.row-menu-item i {
    color: var(--gris-500);
    font-size: 15px;
}

.row-menu-item:hover {
    background: var(--gris-50);
    text-decoration: none;
}

.row-menu-item.is-danger,
.row-menu-item.is-danger i {
    color: var(--danger);
}

.row-menu-item.is-danger:hover {
    background: var(--danger-bg);
}

/* --- États d'administration : un mot, une pastille --- */
.badge-ok,
.badge-suspended,
.badge-invited,
.badge-brand {
    background: var(--chip-bg);
    color: var(--chip-fg);
}

.badge-ok::before,
.badge-suspended::before,
.badge-invited::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.badge-ok        { --chip-bg: var(--success-bg); --chip-fg: var(--success); }
.badge-suspended { --chip-bg: var(--warning-bg); --chip-fg: var(--warning-text); }
.badge-brand     { --chip-bg: var(--indigo-50);  --chip-fg: var(--indigo-700); }
/* Invitation envoyée ou expirée : compte pas encore activé, badge neutre (05/11/2026) */
.badge-invited   { --chip-bg: var(--gris-100);   --chip-fg: var(--neutre); }

.row-suspended .cell-title {
    color: var(--gris-500);
}

/* --- Langue : une étiquette neutre (les couleurs en base ne s'affichent plus) --- */
.lang-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--gris-100);
    color: var(--gris-700);
    font-size: var(--fs-1);
    font-weight: 600;
    line-height: 18px;
    white-space: nowrap;
}

.lang-pill .lang-code {
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--ink);
}

.lang-pills {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* --- Échéance : une pastille seulement quand il faut agir --- */
/* Retard et échéance proche (règles §14, v0.4.4) : un badge dans une colonne
   de tableau ; ailleurs (phrase de la bande, carte du Kanban, ligne compacte
   du téléphone), le même texte en teinte danger ou attention, sans badge. */
.due {
    font-weight: 600;
    white-space: nowrap;
}

.due-overdue { color: var(--danger); }
.due-soon    { color: var(--warning); }

.data-table .col-date .due {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: var(--fs-1);
    line-height: 18px;
}

.data-table .col-date .due-overdue { background: var(--danger-bg);  color: var(--danger-text); }
.data-table .col-date .due-soon    { background: var(--warning-bg); color: var(--warning-text); }

@container (max-width: 639.98px) {
    .data-table .col-date .due {
        padding: 0;
        font-size: inherit;
    }

    .data-table .col-date .due-overdue { background: none; color: var(--danger); }
    .data-table .col-date .due-soon    { background: none; color: var(--warning); }
}


.form-hint {
    display: block;
    margin-top: 4px;
    font-size: var(--fs-2);
    color: var(--gris-500);
}

.form-hint.is-ok {
    color: var(--success);
}

.required-mark {
    color: var(--danger);
}

/* --- Champs par langue (nouvelle commande, dépôt des fichiers audio) --- */
.lang-block {
    margin-top: 20px;
    padding: 16px;
    border: 1px solid var(--gris-200);
    border-radius: var(--radius);
}

.lang-block-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--ink);
}

.lang-block .form-group:last-child {
    margin-bottom: 0;
}

.upload-field + .upload-field {
    margin-top: 12px;
}

.upload-field label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.upload-field input[type="file"] {
    width: 100%;
    padding: 8px;
    border: 1px dashed var(--gris-300);
    border-radius: var(--radius);
    background: var(--gris-50);
    font-family: var(--font-family);
    font-size: var(--fs-2);
}

.secret-box {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.secret-box code {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    background: var(--bg-white);
    border: 1px solid var(--gris-300);
    border-radius: var(--radius);
    font-size: var(--fs-2);
    overflow-wrap: anywhere;
}

/* --- Téléphone : une commande = une carte (intitulé, état, méta) --- */
@container (max-width: 639.98px) {
    .data-table.order-list tbody tr,
    .card .data-table.order-list tbody tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
        gap: 6px 12px;
    }

    .data-table.order-list tbody td {
        padding: 0;
    }

    .data-table.order-list tbody td::before {
        display: none;
    }

    .data-table.order-list .col-main {
        grid-column: 1;
        grid-row: 1;
    }

    .data-table.order-list .col-status {
        grid-column: 2;
        grid-row: 1;
        text-align: right;
    }

    .data-table.order-list .col-voices {
        grid-column: 1;
    }

    .data-table.order-list .col-date {
        grid-column: 2;
        text-align: right;
        align-self: center;
    }

    .data-table.order-list .col-actions {
        grid-column: 1 / -1;
        width: auto;
        text-align: left;
    }

    .data-table.order-list .col-actions .row-actions {
        justify-content: flex-start;
    }

    .data-table.order-list .col-chevron {
        display: none;
    }

    /* Listes d'administration : ligne titre + actions, détails dessous */
    .data-table.admin-list tbody td::before {
        min-width: 0;
    }

    .data-table.admin-list .col-main::before,
    .data-table.admin-list .col-actions::before {
        display: none;
    }

    .data-table.admin-list .col-main {
        margin-bottom: 4px;
    }

    /* Une ligne qui ouvre une fiche garde son chevron, en haut à droite */
    .data-table.admin-list tr.row-link {
        position: relative;
    }

    .data-table.admin-list tr.row-link .col-chevron {
        position: absolute;
        top: 14px;
        right: 12px;
        width: auto;
    }

    .data-table.admin-list .col-chevron::before {
        display: none;
    }

    .data-table.admin-list .col-actions {
        width: auto;
        text-align: left;
        margin-top: 8px;
        padding-top: 10px;
        border-top: 1px solid var(--gris-100);
    }

    .data-table.admin-list .col-actions .row-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

.label-optional {
    margin-left: 4px;
    font-weight: 400;
    color: var(--gris-500);
}

.modal-message {
    padding: 32px 16px;
    text-align: center;
    color: var(--gris-500);
}

.modal-message.is-error {
    color: var(--danger-text);
}

.modal-sm {
    max-width: 440px;
}

/* --- Choix multiples en pastilles (langues d'un type) --- */
.choice-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.form-group .choice-list label.choice {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid var(--gris-300);
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.form-group .choice-list label.choice:has(input:checked) {
    border-color: var(--brand);
    background: var(--indigo-50);
}

.form-group .choice-list input[type="checkbox"] {
    width: 16px;
    min-height: 0;
    height: 16px;
    padding: 0;
    accent-color: var(--brand);
}

.choice .lang-code {
    font-weight: 700;
    letter-spacing: 0.06em;
}

/* Alerte à contenu riche : icône à gauche, texte et actions à droite */
.alert:has(> .alert-body) {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.alert > .alert-body {
    flex: 1;
    min-width: 0;
}

.alert > .ic {
    margin-right: 6px;
}

.alert:has(> .alert-body) > .ic {
    margin: 2px 0 0;
    font-size: 18px;
}

/* Le pied de modale (les actions) reste visible : seul le corps défile */
.modal {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal > form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.modal-header,
.modal-footer {
    flex-shrink: 0;
}

.modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

#statusModalIntro {
    margin: -4px 0 18px;
}

@container (max-width: 639.98px) {
    /* Dans une carte, la ligne prend le fond de la carte : coins arrondis intacts */
    .card .data-table tbody tr,
    .card .data-table tbody tr:hover {
        background: transparent;
    }

}

@media (max-width: 768px) {

    .modal-footer .btn {
        flex: 1 1 auto;
    }
}

@container (max-width: 639.98px) {
    /* Commandes sur téléphone : intitulé + statut, puis voix, date et actions */
    .data-table.order-list tbody tr,
    .card .data-table.order-list tbody tr {
        grid-template-columns: minmax(0, 1fr) auto auto;
    }

    .data-table.order-list .col-main {
        grid-column: 1 / 3;
    }

    .data-table.order-list .col-status {
        grid-column: 3;
    }

    .data-table.order-list .col-voices {
        grid-column: 1;
        grid-row: 2;
        align-self: center;
    }

    .data-table.order-list .col-date {
        grid-column: 2 / -1;
        grid-row: 2;
    }

    .data-table.order-list tr:has(.col-actions .btn-icon) .col-date {
        grid-column: 2;
    }

    .data-table.order-list .col-actions {
        grid-column: 3;
        grid-row: 2;
        text-align: right;
    }

    .data-table.order-list .col-actions:has(.btn) {
        grid-column: 1 / -1;
        grid-row: auto;
        text-align: left;
    }

}

@media (max-width: 768px) {
    .modal-footer .btn {
        white-space: normal;
        text-align: center;
    }
}

/* Coins arrondis de la carte respectés par le survol de la dernière ligne */
.card > .data-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: var(--radius-lg);
}

.card > .data-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: var(--radius-lg);
}

/* --- Écran Menu du téléphone (menu.php) : le menu de la barre, puis le compte --- */
.menu-screen {
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: calc(100vh - 220px);
}

.menu-screen .sidebar-nav {
    flex: 0 0 auto;
}

.nav-item-screen {
    min-height: 44px;
}

.menu-screen-foot {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: auto;
}

.menu-screen-foot .by-ixidia {
    text-align: center;
}

.menu-account {
    padding: 12px;
}

.menu-account .account-avatar {
    width: 44px;
    height: 44px;
}

.menu-screen-foot .btn-block {
    justify-content: center;
    min-height: 44px;
}

.account-chevron {
    margin-left: auto;
    color: var(--gris-400);
    font-size: 16px;
}

/* ============================================
   FICHE COMMANDE (commande.php) — page complète (gabarit « Fiche », règles §5)
   ============================================ */

/* Fil d'Ariane « Suivi › CMD-… » (ordinateur) */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-size: var(--fs-2);
    color: var(--gris-500);
}

.breadcrumb a {
    font-weight: 600;
}

.breadcrumb .ic {
    font-size: 14px;
}

.header-title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    min-width: 0;
}

.header-title-row .header-title {
    overflow-wrap: anywhere;
}

/* Ligne de métadonnées (MetaLigne) : icône + texte, jamais de débordement */
.meta-line {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin-top: 8px;
    list-style: none;
    font-size: var(--fs-3);
    color: var(--gris-500);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    white-space: nowrap;
}

.meta-item.is-libre {
    align-items: flex-start;
    white-space: normal;
    overflow-wrap: anywhere;
}

.meta-item .ic {
    font-size: 16px;
}

.meta-item.is-libre .ic {
    margin-top: 2px;
}

/* Barre d'étapes d'une commande (renderStepBar) : faites, en cours, à venir */
.step-bar {
    display: flex;
    list-style: none;
    margin: 0 0 20px;
    padding: 0;
    counter-reset: none;
}

.step {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: var(--fs-2);
    color: var(--gris-500);
}

/* Le trait qui relie une étape à la précédente : il prend la place libre */
.step:first-child {
    flex: 0 0 auto;
}

.step + .step::before {
    content: "";
    flex: 1 1 auto;
    min-width: 12px;
    height: 2px;
    margin: 0 4px 0 8px;
    background: var(--gris-200);
    border-radius: 1px;
}

.step.is-done + .step::before,
.step.is-current::before {
    background: var(--indigo-500);
}

.step-dot {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    border: 2px solid var(--gris-200);
    background: var(--bg-white);
    color: var(--gris-500);
}

.step-dot .ic {
    font-size: 13px;
}

.step-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.step.is-done .step-dot {
    border-color: var(--indigo-500);
    background: var(--indigo-500);
    color: #fff;
}

.step.is-done {
    color: var(--ink);
}

.step.is-current .step-dot {
    border-color: var(--indigo-500);
    color: var(--indigo-700);
    background: var(--indigo-50);
}

.step.is-current .step-label {
    font-weight: 700;
    color: var(--indigo-700);
}

/* Téléphone : les pastilles et le libellé de l'étape en cours seulement */
@container (max-width: 639.98px) {
    .step-bar {
        margin-bottom: 16px;
    }

    .step:not(.is-current):not([aria-current]) .step-label {
        display: none;
    }

    /* L'étape en cours, ou la dernière quand tout est fait : avec son libellé */
    .step[aria-current] {
        flex: 1 1 auto;
    }
}

/* Un sélecteur à beaucoup d'options défile au lieu de passer sur deux lignes */

@media (max-width: 768px) {
    /* « ‹ Suivi » : en-tête de fiche du téléphone (EnTeteMobile) */
    .mobile-back {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        min-height: 44px;
        font-size: 16px;
        font-weight: 600;
    }

    .mobile-back .ic {
        font-size: 22px;
    }

    .mobile-header-back {
        padding-top: calc(10px + env(safe-area-inset-top));
        padding-bottom: 6px;
    }

    /* Sur une fiche, le grand titre reste visible sous l'en-tête */
    .content-header-fiche .header-title {
        position: static;
        width: auto;
        height: auto;
        overflow: visible;
        clip: auto;
        white-space: normal;
        font-size: 24px;
    }

    .content-header-fiche .header-left {
        display: block !important;
    }

    .breadcrumb {
        display: none;
    }

    /* Les actions d'une fiche restent des boutons, côte à côte */
    .content-header-inline .header-right {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .content-header-inline .header-right .btn {
        flex: 1 1 auto;
        min-height: 44px;
    }
}

/* ============================================
   KANBAN DU SUIVI (suivi.php) — piste « Ondes » du 28/10/2026, adoucie le
   29/10 (règles §8, arbitrage 11). Pas de boîte autour des colonnes : chaque
   étape s'annonce par un grand chiffre Jakarta à sa couleur, seul endroit où
   la couleur d'étape apparaît, sur un filet gris 200 de 1 px. Les cartes
   (arrondi 14) n'ont plus de liseré : la colonne dit déjà l'étape.
   ============================================ */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    align-items: start;
}

.kanban-column {
    min-width: 0;
    scroll-margin-top: 80px;
}

.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 2px 10px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--gris-200);
}

.kanban-column-title {
    margin: 0;
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-family: inherit;
    font-size: var(--fs-3);
    font-weight: 600;
    color: var(--ink);
}

.kanban-column-title [data-filter-count] {
    order: -1;
    font-family: "Plus Jakarta Sans", sans-serif;
    font-weight: 800;
    font-size: 28px;
    line-height: 1;
    color: var(--stage, var(--gris-500));
    font-variant-numeric: tabular-nums;
}

/* Colonne vide : chiffre en gris 300, nom en gris 500, une ligne de texte */
.kanban-column.is-empty [data-filter-count] {
    color: var(--gris-300);
}

.kanban-column.is-empty .kanban-column-title {
    color: var(--gris-500);
}

/* Le « · » ne sert qu'aux lecteurs d'écran (« Soumises · 3 ») */
.kanban-sep {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

/* Ce qui attend l'utilisateur : « À valider » / « À traiter » */
.kanban-todo {
    font-size: var(--fs-1);
    font-weight: 600;
    color: #fff;
    background: var(--brand);
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

.kanban-column-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.kanban-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--bg-white);
    border: 1px solid var(--gris-200);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s;
}

.kanban-card:hover {
    border-color: var(--gris-300);
    text-decoration: none;
}

.kanban-card[hidden] {
    display: none;
}

.kanban-card-title {
    font-family: "Plus Jakarta Sans", sans-serif;
    font-weight: 700;
    font-size: 15px;
    line-height: 1.35;
    color: var(--ink);
}

.kanban-card-meta {
    font-size: var(--fs-2);
    color: var(--gris-500);
}

.kanban-card-foot {
    display: flex;
    flex-wrap: wrap; /* colonne étroite : la date passe dessous plutôt que de déborder */
    align-items: center;
    justify-content: space-between;
    gap: 6px 8px;
    margin-top: 8px;
}

.kanban-card-date {
    margin-left: auto;
    font-size: var(--fs-2);
    color: var(--gris-500);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Livraison à moins de 3 jours : teinte d'attention */
.kanban-card-date.is-soon {
    color: var(--warning);
    font-weight: 600;
}

.kanban-empty {
    margin: 0;
    padding: 4px 2px;
    font-size: var(--fs-2);
    color: var(--gris-500);
}

.kanban-empty[hidden] {
    display: none;
}

@media (max-width: 1200px) {
    .kanban-board {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        row-gap: 28px;
    }
}

/* Téléphone : les étapes l'une sous l'autre */
@media (max-width: 768px) {
    .kanban-board {
        grid-template-columns: 1fr;
        row-gap: 24px;
    }

    .kanban-column-header {
        margin-bottom: 12px;
    }
}

/* ============================================
   STRATÉGIE D'AFFICHAGE (29/10/2026) — docs/ixidia/regles-interface.md
   Des sections sur filet au lieu de cartes empilées, une bande « À faire »
   sous le titre des fiches, deux colonnes à rôle fixe.
   ============================================ */

/* Titre de section sur filet (renderSectionHead, règles IXIDIA §6) */
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gris-200); /* filet de titre de section : gris 200, 1 px (règles §6, arbitrage 7) */
}

.section-title {
    margin: 0;
    font-family: var(--font-title);
    font-size: 15px; /* règles §6 */
    font-weight: 800;
    line-height: 1.3;
    color: var(--ink);
}

.section-count {
    font-family: var(--font-family);
    font-size: var(--fs-2);
    font-weight: 600;
    color: var(--gris-500);
}

.section-aside {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.section-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--fs-2);
    font-weight: 600;
    color: var(--link);
    text-decoration: none;
}

.section-link:hover {
    text-decoration: underline;
}

.section-empty {
    padding: 14px 0;
    font-size: var(--fs-3);
    color: var(--gris-500);
}

/* Bande « À faire » (renderNextBand, règles IXIDIA §7) */
.next-band {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 28px;
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gris-200);
    background: var(--bg-white);
}

.next-band.is-mine {
    background: var(--indigo-50);
    border-color: var(--indigo-100);
}

.next-band .step-bar {
    margin: 0;
}

.next-band.is-mine .step-dot {
    background: var(--bg-white);
}

.next-band.is-mine .step.is-done .step-dot {
    background: var(--indigo-500);
}

.next-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
}

.next-text {
    min-width: 0;
}

.next-who {
    margin: 0;
    font-size: var(--fs-1);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--gris-500);
}

.next-band.is-mine .next-who {
    color: var(--indigo-700);
}

.next-what {
    margin: 2px 0 0;
    font-size: var(--fs-4);
    font-weight: 600;
    line-height: 1.45;
    color: var(--ink);
}

.next-what .due {
    margin-left: 4px;
    vertical-align: 1px;
}

.next-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
}

.next-quote {
    margin: 0;
    padding: 10px 14px;
    border-left: 3px solid var(--warning);
    border-radius: 6px;
    background: var(--bg-white);
    color: var(--ink);
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.next-quote p {
    margin: 0;
}

.next-quote footer {
    margin-top: 4px;
    font-size: var(--fs-2);
    color: var(--gris-500);
}

/* Fiche commande : les messages à gauche, le fil « Suivi » à droite */
.order-layout,
.fiche-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr);
    gap: 32px 40px;
    align-items: start;
}

/* Une voix par langue : langue, lecteur et téléchargement, puis le texte */
.order-voice {
    padding: 16px 0;
    border-bottom: 1px solid var(--gris-200);
}

.order-voice-head {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 40px;
}

.order-voice-head .lang-pill {
    flex-shrink: 0;
}

.order-voice-head audio {
    flex: 1 1 auto;
    min-width: 0;
    height: 40px;
}

.order-voice-pending {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--gris-100);
    font-size: var(--fs-2);
    color: var(--gris-500);
}

.order-voice-text {
    margin-top: 10px;
    line-height: 1.6;
    color: var(--ink);
    overflow-wrap: anywhere;
}

.order-voice-phonetics {
    margin-top: 6px;
    font-size: var(--fs-2);
    color: var(--gris-500);
}

/* Fil « Suivi » (renderOrderThread) : étapes et messages dans le même fil */
.thread-contact {
    margin: 10px 0 0;
    font-size: var(--fs-2);
    color: var(--gris-500);
    overflow-wrap: anywhere;
}

.thread-note {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: var(--warning-bg);
    color: var(--warning-text);
    font-size: var(--fs-2);
}

.thread-note strong {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.thread-note-hint {
    opacity: 0.8;
}

.thread-note p {
    margin: 4px 0 0;
    color: var(--ink);
    font-size: var(--fs-3);
    line-height: 1.5;
}

.thread {
    list-style: none;
    margin: 0;
    padding: 14px 0 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.thread-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.thread-event {
    display: flex;
    align-items: baseline;
    gap: 4px 10px;
    flex-wrap: wrap;
    margin: 0;
    font-size: var(--fs-2);
    color: var(--gris-500);
}

.thread-event::before {
    content: "";
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--gris-300);
    align-self: center;
}

.thread-event > span {
    flex: 1 1 auto;
    min-width: 0;
}

.thread-event strong {
    color: var(--gris-700);
    font-weight: 600;
}

.thread-event time {
    margin-left: auto; /* passée à la ligne, l'heure reste à droite */
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.order-thread .comment {
    max-width: 92%;
    background: var(--bg-white);
    border-color: var(--gris-200);
}

.order-thread .comment.is-mine {
    background: var(--indigo-50);
    border-color: var(--indigo-100);
}

.order-thread .comment.is-revision {
    border-left: 3px solid var(--warning);
}

.thread-more .btn-link {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: var(--fs-2);
    font-weight: 600;
    color: var(--link);
    cursor: pointer;
}

/* Les plus anciens sont repliés tant qu'on ne les demande pas (téléphone seulement) */
.thread-more {
    display: none;
}

.thread-more .btn-link {
    text-align: left;
}

.thread-more-what {
    font-weight: 400;
    color: var(--gris-500);
}

/* Ordinateur, deux colonnes : le Suivi tient dans la hauteur de l'écran et son fil
   défile seul, ouvert sur les derniers éléments ; le champ pour écrire reste en
   bas, toujours visible (app.js pose .is-panel et la hauteur, 02/11/2026). */
.order-thread.is-panel {
    position: sticky;
    top: 16px;
    display: flex;
    flex-direction: column;
    min-height: 360px;
}

.order-thread.is-panel .thread {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 10px;
    padding-bottom: 12px;
    scrollbar-width: thin;
}

.order-thread.is-panel .comment-form {
    flex: none;
    margin-top: 0;
    padding-top: 12px;
    border-top: 1px solid var(--gris-200);
}


.order-thread .comment-form {
    margin-top: 14px;
    padding: 0;
    border-top: 0;
}

.order-thread .comment-form textarea {
    min-height: 44px; /* une ligne au départ, le champ grandit en écrivant (data-autogrow) */
    max-height: 240px;
    resize: none;
}

@container (max-width: 879.98px) {
    .order-layout,
    .fiche-layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 768px) {
    .next-band {
        margin-bottom: 24px;
        padding: 14px 16px;
    }

    .next-what {
        font-size: var(--fs-3);
    }

    /* L'action du moment se colle en bas, au-dessus de la barre d'onglets (règles IXIDIA §7, §16) */
    .next-actions {
        position: fixed;
        left: 0;
        right: 0;
        bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom));
        z-index: 90;
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: 1fr;
        gap: 8px;
        padding: 10px 16px;
        background: var(--bg-white);
        border-top: 1px solid var(--gris-200);
    }

    .next-actions .btn {
        justify-content: center;
        min-height: 44px;
        padding: 8px 10px;
        white-space: normal;
        line-height: 1.2;
        text-align: center;
    }

    .next-actions .btn .ic {
        display: none;
    }

    .page-content:has(.next-actions) {
        padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom) + 84px);
    }

    .thread.is-collapsed .thread-item.is-older {
        display: none;
    }

    .thread.is-collapsed .thread-more {
        display: block;
    }

    /* Replié, le dernier message tient sur une ligne */
    .thread.is-collapsed .thread-item:not(.is-older) .comment-body {
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .order-thread .comment {
        max-width: 100%;
    }
}

/* Barre d'outils des listes (renderFilterBar, règles IXIDIA §8) : recherche + puces de filtre */
.fbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.fbar .search-box {
    flex: 0 1 280px;
    margin: 0;
}

.fbar-chips:empty {
    display: none; /* recherche seule (Équipe avec un seul studio) */
}

.fbar-chips {
    flex: 1 1 0;
    min-width: 280px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* Puce de filtre au gabarit du champ (règles §8, arbitrage 12) : même hauteur
   et même arrondi que la recherche, bordure pleine ; active = teinte de famille
   et bordure couleur d'action. Plus de pointillés. */
.fchip {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    border: 1px solid var(--gris-300);
    border-radius: var(--radius);
    background: var(--bg-white);
    font-size: var(--fs-2);
    font-weight: 500;
    color: var(--ink);
}

.fchip.is-set {
    border-color: var(--brand);
    background: var(--brand-tint);
    color: var(--indigo-700);
    font-weight: 600;
}

.fchip-details > summary {
    list-style: none;
}

.fchip-details > summary::-webkit-details-marker {
    display: none;
}

.fchip-summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    padding: 0 12px;
    border-radius: var(--radius);
    cursor: pointer;
    white-space: nowrap;
}

.fchip-summary strong {
    font-weight: 600;
    color: var(--ink);
    /* Une valeur longue (nom de société) se coupe : la barre tient sur une ligne (règles §8) */
    display: inline-block;
    vertical-align: bottom;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fchip.is-set .fchip-summary strong {
    color: inherit;
}

.fchip.is-set .fchip-summary {
    padding-right: 4px;
}

.fchip-summary .ic {
    font-size: 16px;
    color: var(--gris-500);
}

.fchip.is-set .fchip-summary .ic {
    color: inherit;
}

.fchip-summary:focus-visible,
.fchip-x:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--brand-ring);
}

.fchip-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-right: 4px;
    border-radius: 50%;
    color: var(--indigo-700);
}

.fchip-x:hover {
    background: var(--indigo-100);
}

.fchip-menu.is-right {
    left: auto;
    right: 0;
}

.fchip-menu {
    position: absolute;
    left: 0;
    top: calc(100% + 6px);
    z-index: 120;
    min-width: 220px;
    max-height: 340px;
    overflow-y: auto;
    padding: 6px;
    display: flex;
    flex-direction: column;
    background: var(--bg-white);
    border: 1px solid var(--gris-200);
    border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(18, 49, 59, 0.14);
}

.fchip-option {
    padding: 8px 10px;
    border-radius: 6px;
    font-size: var(--fs-3);
    color: var(--ink);
    text-decoration: none;
    white-space: nowrap;
}

.fchip-option:hover {
    background: var(--gris-50);
    text-decoration: none;
}

.fchip-option.is-current {
    background: var(--indigo-50);
    color: var(--indigo-700);
    font-weight: 600;
}

.fchip-dates {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding: 10px 10px 6px;
    border-top: 1px solid var(--gris-200);
}

.fchip-dates-title {
    width: 100%;
    margin: 0;
    font-size: var(--fs-2);
    font-weight: 600;
    color: var(--gris-500);
}

.fchip-dates label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--fs-2);
    color: var(--gris-700);
}

.fchip-dates input[type="date"] {
    min-height: 36px;
    padding: 0 8px;
    border: 1px solid var(--gris-300);
    border-radius: 8px;
    font-family: var(--font-family);
    font-size: var(--fs-2);
    background: var(--bg-white);
    color: var(--ink);
}

.fbar-clear {
    margin-left: 4px;
    font-size: var(--fs-2);
    font-weight: 600;
}

.fbar-result,
.fbar-elsewhere {
    margin: 0 0 6px;
    font-size: var(--fs-2);
    color: var(--gris-500);
}

.fbar-result strong {
    color: var(--gris-700);
    font-weight: 600;
}

.fbar-elsewhere {
    margin-top: 14px;
}

/* « Afficher les mois précédents » sous Terminées : un lien, un bouton
   secondaire pleine largeur sur téléphone (comme la file de travail, §8) */
.older-months {
    margin: 14px 0 6px;
    font-size: var(--fs-2);
}

.older-months-note {
    color: var(--gris-500);
}

@container (max-width: 639.98px) {
    .older-months-note {
        display: block;
        margin-bottom: 10px;
    }

    .older-months a {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        width: 100%;
        min-height: 44px;
        border: 1px solid var(--gris-300);
        border-radius: var(--radius);
        background: var(--bg-white);
        color: var(--ink);
        font-weight: 600;
        text-decoration: none;
    }
}

.fbar-elsewhere a {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-weight: 600;
}

/* Panneau « Filtres » du téléphone : caché sur ordinateur */
/* Fond, poignée et titre du panneau par le bas : sur téléphone seulement */
.fchip-backdrop,
.fchip-grab,
.fchip-menu-title {
    display: none;
}

/* Listes posées sur la page, sans cadre (règles IXIDIA §6, §8) */
.list-plain .data-table {
    background: transparent;
}

.list-plain .data-table td {
    border-bottom: 1px solid var(--gris-200);
}

.list-plain .data-table tbody tr.row-link:hover td {
    background: var(--bg-white);
}

.list-group-row th {
    padding: 22px 0 8px;
    text-align: left;
    border-bottom: 1px solid var(--gris-200); /* filet de titre de section : gris 200, 1 px (règles §6, arbitrage 7) */
    background: transparent;
}

.list-plain tbody:first-of-type .list-group-row th {
    padding-top: 8px;
}

.list-group-title {
    font-family: var(--font-title);
    font-size: 15px; /* titre de groupe sur filet, comme une section (règles §6, §8) */
    font-weight: 800;
    color: var(--ink);
}

.list-group-count {
    font-size: var(--fs-2);
    font-weight: 600;
    color: var(--gris-500);
}

.list-plain .col-date {
    white-space: nowrap;
    color: var(--gris-500);
}

.list-plain + .form-hint {
    display: block;
    margin-top: 10px;
}

.list-empty {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 20px 0;
    color: var(--gris-500);
    font-size: var(--fs-3);
}

.list-empty p {
    margin: 0;
    max-width: 60ch;
}

@media (max-width: 768px) {
    /* La recherche sur toute la largeur, puis les mêmes puces sur une ligne qui
       défile de côté ; chaque puce ouvre son menu en panneau par le bas
       (règles §8, §10, v0.4.4). Pas de bouton « Filtres · n ». */
    .fbar {
        gap: 8px;
    }

    .fbar .search-box {
        flex: 1 1 100%;
        max-width: none;
    }

    .fbar-chips,
    .section-bar .fbar-chips {
        flex: 1 1 100%;
        min-width: 0;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        padding-bottom: 2px; /* l'anneau de focus n'est pas rogné */
    }

    .fbar-chips::-webkit-scrollbar {
        display: none;
    }

    .fchip,
    .fbar-clear {
        flex-shrink: 0;
    }

    .fchip-details[open] .fchip-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 200;
        background: rgba(0, 0, 0, 0.5);
    }

    .fchip-menu,
    .fchip-menu.is-right {
        position: fixed;
        left: 0;
        right: 0;
        top: auto;
        bottom: 0;
        z-index: 201;
        min-width: 0;
        max-height: 85vh;
        gap: 2px;
        padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
        border: 0;
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.25);
        font-weight: 400;
    }

    .fchip-grab {
        display: block;
        align-self: center;
        width: 36px;
        height: 4px;
        margin-bottom: 8px;
        border-radius: 2px;
        background: var(--gris-300);
    }

    .fchip-menu-title {
        display: block;
        margin: 0 0 6px;
        font-family: var(--font-title);
        font-size: var(--fs-4);
        font-weight: 800;
        color: var(--ink);
    }

    .fchip-option {
        display: flex;
        align-items: center;
        min-height: 44px;
        padding: 0 10px;
        white-space: normal;
    }

    .fchip-dates input[type="date"] {
        font-size: 16px; /* sinon iOS zoome */
    }
}

@container (max-width: 639.98px) {

    /* Listes sans cadre : des lignes séparées par un filet, pas des cartes */
    .list-plain .data-table tbody tr,
    .list-plain .data-table tbody tr:last-child {
        background: transparent;
        border: 0;
        border-bottom: 1px solid var(--gris-200);
        border-radius: 0;
        margin: 0;
        padding: 12px 0;
    }

    .list-plain .data-table tbody tr.list-group-row {
        display: block;
        padding: 18px 0 8px;
        border-bottom: 1px solid var(--gris-200); /* filet de titre de section : gris 200, 1 px (règles §6, arbitrage 7) */
    }

    .list-plain tbody:first-of-type tr.list-group-row {
        padding-top: 4px;
    }

    .list-plain .list-group-row th {
        display: block;
        padding: 0;
        border: 0;
    }

    .list-plain .data-table td {
        border-bottom: 0;
    }

    .list-plain .col-voices {
        display: none !important;
    }

    /* La date rejoint la ligne de faits, à gauche sous l'intitulé (règles §8,
       « lignes compactes ») : seule à droite, elle flottait au milieu de la ligne. */
    .list-plain .data-table.order-list .col-date,
    .list-plain .data-table.order-list tr:has(.col-actions .btn-icon) .col-date {
        grid-column: 1 / 3;
        text-align: left;
    }
}

/* Une ligne qui ouvre une commande garde son chevron sur zone étroite
   (règles §8 : « un chevron gris la termine »), dans une 4e colonne. */
@container (max-width: 639.98px) {
    .data-table.order-list tbody tr:has(> .col-chevron) {
        grid-template-columns: minmax(0, 1fr) auto auto 16px;
    }

    .data-table.order-list tr:has(> .col-chevron) .col-actions:has(.btn) {
        grid-column: 1 / 4;
    }

    .data-table.order-list .col-chevron {
        display: block;
        grid-column: 4;
        grid-row: 1 / span 2;
        align-self: center;
        width: auto;
    }
}

/* ============================================
   LOT B (29/10/2026) — fiche client, Accueil, listes de l'administration
   ============================================ */

/* Grands chiffres en tuiles (renderFigures, règles IXIDIA §6, arbitrage 6) :
   une carte par chiffre, qui ouvre ou filtre son ensemble. Le chiffre prend la
   teinte de son état ; la tuile active prend la teinte de famille. Jamais de
   souligné sous un chiffre (il s'empilait avec le filet du titre de section). */
.figs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 32px;
}

.fig {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 16px;
    background: var(--bg-white);
    border: 1px solid var(--gris-200);
    border-radius: var(--radius-lg);
    color: var(--ink);
    text-decoration: none;
}

.fig:hover {
    text-decoration: none;
    border-color: var(--gris-300);
}

.fig-n {
    font-family: var(--font-title);
    font-size: 36px;
    font-weight: 800;
    line-height: 1.1;
    color: var(--fig);
    font-variant-numeric: tabular-nums;
}

.fig-label {
    font-size: var(--fs-3);
    font-weight: 600;
    color: var(--gris-700);
}

.fig:hover .fig-label {
    color: var(--ink);
}

/* Tuile active : teinte de famille, bordure couleur d'action, libellé en « texte sur la teinte » */
.fig.is-current,
.fig.is-current:hover {
    background: var(--indigo-50);
    border-color: var(--brand);
}

.fig.is-current .fig-label {
    color: var(--indigo-700);
}

.fig.is-zero .fig-n {
    color: var(--gris-300);
}

.fig:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--brand-ring);
}

/* Fiche : le sujet à gauche, l'accompagnement à droite (.fiche-layout partage la grille d'.order-layout) */
.fiche-aside {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.section-bar {
    margin-top: 14px;
}

.section-bar .fbar-chips {
    flex: 0 1 auto;
    min-width: 0;
}

/* Dans une colonne de fiche, le titre de la commande prend la place ; le reste se serre */
.fiche-subject .order-list .col-main {
    width: 100%;
}

.fiche-subject .order-list .col-status,
.fiche-subject .order-list .col-date {
    white-space: nowrap;
}

button.section-link {
    padding: 0;
    border: 0;
    background: none;
    font-family: inherit;
    cursor: pointer;
}

/* Petites listes d'une fiche (personnes, clés) : une ligne par élément, sans cadre */
.item-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--gris-200);
}

.item-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.item-text .cell-meta {
    overflow-wrap: anywhere;
}

.item.is-suspended .cell-title {
    opacity: 0.6;
}

.item .row-menu,
.item > .btn {
    flex-shrink: 0;
}

.person {
    display: flex;
    align-items: center;
    gap: 12px;
}

.person > span:last-child {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* « 1 à valider », « 3 au studio » dans une ligne de liste : le chiffre à la couleur de l'étape */
.count-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 12px;
    font-size: var(--fs-2);
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
}

.count-tag::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--fig);
}

/* Accueil : chaque groupe est une section sur filet, la liste posée dessous */
.home-section + .home-section,
.home-section + .section-head {
    margin-top: 36px;
}

/* Un texte posé sous un titre de section ne colle pas au filet */
.home-section > .section-head + p {
    margin-top: 12px;
}

/* Réglages › Équipe : les comptes client à rattacher, sous la liste des comptes studio */
.reglages-orphans {
    margin-top: 36px;
}

.home-section .list-plain {
    margin-top: 2px;
}

/* Les groupes de l'Accueil s'alignent d'une section à l'autre */
@container (min-width: 640px) {
    .home-section .order-list {
        table-layout: fixed;
    }

    .home-section .order-list .col-main { width: 44%; }
    .home-section .order-list .col-voices { width: 18%; }
    .home-section .order-list .col-status { width: 17%; }
    .home-section .order-list .col-chevron { width: 44px; }
    .home-section .order-list .col-actions { width: 38%; }
}

.list-plain .badge + .badge {
    margin-left: 6px;
}

@container (max-width: 639.98px) {
    .figs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin-bottom: 24px;
    }

    .fig {
        padding: 12px 14px;
    }

    .fig-n {
        font-size: 28px;
    }

    .fig-label {
        font-size: var(--fs-2);
    }

    .fiche-aside {
        margin-top: 8px;
    }

    /* Listes d'administration sans cadre : le titre et ses actions sur une ligne,
       les détails dessous, sans libellés de colonne */
    .list-plain .data-table.admin-list tbody tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 6px 12px;
    }

    .list-plain .data-table.admin-list tbody td {
        grid-column: 1;
        margin: 0;
        padding: 0;
        border: 0;
        text-align: left;
    }

    .list-plain .data-table.admin-list tbody td::before {
        display: none;
    }

    .list-plain .data-table.admin-list .col-main {
        grid-row: 1;
    }

    .list-plain .data-table.admin-list .col-actions,
    .list-plain .data-table.admin-list tr.row-link .col-chevron {
        position: static;
        grid-column: 2;
        grid-row: 1;
        margin: 0;
        padding: 0;
        border: 0;
    }

    .list-plain .data-table.admin-list .col-date {
        display: block;
    }
}

/* Un numéro de téléphone ne se coupe pas */
.cell-meta a[href^="tel:"] {
    white-space: nowrap;
}

/* Rond de ligne (règles §9, arbitrage 19) : appeler ou écrire depuis une ligne
   de liste. Icône seule, fond teinte de famille, 36 px à la souris, 44 px au doigt. */
.btn-round {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--brand-tint);
    color: var(--indigo-700);
    font-size: 16px;
    text-decoration: none;
    flex-shrink: 0;
}

.btn-round:hover {
    background: var(--indigo-100);
}

@media (pointer: coarse) {
    .btn-round {
        width: 44px;
        height: 44px;
    }
}

.data-table .col-contact {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.nowrap {
    white-space: nowrap;
}

/* Annuaire (liste Clients, règles IXIDIA §8) : sur zone étroite, une carte par
   client, en défilement continu ; les listes de suivi (Commandes) restent en lignes */
@container (max-width: 639.98px) {
    /* Le rond « Appeler » à droite du nom, avant le chevron */
    .list-annuaire .data-table.admin-list tbody tr {
        grid-template-columns: minmax(0, 1fr) auto auto;
    }

    .list-annuaire .data-table.admin-list .col-contact {
        grid-column: 2;
        grid-row: 1;
        width: auto;
    }

    .list-annuaire .data-table.admin-list tr.row-link .col-chevron {
        grid-column: 3;
    }

    .list-annuaire .data-table.admin-list .col-contact:not(:has(a)) {
        display: none;
    }

    .list-annuaire .data-table.admin-list tbody tr,
    .list-annuaire .data-table.admin-list tbody tr:last-child {
        background: var(--bg-white);
        border: 1px solid var(--gris-200);
        border-radius: var(--radius-lg);
        margin-bottom: 10px;
        padding: 14px 16px;
    }

    .list-annuaire .data-table.admin-list tbody tr.row-suspended {
        background: transparent;
    }

    /* Valeur absente : « — » dans une cellule de tableau, rien sur une carte (règles §14) */
    .list-annuaire .cell-empty {
        display: none;
    }
}

/* ============================================
   LOT C (29/10/2026) — formulaires en page (commander.php) et Mon compte
   ============================================ */

/* Gabarit Formulaire (règles IXIDIA §5) : les étapes à gauche, le récapitulatif à droite */
.form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
    gap: 32px 48px;
    align-items: start;
}

.form-steps {
    display: flex;
    flex-direction: column;
    gap: 36px;
    min-width: 0;
}

.form-step-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 18px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gris-200); /* filet de titre de section : gris 200, 1 px (règles §6, arbitrage 7) */
    font-family: var(--font-title);
    font-size: var(--fs-4);
    font-weight: 800;
    color: var(--ink);
}

.form-step-head .label-optional {
    font-family: var(--font-family);
    font-size: var(--fs-2);
}

.form-step-n {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--ink);
    color: var(--bg-white);
    font-size: 13px;
    font-weight: 700;
}

.form-narrow {
    max-width: 340px;
}

/* Les textes par langue : séparés par un filet, pas encadrés */
.form-step .lang-block {
    margin: 0;
    padding: 16px 0 4px;
    border: 0;
    border-top: 1px solid var(--gris-200);
    border-radius: 0;
}

.form-step .lang-block:first-child {
    border-top: 0;
    padding-top: 0;
}

/* Le récapitulatif reste visible pendant la saisie, avec le bouton final */
.form-recap {
    position: sticky;
    top: 24px;
    padding: 20px;
    border: 1px solid var(--gris-200);
    border-radius: var(--radius-lg);
    background: var(--bg-white);
}

.form-recap-title {
    margin: 0 0 8px;
    font-family: var(--font-title);
    font-size: var(--fs-4);
    font-weight: 800;
    color: var(--ink);
}

.recap-lines {
    margin: 0;
}

.recap-lines > div {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 12px;
    padding: 9px 0;
    border-top: 1px solid var(--gris-100);
    font-size: var(--fs-2);
}

.recap-lines > div:first-child {
    border-top: 0;
}

.recap-lines dt {
    color: var(--gris-500);
}

.recap-lines dd {
    margin: 0;
    color: var(--ink);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.recap-lang {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 10px;
    color: var(--gris-500);
}

.recap-lang.is-done {
    color: var(--success);
}

.recap-note {
    margin: 12px 0 16px;
    font-size: var(--fs-2);
    line-height: 1.5;
    color: var(--gris-500);
}

.recap-note strong {
    color: var(--ink);
}

.form-submit {
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
}

.form-submit .btn {
    justify-content: center;
}

@container (max-width: 879.98px) {
    .form-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .form-recap {
        position: static;
    }
}

@media (max-width: 768px) {

    /* Les boutons se collent en bas, au-dessus de la barre d'onglets (règles IXIDIA §16) */
    .form-submit {
        position: fixed;
        left: 0;
        right: 0;
        bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom));
        z-index: 90;
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: 1fr;
        flex-direction: row;
        padding: 10px 16px;
        background: var(--bg-white);
        border-top: 1px solid var(--gris-200);
    }

    .form-submit {
        grid-auto-columns: minmax(0, 1fr);
    }

    .form-submit .btn {
        min-height: 44px;
        padding-left: 8px;
        padding-right: 8px;
        white-space: normal;
    }

    .form-submit .btn .ic {
        display: none;
    }

    .page-content:has(.form-submit) {
        padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom) + 84px);
    }
}

@container (max-width: 639.98px) {
    .form-narrow {
        max-width: none;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

/* ============================================
   FILETS DE LIGNE (règles IXIDIA §6, v0.3 du 29/10/2026)
   Dans une section, les éléments se séparent par un filet gris 100 de 1 px,
   placé ENTRE deux éléments : rien après le dernier, le filet du titre suffit
   au-dessus. Les cartes (annuaire sur zone étroite) gardent leur bordure.
   ============================================ */
.list-plain .data-table tbody tr,
.list-plain .data-table td,
.item-list > .item,
.order-voice {
    border-bottom-color: var(--gris-100);
}

.list-plain .data-table tbody tr:last-child,
.list-plain .data-table tbody tr:last-child td,
.item-list > .item:last-child,
.order-voice:last-child {
    border-bottom: 0;
}

@container (max-width: 639.98px) {
    .list-plain .data-table tbody tr {
        border-bottom-color: var(--gris-100);
    }

    .list-plain .data-table tbody tr:last-child {
        border-bottom: 0;
    }

    .list-annuaire .data-table.admin-list tbody tr:last-child {
        border: 1px solid var(--gris-200);
    }
}

/* ============================================
   NOUVEAUTÉS (règles IXIDIA §12, arbitrage 24, 03/11/2026)
   L'entrée au-dessus de la carte du compte (icône seule sur tablette, ligne
   de la page Menu sur téléphone), son point, le panneau de droite (400 px),
   la page du téléphone et la fenêtre de mise en avant (480 px). Le contenu
   vient du fichier publié sur whatsnew : app.js, « NOUVEAUTÉS ».
   ============================================ */
.whatsnew-entry {
    position: relative;
}

.whatsnew-icon {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
}

/* Le point : couleur d'action, jamais rouge, jamais de chiffre dedans */
.whatsnew-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--brand-ink);
}

.whatsnew-icon .whatsnew-dot {
    position: absolute;
    top: -3px;
    right: -4px;
    box-shadow: 0 0 0 2px var(--bg-white);
}

.tabbar-icon .tabbar-dot {
    position: absolute;
    top: -2px;
    right: -6px;
    box-shadow: 0 0 0 2px var(--bg-white);
}

.menu-screen-whatsnew {
    margin-top: -8px;
}

/* --- Panneau : à droite, par-dessus l'écran sans le cacher entièrement --- */
.whatsnew-veil {
    position: fixed;
    inset: 0;
    z-index: 180;
    background: rgba(18, 49, 59, 0.32);
}

/* Au-delà de 1200 px, le reste de l'écran n'est pas assombri ; un clic à côté ferme quand même */
@media (min-width: 1200px) {
    .whatsnew-veil {
        background: transparent;
    }
}

.whatsnew-panel {
    position: fixed;
    top: var(--env-banner-height);
    right: 0;
    bottom: 0;
    z-index: 190;
    width: 400px;
    max-width: 100vw;
    display: flex;
    flex-direction: column;
    background: var(--bg-white);
    border-left: 1px solid var(--gris-200);
    box-shadow: -12px 0 32px rgba(18, 49, 59, 0.16);
}

.whatsnew-panel[hidden] {
    display: none;
}

.whatsnew-panel:focus {
    outline: none;
}

.whatsnew-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 16px 16px 12px 24px;
    border-bottom: 1px solid var(--gris-200);
}

.whatsnew-panel-head h2 {
    font-size: 18px;
    font-weight: 800;
    color: var(--ink);
}

.whatsnew-panel .close-btn,
.whatsnew-feature .close-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: none;
    border: none;
    border-radius: var(--radius);
    font-size: 20px;
    color: var(--gris-500);
    cursor: pointer;
}

.whatsnew-panel .close-btn:hover,
.whatsnew-feature .close-btn:hover {
    background: var(--gris-100);
    color: var(--ink);
}

.whatsnew-panel-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 24px 16px;
}

.whatsnew-foot {
    padding: 12px 24px 16px;
    border-top: 1px solid var(--gris-200);
    font-size: var(--fs-2);
    color: var(--gris-500);
}

@media (prefers-reduced-motion: no-preference) {
    .whatsnew-panel:not([hidden]) {
        animation: whatsnewIn 0.2s ease-out;
    }

    @keyframes whatsnewIn {
        from { transform: translateX(24px); opacity: 0.6; }
    }
}

/* --- Une annonce : étiquette, date, point « non lue », titre, texte, image, lien --- */
.whatsnew-item {
    display: grid;
    gap: 10px;
    padding: 20px 0;
    border-top: 1px solid var(--gris-200);
    min-width: 0;
}

.whatsnew-item:first-child {
    border-top: 0;
}

.whatsnew-item-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--fs-2);
    color: var(--gris-500);
}

.whatsnew-item-head .whatsnew-dot {
    margin-left: auto;
}

.whatsnew-item h3 {
    font-family: var(--font-family);
    font-size: var(--fs-4);
    font-weight: 600;
    line-height: 1.35;
    color: var(--ink);
    text-wrap: balance;
}

/* Les lues ont un titre moins gras */
.whatsnew-item.is-read h3 {
    font-weight: 500;
}

.whatsnew-text {
    display: grid;
    gap: 8px;
    color: var(--gris-500);
    overflow-wrap: break-word;
}

.whatsnew-text ul,
.whatsnew-text ol {
    padding-left: 20px;
}

.whatsnew-text a {
    color: var(--link);
}

.whatsnew-text figure {
    display: grid;
    gap: 4px;
}

.whatsnew-text img,
.whatsnew-text video {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
}

.whatsnew-text figcaption {
    font-size: var(--fs-2);
}

/* Image de une : 16:9, arrondi 10 px */
.whatsnew-visual {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--gris-200);
    background: var(--gris-100);
}

.whatsnew-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    justify-self: start;
    min-height: 32px;
    font-weight: 600;
    color: var(--link);
}

.whatsnew-empty {
    padding: 20px 0;
    color: var(--gris-500);
}

/* Trois étiquettes, pas plus */
.whatsnew-tag {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: var(--fs-1);
    font-weight: 600;
    white-space: nowrap;
}

.whatsnew-tag-nouveau {
    background: var(--indigo-50);
    color: var(--indigo-700);
}

.whatsnew-tag-ameliore {
    background: var(--success-bg);
    color: var(--success);
}

.whatsnew-tag-corrige {
    background: var(--gris-100);
    color: var(--neutre);
}

/* --- Page du téléphone (nouveautes.php), ouverte depuis Menu --- */
.whatsnew-page {
    display: flex;
    flex-direction: column;
    max-width: 640px;
}

.whatsnew-page .whatsnew-foot {
    padding: 16px 0 0;
}

/* --- Mise en avant : la fenêtre commune, 480 px --- */
.modal.whatsnew-feature {
    max-width: 480px;
    padding: 20px;
    display: grid;
    gap: 14px;
}

.whatsnew-feature-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: -6px -8px -4px 0;
}

.whatsnew-feature h2 {
    font-size: 20px;
    font-weight: 800;
    line-height: 1.25;
    color: var(--ink);
    text-wrap: balance;
}

.whatsnew-feature-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 4px;
}

@media (pointer: coarse) {
    .whatsnew-action {
        min-height: 44px;
    }

    .whatsnew-panel .close-btn,
    .whatsnew-feature .close-btn {
        width: 44px;
        height: 44px;
    }
}

/* Sur téléphone : panneau par le bas, boutons empilés, le principal en premier */
@media (max-width: 768px) {
    .modal.whatsnew-feature {
        padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
    }

    .whatsnew-feature-actions {
        flex-direction: column-reverse;
    }

    .whatsnew-feature-actions .btn {
        width: 100%;
        min-height: 44px;
        justify-content: center;
    }
}

/* ============================================
   MODE SOMBRE — valeurs de docs/ixidia/jetons.md, réglage de l'appareil
   suivi par défaut (« Système », règles §17 et §18).
   Les gris et l'indigo gardent leur RÔLE : gris-50 reste le fond de page,
   --ink le texte, indigo-50 / 700 la rubrique active. Le bouton principal
   ne change pas.
   ============================================ */
/* « Système » (par défaut) suit l'appareil, sauf si l'utilisateur a choisi « Clair » */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;

        --gris-50: #0E1A1F;
        --gris-100: #23343A;
        --gris-200: #2A3F47;
        --gris-300: #3A5058;
        --gris-400: #6B7E85;
        --gris-500: #9AAAB0;
        --gris-700: #E8EEF0;
        --ink: #E8EEF0;
        --bg-white: #15252B;           /* cartes, barre latérale, fenêtres */
        --avatar: #2A4A55;
        --neutre: #A3B3B9;

        --indigo-50: #231E52;          /* rubrique active, fonds d'accent */
        --indigo-100: #2E2766;
        --indigo-700: #B9B0FF;         /* texte sur fond d'accent */
        --link: #B9B0FF;
        --brand-word: #B9B0FF;         /* « Sound » sur fond sombre (charte) */
        --brand-ring: rgba(185, 176, 255, 0.5);
        --brand-ring-soft: rgba(185, 176, 255, 0.3);

        --success: #4ADE80;
        --success-bg: #0F2E1C;
        --warning: #FBBF24;
        --warning-bg: #33270A;
        --warning-text: #FBBF24;
        --danger: #F87171;
        --danger-bg: #3A1414;
        --danger-text: #F87171;
    }
    /* Pastilles d'étape : fond foncé teinté, texte clair */
    :root:not([data-theme="light"]) .badge-draft { --chip-bg: #23343A; --chip-fg: #A3B3B9; }
    :root:not([data-theme="light"]) .badge-submitted { --chip-bg: #172554; --chip-fg: #93C5FD; }
    :root:not([data-theme="light"]) .badge-production { --chip-bg: #33270A; --chip-fg: #FBBF24; }
    :root:not([data-theme="light"]) .badge-review { --chip-bg: #3B0F2A; --chip-fg: #F9A8D4; }
    :root:not([data-theme="light"]) .badge-revision { --chip-bg: #332B0A; --chip-fg: #FDE047; }
    :root:not([data-theme="light"]) .badge-delivered { --chip-bg: #0F2E1C; --chip-fg: #4ADE80; }
    :root:not([data-theme="light"]) .badge-scheduled { --chip-bg: #0B2E2B; --chip-fg: #5EEAD4; }
    :root:not([data-theme="light"]) .badge-cancelled { --chip-bg: #3A1414; --chip-fg: #F87171; }
    /* Couleurs d'étape (chiffres et filets du Kanban) : les teintes claires des pastilles */
    :root:not([data-theme="light"]) {
        --badge-submitted: #93C5FD;
        --badge-production: #FBBF24;
        --badge-review: #F9A8D4;
        --badge-revision: #FDE047;
        --badge-draft: #A3B3B9;
        --badge-delivered: #4ADE80;
        --badge-cancelled: #F87171;
    }
    :root:not([data-theme="light"]) .toast, :root:not([data-theme="light"]) .modal, :root:not([data-theme="light"]) .whatsnew-panel {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    }
}

/* Choix « Sombre » dans Mon compte › Préférences (data-theme posé par header.php) */
:root[data-theme="dark"] {
        color-scheme: dark;

        --gris-50: #0E1A1F;
        --gris-100: #23343A;
        --gris-200: #2A3F47;
        --gris-300: #3A5058;
        --gris-400: #6B7E85;
        --gris-500: #9AAAB0;
        --gris-700: #E8EEF0;
        --ink: #E8EEF0;
        --bg-white: #15252B;           /* cartes, barre latérale, fenêtres */
        --avatar: #2A4A55;
        --neutre: #A3B3B9;

        --indigo-50: #231E52;          /* rubrique active, fonds d'accent */
        --indigo-100: #2E2766;
        --indigo-700: #B9B0FF;         /* texte sur fond d'accent */
        --link: #B9B0FF;
        --brand-word: #B9B0FF;         /* « Sound » sur fond sombre (charte) */
        --brand-ring: rgba(185, 176, 255, 0.5);
        --brand-ring-soft: rgba(185, 176, 255, 0.3);

        --success: #4ADE80;
        --success-bg: #0F2E1C;
        --warning: #FBBF24;
        --warning-bg: #33270A;
        --warning-text: #FBBF24;
        --danger: #F87171;
        --danger-bg: #3A1414;
        --danger-text: #F87171;
    }
:root[data-theme="dark"] .badge-draft { --chip-bg: #23343A; --chip-fg: #A3B3B9; }
:root[data-theme="dark"] .badge-submitted { --chip-bg: #172554; --chip-fg: #93C5FD; }
:root[data-theme="dark"] .badge-production { --chip-bg: #33270A; --chip-fg: #FBBF24; }
:root[data-theme="dark"] .badge-review { --chip-bg: #3B0F2A; --chip-fg: #F9A8D4; }
:root[data-theme="dark"] .badge-revision { --chip-bg: #332B0A; --chip-fg: #FDE047; }
:root[data-theme="dark"] .badge-delivered { --chip-bg: #0F2E1C; --chip-fg: #4ADE80; }
:root[data-theme="dark"] .badge-scheduled { --chip-bg: #0B2E2B; --chip-fg: #5EEAD4; }
:root[data-theme="dark"] .badge-cancelled { --chip-bg: #3A1414; --chip-fg: #F87171; }
:root[data-theme="dark"] {
        --badge-submitted: #93C5FD;
        --badge-production: #FBBF24;
        --badge-review: #F9A8D4;
        --badge-revision: #FDE047;
        --badge-draft: #A3B3B9;
        --badge-delivered: #4ADE80;
        --badge-cancelled: #F87171;
    }
:root[data-theme="dark"] .toast, :root[data-theme="dark"] .modal, :root[data-theme="dark"] .whatsnew-panel {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    }

/* Messages des échanges (lot 3), affichés dans le fil « Suivi » de la commande */
.comment {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--gris-50);
    border: 1px solid var(--gris-100);
}

.comment.is-studio {
    background: var(--indigo-50);
    border-color: var(--indigo-100);
}

.comment.is-mine {
    align-self: flex-end;
}

.comment-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    margin-bottom: 4px;
    font-size: var(--fs-2);
    color: var(--gris-500);
}

.comment-meta strong {
    color: var(--ink);
    font-weight: 700;
}

.comment-meta time {
    margin-left: auto;
}

.comment-body {
    color: var(--ink);
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.comment-form {
    padding: 14px 18px 18px;
    border-top: 1px solid var(--gris-100);
    margin-top: 10px;
}

.comment-form .form-group {
    margin-bottom: 0;
}

.comment-form textarea {
    resize: vertical;
    min-height: 72px;
}

.comment-form-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin-top: 10px;
}

.comment-form-foot .form-hint {
    margin: 0;
}

@container (max-width: 639.98px) {
    .comment { max-width: 100%; }
    .comment-form-foot .btn { width: 100%; justify-content: center; }
}

/* Kanban : nombre de messages dans les échanges, à côté de la date */
.kanban-card-comments {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    font-size: var(--fs-2);
    font-variant-numeric: tabular-nums;
    color: var(--gris-500);
}

.kanban-card-comments .ic {
    width: 14px;
    height: 14px;
}

.kanban-card-comments + .kanban-card-date {
    margin-left: 0;
}

/* Le dernier message vient de l'autre côté : une réponse est attendue */
.kanban-card-comments.is-awaiting {
    color: var(--link);
    font-weight: 600;
}

/* Second pied de carte : numéro de retour, ancienneté à l'étape, note interne */
.kanban-card-facts {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: var(--fs-2);
    color: var(--gris-500);
    font-variant-numeric: tabular-nums;
}

.kanban-card-note {
    display: inline-flex;
    margin-left: auto;
}

.kanban-card-note .ic {
    width: 14px;
    height: 14px;
}

/* ============================================
   CIBLES TACTILES
   44 px dès qu'on pointe au doigt (téléphone, iPad, tablette Android),
   40 px à la souris, quelle que soit la largeur de l'écran (arbitrage 15,
   jetons.md). Champs, puces, boutons et navigation changent ensemble : la
   barre de filtres reste alignée.
   ============================================ */
@media (pointer: coarse) {
    .fchip,
    .fchip-dates input[type="date"],
    .form-group input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
    .form-group select {
        min-height: 44px;
    }

    .fchip-summary {
        min-height: 42px;
    }
}

@media (pointer: coarse) {
    .search-box {
        min-height: 44px;
    }

    .search-box input {
        align-self: stretch;
    }

    .btn,
    .btn-sm,
    .data-table .btn-sm,
    .tab-item,
    .segmented button,
    .row-menu-item,
    .pagination-btn,
    .nav-item,
    .topbar-brand,
    .fchip-option {
        min-height: 44px;
    }

    .fchip-option {
        display: flex;
        align-items: center;
    }

    .btn-icon {
        width: 44px;
        height: 44px;
    }

    .row-menu-spacer {
        width: 44px;
    }

    /* Petits liens d'action (« + Ajouter », croix d'une puce, « Effacer ») :
       la zone touchable grandit sans changer le dessin. */
    .section-link,
    .fchip-x,
    .fbar-clear,
    .thread-more .btn-link {
        position: relative;
    }

    .section-link::after,
    .fbar-clear::after,
    .thread-more .btn-link::after {
        content: "";
        position: absolute;
        inset: -14px -6px;
    }

    .fchip-x::after {
        content: "";
        position: absolute;
        inset: -8px;
    }
}

/* ============================================
   PEU DE GRAS SUR TÉLÉPHONE (§16, arbitrage 13)
   Semi-gras et gras : titres de page et de section, élément du moment
   (« À traiter », action suivante, onglet actif) et retards. Le reste
   — noms dans une liste, dates, liens, onglets inactifs — en graisse normale ;
   pastilles et liens d'action en moyen (500).
   ============================================ */
@media (max-width: 768px) {
    .cell-title,
    .kanban-card-date.is-soon,
    .due-soon,
    .voice,
    .lang-pill .lang-code,
    .fig-label,
    .section-count,
    .list-group-count,
    .tab-item:not(.active),
    .tabbar-item:not(.active),
    .segmented button:not([aria-current="true"]),
    .recap-lines dd,
    .account-name {
        font-weight: 400;
    }

    .badge,
.count-tag,
.lang-pill,
.mobile-back,
.section-link,
.thread-more .btn-link,
.comment-meta strong {
        font-weight: 500;
    }

    /* Jakarta n'est chargée qu'en 700 et 800 : le nom d'une carte passe en Inter */
    .kanban-card-title {
        font-family: var(--font-family);
        font-weight: 500;
    }
}

/* Sur téléphone, toute fenêtre devient un panneau par le bas (règles §10, v0.4.4) */
@media (max-width: 768px) {
    .modal-overlay.active {
        align-items: flex-end;
        padding: 0;
    }

    .modal-overlay .modal {
        max-width: none;
        width: 100%;
        max-height: 90vh;
        margin: 0;
        border: none;
        border-radius: 18px 18px 0 0;
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ============================================
   BOUTON FLOTTANT DU TÉLÉPHONE (règles §3, revue v0.4)
   L'action de création de la page (« Passer une commande », « Nouveau
   client »…) quitte l'en-tête : bouton de 52 px en bas à droite, icône et
   verbe, au-dessus de la barre d'onglets. Rendu par includes/header.php.
   ============================================ */
.mobile-fab {
    display: none;
}

@media (max-width: 768px) {
    .mobile-fab {
        display: block;
        position: fixed;
        right: 16px;
        bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom) + 16px);
        z-index: 140;
    }

    .mobile-fab .btn {
        min-height: 52px;
        height: 52px;
        padding: 0 20px;
        border-radius: 999px;
        box-shadow: 0 12px 32px rgba(18, 49, 59, 0.14); /* même ombre que les menus flottants */
    }

    .mobile-fab .btn .ic {
        font-size: 20px;
    }

    /* Le contenu et les toasts laissent la place au bouton */
    .main-content:has(.mobile-fab) .page-content {
        padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom) + 88px);
    }

    body:has(.mobile-fab) .toast-container {
        bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom) + 80px);
    }
}

/* ============================================
   CLAVIER OUVERT SUR TÉLÉPHONE (règles §3, §24)
   app.js pose html.clavier-ouvert pendant la saisie : la barre d'onglets,
   le bouton flottant et les boutons de la bande « À faire » s'effacent ;
   les boutons d'un formulaire restent, collés en bas.
   ============================================ */
@media (max-width: 768px) {
    html.clavier-ouvert .tabbar,
    html.clavier-ouvert .mobile-fab,
    html.clavier-ouvert .next-actions {
        display: none;
    }

    html.clavier-ouvert .form-submit {
        bottom: 0;
    }

    html.clavier-ouvert .page-content {
        padding-bottom: 84px;
    }
}

/* Suivi : messages entre IXIDIA et le studio, que le client ne voit pas (02/11/2026) */
.order-thread .comment.is-internal {
    border-style: dashed;
    border-color: var(--gris-300);
    background: var(--bg-main);
}

.comment-tag {
    font-size: var(--fs-1, 12px);
    font-weight: 600;
    color: var(--gris-500);
}

/* Le studio et l'admin choisissent à qui ils écrivent */
.comment-to {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin: 0 0 8px;
    padding: 0;
    border: 0;
    font-size: var(--fs-2);
}

.comment-to label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    cursor: pointer;
    color: var(--gris-700);
}

/* Kanban : « à répondre » écrit en clair, la couleur seule ne se lit pas sur téléphone */
.kanban-card-awaiting {
    font-weight: 600;
}

/* Fiche commande, grand écran (à partir de 1 100 px, 02/11/2026, demande de Dave) :
   le Suivi occupe tout le tiers droit, du haut au bas de l'écran ; le titre, la
   bande d'étapes et les messages occupent les deux tiers de gauche. Exception au
   gabarit « Fiche » (en-tête sur toute la largeur), à signaler à IXIDIA Design. */
@media (min-width: 1100px) {
    :root {
        --suivi-width: clamp(340px, calc((100vw - var(--sidebar-width)) / 3), 460px);
    }

    .main-content:has(.order-thread.is-side) {
        padding-right: var(--suivi-width);
    }

    .order-layout:has(.order-thread.is-side) {
        grid-template-columns: minmax(0, 1fr);
    }

    .order-thread.is-side {
        position: fixed;
        top: var(--env-banner-height);
        right: 0;
        bottom: 0;
        z-index: 5;
        width: var(--suivi-width);
        height: auto;
        min-height: 0;
        padding: 22px 20px 16px;
        background: var(--bg-white);
        border-left: 1px solid var(--gris-200);
    }
}


/* ============================================
   BANDE DU HAUT (règles §3, arbitrage 28) — ordinateur et tablette : 56 px,
   fond de surface, filet gris 200 ; logo à gauche, Nouveautés et compte à
   droite. Elle reste en place au défilement ; la barre latérale passe dessous.
   ============================================ */
:root {
    --topbar-height: 56px;
}

.topbar {
    position: sticky;
    top: var(--env-banner-height);
    z-index: 110;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-height);
    padding: 0 16px 0 18px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--gris-200);
}

.topbar-end {
    display: flex;
    align-items: center;
    gap: 4px;
}

.topbar-icon,
.topbar-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    color: var(--gris-600);
    cursor: pointer;
}

.topbar-icon:hover {
    background: var(--gris-100);
    text-decoration: none;
}

.topbar-icon .ic {
    font-size: 18px;
}

.topbar-icon.active {
    background: var(--indigo-50);
    color: var(--indigo-700);
}

.topbar-avatar .account-avatar {
    width: 32px;
    height: 32px;
    font-size: var(--fs-1);
}

/* Menu ouvert : anneau couleur d'action autour des initiales */
.topbar-account[open] .account-avatar,
.topbar-avatar.active .account-avatar {
    box-shadow: 0 0 0 2px var(--bg-white), 0 0 0 4px var(--brand-ink);
}

@media (pointer: coarse) {
    .topbar-icon,
    .topbar-avatar {
        width: 44px;
        height: 44px;
    }
}

@media (max-width: 768px) {
    .topbar {
        display: none;
    }
}
