/* =============================================================================
   JobFlow — Feuille de style principale
   Thème : Light Mode strict | Typographie système sans-sérif
   ============================================================================= */

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

:root {
    /* Palette de couleurs */
    --bg:           #FFFFFF;
    --bg-2:         #F8F9FA;
    --bg-3:         #F1F3F5;
    --border:       #E5E7EB;
    --border-2:     #D1D5DB;
    --text:         #111827;
    --text-2:       #374151;
    --text-muted:   #6B7280;

    /* Couleur d'accentuation principale */
    --accent:       #2563EB;
    --accent-dark:  #1D4ED8;
    --accent-light: #EFF6FF;

    /* Couleurs sémantiques */
    --success:        #059669;
    --success-light:  #ECFDF5;
    --success-border: #A7F3D0;
    --error:          #DC2626;
    --error-light:    #FEF2F2;
    --error-border:   #FCA5A5;
    --warning:        #D97706;
    --warning-light:  #FFFBEB;
    --warning-border: #FCD34D;

    /* Typographie */
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

    /* Arrondis */
    --r-sm: 6px;
    --r:    10px;
    --r-lg: 16px;

    /* Ombres */
    --shadow-xs: 0 1px 2px rgba(0,0,0,.06);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
    --shadow:    0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -2px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.07);

    /* Layout */
    --sidebar-w:  248px;
    --topbar-h:   60px;

    --transition: 150ms ease;
}

html, body {
    height: 100%;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg-2);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

/* =============================================================================
   LAYOUT — Grille sidebar + contenu principal
   ============================================================================= */

.layout-admin,
.layout-app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* --- Barre latérale --------------------------------------------------------- */

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.brand-icon {
    width: 34px;
    height: 34px;
    background: var(--accent);
    color: #fff;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -1px;
    flex-shrink: 0;
}

.brand-name {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -.5px;
}

.brand-badge {
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 99px;
    background: var(--accent-light);
    color: var(--accent);
    flex-shrink: 0;
}

.brand-badge.badge-app {
    background: var(--success-light);
    color: var(--success);
}

/* Navigation sidebar */
.nav-list { list-style: none; padding: 10px 0; flex: 1; }

.nav-section-label {
    padding: 14px 20px 5px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-muted);
}

.nav-item { padding: 2px 10px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--r-sm);
    color: var(--text-2);
    font-size: 13.5px;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    text-decoration: none;
}

.nav-link:hover { background: var(--bg-3); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }

.nav-icon {
    width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: .75;
    flex-shrink: 0;
}

.nav-icon svg {
    width: 17px;
    height: 17px;
    display: block;
}

.nav-link.active .nav-icon { opacity: 1; }

.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* --- Zone principale ------------------------------------------------------- */

.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-2);
    min-width: 0;
}

/* Barre supérieure */
.topbar {
    height: var(--topbar-h);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    flex-shrink: 0;
    box-shadow: var(--shadow-xs);
    gap: 16px;
}

.topbar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    flex-shrink: 0;
}

.user-name { font-weight: 500; color: var(--text-2); }

.user-role-badge {
    padding: 2px 9px;
    border-radius: 99px;
    background: var(--bg-3);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: var(--bg);
    border: 1px solid var(--border-2);
    color: var(--text-2);
    border-radius: var(--r-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    text-decoration: none;
}

.btn-logout:hover {
    background: var(--error-light);
    color: var(--error);
    border-color: var(--error-border);
    text-decoration: none;
}

/* Zone de contenu scrollable */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
}

/* =============================================================================
   COMPOSANTS — Alertes, cards, tables, boutons, formulaires
   ============================================================================= */

/* --- Alertes flash ---------------------------------------------------------- */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--r);
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 20px;
    border: 1px solid transparent;
    animation: fadeIn .2s ease;
}

.alert-success { background: var(--success-light); color: var(--success); border-color: var(--success-border); }
.alert-error   { background: var(--error-light);   color: var(--error);   border-color: var(--error-border);   }
.alert-warning { background: var(--warning-light); color: var(--warning); border-color: var(--warning-border); }

