/* ====================================================================
   VisiDog — Système de Design du Portail
   Charte graphique VisiDog Vanilla : CSS natif, aucun framework, responsive.
   ==================================================================== */

:root {
    /* Couleurs institutionnelles VisiDog */
    --vd-navy: #002858;
    --vd-blue: #4898d8;
    --vd-blue-light: rgba(72, 152, 216, 0.14);
    --vd-ink: #101820;
    --vd-surface: #ffffff;
    --vd-bg: #f8f8f0;
    --vd-line: #e3e0d8;
    --vd-muted: #5a6472;

    /* Sémantiques */
    --vd-success: #1a7f37;
    --vd-warning: #9a6700;
    --vd-danger: #c62828;
    --vd-info: #4898d8;

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

    /* Espacements & Rayons */
    --vd-radius: 14px;
    --vd-radius-sm: 6px;
    --vd-radius-lg: 16px;

    /* Ombres */
    --vd-shadow: 0 4px 20px rgba(0, 40, 88, 0.06);
    --vd-shadow-lg: 0 16px 40px rgba(0, 40, 88, 0.14);
}

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

body {
    margin: 0;
    padding: 0;
    font-family: var(--vd-font);
    color: var(--vd-ink);
    background: var(--vd-bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Écrans d'accès communs aux espaces personnels et collectifs. */
[hidden] { display: none !important; }
.vd-access-page, #auth-view {
    background: radial-gradient(ellipse at 15% 10%, #e7f0fa, transparent 55%), var(--vd-bg);
}
.vd-access-header {
    max-width: 1120px;
    margin: auto;
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.vd-access-brand { display: inline-flex; align-items: center; gap: .7rem; color: var(--vd-navy); font-weight: 800; text-decoration: none; }
.vd-access-brand img { width: 40px; height: 40px; object-fit: contain; }
.vd-auth-shell { width: 100%; max-width: 520px; margin: auto; padding: 2rem 1.25rem; }
.vd-access-card { padding: 2rem; position: relative; border-radius: 20px; box-shadow: var(--vd-shadow-lg); }
.vd-access-card h1 { margin: 0 0 .75rem; color: var(--vd-navy); font-size: clamp(1.6rem, 4vw, 2rem); letter-spacing: -.035em; }
.vd-access-card h2 { line-height: 1.4; }
.vd-access-card .vd-form-input, .vd-access-card .vd-form-select { min-height: 46px; font-size: 1rem; }
.vd-access-card .vd-form-label { font-size: .9rem; }
.vd-access-card .vd-form-hint { line-height: 1.5; font-size: .8rem; margin-bottom: 0; }
.vd-access-card .vd-form-group:last-child { margin-bottom: 0; }
.vd-auth-language { display: flex; justify-content: flex-end; margin-bottom: 1rem; }
.vd-registration-access { min-width: 0; margin: 0 0 1.25rem; padding: 0; border: 0; }
.vd-registration-option { display: flex; align-items: center; gap: .65rem; min-height: 46px; margin-top: .5rem; padding: .65rem .75rem; border: 1px solid var(--vd-line); border-radius: var(--vd-radius-sm); cursor: pointer; font-size: .9rem; line-height: 1.4; }
.vd-registration-option input { flex-shrink: 0; margin: 0; accent-color: var(--vd-navy); }
.vd-registration-option:has(input:checked) { border-color: var(--vd-blue); background: var(--vd-blue-light); }
.vd-registration-option:focus-within { outline: 2px solid var(--vd-blue); outline-offset: 2px; }
/* Lignes de features (modale god mode) : même langage que les options
   d'inscription, en liste verticale compacte avec séparateurs. */
#gco-feat-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--vd-line); border-radius: var(--vd-radius-sm); padding: 0 .75rem; }
.vd-feature-row { display: flex; gap: .65rem; align-items: flex-start; padding: .6rem 0; border-bottom: 1px solid var(--vd-line); cursor: pointer; font-size: .9rem; line-height: 1.4; }
.vd-feature-row:last-child { border-bottom: 0; }
.vd-feature-row input { flex-shrink: 0; margin-top: .2rem; accent-color: var(--vd-navy); }
.vd-feature-row:has(input:checked) strong { color: var(--vd-navy); }
.vd-feature-row:focus-within { outline: 2px solid var(--vd-blue); outline-offset: 2px; }
.vd-access-intro { color: var(--vd-muted); line-height: 1.6; margin: 0 0 1.75rem; }
.vd-enroll-layout { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 3.5rem; align-items: start; max-width: 1120px; padding: 1rem 2rem 3rem; margin: auto; }
.vd-enroll-guide { padding-top: 2rem; }
.vd-access-eyebrow { color: var(--vd-navy); font-weight: 700; font-size: .85rem; }
.vd-enroll-guide h2 { color: var(--vd-navy); font-size: clamp(1.8rem, 3.5vw, 2.6rem); line-height: 1.15; letter-spacing: -.04em; margin: 1rem 0; }
.vd-enroll-guide p { line-height: 1.65; color: var(--vd-muted); }
.vd-access-steps { list-style: none; counter-reset: access-step; padding: 0; margin: 2rem 0; display: grid; gap: 1.5rem; }
.vd-access-steps li { counter-increment: access-step; position: relative; padding-left: 3.25rem; line-height: 1.5; }
.vd-access-steps li::before { content: counter(access-step); position: absolute; left: 0; top: 0; width: 2.25rem; height: 2.25rem; display: grid; place-items: center; background: white; border: 1px solid #c6d7e8; border-radius: 50%; font-weight: 700; color: var(--vd-navy); }
.vd-access-steps strong, .vd-access-steps span { display: block; }
.vd-access-steps span { color: var(--vd-muted); font-size: .9rem; margin-top: .25rem; }
.vd-access-note { border-top: 1px solid var(--vd-line); padding-top: 1.25rem; font-size: .9rem; }
.vd-access-fieldset { min-width: 0; padding: 0; margin: 0 0 1.75rem; border: 0; }
.vd-access-fieldset legend { width: 100%; font-weight: 700; color: var(--vd-navy); margin-bottom: 1.25rem; padding: 0 0 .75rem; border-bottom: 1px solid var(--vd-line); }
.vd-access-submit { width: 100%; min-height: 46px; }
.vd-access-status { line-height: 1.6; overflow-wrap: anywhere; margin: 1.25rem 0 0; }
.vd-access-footer { text-align: center; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--vd-line); font-size: .9rem; }
.vd-access-card a:not(.vd-btn), .vd-access-footer a { color: var(--vd-navy); text-underline-offset: .2em; }
.vd-access-page :focus-visible, #auth-view :focus-visible { outline: 3px solid var(--vd-blue); outline-offset: 3px; }
@media (max-width: 760px) {
    .vd-access-header { padding: 1rem; }
    .vd-enroll-layout { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; padding: .5rem 1rem 2rem; }
    .vd-enroll-guide { padding-top: 0; }
    .vd-enroll-card { grid-row: 1; }
    .vd-enroll-guide h2 { font-size: 1.8rem; }
    .vd-access-steps { gap: 1rem; margin: 1.25rem 0; }
    .vd-access-card { padding: 1.5rem; }
}
@media (max-width: 380px) {
    .vd-access-card { padding: 1.25rem; }
    .vd-access-header { gap: .5rem; }
    .vd-access-brand { font-size: .9rem; gap: .4rem; }
}

/* ============================================
   LAYOUT PRINCIPAL
   ============================================ */
.vd-portal {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.vd-portal-header {
    background: var(--vd-navy);
    color: white;
    height: 60px;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 10px rgba(0, 40, 88, 0.2);
}

.vd-portal-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.15rem;
    color: white;
    text-decoration: none;
    letter-spacing: -0.01em;
}

.vd-portal-brand-img {
    height: 1.8rem;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.vd-portal-brand-badge {
    background: var(--vd-blue);
    font-size: 0.65rem;
    text-transform: uppercase;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 700;
}

.vd-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.vd-header-announcement {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 .75rem;
    text-align: center;
    color: #fff;
    font-size: .86rem;
    font-weight: 600;
    line-height: 1.3;
    overflow-wrap: anywhere;
}
.vd-header-announcement[hidden] { display: none; }

.vd-announcement-form { display: grid; gap: 1.5rem; max-width: 960px; }
.vd-announcement-section { min-width: 0; }
.vd-announcement-section + .vd-announcement-section { padding-top: 1.35rem; border-top: 1px solid var(--vd-border, #e2e8f0); }
.vd-announcement-section-heading { margin-bottom: 1rem; }
.vd-announcement-section-heading h2 { margin: 0; font-size: 1rem; font-weight: 700; }
.vd-announcement-section-heading p { margin: .35rem 0 0; color: var(--vd-text-muted, #64748b); font-size: .875rem; line-height: 1.5; }
.vd-announcement-language-grid, .vd-announcement-date-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.vd-announcement-form .vd-form-group { min-width: 0; margin: 0; }
.vd-announcement-form .vd-form-control { width: 100%; min-width: 0; }
.vd-announcement-form textarea.vd-form-control { min-height: 8rem; resize: vertical; line-height: 1.5; }
.vd-form-hint { display: block; margin-top: .4rem; color: var(--vd-text-muted, #64748b); font-size: .78rem; }
.vd-announcement-actions { display: flex; justify-content: flex-end; padding-top: 1rem; border-top: 1px solid var(--vd-border, #e2e8f0); }
@media (max-width: 640px) {
    .vd-announcement-language-grid, .vd-announcement-date-grid { grid-template-columns: 1fr; gap: 1rem; }
    .vd-announcement-actions { justify-content: stretch; }
    .vd-announcement-actions .vd-btn { width: 100%; }
}

.vd-user-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.vd-user-role-badge {
    background: rgba(255, 255, 255, 0.15);
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* ============================================
   SIDEBAR NAVIGATION
   ============================================ */
.vd-layout {
    display: flex;
    flex: 1;
}

.vd-sidebar {
    width: 250px;
    background: var(--vd-surface);
    border-right: 1px solid var(--vd-line);
    min-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.25s ease;
}

.vd-sidebar-nav {
    padding: 1.25rem 0;
}

.vd-sidebar-section {
    padding: 0.75rem 1.25rem 0.35rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--vd-muted);
}

.vd-sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    color: var(--vd-ink);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
    cursor: pointer;
}

.vd-sidebar-link:hover {
    background: var(--vd-blue-light);
    color: var(--vd-navy);
}

.vd-sidebar-link.active {
    background: var(--vd-blue-light);
    color: var(--vd-navy);
    font-weight: 600;
    border-left-color: var(--vd-blue);
}

.vd-sidebar-advanced {
    margin-top: 1rem;
}
.vd-sidebar-advanced > summary {
    padding: 0.75rem 1rem;
    color: var(--vd-text-muted, #64748b);
    font-size: 0.85rem;
    cursor: pointer;
}
.vd-sidebar-advanced > summary:focus-visible {
    outline: 2px solid var(--vd-blue, #2563eb);
    outline-offset: -2px;
}

.vd-sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--vd-line);
}

/* ============================================
   CONTENU CENTRAL
   ============================================ */
.vd-main-content {
    flex: 1;
    padding: 2rem 2.5rem;
    max-width: 1400px;
}

.vd-page-header {
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.vd-page-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--vd-navy);
    margin: 0;
}

.vd-page-subtitle {
    font-size: 0.85rem;
    color: var(--vd-muted);
    margin: 0.25rem 0 0;
}

/* ============================================
   CARTES KPI
   ============================================ */
.vd-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.vd-kpi-card {
    background: var(--vd-surface);
    border: 1px solid var(--vd-line);
    border-radius: var(--vd-radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--vd-shadow);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.vd-kpi-label {
    font-size: 0.8rem;
    color: var(--vd-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.vd-kpi-value {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--vd-navy);
    line-height: 1.1;
    margin-bottom: 0.35rem;
}

.vd-kpi-sub {
    font-size: 0.78rem;
    color: var(--vd-muted);
}

/* ============================================
   PANNEAUX, TABLES & BOÎTES
   ============================================ */
.vd-card {
    background: var(--vd-surface);
    border: 1px solid var(--vd-line);
    border-radius: var(--vd-radius);
    box-shadow: var(--vd-shadow);
    margin-bottom: 1.75rem;
    overflow: hidden;
}

.vd-card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--vd-line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.vd-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--vd-navy);
    margin: 0;
}

.vd-card-body {
    padding: 1.5rem;
}

/* Cartes de synthèse utilisées par les vues d'administration. */
.vd-stats-grid {
    display: grid;
    gap: 1.25rem;
}

.vd-stat-card {
    background: var(--vd-surface);
    border: 1px solid var(--vd-line);
    border-radius: var(--vd-radius);
    box-shadow: var(--vd-shadow);
    padding: 1.25rem 1.5rem;
}

.vd-stat-label {
    font-size: 0.8rem;
    color: var(--vd-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.vd-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--vd-navy);
}

.vd-stat-desc {
    margin-top: 0.4rem;
    font-size: 0.8rem;
    color: var(--vd-muted);
}

/* Les cartes de monitoring ont du contenu direct, sans vd-card-body. */
.vd-monitoring-card {
    padding: 1.25rem 1.5rem;
}

.vd-monitoring-card .vd-card-header {
    padding: 0 0 0.75rem;
}

/* Tableaux */
.vd-table-responsive {
    width: 100%;
    overflow-x: auto;
}

.vd-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.vd-table th {
    background: var(--vd-bg);
    color: var(--vd-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    padding: 0.8rem 1.2rem;
    text-align: left;
    border-bottom: 1px solid var(--vd-line);
}

.vd-table td {
    padding: 0.85rem 1.2rem;
    border-bottom: 1px solid var(--vd-line);
    color: var(--vd-ink);
    vertical-align: middle;
}

.vd-table tr:hover td {
    background: rgba(72, 152, 216, 0.04);
}

/* ============================================
   BOUTONS & BADGES
   ============================================ */
.vd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border-radius: var(--vd-radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    font-family: inherit;
}

.vd-tool-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.vd-btn-primary {
    background: var(--vd-navy);
    color: white;
}
.vd-btn-primary:hover {
    background: #001a3d;
}

.vd-btn-secondary {
    background: var(--vd-surface);
    border-color: var(--vd-line);
    color: var(--vd-ink);
}
.vd-btn-secondary:hover {
    background: var(--vd-bg);
}

.vd-social-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.vd-social-buttons .vd-btn {
    padding-inline: 0.75rem;
    white-space: nowrap;
}

.vd-social-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.vd-btn-danger {
    background: var(--vd-danger);
    color: white;
}
.vd-btn-danger:hover {
    background: #9a1c1c;
}

.vd-btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
}

.vd-btn:disabled,
.vd-btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed !important;
    pointer-events: none !important;
    box-shadow: none !important;
    transform: none !important;
}

@keyframes vd-spin {
    to { transform: rotate(360deg); }
}

.vd-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: vd-spin 0.8s linear infinite;
    vertical-align: middle;
}

.vd-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.55rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
}
.vd-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 2px;
    background: currentColor;
}

.vd-badge-success { background: rgba(26, 127, 55, 0.12); color: var(--vd-success); }
.vd-badge-warning { background: rgba(154, 103, 0, 0.12); color: var(--vd-warning); }
.vd-badge-danger { background: rgba(198, 40, 40, 0.12); color: var(--vd-danger); }
.vd-badge-info { background: var(--vd-blue-light); color: var(--vd-navy); }
.vd-badge-muted { background: var(--vd-line); color: var(--vd-muted); }

/* ============================================
   BANDEAUX D'ALERTE ET NOTIFICATIONS IN-PAGE
   ============================================ */
.vd-alert {
    padding: 0.85rem 1.1rem;
    border-radius: var(--vd-radius-sm);
    font-size: 0.85rem;
    line-height: 1.45;
    margin-bottom: 1.25rem;
    border: 1px solid transparent;
    display: block;
    text-align: left;
    box-sizing: border-box;
}
.vd-alert-danger {
    background: #fef2f2;
    border-color: #fecaca;
    border-left: 4px solid var(--vd-danger);
    color: #991b1b;
}
.vd-alert-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    border-left: 4px solid var(--vd-success);
    color: #166534;
}
.vd-alert-warning {
    background: #fffbeb;
    border-color: #fde68a;
    border-left: 4px solid var(--vd-warning);
    color: #92400e;
}
.vd-alert-info {
    background: #f0f9ff;
    border-color: #bae6fd;
    border-left: 4px solid var(--vd-blue);
    color: var(--vd-navy);
}

/* ============================================
   PROGRESS BARS & CHARTS CSS
   ============================================ */
.vd-progress {
    height: 8px;
    background: var(--vd-line);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.4rem;
}

.vd-progress-bar {
    height: 100%;
    background: var(--vd-blue);
    border-radius: 4px;
    transition: width 0.4s ease;
}
.vd-progress-bar.warning { background: var(--vd-warning); }
.vd-progress-bar.danger { background: var(--vd-danger); }

/* Bar Chart */
.vd-chart-bars-wrap {
    height: 180px;
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    padding: 1rem 0 0.5rem;
    border-bottom: 1px solid var(--vd-line);
}

.vd-chart-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.vd-chart-bar-fill {
    width: 100%;
    max-width: 36px;
    background: var(--vd-blue);
    border-radius: 4px 4px 0 0;
    transition: height 0.3s ease;
    position: relative;
}
.vd-chart-bar-fill:hover {
    background: var(--vd-navy);
}

.vd-chart-bar-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--vd-ink);
    color: white;
    font-size: 0.68rem;
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    margin-bottom: 4px;
}
.vd-chart-bar-fill:hover .vd-chart-bar-tooltip {
    opacity: 1;
}

.vd-chart-bar-label {
    font-size: 0.7rem;
    color: var(--vd-muted);
    margin-top: 0.4rem;
    text-align: center;
}

/* Donut Chart */
.vd-donut-chart {
    position: relative;
    width: 110px;
    height: 110px;
}
.vd-donut-chart svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}
.vd-donut-bg {
    fill: none;
    stroke: var(--vd-line);
    stroke-width: 3.2;
}
.vd-donut-fill {
    fill: none;
    stroke: var(--vd-blue);
    stroke-width: 3.2;
    stroke-linecap: round;
    transition: stroke-dasharray 0.5s ease;
}
.vd-donut-fill.warning { stroke: var(--vd-warning); }
.vd-donut-fill.danger { stroke: var(--vd-danger); }

.vd-donut-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}
.vd-donut-val {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--vd-navy);
    display: block;
    line-height: 1;
}
.vd-donut-sub {
    font-size: 0.65rem;
    color: var(--vd-muted);
    display: block;
    margin-top: 2px;
}

