@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap");

/* ============================================================
   MonGalop — système visuel
   Refonte : zinc clair, accent cuivre unique, bordures fines,
   aucun glassmorphism, aucun halo néon.
   Tous les noms de classes de l'ancien fichier sont conservés :
   les pages existantes prennent le nouveau design sans modification.
   ============================================================ */

:root,
:root[data-theme="light"] {
    --brand-navy: #18181b;
    --brand-navy-soft: #3f3f46;
    --brand-copper: #a3572c;
    --brand-copper-hover: #b56634;
    --brand-forest: #3f7a52;
    --brand-ivory: #f7f4ec;

    --bg-deep-black: #f4f4f5;
    --bg-deep-midnight: #ffffff;
    --bg-body: #f7f7f8;
    --surface: #ffffff;
    --surface-muted: #fbfbfc;
    --surface-sunken: #f4f4f5;

    --chassis-border: #e4e4e7;
    --card-glass-bg: #ffffff;
    --card-glass-border: #e4e4e7;
    --hairline: #f0f0f1;

    --text-primary: #18181b;
    --text-secondary: #6e6e78;
    --text-tertiary: #8b8b93;

    --neon-green: #3f7a52;
    --neon-green-glow: rgba(63, 122, 82, 0.09);
    --neon-blue: #456b99;
    --neon-blue-glow: rgba(69, 107, 153, 0.09);
    --neon-amber: #9a6a15;
    --neon-amber-glow: rgba(154, 106, 21, 0.09);
    --neon-red: #a33b32;
    --neon-red-glow: rgba(163, 59, 50, 0.09);

    --shadow-card: 0 1px 2px rgba(24, 24, 27, 0.05);
    --shadow-raised: 0 6px 16px rgba(24, 24, 27, 0.09);
    --shadow-overlay: 0 28px 70px -24px rgba(24, 24, 27, 0.28);

    --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", monospace;

    /* Rail d'icônes qui se déploie au survol : la signature de la refonte */
    --sidebar-width: 62px;
    --sidebar-width-expanded: 232px;
    --sidebar-width-collapsed: 62px;
    --topbar-height: 52px;
    --content-max-width: 1440px;
}