.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: inherit;
    opacity: .6;
    padding: 0 2px;
    line-height: 1;
    flex-shrink: 0;
}
.alert-close:hover { opacity: 1; }

/* --- Cards ------------------------------------------------------------------ */

.card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.card-title { font-size: 15px; font-weight: 600; color: var(--text); }
.card-sub   { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.card-body { padding: 24px; }

/* --- Grille de statistiques (dashboard) ------------------------------------- */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
}

.stat-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-muted);
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text);
    margin-top: 8px;
    letter-spacing: -1px;
    line-height: 1;
}

.stat-desc { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* --- Graphe SVG des transitions -------------------------------------------- */

.graph-hint {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    padding: 10px 20px;
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
}

.graph-hint span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.graph-container {
    overflow: auto;
    padding: 20px;
    min-height: 160px;
}

/* État survolé sur l'étiquette de transition */
.edge-lbl rect {
    transition: fill var(--transition), stroke var(--transition);
}
.edge-lbl:hover rect {
    fill: var(--error-light);
    stroke: var(--error-border);
}
.edge-lbl:hover text {
    fill: var(--error);
}

/* Nœud survolé pendant drag */
.g-node:hover .node-body {
    filter: brightness(.97);
}

/* --- Modal overlay --------------------------------------------------------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.42);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn .15s ease;
}

.modal-card {
    background: var(--bg);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    padding: 28px 28px 22px;
    width: 100%;
    max-width: 380px;
}

.modal-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

/* Champ invalide dans la modal */
.form-control.is-error {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(220,38,38,.12);
}

/* --- Mise en page côte à côte (page show workflow) ------------------------- */

.show-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

@media (max-width: 960px) {
    .show-split { grid-template-columns: 1fr; }
}

/* --- Bouton icône (remplace les textes Modifier / Supprimer) --------------- */

.btn-icon {
    padding: 5px 7px;
    line-height: 1;
}

.btn-icon svg {
    width: 14px;
    height: 14px;
    display: block;
}

/* --- Colonne de tableau étroite (numéro, actions icônes) ------------------- */

.col-narrow {
    width: 1%;
    white-space: nowrap;
}

/* --- Grille de cartes Workflows -------------------------------------------- */

.workflow-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.workflow-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--shadow-sm);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: box-shadow var(--transition), border-color var(--transition);
}

.workflow-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--border-2);
}

.workflow-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.workflow-card-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    line-height: 1.3;
}

.workflow-card-name:hover {
    color: var(--accent);
    text-decoration: none;
}

.workflow-card-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.55;
    flex: 1;
}

.workflow-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* --- Tableaux --------------------------------------------------------------- */

.table-wrapper { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

thead th {
    padding: 10px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-muted);
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-2); }

td { padding: 13px 16px; color: var(--text-2); vertical-align: middle; }

td strong { color: var(--text); font-weight: 600; }

