/* ==========================================================================
   CORE — base.css
   Styles partagés (home + echo + identification)
   Objectif :
   - Un seul “design system” global : tokens, layout, composants réutilisables
   - Les fichiers CSS de module ne contiennent QUE du spécifique
   ========================================================================== */


/* ==========================================================================
   1) TOKENS (variables CSS)
   ========================================================================== */

:root {
    /* Brand */
    --primary: #31b2a4;
    --primary-dark: #499794;
    --accent: #20c9b6;

    /* Surfaces */
    --bg-page: #f4fbfa;
    --bg-surface: #ffffff;
    --bg-elevated: #ffffff;

    /* Borders */
    --border-subtle: #d4dde9;
    --border-strong: #cbd5e1;

    /* Text */
    --text-main: #0f172a;
    --text-muted: #6b7280;

    /* Radius / Shadow */
    --radius-lg: 16px;
    --radius-md: 10px;
    --shadow-soft: 0 14px 32px rgba(15, 23, 42, 0.14);

    /* Sizes (uniformisation) */
    --control-h: 34px;
    --chip-h: 34px;
    --btn-h: 34px;

    /* UI */
    --chip-bg: #f9fafb;
}

body.dark {
    /* IMPORTANT : le thème est appliqué en changeant UNIQUEMENT les tokens */
    --bg-page: #020617;
    --bg-surface: #02081b;
    --bg-elevated: #020b23;

    --border-subtle: #1f2937;
    --border-strong: #334155;

    --text-main: #e5f9f7;
    --text-muted: #9ca3af;

    --chip-bg: rgba(15, 23, 42, 0.9);
    --shadow-soft: 0 14px 32px rgba(0, 0, 0, 0.85);
}


/* ==========================================================================
   2) BASE / RESET
   ========================================================================== */

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

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, "Helvetica Neue", Arial, sans-serif;

    color: var(--text-main);
    font-size: 14px;
    line-height: 1.6;

    background:
        radial-gradient(circle at top left, rgba(6, 193, 179, 0.20), transparent 55%),
        radial-gradient(circle at bottom right, rgba(19, 196, 163, 0.18), transparent 55%),
        var(--bg-page);

    transition: background 0.25s ease, color 0.25s ease;
}

body.dark {
    background:
        radial-gradient(circle at top left, rgba(6, 193, 179, 0.15), transparent 40%),
        radial-gradient(circle at bottom right, rgba(15, 23, 42, 0.9), transparent 70%),
        var(--bg-page);
}


/* ==========================================================================
   3) TOPBAR (identique en light/dark)
   Pourquoi ?
   - On veut le même rendu (bleu/vert) quel que soit le thème.
   - On force les controls (select) à rester “light”, sinon certains navigateurs
     appliquent un style dark natif (fond noir / texte illisible).
   ========================================================================== */

.topbar {
    background: linear-gradient(90deg, var(--primary-dark), var(--accent));
    color: #fff;
    padding: 10px 22px;
    box-shadow: 0 10px 24px rgba(49, 178, 164, 0.55);

    /* Empêche l’UI “dark native” des form-controls dans la topbar */
    color-scheme: light;
}

/* Double sécurité : certains navigateurs appliquent sur les enfants */
.topbar,
.topbar * { color-scheme: light; }

.topbar-inner {
    max-width: 1180px;
    margin: 0 auto;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo { height: 40px; width: auto; }

.clinic-name {
    font-size: 0.84rem;
    font-weight: 750;
    letter-spacing: 0.02em;
    opacity: 0.96;
}

.app-title {
    font-size: 1.14rem;
    font-weight: 650;
    letter-spacing: 0.02em;
}

.app-subtitle { font-size: 0.82rem; opacity: 0.92; }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.82rem;
}

/* Chips topbar */
.chip {
    height: var(--chip-h);
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(248, 250, 252, 0.65);
    background: rgba(15, 23, 42, 0.14);
    font-weight: 650;
    font-size: 0.78rem;
}

/* Vet select (topbar) */
.vet-select-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 10px;
}

.vet-select-label {
    font-size: 0.82rem;
    font-weight: 650;
    color: rgba(255, 255, 255, 0.92);
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
    white-space: nowrap;
}

