/* ============================================
   ProdOrder - Style principal
   Design inspiré IXIDIA BusinessPlan
   ============================================ */

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

:root {
    /* Top bar - gris foncé IXIDIA */
    --topbar-bg: #4C5156;
    --topbar-height: 40px;

    /* Sidebar - gris clair IXIDIA */
    --sidebar-bg: #DADADC;
    --sidebar-hover: #CDCDD0;
    --sidebar-text: #555;
    --sidebar-text-active: #222;
    --sidebar-width: 220px;

    /* Content header */
    --header-bg: #ffffff;
    --header-border: #d8dbe0;
    --header-height: 50px;

    /* Couleurs principales */
    --primary: #00B4D8;
    --primary-light: #33c4e2;
    --brand: #00B4D8;
    /* Cyan assombri pour tout ce qui porte du texte ou reçoit du blanc :
       #fff sur #00B4D8 ne fait que 2,5:1, très en dessous des 4,5:1 requis.
       #fff sur #00758F = 5,4:1. --brand reste pour le purement décoratif
       (filet de nav active, bordure de focus, ombres). */
    --brand-ink: #00758F;
    --brand-ink-hover: #005f75;
    --success: #2a8642;
    --warning: #f5a623;
    --danger: #d73e31;
    /* --danger sert de fond (bouton, bordure) ; pour du texte rouge sur
       fond clair il faut descendre plus bas : 4,81:1 sur #F5F5F5. */
    --danger-text: #c73729;
    --info: #4a90d9;

    /* Fonds & textes */
    --bg-main: #F5F5F5;
    --bg-white: #ffffff;
    --bg-hover: #f5f6f8;
    --text-dark: #333840;
    /* 4,59:1 sur blanc. L'ancienne valeur #8a919a ne faisait que 3,18:1,
       donc tout le texte secondaire de l'application était sous le seuil AA. */
    --text-muted: #686f78;
    --border-color: #d8dbe0;

    /* -apple-system AVANT "Segoe UI" : sinon tout Mac ayant Office installé
       affichait Segoe UI au lieu de la police système. */
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-size: 13px;

    /* Échelle typographique : six pas, aucun entre-deux. Le fichier comptait
       11 tailles dont 11/12/13/14/15/16 consécutives — de l'irrégularité
       sans hiérarchie. */
    --fs-1: 11px;   /* micro-label en capitales, méta serrée */
    --fs-2: 12px;   /* secondaire, dates, boutons compacts */
    --fs-3: 13px;   /* corps, tableaux, navigation */
    --fs-4: 15px;   /* titre de page, de modale */
    --fs-5: 18px;   /* nom de l'app, icônes de barre */
    --fs-6: 25px;   /* chiffre de statistique */

    /* Badge status colors */
    --badge-draft: #71777e;
    --badge-submitted: #3e79b6;
    --badge-production: #aa6600;
    --badge-review: #8866b7;
    --badge-revision: #947010;
    --badge-delivered: #2a8642;
    --badge-scheduled: #0c857a;
    --badge-cancelled: #d73e31;
}

html, body {
    height: 100%;
    font-family: var(--font-family);
    font-size: var(--font-size);
    /* Absent auparavant : tout le texte courant tournait au défaut navigateur
       (~1,2), ce qui étouffait textes de commande et commentaires. */
    line-height: 1.45;
    color: var(--text-dark);
    background: var(--bg-main);
}

a {
    color: var(--brand-ink);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* --- Focus clavier visible (absent auparavant) --- */
:focus-visible {
    outline: 2px solid var(--brand-ink);
    outline-offset: 2px;
}

/* 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,
.toolbar .search-box input:focus-visible {
    outline: none;
}

/* --- Respect de « réduire les animations » (absent auparavant) --- */
@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
   ============================================ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--topbar-bg) 0%, #3a3f44 100%);
}

