/* Styles spécifiques au dashboard admin */

[x-cloak] { display: none !important; }

/* === Sidebar === */
.admin-shell {
    min-height: 100vh;
    display: flex;
}

.admin-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 16rem;
    background-color: var(--samko-navy);
    background-image:
        linear-gradient(180deg, var(--samko-navy) 0%, var(--samko-navy-deep) 100%);
    color: white;
    z-index: 40;
    display: flex;
    flex-direction: column;
    transform: translateX(0);
    transition: transform 0.25s ease, width 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 1px 0 0 rgba(201, 169, 97, 0.10), 6px 0 28px rgba(15, 42, 71, 0.18);
}

.admin-main {
    margin-left: 16rem;
    flex: 1;
    min-width: 0;
    background-color: #f8fafc;
    transition: margin-left 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

/* === Sidebar collapsed (desktop only) === */
@media (min-width: 1024px) {
    html[data-sidebar="collapsed"] .admin-sidebar { width: 4.75rem; }
    html[data-sidebar="collapsed"] .admin-main { margin-left: 4.75rem; }

    /* Cacher tous les labels (texte direct ou span) en collapsed via font-size:0
       sur le parent. Les SVG sont en width/height explicites donc non affectés. */
    html[data-sidebar="collapsed"] .admin-nav-link {
        font-size: 0;
        justify-content: center;
        padding: 0.6rem 0.5rem;
        gap: 0;
    }
    html[data-sidebar="collapsed"] .admin-nav-link svg { width: 16px; height: 16px; }

    html[data-sidebar="collapsed"] .sidebar-brand-text,
    html[data-sidebar="collapsed"] .sidebar-user-meta,
    html[data-sidebar="collapsed"] .theme-quick-toggle > span,
    html[data-sidebar="collapsed"] .sidebar-logout > span {
        display: none;
    }

    html[data-sidebar="collapsed"] .admin-nav-section-label {
        font-size: 0;
        margin: 1rem 0 0.5rem;
        padding: 0 0.75rem;
        height: 1px;
        background: rgba(201, 169, 97, 0.20);
    }

    html[data-sidebar="collapsed"] .sidebar-brand { justify-content: center; }
    html[data-sidebar="collapsed"] .sidebar-footer {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    html[data-sidebar="collapsed"] .theme-quick-toggle,
    html[data-sidebar="collapsed"] .sidebar-logout {
        justify-content: center;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        gap: 0;
    }
    html[data-sidebar="collapsed"] .sidebar-user-block {
        flex-direction: column;
        align-items: center;
        gap: 0;
    }
    html[data-sidebar="collapsed"] .sidebar-collapse-btn svg { transform: rotate(180deg); }
    html[data-sidebar="collapsed"] .sidebar-collapse-btn[title]:hover::after,
    html[data-sidebar="collapsed"] .admin-nav-link[title]:hover::after,
    html[data-sidebar="collapsed"] .theme-quick-toggle[title]:hover::after,
    html[data-sidebar="collapsed"] .sidebar-logout[title]:hover::after {
        content: attr(title);
        position: absolute;
        left: 100%;
        margin-left: 0.6rem;
        top: 50%;
        transform: translateY(-50%);
        background: var(--samko-navy-deep);
        color: white;
        padding: 0.35rem 0.65rem;
        border-radius: 6px;
        font-size: 0.75rem;
        white-space: nowrap;
        z-index: 50;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
        border: 1px solid rgba(201, 169, 97, 0.3);
        pointer-events: none;
    }
}

@media (max-width: 1023px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }
    .admin-sidebar.open {
        transform: translateX(0);
    }
    .admin-main {
        margin-left: 0;
    }
}

/* === Sidebar header === */
.sidebar-header {
    height: 60px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.875rem 0 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    overflow: hidden;
}
.sidebar-brand-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.92);
    letter-spacing: 0.01em;
    transition: opacity 0.15s ease;
}
.sidebar-collapse-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.04);
    transition: background 0.15s ease, color 0.15s ease;
    cursor: pointer;
}
.sidebar-collapse-btn:hover {
    background: rgba(201, 169, 97, 0.18);
    color: white;
}
.sidebar-collapse-btn svg { transition: transform 0.25s ease; }

/* === Nav links === */
.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.875rem;
    border-radius: 8px;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.72);
    transition: background 0.15s ease, color 0.15s ease;
    position: relative;
    margin-bottom: 2px;
}
.admin-nav-link::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    height: 0;
    width: 3px;
    background: var(--samko-gold);
    border-radius: 0 3px 3px 0;
    transform: translateY(-50%);
    transition: height 0.15s ease;
}
.admin-nav-link:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.05);
}
.admin-nav-link.active {
    color: white;
    background-color: rgba(255, 255, 255, 0.08);
    font-weight: 500;
}
.admin-nav-link.active::before { height: 60%; }
.admin-nav-link svg {
    flex-shrink: 0;
    opacity: 0.78;
}
.admin-nav-link:hover svg { opacity: 1; }
.admin-nav-link.active svg {
    opacity: 1;
    color: var(--samko-gold);
}
.admin-nav-link span:not(.sr-only) {
    overflow: hidden;
    transition: opacity 0.15s ease, width 0.15s ease;
}

.admin-nav-section-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(201, 169, 97, 0.6);
    padding: 0 0.875rem;
    margin: 1.5rem 0 0.5rem;
    transition: opacity 0.15s ease, height 0.15s ease, background 0.15s ease;
}

/* === Sidebar footer === */
.sidebar-footer {
    padding: 0.875rem 1rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}
.sidebar-user-block {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}
.sidebar-user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--samko-gold), var(--samko-gold-soft));
    color: var(--samko-navy);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    font-family: 'Playfair Display', Georgia, serif;
    flex-shrink: 0;
    box-shadow: 0 4px 12px -4px rgba(201, 169, 97, 0.45);
}
.sidebar-user-meta {
    min-width: 0;
    transition: opacity 0.15s ease;
}
.sidebar-user-name {
    font-size: 0.825rem;
    font-weight: 500;
    color: white;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-user-role {
    font-size: 0.65rem;
    color: rgba(201, 169, 97, 0.82);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 0.1rem;
}
.sidebar-logout {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.55);
    margin-top: 0.75rem;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
    cursor: pointer;
}
.sidebar-logout:hover {
    color: white;
    background: rgba(239, 68, 68, 0.20);
}

.admin-topbar {
    background-color: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.875rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 30;
}

.sidebar-toggle {
    display: none;
}

@media (max-width: 1023px) {
    .sidebar-toggle {
        display: inline-flex;
    }
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 1023px) {
    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 42, 71, 0.5);
        z-index: 39;
    }
}

/* === Greeting bar === */
.greeting-bar {
    background: linear-gradient(120deg, #0f2a47 0%, #1a3a5c 45%, #1f3864 100%);
    color: white;
    border-radius: 16px;
    padding: 1.5rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 12px 32px -16px rgba(15, 42, 71, 0.45);
}
.greeting-bar::before {
    content: '';
    position: absolute;
    top: -40%; right: -10%;
    width: 240px; height: 240px;
    background: radial-gradient(circle, rgba(201, 169, 97, 0.22) 0%, transparent 70%);
    pointer-events: none;
}
.greeting-bar::after {
    content: '';
    position: absolute;
    bottom: -60%; left: -5%;
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(74, 124, 176, 0.18) 0%, transparent 70%);
    pointer-events: none;
}
.greeting-text { position: relative; z-index: 1; }
.greeting-hello {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.2;
    color: white;
}
.greeting-hello span { color: var(--samko-gold-soft); }
.greeting-date {
    font-size: 0.825rem;
    color: rgba(255, 255, 255, 0.65);
    margin-top: 0.25rem;
    text-transform: capitalize;
}
.greeting-actions {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}
.greeting-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: white;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    font-size: 0.825rem;
    font-weight: 500;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.greeting-cta:hover {
    background: rgba(201, 169, 97, 0.22);
    border-color: rgba(201, 169, 97, 0.55);
}