.topbar .vet-select {
    height: var(--control-h);
    min-height: var(--control-h);

    border-radius: 999px;
    padding: 0 38px 0 14px;

    border: 1px solid rgba(255, 255, 255, 0.38);
    background-color: rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.96);

    font-weight: 650;
    letter-spacing: 0.01em;

    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);

    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.10);
    outline: none;

    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    /* Flèche discrète */
    background-image:
        linear-gradient(45deg, transparent 50%, rgba(255, 255, 255, 0.9) 50%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.9) 50%, transparent 50%),
        linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0));
    background-position:
        calc(100% - 18px) 13px,
        calc(100% - 13px) 13px,
        0 0;
    background-size:
        5px 5px,
        5px 5px,
        100% 100%;
    background-repeat: no-repeat;
}

.topbar .vet-select:hover {
    background-color: rgba(255, 255, 255, 0.24);
    border-color: rgba(255, 255, 255, 0.58);
}

/* Fix “redevient noir après sélection” */
.topbar .vet-select:focus,
.topbar .vet-select:focus-visible,
.topbar .vet-select:active {
    background-color: rgba(255, 255, 255, 0.18) !important;
    border-color: rgba(255, 255, 255, 0.75) !important;
    color: rgba(255, 255, 255, 0.96) !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.16), 0 8px 18px rgba(0, 0, 0, 0.12);
}

/* Dropdown (souvent OS-native) */
.topbar .vet-select option { color: #111; }


/* ==========================================================================
   REQUIRED FIELDS — halo état (réutilisable core)
   - .req-empty : obligatoire mais vide  -> halo orange
   - .req-ok    : obligatoire et rempli  -> halo vert
   ========================================================================== */

input.req-empty,
select.req-empty,
textarea.req-empty {
  border-color: rgba(255, 145, 0, 0.9) !important;
  box-shadow: 0 0 0 2px rgba(255, 145, 0, 0.20) !important;
}

input.req-ok,
select.req-ok,
textarea.req-ok {
  border-color: rgba(0, 170, 90, 0.9) !important;
  box-shadow: 0 0 0 2px rgba(0, 170, 90, 0.18) !important;
}

/* Optionnel : ne pas “casser” le focus, on laisse le focus visible mais
   on garde la couleur de statut en priorité */
input.req-empty:focus,
select.req-empty:focus,
textarea.req-empty:focus,
input.req-ok:focus,
select.req-ok:focus,
textarea.req-ok:focus {
  outline: none;
}



/* ==========================================================================
   4) THEME TOGGLE
   ========================================================================== */

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.theme-label {
    font-size: 0.78rem;
    opacity: 0.95;
}

.theme-switch {
    position: relative;
    width: 40px;
    height: 22px;
    border-radius: 999px;

    border: 1px solid rgba(15, 23, 42, 0.15);
    background: rgba(15, 23, 42, 0.15);

    cursor: pointer;
    padding: 0;
    outline: none;
}

.theme-thumb {
    position: absolute;
    top: 2px;
    left: 2px;

    width: 16px;
    height: 16px;
    border-radius: 999px;

    background: #fff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.45);
    transition: transform 0.22s ease;
}

.theme-switch-icon {
    position: absolute;
    top: 2px;

    width: 16px;
    height: 16px;

    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;

    pointer-events: none;
}

.theme-switch-icon.sun { left: 4px; }
.theme-switch-icon.moon { right: 4px; }

body.dark .theme-switch {
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(148, 163, 184, 0.6);
}
body.dark .theme-thumb { transform: translateX(16px); }


/* ==========================================================================
   5) LAYOUT GLOBAL
   ========================================================================== */

.shell {
    max-width: 1180px;
    margin: 18px auto;

    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-subtle);

    padding: 18px 20px 16px;
    transition: background 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

body.dark .shell { background: rgba(15, 23, 42, 0.9); }

.content { margin-top: 6px; }


/* ==========================================================================
   6) MODULE HEADER (sous la topbar)
   ========================================================================== */

.module-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;

    padding: 6px 2px 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border-subtle);
}

.mh-left { min-width: 0; }

.mh-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 850;
    letter-spacing: 0.01em;
    line-height: 1.15;
}

.mh-subtitle {
    margin-top: 6px;
    font-size: 0.92rem;
    color: var(--text-muted);
    line-height: 1.3;
}

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

@media (max-width: 900px) {
    .module-header { flex-direction: column; align-items: stretch; }
    .mh-right { justify-content: flex-end; }
}


/* ==========================================================================
   7) SECTIONS / PANES
   ========================================================================== */

.pane {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    padding: 13px 13px 12px;
    background: var(--bg-elevated);
    transition: background 0.25s ease, border-color 0.25s ease;
}