.td-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* --- Badges ----------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-admin        { background: #F3E8FF; color: #7C3AED; }
.badge-gestionnaire { background: var(--accent-light); color: var(--accent); }
.badge-active       { background: var(--success-light); color: var(--success); }
.badge-inactive     { background: var(--error-light);   color: var(--error);   }
.badge-en_cours     { background: var(--accent-light);  color: var(--accent);  }
.badge-termine      { background: var(--success-light); color: var(--success); }
.badge-archive      { background: var(--bg-3);          color: var(--text-muted); }

/* Types d'étapes */
.badge-formulaire   { background: var(--warning-light); color: var(--warning); }
.badge-email        { background: var(--accent-light);  color: var(--accent);  }
.badge-document     { background: #F3E8FF;              color: #7C3AED;        }
.badge-action       { background: #F1F5F9;              color: #475569;        }

/* --- Boutons ---------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--r-sm);
    font-size: 13.5px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    border: 1px solid transparent;
    transition: background var(--transition), box-shadow var(--transition), border-color var(--transition), color var(--transition);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}

.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-primary:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: #fff;
}

.btn-secondary {
    background: var(--bg);
    color: var(--text-2);
    border-color: var(--border-2);
}
.btn-secondary:hover { background: var(--bg-3); text-decoration: none; color: var(--text); }

.btn-danger {
    background: var(--bg);
    color: var(--error);
    border-color: var(--error-border);
}
.btn-danger:hover { background: var(--error-light); text-decoration: none; }

.btn-sm { padding: 5px 13px; font-size: 12.5px; }
.btn-full { width: 100%; }

/* --- En-tête de page -------------------------------------------------------- */

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-header-left { min-width: 0; }

.page-title { font-size: 20px; font-weight: 800; color: var(--text); letter-spacing: -.5px; }
.page-sub   { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* --- État vide -------------------------------------------------------------- */

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

.empty-state-icon { font-size: 36px; opacity: .35; margin-bottom: 14px; }
.empty-state-title { font-size: 15px; font-weight: 600; color: var(--text-2); }
.empty-state-desc  { font-size: 13px; margin-top: 6px; }
.empty-state .btn  { margin-top: 20px; }

/* --- Formulaires ------------------------------------------------------------ */

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

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

.form-group { margin-bottom: 20px; }
.form-group.full { grid-column: 1 / -1; }

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 6px;
}

.required-star { color: var(--error); margin-left: 2px; }

.form-control {
    width: 100%;
    padding: 9px 13px;
    border: 1px solid var(--border-2);
    border-radius: var(--r-sm);
    font-size: 13.5px;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    appearance: none;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.form-control::placeholder { color: var(--text-muted); }
.form-control:disabled { background: var(--bg-2); color: var(--text-muted); cursor: not-allowed; }

select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; }

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

/* Checkbox / Toggle */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
}

.checkbox-group input[type="checkbox"] {
    width: 17px;
    height: 17px;
    cursor: pointer;
    accent-color: var(--accent);
    flex-shrink: 0;
}

.checkbox-label {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-2);
    cursor: pointer;
}

/* Séparateur de section dans un formulaire */
.form-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-muted);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

/* =============================================================================
   PAGE DE CONNEXION
   ============================================================================= */