.login-box {
    background: var(--bg-white);
    border-radius: 8px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-box .logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-box .logo .login-logo {
    width: 220px;
    height: auto;
    margin-bottom: 8px;
}

.login-box .logo p {
    color: var(--text-muted);
    font-size: var(--fs-3);
    margin-top: 4px;
}

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

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

.form-group label {
    display: block;
    font-size: var(--fs-2);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: var(--fs-3);
    font-family: var(--font-family);
    transition: border-color 0.2s;
    background: var(--bg-white);
    color: var(--text-dark);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(58, 134, 255, 0.1);
}

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

/* Validation temps réel */
.field-error {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1) !important;
}
.field-error-msg {
    color: var(--danger-text);
    font-size: var(--fs-2);
    margin-top: 4px;
}
.field-valid {
    border-color: var(--success) !important;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: 4px;
    font-size: var(--fs-3);
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-success:hover {
    background: #27ae60;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover {
    background: #c0392b;
}

.btn-secondary {
    background: #ecf0f1;
    color: var(--text-dark);
}
.btn-secondary:hover {
    background: #d5dbdb;
}

.btn-sm {
    padding: 5px 10px;
    font-size: var(--fs-2);
}

.btn-block {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: var(--fs-3);
}

.login-error {
    background: #fdecea;
    color: var(--danger-text);
    padding: 10px 14px;
    border-radius: 4px;
    font-size: var(--fs-3);
    margin-bottom: 16px;
    border-left: 3px solid var(--danger);
}

.login-success {
    background: #eafaf1;
    color: #2e7d32;
    padding: 10px 14px;
    border-radius: 4px;
    font-size: var(--fs-3);
    margin-bottom: 16px;
    border-left: 3px solid var(--success);
}

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

.forgot-password-link a {
    font-size: var(--fs-3);
    color: var(--text-muted);
    text-decoration: none;
}

.forgot-password-link a:hover {
    color: var(--brand-ink);
}

/* ============================================
   LAYOUT: Top bar + Sidebar + Content
   ============================================ */

/* --- Environment banner (recette) --- */
.env-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 300;
    background: #c0392b;  /* blanc dessus = 5,44:1 ; #e74c3c ne faisait que 3,82:1 */
    color: #fff;
    text-align: center;
    font-size: var(--fs-1);
    font-weight: 700;
    letter-spacing: 1px;
    padding: 2px 0;
}
.env-banner ~ .top-bar {
    top: 20px;
}
.env-banner ~ .app-layout {
    padding-top: calc(var(--topbar-height) + 20px);
}
.env-banner ~ .app-layout .sidebar {
    top: calc(var(--topbar-height) + 20px);
}
.env-banner ~ .app-layout .content-header {
    top: calc(var(--topbar-height) + 20px);
}

/* --- Top bar (dark, full width) --- */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--topbar-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 200;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: var(--fs-5);
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.sidebar-toggle-btn:hover {
    color: #fff;
}

.top-bar-left .app-name {
    color: #fff;
    font-size: var(--fs-5);
    font-weight: 700;
    letter-spacing: 0.08em;
}

.top-bar-left .app-separator {
    color: rgba(255,255,255,0.35);
    font-size: var(--fs-5);
    font-weight: 700;
    line-height: 1;
}

.top-bar-left .app-breadcrumb {
    color: #fff;
    font-size: var(--fs-5);
    font-weight: 700;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,0.7);
    font-size: var(--fs-3);
}

/* --- User dropdown (top bar) --- */
.user-dropdown {
    position: relative;
}

.user-dropdown-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: var(--fs-5);
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s;
}
.user-dropdown-btn:hover {
    color: var(--text-dark);
}

.user-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 220px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 300;
    overflow: hidden;
}
.user-dropdown-menu.open {
    display: block;
}

.user-dropdown-info {
    padding: 12px 16px;
}
.user-dropdown-name {
    font-size: var(--fs-3);
    font-weight: 600;
    color: var(--text-dark);
}
.user-dropdown-detail {
    font-size: var(--fs-2);
    color: var(--text-muted);
    margin-top: 2px;
}

.user-dropdown-divider {
    height: 1px;
    background: var(--border-color);
}

.user-dropdown-item {
    display: block;
    padding: 8px 16px;
    font-size: var(--fs-3);
    color: var(--text-dark);
    text-decoration: none;
    transition: background 0.15s;
}
.user-dropdown-item:hover {
    background: #f5f6f8;
    text-decoration: none;
}
.user-dropdown-item i {
    margin-right: 6px;
    color: var(--text-muted);
    font-size: var(--fs-4);
}

/* --- Profile modal sections --- */
.profile-section-title {
    font-size: var(--fs-3);
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
}
.profile-section-title i {
    margin-right: 4px;
    color: var(--text-muted);
}

/* Sidebar transition (desktop) */
.sidebar {
    transition: transform 0.3s ease;
    -webkit-transition: -webkit-transform 0.3s ease;
    will-change: transform;
}

.main-content {
    transition: margin-left 0.3s ease;
}

/* Le repli est porté par <html>, positionné par un script inline avant le
   rendu : la classe existe donc dès le premier paint, sans saut visible.
   Cantonné au desktop pour ne pas entrer en conflit avec le tiroir mobile. */
@media (min-width: 769px) {
    html.sidebar-collapsed .sidebar {
        transform: translateX(-100%);
        -webkit-transform: translateX(-100%);
    }

    html.sidebar-collapsed .main-content {
        margin-left: 0;
    }
}