.pane-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
}

.pane-title {
    font-size: 0.98rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pane-hint { font-size: 0.80rem; color: var(--text-muted); }

.section-label {
    font-size: 0.80rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.help { font-size: 0.76rem; color: var(--text-muted); margin-top: 2px; }


/* ==========================================================================
   8) STEPPER
   ========================================================================== */

.stepper {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 14px;
    padding: 0 2px;
}

.step {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;

    font-size: 0.80rem;
    padding: 7px 12px;

    border-radius: 999px;
    background: var(--chip-bg);
    border: 1px solid var(--border-subtle);

    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.step-number {
    width: 18px;
    height: 18px;
    border-radius: 999px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 1px solid #d1d5db;
    font-size: 0.72rem;
    background: #f9fafb;
}

.step.active {
    background: rgba(6, 193, 179, 0.10);
    border-color: rgba(6, 193, 179, 0.60);
    color: var(--primary-dark);
    font-weight: 600;
}
.step.active .step-number {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-color: transparent;
    color: #fff;
}

.step.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

body.dark .step { background: rgba(15, 23, 42, 0.9); border-color: var(--border-subtle); }
body.dark .step-number { background: #020617; border-color: #334155; color: var(--text-muted); }
body.dark .step.active { background: rgba(6, 193, 179, 0.18); }

.step-content { display: none; }
.step-content.active { display: block; }


/* ==========================================================================
   9) CARDS
   ========================================================================== */

.card-soft {
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.02);
}
.card-strong {
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    padding: 10px 12px;
    background: var(--bg-elevated);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.12);
}
body.dark .card-soft { background: rgba(15, 23, 42, 0.9); }
body.dark .card-strong { background: rgba(15, 23, 42, 1); }


/* ==========================================================================
   10) GRIDS (global)
   ========================================================================== */

/* Layout “générique” (souvent : infos à gauche / contenu à droite) */
.cols-2 {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.7fr);
    gap: 10px 14px;
}
@media (max-width: 900px) {
    .cols-2 { grid-template-columns: minmax(0, 1fr); }
}


/* ==========================================================================
   11) FORMS (global)
   ========================================================================== */

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px 14px;
    margin-bottom: 4px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Permet à un champ de prendre toute la largeur de la form-grid (2 colonnes) */
.form-row-wide {
  grid-column: 1 / -1;
}

label { font-size: 0.82rem; color: var(--text-muted); }

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
    min-height: var(--control-h);
    border-radius: 9px;
    border: 1px solid var(--border-subtle);

    padding: 7px 10px;
    font-size: 0.92rem;

    background-color: #f9fafb;
    color: var(--text-main);

    outline: none;
    font-family: inherit;

    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    background-color: #fff;
    box-shadow: 0 0 0 1px rgba(6, 193, 179, 0.12);
}

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

/* Dark forms (hors topbar : la topbar force déjà le light) */
body.dark input[type="text"],
body.dark input[type="number"],
body.dark input[type="date"],
body.dark select,
body.dark textarea {
    background-color: #020b1f;
    border-color: #334155;
    color: var(--text-main);
}

body.dark input[type="text"]:focus,
body.dark input[type="number"]:focus,
body.dark input[type="date"]:focus,
body.dark select:focus,
body.dark textarea:focus {
    border-color: var(--accent);
    background-color: #020f26;
    box-shadow: 0 0 0 1px rgba(32, 201, 182, 0.30);
}


/* ==========================================================================
   12) ACTIONS / BUTTONS (global)
   ========================================================================== */

.actions-row {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.btn-primary,
.btn-secondary,
.btn-chip,
.btn-primary-light,
.btn-danger-outline {
    min-height: var(--btn-h);
    border-radius: 999px;
    font-size: 0.84rem;
    cursor: pointer;
}

.btn-primary {
    border: none;
    padding: 7px 16px;
    font-weight: 650;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    box-shadow: 0 8px 18px rgba(6, 193, 179, 0.55);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(6, 193, 179, 0.60); }

.btn-secondary {
    border: 1px solid var(--border-strong);
    padding: 7px 14px;
    background: transparent;
    color: var(--text-main);
    font-weight: 600;
}
.btn-secondary:hover { background: rgba(148, 163, 184, 0.12); }

.btn-chip {
    border: 1px solid var(--border-strong);
    padding: 4px 12px;
    background: transparent;
    font-size: 0.80rem;
    font-weight: 600;
}
.btn-chip:hover { background: rgba(148, 163, 184, 0.12); }

.btn-primary-light {
    border: none;
    padding: 7px 14px;
    background: #fff;
    color: var(--primary-dark);
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
}


/* ==========================================================================
   13) TABLES (global)
   ========================================================================== */

table { border-collapse: collapse; width: 100%; }

th,
td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.86rem;
}