/* === KPI cards (refonte premium) === */
.kpi-card {
    display: block;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px -16px rgba(15, 42, 71, 0.20);
    border-color: #cbd5e1;
}
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}
.kpi-card-navy::before { background: linear-gradient(90deg, #0f2a47, #1a5490); }
.kpi-card-blue::before { background: linear-gradient(90deg, #4a7cb0, #1a5490); }
.kpi-card-green::before { background: linear-gradient(90deg, #4ade80, #16a34a); }
.kpi-card-gold::before { background: linear-gradient(90deg, #f0d68a, #c9a961); }
.kpi-card-purple::before { background: linear-gradient(90deg, #a78bfa, #7c3aed); }

.kpi-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.85rem;
}
.kpi-icon-navy { background: rgba(15, 42, 71, 0.10); color: var(--samko-navy); }
.kpi-icon-blue { background: rgba(26, 84, 144, 0.10); color: var(--samko-blue); }
.kpi-icon-gold { background: rgba(201, 169, 97, 0.15); color: var(--samko-gold); }
.kpi-icon-green { background: rgba(22, 163, 74, 0.10); color: #15803d; }
.kpi-icon-purple { background: rgba(124, 58, 237, 0.10); color: #7c3aed; }

.kpi-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    font-weight: 600;
}
.kpi-value {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--samko-navy);
    line-height: 1.1;
    margin-top: 0.15rem;
    font-variant-numeric: tabular-nums;
}
.kpi-card-gold .kpi-value { color: #92651d; }
.kpi-card-green .kpi-value { color: #15803d; }
.kpi-card-purple .kpi-value { color: #6d28d9; }
.kpi-sub {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.35rem;
}

/* === Dashboard card (chart + tunnel) === */
.dashboard-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
}
.dashboard-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}
.dashboard-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--samko-navy);
}
.dashboard-card-subtitle {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.1rem;
}
.dashboard-card-pill {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--samko-blue);
    background: rgba(26, 84, 144, 0.08);
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    white-space: nowrap;
}

/* === Funnel (tunnel) === */
.funnel-row {
    display: block;
    padding: 0.55rem 0;
    cursor: pointer;
    transition: opacity 0.12s ease;
}
.funnel-row:hover { opacity: 0.85; }
.funnel-row-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.35rem;
}
.funnel-row-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #475569;
    font-weight: 600;
}
.funnel-row-count {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--samko-navy);
    font-variant-numeric: tabular-nums;
}
.funnel-bar {
    height: 6px;
    background: #f1f5f9;
    border-radius: 999px;
    overflow: hidden;
}
.funnel-bar span {
    display: block;
    height: 100%;
    background: var(--funnel-color, var(--samko-blue));
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* === Poste card (refonte premium) === */
.poste-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    position: relative;
}
.poste-card.menu-open { z-index: 30; }
.poste-card-actions { position: relative; }
.poste-card:hover {
    transform: translateY(-2px);
    border-color: #cbd5e1;
    box-shadow: 0 14px 32px -16px rgba(15, 42, 71, 0.20);
}
.poste-card-top {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}
.poste-client {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--samko-blue);
    font-weight: 700;
    margin-bottom: 0.15rem;
}
.poste-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--samko-navy);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.poste-card-stats {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding-top: 0.5rem;
    border-top: 1px solid #f1f5f9;
}
.stat-value {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--samko-navy);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.stat-suffix {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 500;
    margin-left: 0.1rem;
}
.stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    margin-top: 0.25rem;
}

.poste-card-progress {
    margin-top: -0.5rem;
}
.poste-card-progress .bar {
    width: 100%;
    height: 4px;
    background: #f1f5f9;
    border-radius: 999px;
    overflow: hidden;
}
.poste-card-progress .bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.poste-card-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.poste-cta {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: var(--samko-navy);
    color: white;
    padding: 0.55rem 0.9rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: background 0.15s ease;
}
.poste-cta:hover { background: var(--samko-blue); }
.poste-export {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #f1f5f9;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}
.poste-export:hover { background: rgba(124, 58, 237, 0.10); color: #7c3aed; }

/* === Filter bar === */
.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    font-size: 0.825rem;
    font-weight: 500;
    color: #475569;
    background: white;
    border: 1px solid #e2e8f0;
    transition: all 0.15s ease;
    cursor: pointer;
}
.filter-pill:hover {
    border-color: var(--samko-blue);
    color: var(--samko-navy);
}
.filter-pill.active {
    background: var(--samko-navy);
    color: white;
    border-color: var(--samko-navy);
}
.filter-pill .count {
    background: rgba(255,255,255,0.15);
    padding: 0 0.4rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
}
.filter-pill:not(.active) .count {
    background: #f1f5f9;
    color: #64748b;
}

/* === Status dot === */
.status-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
}
.status-dot-DRAFT { background: #94a3b8; box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.18); }
.status-dot-OUVERT { background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18); animation: pulse-green 2s infinite; }
.status-dot-FERME { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18); }
.status-dot-ARCHIVE { background: #cbd5e1; }

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18); }
    50% { box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.10); }
}

/* === Score badge with progress === */
.score-cell {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    min-width: 80px;
}
.score-badge {
    font-size: 0.825rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.score-bar {
    width: 60px;
    height: 4px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}
.score-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease;
}