/* ============================================
   MODALES
   ============================================ */
.vd-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 40, 88, 0.45);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}
.vd-modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.vd-modal-content {
    background: var(--vd-surface);
    border-radius: var(--vd-radius);
    width: min(550px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--vd-shadow-lg);
    border: 1px solid var(--vd-line);
    transform: translateY(15px);
    transition: transform 0.2s ease;
}
.vd-modal-backdrop.active .vd-modal-content {
    transform: translateY(0);
}

.vd-modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--vd-line);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.vd-modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--vd-navy);
    margin: 0;
}
.vd-modal-close {
    background: none;
    border: none;
    font-size: 1.35rem;
    cursor: pointer;
    color: var(--vd-muted);
    line-height: 1;
    padding: 0;
}

.vd-modal-body {
    padding: 1.5rem;
}
.vd-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--vd-line);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Formulaires */
.vd-form-group {
    margin-bottom: 1.25rem;
}
.vd-form-label, .vd-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--vd-ink);
}
.vd-form-input, .vd-form-select, .vd-form-textarea, .vd-input, .vd-select {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--vd-line);
    border-radius: var(--vd-radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--vd-surface);
    color: var(--vd-ink);
}
.vd-form-input:focus, .vd-form-select:focus, .vd-form-textarea:focus, .vd-input:focus, .vd-select:focus {
    outline: none;
    border-color: var(--vd-blue);
    box-shadow: 0 0 0 3px var(--vd-blue-light);
}
.vd-form-hint {
    font-size: 0.75rem;
    color: var(--vd-muted);
    margin-top: 0.35rem;
}