th {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: rgba(15, 23, 42, 0.02);
    text-align: left;
}
body.dark th { background: rgba(15, 23, 42, 0.9); }

.numeric { text-align: right; font-variant-numeric: tabular-nums; }


/* ==========================================================================
   14) STATUS PILLS
   ========================================================================== */

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    border: 1px solid transparent;
    white-space: nowrap;
}

.status-ok {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}
.status-warn {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}
.status-neutral {
    background: #e5e7eb;
    color: #374151;
    border-color: #d1d5db;
}


/* ==========================================================================
   15) DANGER ZONE (global)
   ========================================================================== */

.danger-zone {
    margin-top: 16px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #fee2e2;
    background: #fef2f2;
}

.danger-title {
    font-size: 0.82rem;
    font-weight: 750;
    color: #b91c1c;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.danger-text {
    font-size: 0.80rem;
    color: #7f1d1d;
    margin-bottom: 8px;
}

.btn-danger-outline {
    border: 1px solid #ef4444;
    background: transparent;
    padding: 6px 12px;
    color: #b91c1c;
    font-weight: 650;
}
.btn-danger-outline:hover { background: #fee2e2; }

body.dark .danger-zone { background: #020617; border-color: rgba(248, 113, 113, 0.45); }
body.dark .danger-title { color: #fecaca; }
body.dark .danger-text { color: #fca5a5; }
body.dark .btn-danger-outline { border-color: #f97373; color: #fecaca; }
body.dark .btn-danger-outline:hover { background: rgba(248, 113, 113, 0.14); }


/* ==========================================================================
   16) FOOTER
   ========================================================================== */

.footer {
    margin-top: 10px;
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}


/* ==========================================================================
   17) HOME — TOOL CARDS
   ========================================================================== */

.tools-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.tool-card {
    display: flex;
    gap: 12px;

    padding: 14px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);

    background: var(--bg-elevated);
    text-decoration: none;
    color: var(--text-main);

    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.tool-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12);
}

body.dark .tool-card { box-shadow: 0 14px 28px rgba(0, 0, 0, 0.45); }
.tool-card.is-disabled { opacity: 0.60; pointer-events: none; }

.tool-icon {
    width: 46px;
    height: 46px;
    flex: 0 0 auto;

    border-radius: 14px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(6, 193, 179, 0.12);
    border: 1px solid rgba(6, 193, 179, 0.22);

    font-size: 20px;
}

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

.tool-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.tool-title {
    font-weight: 780;
    font-size: 1.02rem;
    line-height: 1.2;
}

.tool-desc {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.35;
}

.tool-cta {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tool-path {
    font-size: 0.80rem;
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
    padding: 3px 10px;
    border-radius: 999px;
}

.home-note { margin-top: 14px; }
.home-note-title { font-weight: 700; margin-bottom: 4px; }
.home-note-text {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.35;
}


/* ==========================================================================
   DEMO BANNER
   ========================================================================== */

.demo-banner {
    max-width: 1180px;
    margin: 10px auto 0;
    padding: 10px 14px;

    border-radius: 12px;
    border: 1px solid rgba(220, 38, 38, 0.35);
    background: rgba(220, 38, 38, 0.10);

    color: var(--text-main);
    font-weight: 750;
    letter-spacing: 0.01em;
}

.demo-banner strong {
    display: inline-block;
    margin-right: 8px;
    padding: 2px 10px;
    border-radius: 999px;
    background: rgba(220, 38, 38, 0.85);
    color: #fff;
    font-weight: 900;
    font-size: 0.82rem;
}

/* Dark mode: un peu plus lisible */
body.dark .demo-banner {
    border-color: rgba(248, 113, 113, 0.45);
    background: rgba(248, 113, 113, 0.10);
}



/* ==========================================================================
   18) MODULE UI — COMPOSANTS PARTAGÉS (Echo + Identification)
   -> C’est le refactoring : on supprime la duplication des CSS modules.
   ========================================================================== */
   
/* Badges côte à côte (utilisé dans les listes / tables) */
.badges-inline{
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

/* --- Filtres / recherche (pattern commun) --- */
.filters-block { margin-bottom: 14px; }

.filters-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px 12px;
    align-items: end;
}

/* Élément qui doit prendre toute la largeur dans la grille */
.filters-span { grid-column: 1 / -1; }

/* Champ de recherche compact (pattern commun) */
.search-input.compact{
  max-width: 520px;     /* ajuste si tu veux : 420 / 520 / 620 */
  width: 100%;
}

/* Sur écrans larges : on évite que ça tire */
@media (min-width: 1100px){
  .search-input.compact{
    max-width: 520px;
  }
}


/* Zone “large” : barre recherche + 3 filtres (selon écrans) */
.filters-grid-wide {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 8px 12px;
}

.filters-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.quick-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.quick-filter-btn {
    padding: 7px 10px;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.75);
    color: var(--primary-dark);
    font-weight: 700;
    cursor: pointer;
    transition: transform .08s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease;
}

.quick-filter-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.10);
}

.quick-filter-btn.active {
    background: rgba(18, 165, 148, 0.16);
    border-color: rgba(18, 165, 148, 0.45);
}

.btn-search {
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(18, 165, 148, 0.35);
    background: rgba(255, 255, 255, 0.85);
    color: var(--primary-dark);
    font-weight: 900;
    cursor: pointer;
    transition: transform .08s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease;
}

.btn-search:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.10);
    border-color: rgba(18, 165, 148, 0.55);
}