/* --- App layout (below top bar) --- */
.app-layout {
    display: flex;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    padding-top: var(--topbar-height);
}

/* --- Sidebar (light gray) --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
    border-right: 1px solid #c8c8ca;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-bottom: 1px solid #c8c8ca;
}

.sidebar-brand .brand-logo {
    width: 95px;
    height: auto;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 0;
}

.nav-section {
    margin-bottom: 2px;
}

.nav-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 28px;
    padding: 0 16px;
    font-size: var(--fs-3);
    font-weight: 400;
    color: var(--sidebar-text-active);
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.nav-section-title:hover {
    background: var(--sidebar-hover);
}

.nav-section-title .section-icon {
    font-size: var(--fs-3);
    color: #666;
    width: 18px;
    text-align: center;
}

.nav-section-title .section-label {
    flex: 1;
}

.nav-section-title .section-chevron {
    font-size: var(--fs-2);
    transition: transform 0.2s;
    color: #888;
}

.nav-section.collapsed .section-chevron {
    transform: rotate(180deg);
}

.nav-section-items {
    overflow: hidden;
    transition: max-height 0.2s ease;
    margin-top: 6px;
}

.nav-section.collapsed .nav-section-items {
    display: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 34px;
    padding: 0 14px 0 13px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: var(--fs-3);
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

/* On scanne ce qu'on clique : l'icône est sur l'item, plus sur le groupe. */
.nav-item .nav-icon {
    font-size: var(--fs-4);
    width: 18px;
    text-align: center;
    color: #7b8087;
    flex-shrink: 0;
}

.nav-item:hover .nav-icon {
    color: #4d5259;
}

.nav-item.active .nav-icon {
    color: var(--brand-ink);
}

/* Administration est le seul regroupement conservé : il sépare vraiment deux
   mondes. Un filet et un intitulé, pas un repli — le groupe principal était
   seul chez les clients, et le replier vidait la sidebar. */
.nav-group {
    margin-top: 12px;
    padding-top: 11px;
    border-top: 1px solid #c8c8ca;
}

.nav-group-label {
    padding: 0 16px 5px;
    font-size: var(--fs-1);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #5b6067;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
    text-decoration: none;
}

.nav-item.active {
    background: #ffffff;
    color: var(--sidebar-text-active);
    border-left-color: var(--brand);
    font-weight: 600;
}

.nav-item .nav-dash {
    color: #999;
    font-size: var(--fs-1);
    width: 12px;
    text-align: center;
    flex-shrink: 0;
}

.nav-item.active .nav-dash {
    color: var(--brand);
}

.nav-item .nav-badge {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    background: var(--brand-ink);
    color: #fff;
    font-size: var(--fs-1);
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 700;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid #c8c8ca;
    font-size: var(--fs-2);
}

.sidebar-footer .logout-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #555;
    font-size: var(--fs-2);
    text-decoration: none;
    padding: 4px 0;
}

.sidebar-footer .logout-link:hover {
    color: var(--text-dark);
}

/* --- Main content --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--topbar-height));
}

/* --- Content header (greeting bar) --- */
/* Ces 50px portaient une salutation et une icône de profil. Ils portent
   maintenant le titre de la page et son action principale — la salutation
   descend dans le menu de profil, où elle relève de l'identité. */
.content-header {
    min-height: var(--header-height);
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 9px 24px;
    position: sticky;
    top: var(--topbar-height);
    z-index: 50;
}

.header-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

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

.header-title {
    font-size: var(--fs-4);
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.25;
    color: var(--text-dark);
}

.header-sub {
    font-size: var(--fs-2);
    color: var(--text-muted);
    margin-top: 1px;
}