:root[data-theme="dark"] {
    --brand-navy: #fafafa;
    --brand-navy-soft: #e4e4e7;
    --brand-copper: #c2764a;
    --brand-copper-hover: #d08a5f;
    --brand-forest: #5f9c6f;
    --brand-ivory: #f7f4ec;

    --bg-deep-black: #0b0b0d;
    --bg-deep-midnight: #0e0e10;
    --bg-body: #09090b;
    --surface: #0c0c0e;
    --surface-muted: #0e0e10;
    --surface-sunken: #18181b;

    --chassis-border: #1c1c1f;
    --card-glass-bg: #0c0c0e;
    --card-glass-border: #27272a;
    --hairline: #18181b;

    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;

    --neon-green: #5f9c6f;
    --neon-green-glow: rgba(95, 156, 111, 0.14);
    --neon-blue: #6f8fb8;
    --neon-blue-glow: rgba(111, 143, 184, 0.14);
    --neon-amber: #c9954a;
    --neon-amber-glow: rgba(201, 149, 74, 0.14);
    --neon-red: #b4544b;
    --neon-red-glow: rgba(180, 84, 75, 0.14);

    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-raised: 0 8px 20px rgba(0, 0, 0, 0.5);
    --shadow-overlay: 0 28px 70px -20px rgba(0, 0, 0, 0.8);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

html, body { height: 100%; }

body {
    background: var(--bg-body);
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.45;
}

a { text-decoration: none; color: inherit; }
a:hover { color: var(--brand-copper); }

button, select, input, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:not(:disabled) { cursor: pointer; }
button:disabled, [aria-disabled="true"] { cursor: not-allowed !important; opacity: 0.48; }

::selection { background: var(--brand-copper); color: #ffffff; }

:where(button, a, input, select, textarea):focus-visible {
    outline: 2px solid var(--brand-copper);
    outline-offset: 2px;
}

/* Les chiffres sont tabulaires partout : c'est un outil de gestion */
.mono,
[class*="-value"],
[class*="-chrono"],
[class*="-gains"],
[class*="-amount"] {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   Boutons
   ============================================================ */
.btn-primary,
.btn-secondary,
.btn-add,
.btn-remove,
.btn-ana,
.action-btn,
.planning-action,
.btn-health-primary,
.btn-health-secondary {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 13px;
    border-radius: 7px;
    border: 1px solid var(--card-glass-border);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    transition: border-color 0.14s ease, background-color 0.14s ease, color 0.14s ease;
}

.btn-primary,
.btn-health-primary,
.planning-action.primary {
    background: var(--brand-copper);
    border-color: var(--brand-copper);
    color: #ffffff;
    font-weight: 600;
}

.btn-primary:not(:disabled):hover,
.btn-health-primary:not(:disabled):hover,
.planning-action.primary:not(:disabled):hover {
    background: var(--brand-copper-hover);
    border-color: var(--brand-copper-hover);
}

.btn-secondary:not(:disabled):hover,
.btn-add:not(:disabled):hover,
.btn-ana:not(:disabled):hover,
.action-btn:not(:disabled):hover,
.planning-action:not(:disabled):hover,
.btn-health-secondary:not(:disabled):hover {
    border-color: var(--brand-copper);
    color: var(--brand-copper);
}

.btn-remove,
.btn-remove:not(:disabled):hover {
    color: var(--neon-red);
    border-color: var(--card-glass-border);
}
.btn-remove:not(:disabled):hover { border-color: var(--neon-red); }

.action-btn.small,
.filters-reset,
.pagination-btn { min-height: 28px; padding: 0 10px; font-size: 12px; }

.modal-close,
.jockey-access,
.jockey-remove,
.lot-icon-btn,
#add-jockey-btn {
    min-width: 28px !important;
    min-height: 28px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 6px;
    border: 1px solid var(--card-glass-border);
    background: transparent;
    color: var(--text-secondary);
}

.modal-close:hover,
.lot-icon-btn:hover,
#add-jockey-btn:hover { color: var(--text-primary); border-color: var(--brand-copper); }

/* Menu utilisateur de la topbar */
.user-menu-btn {
    display: flex; align-items: center; gap: 8px;
    padding: 0 10px;
    min-height: 30px;
    background: var(--surface-sunken);
    border: 1px solid var(--card-glass-border);
    border-radius: 7px;
    cursor: pointer;
    color: var(--text-secondary);
}
.user-menu-btn:hover { color: var(--text-primary); border-color: var(--brand-copper); }
.user-avatar {
    width: 22px; height: 22px; display: grid; place-items: center;
    border-radius: 50%; background: var(--surface);
    border: 1px solid var(--card-glass-border);
    color: var(--text-secondary); font-family: var(--font-mono);
    font-size: 10px; font-weight: 600;
}
.user-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 500; }
.logout-label { font-size: 11px; color: var(--text-secondary); }

@media (max-width: 720px) {
    .user-name, .logout-label { display: none; }
}

/* ============================================================
   Retours d'action : notifications, confirmations, attente
   ============================================================ */
.toast-region {
    position: fixed; right: 20px; bottom: 20px; z-index: 1000;
    display: flex; flex-direction: column; gap: 8px;
    width: min(380px, calc(100vw - 32px)); pointer-events: none;
}
.app-toast {
    display: grid; grid-template-columns: 22px 1fr 20px; align-items: center; gap: 10px;
    padding: 12px 13px;
    border: 1px solid var(--card-glass-border); border-radius: 9px;
    background: var(--surface); color: var(--text-primary);
    box-shadow: var(--shadow-overlay);
    transform: translateY(8px); opacity: 0;
    transition: transform 0.16s ease, opacity 0.16s ease;
    pointer-events: auto;
}
.app-toast.visible { transform: translateY(0); opacity: 1; }
.toast-icon {
    width: 20px; height: 20px; display: grid; place-items: center;
    border-radius: 5px; font-family: var(--font-mono); font-size: 11px; font-weight: 600;
}
.toast-success .toast-icon { background: var(--neon-green-glow); color: var(--neon-green); }
.toast-error .toast-icon { background: var(--neon-red-glow); color: var(--neon-red); }
.toast-info .toast-icon { background: var(--neon-blue-glow); color: var(--neon-blue); }
.toast-message { font-size: 12.5px; line-height: 1.45; }
.toast-close { border: 0; background: transparent; color: var(--text-secondary); font-size: 17px; line-height: 1; cursor: pointer; }
.toast-close:hover { color: var(--text-primary); }

.confirm-backdrop {
    position: fixed; inset: 0; z-index: 1100;
    display: grid; place-items: center; padding: 20px;
    background: rgba(24, 24, 27, 0.32);
    opacity: 0; transition: opacity 0.16s ease;
}
:root[data-theme="dark"] .confirm-backdrop { background: rgba(4, 4, 5, 0.72); }
.confirm-backdrop.visible { opacity: 1; }
.confirm-dialog {
    width: min(460px, 100%); padding: 22px;
    border: 1px solid var(--card-glass-border); border-radius: 11px;
    background: var(--surface); box-shadow: var(--shadow-overlay);
}
.confirm-symbol {
    width: 30px; height: 30px; display: grid; place-items: center; margin-bottom: 14px;
    border-radius: 7px; background: var(--neon-blue-glow); color: var(--neon-blue);
    font-family: var(--font-mono); font-weight: 600;
}
.confirm-symbol.danger { background: var(--neon-red-glow); color: var(--neon-red); }
.confirm-dialog h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 7px; }
.confirm-dialog p { color: var(--text-secondary); font-size: 12.5px; line-height: 1.6; text-wrap: pretty; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.confirm-actions button {
    border-radius: 7px; padding: 0 13px; min-height: 30px;
    border: 1px solid var(--card-glass-border); font-size: 12.5px; font-weight: 500; cursor: pointer;
}
.confirm-cancel { background: transparent; color: var(--text-primary); }
.confirm-cancel:hover { border-color: var(--brand-copper); }
.confirm-submit { background: var(--brand-copper); color: #ffffff; border-color: var(--brand-copper) !important; font-weight: 600; }
.confirm-submit:hover { background: var(--brand-copper-hover); }
.confirm-submit.danger { background: var(--neon-red); border-color: var(--neon-red) !important; }

.button-spinner {
    width: 12px; height: 12px; display: inline-block; margin-right: 6px; vertical-align: -1px;
    border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
    animation: button-spin 0.65s linear infinite;
}
button[aria-busy="true"] { cursor: wait !important; opacity: 0.78; }
@keyframes button-spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
    .toast-region { right: 16px; bottom: 16px; }
    .confirm-actions { flex-direction: column-reverse; }
    .confirm-actions button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .app-toast, .confirm-backdrop, .button-spinner { transition: none; animation-duration: 1.5s; }
}

.loading-state {
    min-height: 110px; display: flex; align-items: center; justify-content: center; gap: 10px;
    color: var(--text-secondary); font-size: 12.5px;
}
.loading-spinner {
    width: 18px; height: 18px;
    border: 2px solid var(--hairline); border-top-color: var(--brand-copper);
    border-radius: 50%; animation: button-spin 0.75s linear infinite;
}
.error-state {
    display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 12px;
    padding: 15px; border: 1px solid var(--card-glass-border); border-left: 2px solid var(--neon-red);
    border-radius: 9px; background: var(--surface); color: var(--text-primary);
}
.error-state-icon {
    width: 26px; height: 26px; display: grid; place-items: center; border-radius: 6px;
    background: var(--neon-red-glow); color: var(--neon-red);
    font-family: var(--font-mono); font-weight: 600;
}
.error-state strong { font-size: 12.5px; font-weight: 600; }
.error-state p { margin-top: 3px; color: var(--text-secondary); font-size: 11.5px; line-height: 1.5; }
.error-state button {
    padding: 0 11px; min-height: 28px; border: 1px solid var(--card-glass-border);
    border-radius: 7px; background: transparent; color: var(--text-primary);
    cursor: pointer; font-size: 12px; font-weight: 500;
}
.error-state button:hover { border-color: var(--brand-copper); color: var(--brand-copper); }
@media (max-width: 720px) {
    .error-state { grid-template-columns: 28px 1fr; }
    .error-state button { grid-column: 1 / -1; }
}

/* ============================================================
   Châssis : rail d'icônes + topbar + contenu
   ============================================================ */
.app-shell {
    display: flex;
    min-height: 100vh;
    background: var(--bg-body);
}

/* La sidebar est en position fixe et se déploie au survol par-dessus le
   contenu : la largeur du flux reste celle du rail, donc rien ne bouge. */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    background: var(--bg-deep-black);
    border-right: 1px solid var(--chassis-border);
    overflow: hidden;
    white-space: nowrap;
    z-index: 60;
    transition: width 0.16s ease, box-shadow 0.16s ease;
}