.login-page {
    min-height: 100vh;
    background: var(--bg-2);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px 36px;
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.login-logo-icon {
    width: 42px;
    height: 42px;
    background: var(--accent);
    color: #fff;
    border-radius: var(--r);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: -1px;
}

.login-logo-name {
    font-size: 22px;
    font-weight: 900;
    color: var(--text);
    letter-spacing: -1px;
}

.login-headline  { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.login-subline   { font-size: 13px; color: var(--text-muted); margin-bottom: 28px; }

.login-submit {
    width: 100%;
    justify-content: center;
    padding: 11px;
    font-size: 14px;
    margin-top: 4px;
}

/* =============================================================================
   UTILITAIRES
   ============================================================================= */

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.text-muted   { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-error   { color: var(--error); }
.text-small   { font-size: 12px; }
.fw-600       { font-weight: 600; }

.d-flex       { display: flex; }
.align-center { align-items: center; }
.gap-1        { gap: 8px; }
.gap-2        { gap: 16px; }
.ml-auto      { margin-left: auto; }

/* =============================================================================
   ANIMATIONS
   ============================================================================= */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media (max-width: 768px) {
    .sidebar { display: none; }
    .content { padding: 16px; }
    .topbar  { padding: 0 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .login-card { padding: 28px 20px; }
}

/* =============================================================================
   RENDU MARKDOWN — prévisualisation email / document / instructions
   Rétablit les marges et l'espacement supprimés par le reset global.
   ============================================================================= */

.markdown-body {
    line-height: 1.65;
    color: var(--text);
}
.markdown-body h1 {
    font-size: 1.25em;
    font-weight: 700;
    margin: 0 0 14px 0;
    color: var(--text);
}
.markdown-body h2 {
    font-size: 1.1em;
    font-weight: 700;
    margin: 20px 0 8px 0;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
.markdown-body h3 {
    font-size: 1em;
    font-weight: 600;
    margin: 14px 0 6px 0;
    color: var(--text-2);
}
.markdown-body p {
    margin: 0 0 10px 0;
}
.markdown-body p:last-child {
    margin-bottom: 0;
}
.markdown-body ul {
    margin: 0 0 10px 0;
    padding-left: 22px;
}
.markdown-body li {
    margin-bottom: 4px;
}
.markdown-body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0;
}
.markdown-body strong { font-weight: 700; }
.markdown-body em     { font-style: italic; }
.markdown-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 0 0 12px 0;
    font-size: .95em;
}
.markdown-body table th {
    font-weight: 600;
    text-align: left;
    padding: 6px 10px;
    border: 1px solid var(--border);
    color: var(--text-2);
}
.markdown-body table td {
    padding: 6px 10px;
    border: 1px solid var(--border);
    vertical-align: top;
}

/* --- Kanban dossiers (espace opérationnel) ----------------------------------- */

.kanban-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.kanban-tab {
    padding: 9px 16px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color var(--transition), border-color var(--transition);
}
.kanban-tab:hover  { color: var(--text); }
.kanban-tab.active { color: var(--accent); border-color: var(--accent); font-weight: 600; }

.kanban-board {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 12px;
    align-items: flex-start;
}

.kanban-col {
    flex: 0 0 280px;
    width: 280px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 240px);
    transition: opacity var(--transition), box-shadow var(--transition),
                flex-basis .18s ease, width .18s ease;
}

/* Colonne sans ticket : réduite pour laisser plus de place aux colonnes actives. */
.kanban-col--empty {
    flex: 0 0 130px;
    width: 130px;
}

/* Au survol, une colonne vide reprend sa taille normale (même hors drag). */
.kanban-col--empty:hover {
    flex: 0 0 280px;
    width: 280px;
}

/* Pendant un drag, les colonnes vides reprennent leur taille normale : elles restent
   des cibles de dépôt faciles à viser malgré leur rétrécissement habituel. */
.kanban-board--dragging .kanban-col--empty {
    flex: 0 0 280px;
    width: 280px;
}

.kanban-col--hidden { display: none; }

/* Pendant un drag : les colonnes non atteignables depuis l'étape courante disparaissent
   entièrement (au lieu d'un simple grisage), pour ne laisser visibles que les cibles valides. */
.kanban-col--disabled { display: none; }

.kanban-col--hover {
    box-shadow: 0 0 0 2px var(--accent) inset;
    background: var(--accent-light);
}

.kanban-col-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 13px;
}
.kanban-col-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kanban-col-title { flex: 1; }
.kanban-col-count {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-3);
    border-radius: 99px;
    padding: 1px 8px;
}

.kanban-col-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 60px;
}

.kanban-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 10px 0;
}

.kanban-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 10px 12px;
    cursor: grab;
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--transition), transform var(--transition);
    /* Le drag est géré au pointeur (JS), pas par l'API HTML5 native : évite qu'un
       clic-glissé démarre une sélection de texte ou un scroll tactile parasite. */
    user-select: none;
    touch-action: none;
}
.kanban-card:hover  { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.kanban-card:active { cursor: grabbing; }

/* Carte d'origine pendant le drag (estompée) */
.kanban-card--dragging { opacity: .35; }

/* Clone flottant qui suit le pointeur pendant le drag */
.kanban-card--ghost {
    position: fixed;
    z-index: 2000;
    pointer-events: none;
    box-shadow: var(--shadow-lg);
    opacity: .95;
    transform: rotate(1.5deg);
}
.kanban-card-label {
    font-weight: 600;
    font-size: 13.5px;
    margin-bottom: 6px;
    word-break: break-word;
}
.kanban-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* --- Panneau latéral (fiche dossier en iframe) -------------------------------- */

.ticket-panel {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
}
.ticket-panel.open { display: block; }

.ticket-panel-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.42);
}

.ticket-panel-body {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: min(760px, 92vw);
    background: var(--bg);
    box-shadow: -8px 0 30px rgba(0,0,0,.25);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .25s ease;
}
.ticket-panel.open .ticket-panel-body { transform: translateX(0); }

.ticket-panel-toolbar {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

.ticket-panel-iframe {
    flex: 1;
    width: 100%;
    border: 0;
}