/* Badges de rôle */
.badge-role-admin { background: #d24537; color: #fff; }
.badge-role-production { background: #b1611a; color: #fff; }
.badge-role-client { background: var(--brand-ink); color: #fff; }

/* --- Page content --- */
.page-content {
    flex: 1;
    padding: 20px 24px;
}

/* --- Status bar (bottom, like IXIDIA desktop) --- */

/* ============================================
   TABS (like the screenshot: Global, Engagement, etc.)
   ============================================ */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    background: var(--bg-white);
    padding: 0 4px;
    border-radius: 4px 4px 0 0;
}

.tab-item {
    padding: 10px 20px;
    font-size: var(--fs-3);
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.2s;
    cursor: pointer;
}

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

.tab-item.active {
    color: var(--brand-ink);
    border-bottom-color: var(--brand);
    font-weight: 600;
}

.tab-item .tab-count {
    font-size: var(--fs-1);
    color: var(--text-muted);
    margin-left: 4px;
    vertical-align: super;
}

/* ============================================
   TABLE (data table like IXIDIA)
   ============================================ */
.data-table-wrapper {
    background: var(--bg-white);
    border-radius: 4px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

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

.data-table thead th {
    background: #f5f6f8;
    padding: 8px 14px;
    text-align: left;
    font-weight: 600;
    font-size: var(--fs-1);
    color: #5f666e;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table tbody tr {
    border-bottom: 1px solid #f0f1f3;
    transition: background 0.1s;
}

.data-table tbody tr:hover {
    background: #f7f8fa;
}

.data-table tbody td {
    padding: 9px 14px;
    vertical-align: middle;
}

.data-table .col-ref {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    font-size: var(--fs-2);
    color: var(--text-muted);
}

.data-table .col-title {
    font-weight: 600;
}

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

/* ============================================
   BADGES (status badges like IXIDIA)
   ============================================ */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 3px;
    font-size: var(--fs-1);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

/* Puces d'état : fond teinté et texte foncé de la même teinte, plutôt qu'un
   aplat saturé en capitales. Même information, beaucoup moins d'encre quand
   elle se répète vingt fois par écran. Les --badge-* saturés restent utilisés
   comme filets de couleur (colonnes Kanban, rail de pipeline). */
.badge-draft,
.badge-submitted,
.badge-production,
.badge-review,
.badge-revision,
.badge-delivered,
.badge-scheduled,
.badge-cancelled {
    background: var(--chip-bg);
    color: var(--chip-fg);
    text-transform: none;
    font-weight: 600;
    letter-spacing: 0;
}

.badge-draft      { --chip-bg: #f3f4f5; --chip-fg: #6a7077; }
.badge-submitted  { --chip-bg: #edf4fb; --chip-fg: #3a72ab; }
.badge-production { --chip-bg: #fcf3e6; --chip-fg: #a16100; }
.badge-review     { --chip-bg: #f4f0f9; --chip-fg: #805fac; }
.badge-revision   { --chip-bg: #fbf6e8; --chip-fg: #8e6b0f; }
.badge-delivered  { --chip-bg: #ebf6ee; --chip-fg: #277e3e; }
.badge-scheduled  { --chip-bg: #e7f4f3; --chip-fg: #0b7c72; }
.badge-cancelled  { --chip-bg: #fdeceb; --chip-fg: #c7392d; }

/* Type badges (like PLAN, CREDIT, OFFRE in IXIDIA) */
/* La classe est générée depuis le premier mot du nom du type
   (strtolower(explode(' ', $type_name)[0])). Les types réels s'appellent
   « Message 1 voix - FR », « Message 3 voix - FR / NL / EN »… donc tous
   produisent .badge-type-message, qui n'existe pas : les badges sortaient
   sans fond. Ce défaut donne un rendu correct quel que soit le nom. */
.badge-type {
    padding: 2px 8px;
    border-radius: 3px;
    font-size: var(--fs-1);
    font-weight: 700;
    text-transform: uppercase;
    background: #eceef1;
    color: #4b535d;
}

/* ============================================
   TOOLBAR (filter bar like IXIDIA)
   ============================================ */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.toolbar .search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 7px 12px;
    flex: 1;
    max-width: 400px;
}

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

.toolbar .search-icon {
    color: var(--text-muted);
    font-size: var(--fs-4);
}

.toolbar select {
    padding: 7px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: var(--fs-3);
    font-family: var(--font-family);
    background: var(--bg-white);
    color: var(--text-dark);
}

/* Toggle switches (iOS-style) */
.toggle-switches {
    display: flex;
    align-items: center;
    gap: 20px;
}

.toggle-switch-item {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    margin: 0;
}

.toggle-switch-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    line-height: 1;
}

.toggle-track {
    position: relative;
    width: 32px;
    height: 18px;
    background: #c8c8ca;
    border-radius: 9px;
    transition: background 0.25s ease;
    flex-shrink: 0;
}

.toggle-track .toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    transition: transform 0.25s ease;
}

.toggle-track.active {
    background: var(--brand-ink);
}

.toggle-track.active .toggle-thumb {
    transform: translateX(14px);
}

.toggle-label {
    font-size: var(--fs-2);
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
}

/* ============================================
   CARDS & PANELS
   ============================================ */
.card {
    background: var(--bg-white);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: var(--fs-3);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 18px;
}

/* Stats cards */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
}

a.stat-card-link {
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

a.stat-card-link:hover {
    border-color: var(--brand);
    box-shadow: 0 2px 8px rgba(0, 180, 216, 0.15);
}

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-5);
}

.stat-card .stat-icon.blue { background: rgba(52, 152, 219, 0.1); color: #3498db; }
.stat-card .stat-icon.orange { background: rgba(230, 126, 34, 0.1); color: #e67e22; }
.stat-card .stat-icon.green { background: rgba(46, 204, 113, 0.1); color: #2ecc71; }
.stat-card .stat-icon.purple { background: rgba(155, 89, 182, 0.1); color: #9b59b6; }

.stat-card .stat-value {
    font-size: var(--fs-6);
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--text-dark);
}

.stat-card .stat-label {
    font-size: var(--fs-2);
    color: var(--text-muted);
    margin-top: 2px;
}

/* ============================================
   TIMELINE (order tracking)
   ============================================ */
.timeline {
    position: relative;
    padding-left: 28px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -22px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-color);
    border: 2px solid var(--bg-white);
}

.timeline-item.active::before {
    background: var(--primary-light);
}

.timeline-item .timeline-date {
    font-size: var(--fs-1);
    color: var(--text-muted);
    margin-bottom: 2px;
}

.timeline-item .timeline-content {
    font-size: var(--fs-3);
}

.timeline-item .timeline-content strong {
    font-weight: 600;
}

.timeline-item .timeline-comment {
    margin-top: 4px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: var(--fs-2);
    color: var(--text-muted);
}

/* ============================================
   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.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    -webkit-overflow-scrolling: touch;
}

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

.modal {
    background: var(--bg-white);
    border-radius: 8px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: var(--fs-4);
}

.modal-header .close-btn {
    background: none;
    border: none;
    font-size: var(--fs-5);
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    line-height: 1;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

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

.schedule-export-actions .btn {
    font-size: var(--fs-2);
    padding: 4px 10px;
    text-decoration: none;
}

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

.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 6px;
    font-size: var(--fs-3);
    border-left: 4px solid;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    animation: toastSlideIn 0.3s ease-out;
    transition: opacity 0.3s, transform 0.3s;
}

.toast.toast-hiding {
    opacity: 0;
    transform: translateX(30px);
}

.toast-icon {
    flex-shrink: 0;
    font-size: var(--fs-4);
    line-height: 1.3;
}

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

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: var(--fs-4);
    line-height: 1;
    padding: 0;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.toast-close:hover {
    opacity: 1;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 0 6px;
    animation: toastProgress var(--toast-duration, 8s) linear forwards;
}

.toast { position: relative; overflow: hidden; }

.toast-success {
    background: #eafaf1;
    border-color: var(--success);
    color: #186a3b;
}
.toast-success .toast-close { color: #186a3b; }
.toast-success .toast-progress { background: var(--success); }

.toast-danger {
    background: #fdecea;
    border-color: var(--danger);
    color: #c0392b;
}
.toast-danger .toast-close { color: #c0392b; }
.toast-danger .toast-progress { background: var(--danger); }

.toast-info {
    background: #eaf2fd;
    border-color: var(--info);
    color: #2471a3;
}
.toast-info .toast-close { color: #2471a3; }
.toast-info .toast-progress { background: var(--info); }

.toast-warning {
    background: #fef9e7;
    border-color: #f1c40f;
    color: #7d6608;
}
.toast-warning .toast-close { color: #7d6608; }
.toast-warning .toast-progress { background: #f1c40f; }

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(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: 4px;
    font-size: var(--fs-3);
    margin-bottom: 16px;
    border-left: 3px solid;
}

.alert-success {
    background: #eafaf1;
    border-color: var(--success);
    color: #186a3b;
}

.alert-danger {
    background: #fdecea;
    border-color: var(--danger);
    color: #c0392b;
}

.alert-info {
    background: #eaf2fd;
    border-color: var(--info);
    color: #2471a3;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    /* Glyphe décoratif, hors échelle typographique */
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state h3 {
    font-size: var(--fs-4);
    color: var(--text-dark);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: var(--fs-3);
    max-width: 400px;
    margin: 0 auto 20px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    /* --- Sidebar --- */
    .sidebar {
        transform: translateX(-100%);
        -webkit-transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        -webkit-transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
    }

    /* --- Layout --- */
    .content-header {
        flex-direction: row;
        align-items: center;
        height: auto;
        padding: 10px 16px;
        gap: 8px;
    }

    .header-left {
        flex: 1;
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
        min-width: 0;
    }

    .page-content {
        padding: 12px 10px;
    }

    /* --- Stats --- */
    .stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 12px 10px;
        gap: 10px;
    }

    .stat-card .stat-icon {
        width: 36px;
        height: 36px;
        font-size: var(--fs-4);
    }

    .stat-card .stat-value {
        font-size: var(--fs-5);
    }

    /* --- Toolbar / Filtres --- */
    .toolbar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .toolbar .search-box {
        grid-column: 1 / -1;
        max-width: none;
    }

    .toolbar select,
    .toolbar input[type="date"],
    .toolbar .search-box input {
        width: 100%;
        font-size: 16px;
        padding: 6px 8px;
    }

    .toolbar .btn {
        text-align: center;
        padding: 6px 8px;
        font-size: var(--fs-3);
    }

    /* --- Tables : transformation en cards --- */
    .data-table-wrapper {
        border: none;
        background: transparent;
        overflow: visible;
    }

    .data-table {
        border: none;
    }

    .data-table thead {
        display: none;
    }

    .data-table tbody tr {
        display: block;
        background: var(--bg-white);
        border: 1px solid var(--border-color);
        border-radius: 6px;
        padding: 12px;
        margin-bottom: 10px;
    }

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

    .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;
    }

    /* Référence : pleine largeur, bien visible */
    .data-table .col-ref {
        font-size: var(--fs-2);
        font-weight: 600;
        color: var(--text-dark);
        margin-bottom: 4px;
    }

    .data-table .col-ref::before {
        display: none;
    }

    /* Intitulé : pas de troncature */
    .data-table .col-title {
        font-weight: 600;
        margin-bottom: 4px;
    }

    .data-table .col-title::before {
        display: none;
    }

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

    /* Actions : flex wrap */
    .data-table td .d-flex {
        display: flex !important;
        flex-wrap: wrap;
        gap: 6px !important;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid #f0f1f3;
    }

    .data-table td .d-flex .btn {
        flex: none;
    }

    .data-table .btn-sm {
        padding: 6px 10px;
        font-size: var(--fs-2);
    }

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

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

    .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;
    }

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

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .modal-detail {
        max-width: 95vw;
    }

    .detail-info-table .detail-label {
        width: auto;
        display: block;
        font-size: var(--fs-1);
        padding-bottom: 0;
    }

    .detail-info-table .detail-value {
        display: block;
        padding-top: 0;
        padding-bottom: 8px;
    }

    .detail-info-table td {
        display: block;
        padding: 2px 0;
    }

    .detail-info-table tr {
        display: block;
        padding: 4px 0;
        border-bottom: 1px solid #f0f1f3;
    }

    .detail-text-box {
        font-size: var(--fs-2);
        padding: 10px;
    }

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

    /* --- Cards --- */
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        font-size: var(--fs-3);
    }

    .card-body {
        padding: 14px;
    }

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

    .form-group 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;
    }

    /* --- Kanban --- */
    .kanban-board {
        grid-template-columns: 1fr;
    }

    .kanban-card-actions {
        flex-wrap: wrap;
        gap: 4px;
    }

    .kanban-card-actions .btn {
        font-size: var(--fs-1);
        padding: 4px 8px;
    }

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

    .pagination-btn {
        min-width: 30px;
        padding: 6px 8px;
        font-size: var(--fs-2);
    }

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

    /* --- Badges --- */
    .badge {
        font-size: var(--fs-1);
        padding: 3px 7px;
    }

}

@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr 1fr;
    }

    .top-bar-left .app-separator,
    .top-bar-left .app-breadcrumb {
        display: none;
    }

    .page-content {
        padding: 10px 8px;
    }

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

    .data-table .btn-sm {
        padding: 5px 8px;
        font-size: var(--fs-1);
    }
}

/* Backdrop mobile pour la sidebar */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 99;
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 768px) {
    .sidebar-backdrop.active {
        display: block;
    }
}