/* Dark mode : garder de la lisibilité */
body.dark .quick-filter-btn {
    background: rgba(2, 11, 31, 0.55);
    border-color: rgba(255, 255, 255, 0.16);
    color: var(--text-main);
}
body.dark .quick-filter-btn.active {
    background: rgba(32, 201, 182, 0.14);
    border-color: rgba(32, 201, 182, 0.55);
    color: var(--text-main);
}
body.dark .btn-search {
    background: rgba(2, 11, 31, 0.55);
    border-color: rgba(32, 201, 182, 0.55);
    color: var(--text-main);
}
body.dark .btn-search:hover { border-color: rgba(32, 201, 182, 0.75); }


/* --- Tables : actions compactes (pattern commun) --- */
.row-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.btn-table {
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.90);
    font-weight: 800;
    cursor: pointer;
    transition: transform .08s ease, box-shadow .12s ease;
}

.btn-table:hover {
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.10);
    transform: translateY(-1px);
}

body.dark .btn-table {
    background: rgba(2, 11, 31, 0.55);
    border-color: rgba(255, 255, 255, 0.16);
}

/* Ligne sélectionnée (utilisée dans les listes de résultats) */
.selected-row {
    outline: 2px solid rgba(18, 165, 148, 0.35);
    box-shadow: 0 10px 26px rgba(18, 165, 148, 0.15);
}

/* Echo utilise aussi “exam-selected” */
.exam-row.exam-selected { /* alias visuel */
    outline: 2px solid rgba(18, 165, 148, 0.35);
    box-shadow: 0 10px 26px rgba(18, 165, 148, 0.15);
}


/* ==========================================================================
   19) RESPONSIVE
   ========================================================================== */

@media (max-width: 900px) {
    .topbar-inner,
    .shell { border-radius: 0; }

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


/* ==========================================================================
   20) SAFETY NET — lisibilité des boutons en dark mode
   - Certains navigateurs peuvent ré-appliquer des couleurs par défaut (noir).
   ========================================================================== */

button,
input[type="button"],
input[type="submit"],
input[type="reset"] {
    font: inherit;
    color: inherit;
}

/* En dark mode, on force une couleur lisible sur les boutons non “designés” */
body.dark button:not(.btn-primary):not(.btn-primary-light),
body.dark input[type="button"],
body.dark input[type="submit"],
body.dark input[type="reset"] {
    color: var(--text-main);
}

button:disabled,
input[type="button"]:disabled,
input[type="submit"]:disabled,
input[type="reset"]:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Always honor the HTML hidden attribute */
[hidden] {
  display: none !important;
}

/* Required fields must override focus styles */
input.req-empty:focus,
select.req-empty:focus,
textarea.req-empty:focus {
  border-color: rgba(255, 145, 0, 0.9) !important;
  box-shadow: 0 0 0 2px rgba(255, 145, 0, 0.20) !important;
}

input.req-ok:focus,
select.req-ok:focus,
textarea.req-ok:focus {
  border-color: rgba(0, 170, 90, 0.9) !important;
  box-shadow: 0 0 0 2px rgba(0, 170, 90, 0.18) !important;
}