/* Les identifiants techniques restent lisibles : ils se recopient sans ambiguïté. */
.vd-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85em;
}

/* Les capacités et tarifs gardent des champs lisibles dans la modale étroite. */
#model-capability-fields, #model-pricing-fields {
    margin-top: 1.25rem;
    padding: 1rem;
    border: 1px solid var(--vd-line);
    border-radius: var(--vd-radius-sm);
    min-width: 0;
}
#model-capability-fields > label, #model-pricing-fields > label {
    display: block;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}
#model-capability-fields .vd-input, #model-pricing-fields .vd-input,
#model-pricing-fields .vd-select { margin-top: 0.35rem; }
#model-pricing-fields legend { font-size: 0.9rem; font-weight: 600; }

/* Toast notifications */
.vd-toast-container {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.vd-toast {
    background: var(--vd-surface);
    border: 1px solid var(--vd-line);
    border-left: 4px solid var(--vd-blue);
    box-shadow: var(--vd-shadow);
    padding: 0.75rem 1.1rem;
    border-radius: var(--vd-radius-sm);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    animation: toastSlide 0.25s ease;
}
.vd-toast-success { border-left-color: var(--vd-success); }
.vd-toast-error { border-left-color: var(--vd-danger); }
.vd-toast-warning { border-left-color: var(--vd-warning); }

@keyframes toastSlide {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
    .vd-portal-header {
        height: auto;
        min-height: 60px;
        padding: .75rem 1rem;
        flex-wrap: wrap;
        gap: .75rem;
    }
    .vd-portal-brand { max-width: 100%; flex-wrap: wrap; }
    .vd-portal-brand-badge { max-width: 100%; overflow-wrap: anywhere; }
    .vd-header-actions { width: 100%; flex-wrap: wrap; gap: .5rem .75rem; }
    .vd-header-announcement { flex: 1 1 100%; order: 3; padding: .2rem 0; }
    .vd-user-profile { max-width: 100%; flex-wrap: wrap; overflow-wrap: anywhere; }
    .vd-layout {
        flex-direction: column;
    }
    .vd-sidebar {
        width: 100%;
        min-height: auto;
        border-right: none;
        border-bottom: 1px solid var(--vd-line);
    }
    .vd-sidebar-nav {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        padding: 0.5rem;
    }
    .vd-sidebar-section {
        display: none;
    }
    .vd-sidebar-link {
        display: inline-flex;
        white-space: nowrap;
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: 0.5rem 0.75rem;
    }
    .vd-sidebar-link.active {
        border-bottom-color: var(--vd-blue);
    }
    .vd-main-content {
        padding: 1.25rem;
    }
    .vd-monitoring-card {
        padding: 1rem 1.15rem;
    }
}

/* ============================================
   SÉLECTEUR DE LANGUE BILINGUE (FR / EN)
   ============================================ */
.vd-lang-switcher {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    user-select: none;
}

.vd-lang-switcher button {
    border: none;
    outline: none;
    cursor: pointer;
    font-family: var(--vd-font);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    border-radius: 4px;
    padding: 4px 7px;
    transition: all 0.15s ease;
}

.vd-lang-switcher button:hover {
    filter: brightness(1.15);
}

/* ============================================
   TABLE TOOLBAR, FILTRES COLONNES & PAGINATION
   ============================================ */
.vd-table-toolbar {
    padding: 0.85rem 1.25rem;
    background: var(--vd-surface);
    border-bottom: 1px solid var(--vd-line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.vd-table-toolbar-left,
.vd-table-toolbar-right {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.vd-per-page-group {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    color: var(--vd-muted);
}

.vd-per-page-select {
    padding: 0.35rem 0.6rem;
    font-size: 0.82rem;
    font-family: inherit;
    border: 1px solid var(--vd-line);
    border-radius: var(--vd-radius-sm);
    background: var(--vd-surface);
    color: var(--vd-ink);
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s ease;
}

.vd-per-page-select:focus {
    border-color: var(--vd-blue);
}

.vd-filter-row th {
    background: #f1f4f8;
    padding: 0.45rem 0.5rem;
    border-bottom: 2px solid var(--vd-line);
    vertical-align: middle;
}

.vd-col-filter {
    width: 100%;
    min-width: 70px;
    padding: 0.35rem 0.5rem;
    font-size: 0.76rem;
    font-family: inherit;
    border: 1px solid var(--vd-line);
    border-radius: var(--vd-radius-sm);
    background: var(--vd-surface);
    color: var(--vd-ink);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.03);
    outline: none;
    transition: all 0.15s ease;
    box-sizing: border-box;
}

.vd-col-filter:focus {
    border-color: var(--vd-blue);
    background: #fff;
    box-shadow: 0 0 0 2px rgba(72, 152, 216, 0.2);
}

.vd-col-filter::placeholder {
    color: #9aa5b5;
    font-size: 0.74rem;
}

select.vd-col-filter {
    cursor: pointer;
}

.vd-pagination-bar {
    padding: 0.85rem 1.25rem;
    background: var(--vd-surface);
    border-top: 1px solid var(--vd-line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.vd-pagination-info {
    font-size: 0.82rem;
    color: var(--vd-muted);
}

.vd-pagination-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.vd-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 0.5rem;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    border: 1px solid var(--vd-line);
    border-radius: var(--vd-radius-sm);
    background: var(--vd-surface);
    color: var(--vd-ink);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.vd-page-btn:hover:not(:disabled):not(.active) {
    border-color: var(--vd-blue);
    color: var(--vd-navy);
    background: var(--vd-blue-light);
}

.vd-page-btn.active {
    background: var(--vd-navy);
    color: #ffffff;
    border-color: var(--vd-navy);
    cursor: default;
}

.vd-page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    background: #f8f9fa;
}

.vd-page-ellipsis {
    padding: 0 0.35rem;
    color: var(--vd-muted);
    font-size: 0.82rem;
    user-select: none;
}

.vd-active-filters-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    background: var(--vd-blue-light);
    color: var(--vd-navy);
}

/* Styles Alertes & Webhooks */
.vd-alerts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}
@media (min-width: 1024px) {
    .vd-alerts-grid {
        grid-template-columns: 1.15fr 0.85fr;
    }
}

.vd-channel-card {
    background: var(--vd-surface);
    border: 1px solid var(--vd-line);
    border-radius: var(--vd-radius);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.vd-channel-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}
.vd-channel-card.active {
    border-color: #38bdf8;
    background: linear-gradient(to bottom, #ffffff, #f8fafc);
}

.vd-channel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}
.vd-channel-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--vd-ink);
}
.vd-channel-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--vd-blue-light);
    color: var(--vd-navy);
    font-size: 1.1rem;
}

.vd-code-preview-container {
    position: relative;
    background: #0f172a;
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.82rem;
    line-height: 1.5;
    color: #e2e8f0;
    border: 1px solid #1e293b;
}
.vd-code-preview-container pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
}
.vd-code-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #1e293b;
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.vd-copy-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    padding: 0.25rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.vd-copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.vd-quota-progress-container {
    background: #f1f5f9;
    border-radius: 6px;
    height: 10px;
    overflow: hidden;
    position: relative;
    margin: 0.5rem 0 0.75rem 0;
}
.vd-quota-progress-bar {
    height: 100%;
    border-radius: 6px;
    transition: width 0.4s ease;
}
.vd-quota-threshold-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #dc2626;
    z-index: 2;
}

.vd-test-result-box {
    margin-top: 0.75rem;
    padding: 0.6rem 0.85rem;
    border-radius: 6px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.vd-test-result-box.success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}
.vd-test-result-box.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