/* Backdrop desktop pour sidebar collapse (pas besoin) */

/* ============================================
   KANBAN BOARD (suivi.php)
   ============================================ */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    align-items: start;
}

@media (max-width: 768px) {
    .kanban-board {
        grid-template-columns: 1fr !important;
    }
}

.kanban-column {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    min-height: 200px;
}

.kanban-column-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 14px 11px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-white);
    border-radius: 6px 6px 0 0;
}

/* Filet de 3px dans la couleur de l'étape : les colonnes portaient jusqu'ici
   un gris uniforme, alors que c'est exactement ce qu'elles servent à distinguer. */
.kanban-column-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--stage, var(--border-color));
    border-radius: 6px 6px 0 0;
}

.kanban-column-title {
    font-size: var(--fs-2);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 6px;
}

.kanban-column-title i {
    font-size: var(--fs-3);
    color: var(--text-muted);
}

.kanban-column-count {
    background: var(--border-color);
    font-variant-numeric: tabular-nums;
    color: var(--text-dark);
    font-size: var(--fs-1);
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}

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

.kanban-empty {
    text-align: center;
    padding: 30px 10px;
    color: var(--text-muted);
    font-size: var(--fs-2);
    font-style: italic;
}

/* --- Kanban cards --- */
.kanban-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 12px;
    border-left: 3px solid var(--border-color);
    transition: box-shadow 0.15s;
}