.sidebar:hover,
.sidebar:focus-within {
    width: var(--sidebar-width-expanded);
    box-shadow: 24px 0 48px -24px rgba(24, 24, 27, 0.18);
}
:root[data-theme="dark"] .sidebar:hover,
:root[data-theme="dark"] .sidebar:focus-within {
    box-shadow: 24px 0 48px -24px rgba(0, 0, 0, 0.9);
}

/* Le contenu réserve la largeur du rail replié */
.app-shell > .app-main { margin-left: var(--sidebar-width); }

.sidebar::-webkit-scrollbar { width: 0; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 32px;
    height: var(--topbar-height);
    flex: 0 0 var(--topbar-height);
    padding: 0 14px;
    border-bottom: 1px solid var(--chassis-border);
    justify-content: flex-start;
}

.sidebar-brand img {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    object-fit: contain;
    border-radius: 0;
    box-shadow: none;
}

.sidebar-brand > span {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    white-space: nowrap;
}

.sidebar-brand .brand-strong { font-weight: 600; color: var(--text-primary); }
.sidebar-brand .brand-light { font-weight: 400; color: var(--text-secondary); }

.sidebar-ecurie {
    padding: 10px 8px 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sidebar-ecurie-label {
    font-size: 9.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-secondary);
    padding-left: 4px;
}