/* === Avatar circle (initiale client) === */
.avatar-initial {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    background: linear-gradient(135deg, #4a89c8, #1f3864);
}

/* === Modern table === */
.table-modern {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.table-modern thead th {
    background: #f8fafc;
    text-align: left;
    padding: 0.875rem 1rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}
.table-modern tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.12s ease;
    position: relative;
}
.table-modern tbody tr:hover {
    background: #fafbfd;
}
.table-modern tbody tr:hover::after {
    content: '';
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 2px;
    background: var(--samko-gold);
}
.table-modern tbody td {
    padding: 1rem;
    vertical-align: middle;
}

/* === Icon button === */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border-radius: 6px;
    color: #64748b;
    transition: all 0.12s ease;
    background: transparent;
    border: none;
    cursor: pointer;
}
.icon-btn:hover {
    background: #f1f5f9;
    color: var(--samko-navy);
}
.icon-btn-danger:hover { color: #dc2626; background: #fee2e2; }

/* === Search input === */
.search-input {
    width: 100%;
    padding: 0.55rem 0.875rem 0.55rem 2.5rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: white;
    font-size: 0.875rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-input:focus {
    outline: none;
    border-color: var(--samko-blue);
    box-shadow: 0 0 0 3px rgba(26, 84, 144, 0.12);
}
.search-wrapper {
    position: relative;
}
.search-wrapper svg.search-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}

/* === Urgency date === */
.date-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
}
.date-cell.urgent { color: #dc2626; }
.date-cell.warning { color: #d97706; }
.date-cell.normal { color: #64748b; }

/* === Empty state === */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #94a3b8;
}
.empty-state-icon {
    width: 56px; height: 56px;
    margin: 0 auto 1rem;
    background: #f1f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
}

/* Slider styling */
input[type="range"] {
    accent-color: var(--samko-blue);
}

/* Tableau : scroll horizontal smooth */
.overflow-x-auto {
    -webkit-overflow-scrolling: touch;
}

/* Iframe PDF dark theme adjustment (some PDFs render with white bg, ce qui est OK) */
iframe {
    color-scheme: light;
}

/* Chart canvas responsive */
canvas {
    max-width: 100%;
}

/* === Modal tabs === */
.modal-tab,
.modal-tab-active {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    font-size: 0.825rem;
    font-weight: 500;
    color: #64748b;
    border-bottom: 2px solid transparent;
    transition: color 0.12s ease, border-color 0.12s ease;
    background: transparent;
    border-radius: 0;
    cursor: pointer;
}
.modal-tab:hover {
    color: var(--samko-navy);
}
.modal-tab-active {
    color: var(--samko-navy);
    border-bottom-color: var(--samko-gold);
    font-weight: 600;
}

.modal-tab-badge {
    display: inline-block;
    background: #f1f5f9;
    color: #475569;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    line-height: 1.4;
}
.modal-tab-active .modal-tab-badge {
    background: var(--samko-gold);
    color: #1f3864;
}

/* ========================================================================
   Badge compteur (pastille ronde de comptage) — composant réutilisable.
   POURQUOI : le tw.css est purgé (statique). Les utilitaires arbitraires
   `text-[10px]`, `px-1.5`, `py-0.5`, `gap-1.5`, `min-w-[…]` en sont ABSENTS ;
   un compteur numérique nu (ex. « À valider 1 ») se retrouvait sans padding
   ni taille et `rounded-full` le réduisait à un trait vertical.
   USAGE : <span class="badge-compteur bg-amber-100 text-amber-800">1</span>
   (la FORME est ici ; la COULEUR reste des utilitaires « bg- » et « text- », présents).
   min-width == height -> cercle à 1 chiffre, s'élargit en pilule au-delà.
   ======================================================================== */
.badge-compteur {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    vertical-align: middle;
}

/* ========================================================================
   DARK MODE
   Stratégie : variables sémantiques + overrides ciblés sur classes Tailwind
   les plus utilisées. Contraste WCAG AA garanti sur les textes.
   ======================================================================== */

:root {
    --dm-bg: #f7f9fc;
    --dm-surface: #ffffff;
    --dm-elevated: #ffffff;
    --dm-muted: #f1f5f9;
    --dm-text: #0f172a;
    --dm-text-soft: #475569;
    --dm-text-mute: #94a3b8;
    --dm-border: #e2e8f0;
    --dm-border-soft: #f1f5f9;
}

html[data-theme="dark"] {
    --dm-bg: #0a1424;
    --dm-surface: #112139;
    --dm-elevated: #15294a;
    --dm-muted: #1a3052;
    --dm-text: #f1f5f9;
    --dm-text-soft: #cbd5e1;
    --dm-text-mute: #94a3b8;
    --dm-border: #1f3864;
    --dm-border-soft: #1a2d4a;
    color-scheme: dark;
}

/* Tokens du système de formulaires (déclarés en clair dans style.css) */
html[data-theme="dark"] {
    --form-bg: var(--dm-muted);
    --form-bg-disabled: rgba(255, 255, 255, 0.04);
    --form-border: #2e4a76;
    --form-text: var(--dm-text);
    --form-placeholder: #7d90ab;
    --form-label: var(--dm-text-mute);
    --form-hint: var(--dm-text-mute);
    --form-focus-border: var(--samko-gold);
    --form-focus-ring: rgba(201, 169, 97, 0.20);
    --form-accent: var(--samko-blue-soft);
    --form-error: #fca5a5;
    --form-error-bg: rgba(239, 68, 68, 0.12);
    --form-error-border: rgba(239, 68, 68, 0.35);
    --form-chevron: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

html[data-theme="dark"] body { background-color: var(--dm-bg); color: var(--dm-text); }

/* Surface = blanc en clair, slate-900 atténué en sombre */
html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .hover\:bg-white:hover { background-color: var(--dm-surface) !important; }

html[data-theme="dark"] .bg-slate-50,
html[data-theme="dark"] .hover\:bg-slate-50:hover,
html[data-theme="dark"] .bg-slate-100,
html[data-theme="dark"] .hover\:bg-slate-100:hover,
html[data-theme="dark"] .hover\:bg-slate-200:hover { background-color: var(--dm-muted) !important; }

html[data-theme="dark"] .admin-main { background-color: var(--dm-bg); }
html[data-theme="dark"] .admin-topbar { background-color: var(--dm-surface); border-bottom-color: var(--dm-border); }
html[data-theme="dark"] .admin-topbar h2 { color: var(--dm-text); }

/* Texte : remap tonal -> dm-text* */
html[data-theme="dark"] .text-slate-900,
html[data-theme="dark"] .text-slate-800 { color: var(--dm-text) !important; }
html[data-theme="dark"] .text-slate-700,
html[data-theme="dark"] .text-slate-600 { color: var(--dm-text-soft) !important; }
html[data-theme="dark"] .text-slate-500 { color: var(--dm-text-mute) !important; }
html[data-theme="dark"] .text-slate-400 { color: #64748b !important; }
html[data-theme="dark"] .text-samko-navy { color: var(--dm-text) !important; }
html[data-theme="dark"] .text-samko-blue { color: var(--samko-blue-soft) !important; }

/* Borders */
html[data-theme="dark"] .border-slate-300,
html[data-theme="dark"] .border-slate-200 { border-color: var(--dm-border) !important; }
html[data-theme="dark"] .border-slate-100 { border-color: var(--dm-border-soft) !important; }
html[data-theme="dark"] .divide-slate-100 > * + *,
html[data-theme="dark"] .divide-slate-200 > * + * { border-color: var(--dm-border-soft) !important; }

/* Greeting bar : déjà sombre, on garde tel quel */

/* KPI cards en sombre */
html[data-theme="dark"] .kpi-card {
    background-color: var(--dm-surface);
    border-color: var(--dm-border);
}
html[data-theme="dark"] .kpi-card:hover {
    border-color: rgba(201, 169, 97, 0.4);
    box-shadow: 0 14px 32px -16px rgba(0, 0, 0, 0.6);
}
html[data-theme="dark"] .kpi-value { color: var(--samko-ivory); }
html[data-theme="dark"] .kpi-card-gold .kpi-value { color: #f0d68a; }
html[data-theme="dark"] .kpi-card-green .kpi-value { color: #4ade80; }
html[data-theme="dark"] .kpi-card-purple .kpi-value { color: #c4b5fd; }
html[data-theme="dark"] .kpi-label { color: var(--dm-text-mute); }
html[data-theme="dark"] .kpi-sub { color: #64748b; }

/* Dashboard cards (chart, funnel) */
html[data-theme="dark"] .dashboard-card {
    background-color: var(--dm-surface);
    border-color: var(--dm-border);
}
html[data-theme="dark"] .dashboard-card-title { color: var(--dm-text); }
html[data-theme="dark"] .dashboard-card-subtitle { color: var(--dm-text-mute); }
html[data-theme="dark"] .dashboard-card-pill {
    background: rgba(74, 124, 176, 0.18);
    color: var(--samko-blue-soft);
}

/* Funnel */
html[data-theme="dark"] .funnel-row-label { color: var(--dm-text-soft); }
html[data-theme="dark"] .funnel-row-count { color: var(--dm-text); }
html[data-theme="dark"] .funnel-bar { background: rgba(255, 255, 255, 0.06); }

/* Poste cards */
html[data-theme="dark"] .poste-card {
    background: var(--dm-surface);
    border-color: var(--dm-border);
}
html[data-theme="dark"] .poste-card:hover {
    border-color: rgba(201, 169, 97, 0.4);
    box-shadow: 0 14px 32px -16px rgba(0, 0, 0, 0.6);
}
html[data-theme="dark"] .poste-title { color: var(--dm-text); }
html[data-theme="dark"] .stat-value { color: var(--dm-text); }
html[data-theme="dark"] .stat-label,
html[data-theme="dark"] .stat-suffix { color: var(--dm-text-mute); }
html[data-theme="dark"] .poste-card-stats { border-top-color: var(--dm-border-soft); }
html[data-theme="dark"] .poste-card-progress .bar { background: rgba(255, 255, 255, 0.06); }
html[data-theme="dark"] .poste-cta { background: var(--samko-blue); }
html[data-theme="dark"] .poste-cta:hover { background: var(--samko-blue-soft); }
html[data-theme="dark"] .poste-export {
    background: rgba(255, 255, 255, 0.04);
    color: var(--dm-text-mute);
}
html[data-theme="dark"] .poste-export:hover {
    background: rgba(124, 58, 237, 0.22);
    color: #c4b5fd;
}

/* Tableau et modal */
html[data-theme="dark"] table thead { background: rgba(255, 255, 255, 0.03); }
html[data-theme="dark"] table thead th { color: var(--dm-text-mute) !important; }
html[data-theme="dark"] tbody tr:hover { background-color: rgba(255, 255, 255, 0.03) !important; }
html[data-theme="dark"] .bg-samko-blue\/5 { background-color: rgba(74, 124, 176, 0.10) !important; }
html[data-theme="dark"] .border-samko-blue\/20 { border-color: rgba(74, 124, 176, 0.30) !important; }
html[data-theme="dark"] .text-samko-blue { color: var(--samko-blue-soft) !important; }

/* Modal tabs */
html[data-theme="dark"] .modal-tab { color: var(--dm-text-mute); }
html[data-theme="dark"] .modal-tab:hover { color: var(--dm-text); }
html[data-theme="dark"] .modal-tab-active { color: var(--samko-ivory); }
html[data-theme="dark"] .modal-tab-badge { background: rgba(255, 255, 255, 0.08); color: var(--dm-text-soft); }
html[data-theme="dark"] .modal-tab-active .modal-tab-badge { background: var(--samko-gold); color: #0f2a47; }

/* Inputs : filet générique aligné sur les tokens --form-* (les champs migrés
   sur .form-input/.form-select/.form-textarea lisent déjà ces tokens). */
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] input[type="tel"],
html[data-theme="dark"] input[type="date"],
html[data-theme="dark"] input[type="time"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
    background-color: var(--form-bg) !important;
    border-color: var(--form-border) !important;
    color: var(--form-text) !important;
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: var(--form-placeholder) !important; }
html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus {
    border-color: var(--form-focus-border) !important;
    box-shadow: 0 0 0 3px var(--form-focus-ring) !important;
}
html[data-theme="dark"] input:disabled,
html[data-theme="dark"] select:disabled,
html[data-theme="dark"] textarea:disabled {
    background-color: var(--form-bg-disabled) !important;
    color: var(--form-label) !important;
}
html[data-theme="dark"] input[type="checkbox"],
html[data-theme="dark"] input[type="radio"] {
    background-color: var(--form-bg) !important;
    border-color: var(--form-border) !important;
}

/* Modal overlay reste sombre, contenu en dm-surface */
html[data-theme="dark"] .bg-black\/50 { background-color: rgba(0, 0, 0, 0.65) !important; }
html[data-theme="dark"] .bg-black\/60 { background-color: rgba(0, 0, 0, 0.75) !important; }

/* Iframe (CV preview) : on garde light pour le rendu PDF natif */
html[data-theme="dark"] iframe { background-color: #fff; color-scheme: light; }

/* Badges colorés : on inverse opacity-based pour rester lisible */
html[data-theme="dark"] .bg-yellow-50,
html[data-theme="dark"] .bg-yellow-100 { background-color: rgba(234, 179, 8, 0.16) !important; }
html[data-theme="dark"] .text-yellow-600,
html[data-theme="dark"] .text-yellow-700,
html[data-theme="dark"] .text-yellow-800 { color: #fbbf24 !important; }
html[data-theme="dark"] .border-yellow-200 { border-color: rgba(234, 179, 8, 0.35) !important; }
html[data-theme="dark"] .hover\:border-yellow-400:hover { border-color: rgba(234, 179, 8, 0.55) !important; }

html[data-theme="dark"] .bg-green-50,
html[data-theme="dark"] .bg-green-100 { background-color: rgba(34, 197, 94, 0.14) !important; }
html[data-theme="dark"] .text-green-600,
html[data-theme="dark"] .text-green-700,
html[data-theme="dark"] .text-green-800 { color: #4ade80 !important; }
html[data-theme="dark"] .border-green-200 { border-color: rgba(34, 197, 94, 0.35) !important; }
html[data-theme="dark"] .hover\:border-green-400:hover { border-color: rgba(34, 197, 94, 0.55) !important; }

html[data-theme="dark"] .bg-orange-50,
html[data-theme="dark"] .bg-orange-100 { background-color: rgba(249, 115, 22, 0.14) !important; }
html[data-theme="dark"] .text-orange-700,
html[data-theme="dark"] .text-orange-800 { color: #fb923c !important; }

html[data-theme="dark"] .bg-red-50,
html[data-theme="dark"] .bg-red-100 { background-color: rgba(239, 68, 68, 0.14) !important; }
html[data-theme="dark"] .text-red-600,
html[data-theme="dark"] .text-red-700 { color: #f87171 !important; }

/* Amber (« attention » / avertissements) : sans ce remap, amber-50/100
   restaient CLAIRS en mode sombre alors que le texte est remap en clair
   (dm-text) -> titres illisibles (carte Alertes du tableau de bord, encadrés
   collaborateurs/settings/terrain). Mêmes tons translucides que rouge/orange. */
html[data-theme="dark"] .bg-amber-50,
html[data-theme="dark"] .bg-amber-100 { background-color: rgba(245, 158, 11, 0.15) !important; }
html[data-theme="dark"] .border-amber-100,
html[data-theme="dark"] .border-amber-200 { border-color: rgba(245, 158, 11, 0.3) !important; }
html[data-theme="dark"] .text-amber-700,
html[data-theme="dark"] .text-amber-800 { color: #fcd34d !important; }

html[data-theme="dark"] .bg-purple-50,
html[data-theme="dark"] .bg-purple-100 { background-color: rgba(124, 58, 237, 0.18) !important; }
html[data-theme="dark"] .text-purple-500,
html[data-theme="dark"] .text-purple-700 { color: #c4b5fd !important; }
html[data-theme="dark"] .border-purple-200 { border-color: rgba(124, 58, 237, 0.35) !important; }
html[data-theme="dark"] .hover\:border-purple-400:hover { border-color: rgba(124, 58, 237, 0.55) !important; }

html[data-theme="dark"] .bg-blue-50,
html[data-theme="dark"] .bg-blue-100 { background-color: rgba(74, 124, 176, 0.16) !important; }
html[data-theme="dark"] .text-blue-700 { color: var(--samko-blue-soft) !important; }

/* Code, pre */
html[data-theme="dark"] pre { background: rgba(0, 0, 0, 0.4) !important; color: var(--dm-text-soft) !important; }

/* Score badge: garantir lisibilité */
html[data-theme="dark"] .bg-yellow-100.text-yellow-700,
html[data-theme="dark"] .bg-yellow-100.text-yellow-800 { background-color: rgba(234, 179, 8, 0.20) !important; }

/* === Theme toggle dans la sidebar === */
.theme-quick-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.75rem;
    transition: background 0.15s ease, color 0.15s ease;
    width: 100%;
    cursor: pointer;
}
.theme-quick-toggle:hover {
    background: rgba(201, 169, 97, 0.16);
    color: white;
}
.theme-quick-toggle svg { flex-shrink: 0; }

/* === Settings page === */
.settings-section {
    background: var(--dm-surface);
    border: 1px solid var(--dm-border);
    border-radius: 14px;
    padding: 1.5rem 1.75rem;
}
html:not([data-theme="dark"]) .settings-section { background: #fff; border-color: #e2e8f0; }

.settings-section-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--dm-text);
    margin-bottom: 0.25rem;
}
html:not([data-theme="dark"]) .settings-section-title { color: var(--samko-navy); }
.settings-section-subtitle {
    font-size: 0.8rem;
    color: var(--dm-text-mute);
    margin-bottom: 1.25rem;
}

.settings-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 0.75rem 0;
    border-top: 1px solid var(--dm-border-soft);
}
.settings-row:first-of-type { border-top: 0; padding-top: 0; }
.settings-row-label { font-size: 0.875rem; font-weight: 500; color: var(--dm-text); }
html:not([data-theme="dark"]) .settings-row-label { color: var(--samko-navy); }
.settings-row-help { font-size: 0.75rem; color: var(--dm-text-mute); margin-top: 0.15rem; }

.theme-choice-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}
.theme-choice {
    border: 1.5px solid var(--dm-border);
    background: var(--dm-muted);
    border-radius: 12px;
    padding: 1rem 0.85rem;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
html:not([data-theme="dark"]) .theme-choice { background: #f8fafc; border-color: #e2e8f0; }
.theme-choice:hover { border-color: var(--samko-gold-soft); }
.theme-choice.is-active {
    border-color: var(--samko-gold);
    background: rgba(201, 169, 97, 0.10);
}
.theme-choice-preview {
    height: 56px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.06);
    overflow: hidden;
    position: relative;
}
.theme-choice-preview .preview-bar {
    height: 12px;
    width: 100%;
    background: linear-gradient(90deg, #c9a961, #e0c98a);
}
.theme-choice-preview .preview-body {
    height: 44px;
    display: flex;
    align-items: center;
    padding: 0 0.5rem;
    gap: 0.35rem;
}
.theme-choice-preview .preview-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
}
.theme-choice[data-key="light"] .preview-body { background: #f7f9fc; }
.theme-choice[data-key="light"] .preview-dot { background: #1a5490; }
.theme-choice[data-key="dark"] .preview-body { background: #0a1424; }
.theme-choice[data-key="dark"] .preview-dot { background: #c9a961; }
.theme-choice[data-key="auto"] .preview-body {
    background: linear-gradient(120deg, #f7f9fc 0%, #f7f9fc 50%, #0a1424 50%, #0a1424 100%);
}
.theme-choice[data-key="auto"] .preview-dot {
    background: linear-gradient(120deg, #1a5490 0%, #1a5490 50%, #c9a961 50%, #c9a961 100%);
}
.theme-choice-label {
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--dm-text);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
html:not([data-theme="dark"]) .theme-choice-label { color: var(--samko-navy); }
.theme-choice-help { font-size: 0.7rem; color: var(--dm-text-mute); }

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
}
.status-pill::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
}
.status-pill.ok { background: rgba(34, 197, 94, 0.14); color: #16a34a; }
.status-pill.ok::before { background: #22c55e; }
.status-pill.ko { background: rgba(239, 68, 68, 0.14); color: #ef4444; }
.status-pill.ko::before { background: #ef4444; }
.status-pill.idle { background: rgba(148, 163, 184, 0.16); color: #64748b; }
.status-pill.idle::before { background: #94a3b8; }
html[data-theme="dark"] .status-pill.ok { color: #4ade80; }
html[data-theme="dark"] .status-pill.ko { color: #f87171; }

/* ===========================================================
   Modal de confirmation (samkoConfirm)
   =========================================================== */

.samko-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 42, 71, 0.55);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}
.samko-confirm-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.samko-confirm-dialog {
    background: var(--dm-surface);
    border: 1px solid var(--dm-border);
    border-radius: 14px;
    padding: 1.5rem 1.5rem 1.25rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 24px 56px -16px rgba(15, 42, 71, 0.40);
    transform: translateY(8px) scale(0.985);
    transition: transform 0.20s cubic-bezier(0.22, 1, 0.36, 1);
    text-align: left;
}
html:not([data-theme="dark"]) .samko-confirm-dialog {
    background: #ffffff;
    border-color: #e2e8f0;
}
.samko-confirm-overlay.open .samko-confirm-dialog {
    transform: translateY(0) scale(1);
}

.samko-confirm-icon {
    width: 44px; height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    flex-shrink: 0;
}
.samko-confirm-icon.variant-primary {
    background: rgba(26, 84, 144, 0.10);
    color: var(--samko-blue);
}
.samko-confirm-icon.variant-info {
    background: rgba(26, 84, 144, 0.10);
    color: var(--samko-blue);
}
.samko-confirm-icon.variant-danger {
    background: rgba(220, 38, 38, 0.12);
    color: #dc2626;
}
html[data-theme="dark"] .samko-confirm-icon.variant-primary {
    background: rgba(74, 124, 176, 0.20);
    color: var(--samko-blue-soft);
}
html[data-theme="dark"] .samko-confirm-icon.variant-danger {
    background: rgba(248, 113, 113, 0.18);
    color: #f87171;
}

.samko-confirm-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--samko-navy);
    margin: 0 0 0.45rem;
    letter-spacing: -0.005em;
}
html[data-theme="dark"] .samko-confirm-title { color: var(--dm-text); }

.samko-confirm-message {
    font-size: 0.875rem;
    color: var(--dm-text-soft);
    line-height: 1.5;
    margin: 0;
    white-space: pre-line;
}
html:not([data-theme="dark"]) .samko-confirm-message { color: #475569; }

.samko-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--dm-border-soft);
}
html:not([data-theme="dark"]) .samko-confirm-actions { border-top-color: #f1f5f9; }

.samko-confirm-btn {
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.55rem 1.1rem;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    cursor: pointer;
}
.samko-confirm-btn:focus-visible {
    outline: 2px solid var(--samko-gold);
    outline-offset: 2px;
}

.samko-confirm-btn-cancel {
    background: transparent;
    color: var(--dm-text-soft);
    border-color: var(--dm-border);
}
.samko-confirm-btn-cancel:hover {
    background: var(--dm-muted);
    color: var(--dm-text);
}
html:not([data-theme="dark"]) .samko-confirm-btn-cancel {
    color: #475569;
    border-color: #cbd5e1;
}
html:not([data-theme="dark"]) .samko-confirm-btn-cancel:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.samko-confirm-btn-primary {
    background: var(--samko-navy);
    color: white;
}
.samko-confirm-btn-primary:hover { background: var(--samko-blue); }
html[data-theme="dark"] .samko-confirm-btn-primary {
    background: var(--samko-blue);
}
html[data-theme="dark"] .samko-confirm-btn-primary:hover {
    background: var(--samko-blue-soft);
}

.samko-confirm-btn-danger {
    background: #dc2626;
    color: white;
}
.samko-confirm-btn-danger:hover { background: #b91c1c; }
html[data-theme="dark"] .samko-confirm-btn-danger {
    background: #ef4444;
}
html[data-theme="dark"] .samko-confirm-btn-danger:hover {
    background: #dc2626;
}

.samko-confirm-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.samko-confirm-btn-danger:disabled:hover { background: #dc2626; }
html[data-theme="dark"] .samko-confirm-btn-danger:disabled:hover { background: #ef4444; }

.samko-confirm-input-wrap {
    margin-top: 1rem;
    text-align: left;
}
.samko-confirm-input-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--form-label);
    margin-bottom: 0.4rem;
}
/* Champ du modal samkoConfirm : aligné sur le système Formulaires SAMKO
   (tokens --form-* de style.css, surchargés en sombre plus haut). */
.samko-confirm-input {
    width: 100%;
    font-family: 'SF Mono', 'Cascadia Code', Consolas, monospace;
    font-size: 0.875rem;
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    border: 1px solid var(--form-border);
    background: var(--form-bg);
    color: var(--form-text);
    letter-spacing: 0.02em;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.samko-confirm-input:focus {
    outline: none;
    border-color: var(--form-focus-border);
    box-shadow: 0 0 0 3px var(--form-focus-ring);
}
.samko-confirm-input::placeholder {
    color: var(--form-placeholder);
    opacity: 1;
}

/* ===========================================================
   Analytics : funnel par poste
   =========================================================== */

.funnel-poste-card {
    padding: 1rem 1.1rem;
    background: rgba(248, 250, 252, 0.6);
    border: 1px solid var(--dm-border);
    border-radius: 12px;
}
html[data-theme="dark"] .funnel-poste-card {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--dm-border);
}

.funnel-row-graphic {
    display: grid;
    grid-template-columns: 130px 1fr 50px;
    gap: 0.6rem;
    align-items: center;
    font-size: 0.8rem;
}

.funnel-step-label {
    font-weight: 500;
    color: var(--dm-text-soft);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
}

.funnel-step-bar-wrap {
    height: 22px;
    background: rgba(15, 42, 71, 0.04);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}
html[data-theme="dark"] .funnel-step-bar-wrap {
    background: rgba(255, 255, 255, 0.05);
}

.funnel-step-bar {
    height: 100%;
    border-radius: 6px;
    transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    align-items: center;
    padding-right: 0.55rem;
    justify-content: flex-end;
    min-width: 28px;
}

.funnel-step-count {
    color: white;
    font-weight: 700;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.funnel-step-conv {
    text-align: right;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--dm-text-soft);
    font-variant-numeric: tabular-nums;
}
.funnel-step-conv-na {
    color: var(--dm-text-mute);
    font-weight: 400;
}

/* ===========================================================
   Analytics : critères baisseurs
   =========================================================== */

.critere-score-pill {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    color: white;
    font-weight: 700;
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    min-width: 58px;
    text-align: center;
}

/* ===========================================================
   Analytics : Time-to-hire KPI
   =========================================================== */

.tth-kpi {
    background: rgba(201, 169, 97, 0.10);
    border: 1px solid rgba(201, 169, 97, 0.30);
    border-radius: 10px;
    padding: 0.85rem 0.5rem;
    text-align: center;
}
html[data-theme="dark"] .tth-kpi {
    background: rgba(201, 169, 97, 0.14);
    border-color: rgba(201, 169, 97, 0.30);
}
.tth-kpi-value {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--samko-navy);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
html[data-theme="dark"] .tth-kpi-value { color: var(--samko-gold-soft); }
.tth-kpi-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--dm-text-mute);
    margin-top: 0.2rem;
    font-weight: 600;
}

/* ===========================================================
   Analytics : Heatmap
   =========================================================== */

.heatmap-grid {
    display: grid;
    grid-template-columns: 70px repeat(24, minmax(28px, 1fr));
    gap: 2px;
    min-width: 760px;
}
.heatmap-corner {
    height: 22px;
}
.heatmap-h-label {
    font-size: 0.6rem;
    text-align: center;
    color: var(--dm-text-mute);
    line-height: 22px;
    font-variant-numeric: tabular-nums;
}
.heatmap-d-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--dm-text-soft);
    line-height: 28px;
    padding-right: 0.5rem;
    text-align: right;
}
.heatmap-cell {
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
    font-variant-numeric: tabular-nums;
    transition: transform 0.1s ease;
    cursor: pointer;
}
.heatmap-cell:hover {
    transform: scale(1.1);
    z-index: 5;
    position: relative;
    box-shadow: 0 4px 10px rgba(15, 42, 71, 0.25);
}

/* ===========================================================
   Page Aide (tutoriel RH)
   =========================================================== */

.aide-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 2.5rem;
    align-items: start;
}
@media (max-width: 1023px) {
    .aide-layout { grid-template-columns: 1fr; }
}

.aide-toc {
    position: sticky;
    top: 90px;
    padding: 1rem 0.5rem;
    border-left: 2px solid rgba(201, 169, 97, 0.30);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.aide-toc-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--samko-gold);
    font-weight: 700;
    padding-left: 0.85rem;
    margin-bottom: 0.65rem;
}
.aide-toc-link {
    display: block;
    font-size: 0.82rem;
    color: var(--dm-text-mute);
    padding: 0.35rem 0.85rem;
    border-left: 2px solid transparent;
    margin-left: -2px;
    transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.aide-toc-link:hover {
    color: var(--samko-navy);
    background: rgba(201, 169, 97, 0.05);
}
html[data-theme="dark"] .aide-toc-link:hover { color: var(--samko-gold-soft); }
.aide-toc-link.active {
    color: var(--samko-navy);
    font-weight: 600;
    border-left-color: var(--samko-gold);
    background: rgba(201, 169, 97, 0.10);
}
html[data-theme="dark"] .aide-toc-link.active { color: var(--samko-gold-soft); }

.aide-content {
    min-width: 0;
    background: var(--dm-surface);
    border: 1px solid var(--dm-border);
    border-radius: 14px;
    padding: 2rem 2.5rem;
    box-shadow: 0 6px 18px -10px rgba(15, 42, 71, 0.10);
}
html:not([data-theme="dark"]) .aide-content { background: #ffffff; border-color: #e2e8f0; }

.aide-hero {
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--dm-border-soft);
    margin-bottom: 1.75rem;
}
.aide-hero-eyebrow {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--samko-blue);
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.aide-hero-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--samko-navy);
    letter-spacing: -0.015em;
    line-height: 1.15;
}
html[data-theme="dark"] .aide-hero-title { color: var(--dm-text); }
.aide-hero-lead {
    font-size: 0.95rem;
    color: var(--dm-text-soft);
    margin-top: 0.65rem;
    line-height: 1.55;
}
.aide-hero-meta {
    font-size: 0.8rem;
    color: var(--dm-text-mute);
    margin-top: 0.8rem;
}
.aide-hero-meta a { color: var(--samko-blue); text-decoration: underline; }
html[data-theme="dark"] .aide-hero-meta a { color: var(--samko-blue-soft); }

.aide-section {
    padding: 1.5rem 0 1.25rem;
    border-top: 1px solid var(--dm-border-soft);
}
.aide-section:first-of-type { border-top: 0; padding-top: 0.5rem; }

.aide-h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--samko-navy);
    letter-spacing: -0.01em;
    margin-bottom: 0.85rem;
    scroll-margin-top: 80px;
}
html[data-theme="dark"] .aide-h2 { color: var(--dm-text); }

.aide-h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--samko-blue);
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}
html[data-theme="dark"] .aide-h3 { color: var(--samko-blue-soft); }

.aide-section p {
    color: var(--dm-text-soft);
    line-height: 1.6;
    font-size: 0.92rem;
    margin-bottom: 0.7rem;
}
html:not([data-theme="dark"]) .aide-section p { color: #475569; }

.aide-list, .aide-steps, .aide-workflow {
    color: var(--dm-text-soft);
    line-height: 1.65;
    font-size: 0.92rem;
    padding-left: 1.25rem;
    margin-bottom: 0.7rem;
}
html:not([data-theme="dark"]) .aide-list,
html:not([data-theme="dark"]) .aide-steps,
html:not([data-theme="dark"]) .aide-workflow { color: #475569; }
.aide-list { list-style: disc; }
.aide-list-tight { margin-top: 0.35rem; margin-bottom: 0.5rem; }
.aide-steps { list-style: decimal; counter-reset: step; }
.aide-list li, .aide-steps li, .aide-workflow li { margin-bottom: 0.4rem; }
.aide-list strong, .aide-steps strong, .aide-workflow strong { color: var(--dm-text); }
html:not([data-theme="dark"]) .aide-list strong,
html:not([data-theme="dark"]) .aide-steps strong,
html:not([data-theme="dark"]) .aide-workflow strong { color: #0f172a; }

.aide-workflow {
    list-style: none;
    padding-left: 0;
}
.aide-workflow li {
    padding: 0.5rem 0.85rem;
    border-left: 3px solid rgba(201, 169, 97, 0.35);
    margin-bottom: 0.5rem;
    background: rgba(248, 250, 252, 0.5);
    border-radius: 0 8px 8px 0;
}
html[data-theme="dark"] .aide-workflow li { background: rgba(255, 255, 255, 0.03); }

.aide-step-tag {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    margin-right: 0.5rem;
    text-transform: uppercase;
}
.aide-step-grey { background: rgba(148, 163, 184, 0.18); color: #475569; }
.aide-step-blue { background: rgba(26, 84, 144, 0.16); color: #1a5490; }
.aide-step-gold { background: rgba(201, 169, 97, 0.22); color: #92651d; }
.aide-step-green { background: rgba(22, 163, 74, 0.16); color: #15803d; }
.aide-step-red { background: rgba(220, 38, 38, 0.16); color: #b91c1c; }
.aide-step-orange { background: rgba(234, 88, 12, 0.16); color: #c2410c; }
.aide-step-purple { background: rgba(124, 58, 237, 0.16); color: #6d28d9; }
html[data-theme="dark"] .aide-step-grey { color: #cbd5e1; }
html[data-theme="dark"] .aide-step-blue { color: var(--samko-blue-soft); }
html[data-theme="dark"] .aide-step-gold { color: var(--samko-gold-soft); }
html[data-theme="dark"] .aide-step-green { color: #4ade80; }
html[data-theme="dark"] .aide-step-red { color: #f87171; }
html[data-theme="dark"] .aide-step-orange { color: #fb923c; }
html[data-theme="dark"] .aide-step-purple { color: #c4b5fd; }

.aide-callout {
    padding: 0.85rem 1rem;
    background: rgba(201, 169, 97, 0.10);
    border-left: 3px solid var(--samko-gold);
    border-radius: 0 8px 8px 0;
    font-size: 0.88rem !important;
    color: var(--samko-navy) !important;
    font-weight: 500;
    margin-top: 0.5rem;
}
html[data-theme="dark"] .aide-callout {
    background: rgba(201, 169, 97, 0.14);
    color: var(--samko-gold-soft) !important;
}

.aide-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1rem 0;
}
@media (max-width: 767px) { .aide-grid-2 { grid-template-columns: 1fr; } }

.aide-card {
    background: rgba(248, 250, 252, 0.5);
    border: 1px solid var(--dm-border-soft);
    border-radius: 12px;
    padding: 1.1rem 1.25rem;
}
html[data-theme="dark"] .aide-card { background: rgba(255, 255, 255, 0.03); border-color: var(--dm-border); }
.aide-card-eyebrow {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: var(--samko-gold);
    margin-bottom: 0.25rem;
}
.aide-card-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--samko-navy);
    margin-bottom: 0.5rem;
}
html[data-theme="dark"] .aide-card-title { color: var(--dm-text); }

.aide-faq dt {
    font-weight: 600;
    color: var(--samko-navy);
    margin-top: 1rem;
    font-size: 0.92rem;
}
html[data-theme="dark"] .aide-faq dt { color: var(--dm-text); }
.aide-faq dd {
    color: var(--dm-text-soft);
    margin-left: 0;
    margin-top: 0.25rem;
    font-size: 0.88rem;
    line-height: 1.55;
}
html:not([data-theme="dark"]) .aide-faq dd { color: #475569; }

.aide-section code,
.aide-faq code,
.aide-hero code {
    background: rgba(15, 42, 71, 0.06);
    color: var(--samko-navy);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-family: 'SF Mono', Menlo, monospace;
    font-size: 0.82em;
}
html[data-theme="dark"] .aide-section code,
html[data-theme="dark"] .aide-faq code,
html[data-theme="dark"] .aide-hero code {
    background: rgba(255, 255, 255, 0.08);
    color: var(--samko-gold-soft);
}

.aide-section em { font-style: normal; color: var(--samko-blue); font-weight: 600; }
html[data-theme="dark"] .aide-section em { color: var(--samko-blue-soft); }

.aide-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--dm-border-soft);
    font-size: 0.85rem;
    color: var(--dm-text-mute);
}
.aide-footer-meta {
    font-size: 0.75rem;
    color: var(--dm-text-mute);
    margin-top: 0.5rem;
}

/* ===========================================================
   Tooltip custom du chart Candidatures reçues
   =========================================================== */

.samko-chart-tooltip {
    position: absolute;
    z-index: 80;
    min-width: 200px;
    max-width: 260px;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    border: 1px solid rgba(201, 169, 97, 0.40);
    border-radius: 10px;
    padding: 0.55rem 0.75rem;
    box-shadow: 0 12px 28px -10px rgba(15, 42, 71, 0.22);
    opacity: 0;
    transform: translateY(-4px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.18s cubic-bezier(0.22, 1, 0.36, 1), transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
    font-family: 'Inter', sans-serif;
    transform-origin: left center;
}
.samko-chart-tooltip.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}
html[data-theme="dark"] .samko-chart-tooltip {
    background: rgba(21, 41, 74, 0.72);
    border-color: rgba(201, 169, 97, 0.40);
    box-shadow: 0 12px 28px -10px rgba(0, 0, 0, 0.55);
}

.samko-chart-tooltip .sct-header {
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(15, 42, 71, 0.08);
    margin-bottom: 0.45rem;
}
html[data-theme="dark"] .samko-chart-tooltip .sct-header { border-bottom-color: rgba(255, 255, 255, 0.08); }

.samko-chart-tooltip .sct-date {
    font-size: 0.62rem;
    text-transform: capitalize;
    color: #64748b;
    letter-spacing: 0.04em;
    margin-bottom: 0.1rem;
    font-weight: 500;
}
html[data-theme="dark"] .samko-chart-tooltip .sct-date { color: #94a3b8; }

.samko-chart-tooltip .sct-count {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f2a47;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.samko-chart-tooltip .sct-count span {
    font-family: 'Inter', sans-serif;
    font-size: 0.68rem;
    font-weight: 400;
    color: #94a3b8;
    margin-left: 0.2rem;
}
html[data-theme="dark"] .samko-chart-tooltip .sct-count { color: #f1f5f9; }

.samko-chart-tooltip .sct-block {
    margin-bottom: 0.45rem;
}
.samko-chart-tooltip .sct-block:last-child { margin-bottom: 0; }

.samko-chart-tooltip .sct-block-title {
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.samko-chart-tooltip .sct-statuts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.22rem;
}
.samko-chart-tooltip .sct-statut-chip {
    display: inline-block;
    font-size: 0.62rem;
    padding: 0.1rem 0.42rem;
    border-radius: 999px;
    border: 1px solid;
    font-weight: 500;
    line-height: 1.4;
}
.samko-chart-tooltip .sct-statut-chip strong { font-weight: 700; }

.samko-chart-tooltip .sct-postes {
    list-style: none;
    padding: 0;
    margin: 0;
}
.samko-chart-tooltip .sct-postes li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.18rem 0;
    border-top: 1px dashed rgba(15, 42, 71, 0.08);
    font-size: 0.66rem;
}
.samko-chart-tooltip .sct-postes li:first-child { border-top: 0; padding-top: 0; }
html[data-theme="dark"] .samko-chart-tooltip .sct-postes li { border-top-color: rgba(255, 255, 255, 0.08); }

.samko-chart-tooltip .sct-poste-label {
    color: #475569;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
html[data-theme="dark"] .samko-chart-tooltip .sct-poste-label { color: #cbd5e1; }

.samko-chart-tooltip .sct-poste-nb {
    font-weight: 700;
    color: #0f2a47;
    font-variant-numeric: tabular-nums;
}
html[data-theme="dark"] .samko-chart-tooltip .sct-poste-nb { color: #c9a961; }

.samko-chart-tooltip .sct-foot {
    margin-top: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(15, 42, 71, 0.08);
    font-size: 0.62rem;
    color: #64748b;
}
html[data-theme="dark"] .samko-chart-tooltip .sct-foot { border-top-color: rgba(255, 255, 255, 0.08); color: #94a3b8; }
.samko-chart-tooltip .sct-foot strong { color: #c9a961; font-weight: 700; }

.samko-chart-tooltip .sct-empty {
    font-size: 0.7rem;
    color: #94a3b8;
    font-style: italic;
    text-align: center;
    padding: 0.3rem 0;
}

/* ===========================================================
   Encart de décision (modal candidat)
   =========================================================== */

.decision-block {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1rem 1.1rem;
    border-radius: 12px;
    border: 1.5px solid transparent;
    background: #f8fafc;
    margin-bottom: 0.75rem;
}
.decision-icon {
    width: 38px; height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.decision-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.025rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 0.15rem;
}
.decision-meta {
    font-size: 0.75rem;
    color: #64748b;
}
.decision-comment {
    font-size: 0.8rem;
    color: #475569;
    margin-top: 0.5rem;
    padding: 0.5rem 0.65rem;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    border-left: 3px solid currentColor;
    border-left-color: rgba(0, 0, 0, 0.10);
    font-style: italic;
}

.decision-block-RETENU {
    background: rgba(34, 197, 94, 0.06);
    border-color: rgba(34, 197, 94, 0.30);
}
.decision-block-RETENU .decision-icon {
    background: rgba(34, 197, 94, 0.16);
    color: #16a34a;
}
.decision-block-RETENU .decision-title { color: #15803d; }

.decision-block-REJETE_RH {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.30);
}
.decision-block-REJETE_RH .decision-icon {
    background: rgba(239, 68, 68, 0.16);
    color: #dc2626;
}
.decision-block-REJETE_RH .decision-title { color: #b91c1c; }

.decision-block-TRANSMIS_CLIENT {
    background: rgba(124, 58, 237, 0.08);
    border-color: rgba(124, 58, 237, 0.30);
}
.decision-block-TRANSMIS_CLIENT .decision-icon {
    background: rgba(124, 58, 237, 0.16);
    color: #7c3aed;
}
.decision-block-TRANSMIS_CLIENT .decision-title { color: #6d28d9; }

html[data-theme="dark"] .decision-block { background: rgba(255, 255, 255, 0.03); }
html[data-theme="dark"] .decision-comment { background: rgba(255, 255, 255, 0.04); color: var(--dm-text-soft); }
html[data-theme="dark"] .decision-block-RETENU { background: rgba(34, 197, 94, 0.10); }
html[data-theme="dark"] .decision-block-RETENU .decision-title { color: #4ade80; }
html[data-theme="dark"] .decision-block-REJETE_RH { background: rgba(239, 68, 68, 0.10); }
html[data-theme="dark"] .decision-block-REJETE_RH .decision-title { color: #f87171; }
html[data-theme="dark"] .decision-block-TRANSMIS_CLIENT { background: rgba(124, 58, 237, 0.12); }
html[data-theme="dark"] .decision-block-TRANSMIS_CLIENT .decision-title { color: #c4b5fd; }

/* ===========================================================
   Menu d'export sur les cards poste (dashboard)
   =========================================================== */

.export-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 280px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 14px 36px -16px rgba(15, 42, 71, 0.30);
    z-index: 20;
    overflow: hidden;
}
html[data-theme="dark"] .export-menu {
    background: var(--dm-surface);
    border-color: var(--dm-border);
}
.export-menu-item {
    display: block;
    text-align: left;
    width: 100%;
    padding: 0.85rem 1rem;
    transition: background 0.12s ease;
    cursor: pointer;
}
.export-menu-item + .export-menu-item {
    border-top: 1px solid #f1f5f9;
}
html[data-theme="dark"] .export-menu-item + .export-menu-item { border-top-color: var(--dm-border-soft); }
.export-menu-item:hover {
    background: rgba(26, 84, 144, 0.05);
}
html[data-theme="dark"] .export-menu-item:hover {
    background: rgba(74, 124, 176, 0.08);
}
.export-menu-title {
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--samko-navy);
}
html[data-theme="dark"] .export-menu-title { color: var(--dm-text); }
.export-menu-sub {
    font-size: 0.72rem;
    color: #64748b;
    margin-top: 0.15rem;
}
html[data-theme="dark"] .export-menu-sub { color: var(--dm-text-mute); }
.export-menu-pill {
    display: inline-block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.15rem 0.45rem;
    background: var(--samko-gold);
    color: var(--samko-navy);
    border-radius: 999px;
    font-weight: 700;
    margin-right: 0.4rem;
}

/* ============================================================
   ÉTAT DU SYSTÈME (onglet Analytics) — health checks visuels
   ============================================================ */

/* Bandeau global : pulsation discrète qui change de couleur */
.health-pulse {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 0 rgba(0,0,0,0);
}
.health-pulse-ok       { background: #16a34a; box-shadow: 0 0 0 4px rgba(22,163,74,0.18); }
.health-pulse-warning  { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245,158,11,0.20); }
.health-pulse-critical { background: #dc2626; box-shadow: 0 0 0 4px rgba(220,38,38,0.22);
                         animation: healthPulse 1.4s ease-in-out infinite; }
.health-pulse-unknown  { background: #94a3b8; box-shadow: 0 0 0 4px rgba(148,163,184,0.18); }

@keyframes healthPulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(220,38,38,0.22); }
    50%      { box-shadow: 0 0 0 8px rgba(220,38,38,0.10); }
}

/* Pastilles légende & item */
.health-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.4em;
    vertical-align: middle;
}
.health-dot-ok       { background: #16a34a; }
.health-dot-warning  { background: #f59e0b; }
.health-dot-critical { background: #dc2626; }
.health-dot-unknown  { background: #94a3b8; }

.health-legend {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: #64748b;
    padding: 0.25rem 0.6rem;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}
html[data-theme="dark"] .health-legend { background: var(--dm-card-bg); color: var(--dm-text-mute); border-color: var(--dm-border); }

/* Liste des items par catégorie */
.health-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.health-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 3px solid transparent;
    border-radius: 8px;
    transition: background 0.15s;
}
.health-item:hover { background: #f1f5f9; }
html[data-theme="dark"] .health-item { background: var(--dm-card-bg); border-color: var(--dm-border); }
html[data-theme="dark"] .health-item:hover { background: var(--dm-bg-hover); }

.health-item-ok       { border-left-color: #16a34a; }
.health-item-warning  { border-left-color: #f59e0b; background: #fffbeb; }
.health-item-critical { border-left-color: #dc2626; background: #fef2f2; }
.health-item-unknown  { border-left-color: #94a3b8; }

html[data-theme="dark"] .health-item-warning  { background: rgba(245,158,11,0.08); }
html[data-theme="dark"] .health-item-critical { background: rgba(220,38,38,0.10); }

.health-item-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.health-item-body {
    min-width: 0;
}
.health-item-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
}
.health-item-detail {
    font-size: 0.78rem;
    color: #64748b;
    margin-top: 0.15rem;
    line-height: 1.4;
}
html[data-theme="dark"] .health-item-label  { color: var(--dm-text); }
html[data-theme="dark"] .health-item-detail { color: var(--dm-text-mute); }

.health-item-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    white-space: nowrap;
}
.badge-ok       { background: rgba(22,163,74,0.12);  color: #047857; }
.badge-warning  { background: rgba(245,158,11,0.16); color: #b45309; }
.badge-critical { background: rgba(220,38,38,0.14);  color: #b91c1c; }
.badge-unknown  { background: rgba(148,163,184,0.15); color: #475569; }

html[data-theme="dark"] .badge-ok       { background: rgba(22,163,74,0.22);  color: #4ade80; }
html[data-theme="dark"] .badge-warning  { background: rgba(245,158,11,0.22); color: #fcd34d; }
html[data-theme="dark"] .badge-critical { background: rgba(220,38,38,0.22);  color: #fca5a5; }
html[data-theme="dark"] .badge-unknown  { background: rgba(148,163,184,0.22); color: #cbd5e1; }

/* ============================================================
   TOAST "Nouvelle version disponible" (style Claude)
   Injecté par theme-init.js quand /api/version change.
   ============================================================ */

#samko-update-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    max-width: 420px;
    animation: samkoUpdateSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes samkoUpdateSlideIn {
    from { transform: translateY(28px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.samko-update-toast-inner {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.9rem 1rem 0.9rem 1.1rem;
    background: linear-gradient(135deg, #1e293b 0%, #0f1b3d 100%);
    color: #fff;
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(15, 27, 61, 0.45), 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(201, 169, 97, 0.25);
}

.samko-update-toast-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(201, 169, 97, 0.18);
    color: #c9a961;
    flex-shrink: 0;
}

.samko-update-toast-text {
    flex: 1;
    min-width: 0;
}

.samko-update-toast-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
    line-height: 1.25;
    margin: 0 0 0.15rem 0;
}

.samko-update-toast-sub {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.35;
    margin: 0;
}

.samko-update-toast-btn {
    background: #c9a961;
    color: #0f1b3d;
    border: none;
    padding: 0.5rem 0.95rem;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    flex-shrink: 0;
}
.samko-update-toast-btn:hover { background: #d8b87a; }
.samko-update-toast-btn:active { transform: scale(0.97); }

.samko-update-toast-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.45);
    font-size: 1.35rem;
    line-height: 1;
    padding: 0.15rem 0.4rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.15s;
}
.samko-update-toast-close:hover { color: #fff; }

/* Sur mobile : toast pleine largeur en bas */
@media (max-width: 640px) {
    #samko-update-toast {
        left: 0.75rem;
        right: 0.75rem;
        bottom: 0.75rem;
        max-width: none;
    }
}

/* ===========================================================
 * Settings : sections collapsibles (accordéons)
 * =========================================================== */

.settings-accordion { padding: 0; overflow: hidden; }
.settings-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    padding: 1.1rem 1.5rem;
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease;
}
.settings-accordion-header:hover { background: rgba(148, 163, 184, 0.06); }
.settings-accordion-header > div:first-child { flex: 1; min-width: 0; }
.settings-accordion-header .settings-section-title,
.settings-accordion-header .settings-section-subtitle { margin-bottom: 0; }
.settings-accordion-header .settings-section-subtitle { margin-top: 0.15rem; }
.settings-accordion-chevron {
    color: var(--dm-text-mute);
    transition: transform 0.2s ease, color 0.15s ease;
    flex-shrink: 0;
}
.settings-accordion.is-open .settings-accordion-chevron {
    transform: rotate(180deg);
    color: var(--samko-navy);
}
html[data-theme="dark"] .settings-accordion.is-open .settings-accordion-chevron { color: var(--samko-gold); }
.settings-accordion-body {
    padding: 0 1.5rem 1.5rem 1.5rem;
    border-top: 1px solid var(--dm-border-soft);
}

/* ===========================================================
 * Settings : cartes carrées (intégrations + système)
 * =========================================================== */

.settings-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.85rem;
}

.settings-card {
    background: var(--dm-muted);
    border: 1px solid var(--dm-border);
    border-left: 3px solid var(--dm-border);
    border-radius: 12px;
    padding: 0.95rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-height: 150px;
    transition: border-color 0.15s ease, transform 0.15s ease;
}
html:not([data-theme="dark"]) .settings-card { background: #f8fafc; border-color: #e2e8f0; }
.settings-card:hover { transform: translateY(-1px); }
.settings-card-wide { grid-column: span 2; }
@media (max-width: 640px) { .settings-card-wide { grid-column: span 1; } }

.settings-card.card-state-ok { border-left-color: #22c55e; }
.settings-card.card-state-warning { border-left-color: #f59e0b; }
.settings-card.card-state-critical,
.settings-card.card-state-ko { border-left-color: #ef4444; }
.settings-card.card-state-missing,
.settings-card.card-state-unknown { border-left-color: #94a3b8; }

.settings-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.35rem;
}
.settings-card-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: rgba(26, 84, 144, 0.10);
    color: var(--samko-navy);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
html[data-theme="dark"] .settings-card-icon { background: rgba(201, 169, 97, 0.12); color: var(--samko-gold); }

.settings-card-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--dm-text);
    line-height: 1.2;
}
html:not([data-theme="dark"]) .settings-card-title { color: var(--samko-navy); }
.settings-card-subtitle {
    font-size: 0.7rem;
    color: var(--dm-text-mute);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
}
.settings-card-detail {
    font-size: 0.75rem;
    color: var(--dm-text-mute);
    line-height: 1.35;
    margin-top: 0.4rem;
}
.settings-card-metric {
    font-size: 0.72rem;
    color: var(--dm-text);
    margin-top: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.settings-card-metric-label {
    color: var(--dm-text-mute);
    text-transform: uppercase;
    font-size: 0.62rem;
    letter-spacing: 0.05em;
    font-weight: 600;
}
.settings-card-metric code {
    background: rgba(148, 163, 184, 0.14);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-size: 0.7rem;
}
.settings-card-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    color: var(--samko-blue);
    margin-top: 0.45rem;
    text-decoration: none;
    word-break: break-all;
}
.settings-card-link:hover { text-decoration: underline; }

/* ===========================================================
 * Barre de progression usage (OpenRouter, disque)
 * =========================================================== */

.usage-bar {
    background: rgba(148, 163, 184, 0.22);
    border-radius: 999px;
    overflow: hidden;
    height: 8px;
    width: 100%;
}
.usage-bar-fill {
    height: 100%;
    transition: width 0.5s ease;
    border-radius: 999px;
}
.usage-bar-fill.ok { background: linear-gradient(90deg, #22c55e, #16a34a); }
.usage-bar-fill.warning { background: linear-gradient(90deg, #facc15, #f59e0b); }
.usage-bar-fill.critical { background: linear-gradient(90deg, #f87171, #ef4444); }
.usage-bar-fill.unknown { background: #94a3b8; }

/* ===========================================================
 * Carte coûts IA (reporting Direction)
 * =========================================================== */

.cost-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}
.cost-card {
    background: var(--dm-muted);
    border: 1px solid var(--dm-border);
    border-radius: 12px;
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
html:not([data-theme="dark"]) .cost-card { background: #f8fafc; border-color: #e2e8f0; }

.cost-card-primary {
    background: linear-gradient(135deg, var(--samko-navy) 0%, #1e3a5f 100%);
    border-color: transparent;
    color: #fff;
}
.cost-card-primary .cost-card-label,
.cost-card-primary .cost-card-help,
.cost-card-primary .cost-card-sub { color: rgba(255,255,255,0.75); }
.cost-card-primary .cost-card-value { color: var(--samko-gold); }

.cost-card-accent { border-left: 3px solid var(--samko-gold); }

.cost-card-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--dm-text-mute);
    font-weight: 600;
}
.cost-card-value {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--dm-text);
    line-height: 1.1;
    margin-top: 0.2rem;
}
html:not([data-theme="dark"]) .cost-card-value { color: var(--samko-navy); }
.cost-card-sub {
    font-size: 0.75rem;
    color: var(--dm-text-mute);
    margin-top: 0.1rem;
}
.cost-card-help {
    font-size: 0.7rem;
    color: var(--dm-text-mute);
    margin-top: 0.4rem;
    line-height: 1.3;
}

.cost-history summary { padding: 0.5rem 0; }
.cost-history summary::-webkit-details-marker { display: inline; }

/* Compagnon hover des utilitaires maison samko (inconnus du compilateur Tailwind). */
.hover\:bg-samko-blue:hover { background-color: #1a5490; }

/* Affichage d'identifiants (mot de passe généré, identifiant) : boîte sombre
   lisible à l'identique en clair ET en sombre — immunisée contre les overrides
   de couleur !important du mode sombre (ligne .text-slate-900 etc.). */
.cred-box {
    background: #0f2a47;
    border: 1px solid #1a5490;
    border-radius: 10px;
    padding: 0.7rem 0.9rem;
}
.cred-box .cred-label {
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #c9a961 !important;
    margin-bottom: 0.3rem;
}
.cred-box .cred-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #ffffff !important;
    word-break: break-all;
}