.kanban-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Le calme ne mérite pas d'encre : une commande dans les temps n'a pas de
   filet. Le vert est retiré — il signifie « validée » ailleurs dans l'app,
   et une carte verte dans « En production » se lisait comme un statut. */
.kanban-card-ok {
    border-left-color: transparent;
}

.kanban-card-urgent {
    border-left-color: var(--warning);
}

.kanban-card-overdue {
    border-left-color: var(--danger);
    background: #fef8f7;
}

.kanban-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.kanban-ref {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    font-size: var(--fs-1);
    color: var(--text-muted);
}

.kanban-card-title {
    font-weight: 600;
    font-size: var(--fs-3);
    margin-bottom: 6px;
    line-height: 1.3;
}

.kanban-card-title a {
    color: var(--text-dark);
}

.kanban-card-title a:hover {
    color: var(--brand-ink);
}

.kanban-card-client {
    font-size: var(--fs-1);
    color: var(--text-muted);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.kanban-card-client i {
    font-size: var(--fs-2);
}

.kanban-card-deadline {
    font-size: var(--fs-1);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
}

.kanban-card-deadline i {
    font-size: var(--fs-2);
}

.kanban-deadline-ok {
    color: var(--success);
}

.kanban-deadline-urgent {
    color: #b1611a;
}

.kanban-deadline-overdue {
    /* --danger sert de fond de bouton ; sur le fond teinté de la carte en
       retard il ne fait que 4,32:1, d'où la variante texte. */
    color: var(--danger-text);
    font-weight: 600;
}

.kanban-delay {
    font-weight: 600;
}

.kanban-card-actions {
    display: flex;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid #f0f1f3;
}

.kanban-card-actions .btn {
    flex: 1;
    justify-content: center;
    font-size: var(--fs-1);
    padding: 4px 8px;
}

@media (max-width: 1200px) and (min-width: 769px) {
    .kanban-board {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   MODAL D&Eacute;TAIL COMMANDE (large, 2 colonnes)
   ============================================ */
.modal-detail {
    max-width: 900px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

.detail-grid .card {
    margin-bottom: 0;
}

.detail-info-table {
    width: 100%;
    font-size: var(--fs-3);
}

.detail-info-table td {
    padding: 6px 0;
    vertical-align: top;
}

.detail-info-table .detail-label {
    color: var(--text-muted);
    width: 140px;
}

@media (max-width: 768px) {
    .detail-info-table .detail-label {
        width: auto;
        display: block;
        font-size: var(--fs-1);
        padding-bottom: 0;
    }

    .detail-info-table .detail-value {
        display: block;
        padding-top: 0;
        padding-bottom: 8px;
    }

    .detail-info-table td {
        display: block;
        padding: 2px 0;
    }

    .detail-info-table tr {
        display: block;
        padding: 4px 0;
        border-bottom: 1px solid #f0f1f3;
    }
}

.detail-info-table .detail-value {
    color: var(--text-dark);
}

.detail-lang-block {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.detail-lang-title {
    font-size: var(--fs-2);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 2px solid;
}

.detail-lang-title i {
    margin-right: 4px;
}

.detail-text-box {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 4px;
    font-size: var(--fs-3);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.detail-phonetics {
    margin-top: 6px;
    font-size: var(--fs-2);
    color: var(--text-muted);
}

/* ============================================
   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: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: #fff;
    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(--primary);
}

.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);
}

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

/* ============================================
   UTILITIES
   ============================================ */
/* ============================================
   SCHEDULE MODAL (Planning de diffusion)
   ============================================ */
.modal-schedule {
    max-width: 700px;
}

.schedule-summary {
    text-align: center;
    padding: 12px;
    background: #f0f4ff;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: var(--fs-3);
    color: var(--text-dark);
}

.schedule-month {
    margin-bottom: 20px;
}

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

.schedule-nav-label {
    font-weight: 600;
    font-size: var(--fs-3);
    color: var(--brand-ink);
    min-width: 140px;
    text-align: center;
}

.schedule-nav-btn {
    padding: 4px 10px;
    line-height: 1;
}

.schedule-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.schedule-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    font-size: var(--fs-2);
}

.schedule-grid .day-header {
    text-align: center;
    font-weight: 600;
    color: var(--text-muted);
    padding: 4px 0;
    font-size: var(--fs-1);
    text-transform: uppercase;
}

.schedule-grid .day-cell {
    text-align: center;
    padding: 6px 2px;
    border-radius: 3px;
    min-height: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.schedule-grid .day-cell.has-broadcasts {
    background: #e8f4fd;
    cursor: pointer;
}

.schedule-grid .day-cell.has-broadcasts:hover {
    background: #d0e8f9;
}

.schedule-grid .day-num {
    font-size: var(--fs-2);
    color: var(--text-dark);
}

.schedule-grid .day-count {
    font-size: var(--fs-1);
    font-weight: 600;
    color: var(--brand-ink);
    margin-top: 1px;
}

.schedule-grid .day-cell.empty .day-num {
    color: var(--text-muted);
}

/* Day detail view */
.schedule-day-detail {
    padding: 0;
}

.schedule-day-title {
    font-weight: 600;
    font-size: var(--fs-4);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.schedule-lang-section {
    margin-bottom: 16px;
}

.schedule-lang-label {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: var(--fs-1);
    font-weight: 600;
    margin-bottom: 8px;
}

.schedule-times {
    font-size: var(--fs-2);
    color: var(--text-dark);
    line-height: 1.8;
}

.schedule-times .time-chip {
    display: inline-block;
    padding: 2px 6px;
    background: #f5f6f8;
    border-radius: 3px;
    margin: 1px 2px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    font-size: var(--fs-2);
}

.schedule-day-total {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    font-size: var(--fs-2);
    color: var(--text-muted);
    text-align: right;
}

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

    .schedule-grid .day-cell {
        min-height: 32px;
        padding: 3px 1px;
    }

    .schedule-grid .day-count {
        font-size: var(--fs-1);
    }
}

/* Alert warning (for API key display) */
.alert-warning {
    background: #fef9e7;
    border-color: #f1c40f;
    color: #7d6608;
}

/* 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;
}

.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.d-flex { display: flex; }
.gap-2 { gap: 8px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ============================================
   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(--border-color);
    border-radius: 2px;
    color: var(--text-muted);
    background: transparent;
}

.voice-done {
    background: var(--text-dark);
    border-color: var(--text-dark);
    color: #fff;
}

/* ============================================
   RAIL DE PIPELINE
   Les quatre étapes actives, lues de gauche à droite dans l'ordre réel
   du flux. Remplace quatre cartes de statistiques détachées.
   ============================================ */
.rail {
    display: flex;
    align-items: stretch;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 18px;
}

.rail-cell {
    flex: 1;
    position: relative;
    padding: 15px 16px 13px;
    display: block;
    min-width: 0;
    color: inherit;
    text-decoration: none;
    transition: background 0.15s;
}

.rail-cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--stage);
}

.rail-cell:hover {
    background: #fafbfc;
    text-decoration: none;
}

.rail-count {
    display: block;
    font-size: var(--fs-6);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    color: var(--text-dark);
}

/* Un compteur à zéro s'affiche moins fort qu'un compteur plein, mais reste
   lisible : la première version était à 1,39:1, soit quasi invisible. */
.rail-zero .rail-count {
    color: var(--text-muted);
}

.rail-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: var(--fs-2);
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rail-label i {
    font-size: var(--fs-3);
    color: var(--stage);
    flex-shrink: 0;
}

/* Le chevron dit que ces étapes forment une séquence, pas des catégories
   parallèles. C'est de l'information, pas de la décoration. */
.rail-sep {
    align-self: center;
    color: var(--border-color);
    font-size: var(--fs-4);
    line-height: 1;
    padding: 0 1px;
    user-select: none;
}

.rail-total {
    flex: 0 0 auto;
    padding: 15px 20px 13px;
    border-left: 1px solid var(--border-color);
    background: #fbfbfc;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.rail-total .rail-count {
    font-size: var(--fs-5);
    color: var(--text-muted);
}

.rail-total .rail-label {
    margin-top: 4px;
}

/* ============================================
   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: 2px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 2px;
    margin-bottom: 16px;
}

.segmented a {
    padding: 5px 12px;
    border-radius: 3px;
    font-size: var(--fs-2);
    font-weight: 400;
    color: var(--text-muted);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

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

.segmented a[aria-current="true"] {
    background: var(--bg-white);
    color: var(--text-dark);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(20, 25, 35, 0.09);
}

/* --- Responsive des composants ci-dessus (après leurs règles de base) --- */
@media (max-width: 900px) {
    .rail {
        flex-wrap: wrap;
    }

    .rail-cell {
        flex: 1 1 40%;
    }

    .rail-sep {
        display: none;
    }

    .rail-total {
        flex: 1 1 100%;
        border-left: 0;
        border-top: 1px solid var(--border-color);
    }
}

@media (max-width: 768px) {
    .content-header {
        flex-wrap: wrap;
        padding: 9px 14px;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .segmented {
        width: 100%;
    }

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