.sidebar-ecurie-select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    min-width: 196px;
    background-color: var(--surface);
    border: 1px solid var(--card-glass-border);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 500;
    border-radius: 7px;
    padding: 7px 26px 7px 9px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236e6e78' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    transition: border-color 0.15s ease;
}

.sidebar-ecurie-select:hover,
.sidebar-ecurie-select:focus { border-color: var(--brand-copper); outline: none; }

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    padding: 10px 8px;
    overflow: hidden;
}

.sidebar-nav-title {
    font-size: 9.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-secondary);
    padding: 12px 10px 5px;
}

/* Le libellé est poussé au-delà du bord de clip : au repli, seule
   l'icône est visible, sans display:none (donc lisible par les lecteurs
   d'écran et révélée par une simple transition de largeur). */
.sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 36px;
    width: 216px;
    padding: 8px 10px;
    border-radius: 7px;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
    min-height: 34px;
}

.sidebar .nav-item svg {
    flex: 0 0 17px;
    width: 17px;
    height: 17px;
    opacity: 1;
}

.app-icon {
    display: block;
    overflow: visible;
    fill: none;
    stroke: currentColor;
    vector-effect: non-scaling-stroke;
}

.sidebar .nav-item:hover { background: var(--surface-sunken); color: var(--text-primary); }

.sidebar .nav-item.active {
    background: var(--surface-sunken);
    color: var(--text-primary);
    box-shadow: none;
}

.sidebar .nav-item.active svg { opacity: 1; filter: none; color: var(--brand-copper); }

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-top: 1px solid var(--chassis-border);
    padding: 10px 8px;
}

/* Zone principale : topbar + contenu scrollable */
.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--chassis-border) transparent;
}

.app-main::-webkit-scrollbar { width: 10px; }
.app-main::-webkit-scrollbar-track { background: transparent; }
.app-main::-webkit-scrollbar-thumb {
    background: var(--chassis-border);
    border-radius: 10px;
    border: 3px solid transparent;
    background-clip: padding-box;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: var(--topbar-height);
    padding: 0 22px;
    background: var(--bg-body);
    border-bottom: 1px solid var(--chassis-border);
    flex-shrink: 0;
}

.topbar-title { min-width: 0; }

.topbar-eyebrow {
    font-size: 11px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-secondary);
    margin-bottom: 1px;
}

.topbar-title h1 {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.icon-btn {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: var(--surface-sunken);
    border: 1px solid var(--card-glass-border);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}

.icon-btn:hover { border-color: var(--brand-copper); color: var(--brand-copper); }

.theme-toggle-btn .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle-btn .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle-btn .icon-moon { display: block; }

/* Fil d'ariane contextuel cheval */
.subnav {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    padding: 9px 22px;
    background: var(--bg-body);
    border-bottom: 1px solid var(--chassis-border);
    flex-shrink: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.subnav::-webkit-scrollbar { display: none; }
.subnav .back-btn { position: static; margin-right: 8px; }

.subnav-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    border-radius: 7px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: background 0.15s ease, color 0.15s ease;
    min-height: 28px;
    flex-shrink: 0;
}

.subnav-tab .app-icon { width: 15px; height: 15px; flex-shrink: 0; }

.subnav-tab:hover { background: var(--surface-sunken); color: var(--text-primary); }

.subnav-tab.active {
    background: var(--brand-navy);
    color: var(--bg-body);
    box-shadow: none;
}

.content {
    flex: 1;
    min-width: 0;
    width: 100%;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 26px 28px 56px;
}

/* ============================================================
   Cartes et surfaces : les classes de vos pages, retunées
   ============================================================ */
.card,
.card-glass,
.panel,
.stat-card,
.kpi-card,
.horse-card,
.lot-card,
.health-card,
.billing-card,
.race-card,
.section-card {
    background: var(--surface);
    border: 1px solid var(--card-glass-border);
    border-radius: 11px;
    box-shadow: var(--shadow-card);
    backdrop-filter: none;
}

.horse-card:hover,
.race-card:hover {
    border-color: var(--brand-copper);
    box-shadow: var(--shadow-raised);
}

/* Tableaux : denses, filets fins, chiffres tabulaires */
table { width: 100%; border-collapse: collapse; }

thead th {
    text-align: left;
    padding: 10px 16px;
    background: var(--surface-sunken);
    border-bottom: 1px solid var(--card-glass-border);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-secondary);
    white-space: nowrap;
}

tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--hairline);
    font-size: 12.5px;
    color: var(--text-primary);
}

tbody tr:hover { background: var(--surface-muted); }

td.num, th.num, .num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Champs de saisie */
input[type="text"], input[type="number"], input[type="date"],
input[type="search"], input[type="password"], input[type="email"],
select, textarea {
    background: var(--surface);
    border: 1px solid var(--card-glass-border);
    border-radius: 7px;
    padding: 0 10px;
    min-height: 32px;
    color: var(--text-primary);
    font-size: 12.5px;
    transition: border-color 0.15s ease;
}
textarea { padding: 9px 10px; min-height: 72px; line-height: 1.5; }
input:hover, select:hover, textarea:hover { border-color: var(--text-tertiary); }
input:focus, select:focus, textarea:focus { border-color: var(--brand-copper); outline: none; }
input::placeholder, textarea::placeholder { color: var(--text-tertiary); }

label, .field label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

/* Pastilles de statut : jamais de la couleur d'un bouton d'action */
.badge, .tag, .chip, .status-pill, .statut {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 20px;
    border: 1px solid var(--card-glass-border);
    background: var(--surface-sunken);
    color: var(--text-secondary);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge.ok, .tag.ok, .status-pill.ok, .statut.apte, .statut-fit {
    background: var(--neon-green-glow); border-color: var(--neon-green); color: var(--neon-green);
}
.badge.warn, .tag.warn, .status-pill.warn, .statut-monitoring {
    background: var(--neon-amber-glow); border-color: var(--neon-amber); color: var(--neon-amber);
}
.badge.danger, .tag.danger, .status-pill.danger, .statut-care {
    background: var(--neon-red-glow); border-color: var(--neon-red); color: var(--neon-red);
}
.badge.info, .tag.info, .status-pill.info, .statut-rest {
    background: var(--neon-blue-glow); border-color: var(--neon-blue); color: var(--neon-blue);
}

/* Casaques : toujours en médaillon rond, à gauche du nom */
.casaque, .casaque-img, img[src*="casques"], img[src*="casaques"] {
    border-radius: 50%;
    object-fit: contain;
    background: var(--surface-sunken);
    border: 1px solid var(--card-glass-border);
}

/* Grilles réutilisables */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.grid-span-2 { grid-column: span 2; }

.section-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 12px;
    padding-left: 0;
}

.preview-banner {
    background: var(--neon-amber-glow);
    border: 1px solid var(--neon-amber);
    color: var(--neon-amber);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-radius: 7px;
    padding: 8px 12px;
    margin-bottom: 16px;
    text-align: center;
}

.back-btn {
    width: 30px;
    height: 30px;
    background: var(--surface-sunken);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border: 1px solid var(--card-glass-border);
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.back-btn:hover { border-color: var(--brand-copper); color: var(--brand-copper); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 980px) {
    .sidebar-ecurie { display: none; }
    .topbar, .content, .subnav { padding-left: 20px; padding-right: 20px; }
}

@media (max-width: 720px) {
    .topbar, .content, .subnav { padding-left: 16px; padding-right: 16px; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .grid-span-2 { grid-column: span 1; }
    /* Sur mobile, les cibles tactiles repassent à 44px */
    .btn-primary, .btn-secondary, .btn-add, .btn-ana, .action-btn,
    .planning-action, .btn-health-primary, .btn-health-secondary,
    .sidebar .nav-item, .subnav-tab { min-height: 44px; }
    input, select, textarea { min-height: 44px; }
}

@media print {
    .sidebar, .topbar, .subnav, .toast-region { display: none !important; }
    .app-shell > .app-main { margin-left: 0; }
    .app-main { height: auto; overflow: visible; }
    body { background: #ffffff; }
    .card, .card-glass, .panel { box-shadow: none; break-inside: avoid; }
}
