* {
    box-sizing: border-box;
}

:root {
    /* Largeur de base : 1 colonne simple = 280px */
    --col-base: 290px;
    --sidebar-width: 150px; /* Largeur de la colonne violette/grise à gauche */
    /* Hauteur d’une ligne (case) : ajustable */
    --swimlane-height: clamp(170px, 35vh, 420px);
    /* Couleurs */
    --bg-color: #ffffff;
    --text-color: #333;
    --border-color: #dfe1e6;
    --header-bg: #f4f5f7;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
    line-height: 1.3;


    /* Boutons */
    --btn-blue: #0052cc;   /* Bleu pour Colonne */
    --btn-green: #00875a;  /* Vert pour Story */
    --btn-grey: #42526e;   /* Gris pour Gestion */
    --btn-edit: #ffab00;   /* Jaune */
    --btn-delete: #de350b; /* Rouge */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- NAVBAR UNIFORME --- */
.kb-navbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0;
    flex-shrink: 0;
    background: #fff;
}

.kb-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: #172b4d;
    margin-right: 15px;
}

/* INPUTS ET FORMULAIRES */
.inline-form { display: flex; gap: 5px; align-items: center; }
.form-control {
    padding: 8px 10px; /* Même hauteur que les boutons */
    border: 2px solid var(--border-color);
    border-radius: 3px;
    font-size: 14px;
    height: 36px; /* Hauteur fixe forcée */
}

/* BOUTONS UNIFORMES */
.btn {
    height: 36px; /* Hauteur fixe pour alignement parfait */
    padding: 0 15px;
    border-radius: 3px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: background 0.1s;
}

/* Couleurs demandées */
.btn-col { background-color: var(--btn-blue); }    /* Bleu - Ajouter Colonne */
.btn-story { background-color: var(--btn-green); } /* Vert - Ajouter Story */
.btn-manage { background-color: var(--btn-grey); } /* Gris - Gérer Stories */
.btn-row { background-color: #6b778c; }            /* Gris un peu différent pour Ligne */

.btn:hover { opacity: 0.9; }

/* Petits boutons Edit/Delete */
.btn-warning { background: var(--btn-edit); color: #172b4d; padding: 2px 8px; font-size: 12px; height: 24px; margin-left: 5px; }
.btn-danger { background: var(--btn-delete); color: white; padding: 2px 8px; font-size: 12px; height: 24px; margin-left: 5px; }


/* --- STRUCTURE DU TABLEAU --- */
.kanban-board {
    display: flex;
    flex-direction: column;
    overflow: auto;
    flex: 1;
    min-height: 0;
    border: 1px solid var(--border-color);
    margin-top: 15px;
}

/* LOGIQUE DE LARGEUR STRICTE (C'est ça qui aligne tout) */
/* On applique flex: 0 0 auto pour interdire le redimensionnement */
.col-width-simple {
    flex: 0 0 auto;
    width: var(--col-base);
}
.col-width-double {
    flex: 0 0 auto;
    width: calc(var(--col-base) * 2);
}
/* La sous-colonne fait exactement la taille d'une simple */
.sub-col-item {
    width: var(--col-base);
    border-right: 1px dashed #dfe1e6;
    padding: 5px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.sub-col-item:last-child { border-right: none; }


/* 1. EN-TÊTE FIXE */
.board-header-row {
    display: flex;
    background-color: var(--header-bg);
    border-bottom: 2px solid #ccc;
    position: sticky;
    top: 0;
    z-index: 100;
    width: max-content; /* Prend toute la place nécessaire */
}

.header-corner-placeholder {
    width: var(--sidebar-width);
    flex-shrink: 0;
    border-right: 2px solid #ccc;
    background: var(--header-bg);
}

.column-headers-container { display: flex; }

.col-header-item {
    border-right: 1px solid var(--border-color);
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--header-bg);
}

.col-header-top { display: flex; justify-content: space-between; align-items: center; font-weight: bold; color: #172b4d; }


/* 2. LIGNES (SWIMLANES) */
.kb-swimlane {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    width: max-content;
    background: #fff;
    height: var(--swimlane-height);
    min-height: var(--swimlane-height);
}

.swimlane-title-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background-color: #ffffff; /* Sobre, blanc */
    border-right: 2px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: bold;
    padding: 10px;
    color: #42526e;
    font-size: 1.1em;
    flex-direction: column;
    gap: 8px;
}

/* Couleur alternée pour les lignes (Zebra striping léger) pour lisibilité */
.kb-swimlane:nth-child(even) .swimlane-title-sidebar { background-color: #f9f9f9; }

.swimlane-columns-container { display: flex; }
.swimlane-columns-container { min-height: 0; }

.kb-col-body {
    border-right: 1px solid #eee;
    padding: 8px;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow-y: auto;  /* le scroll des issues */
    scrollbar-gutter: stable;
}
.kb-col-body.drag-over { background-color: #e3f2fd; }

/* CARTES */
.kb-card {
    background: #fff;
    border: 1px solid #dfe1e6;
    border-radius: 3px;
    padding: 8px;
    margin-bottom: 8px;
    box-shadow: 0 1px 2px rgba(9, 30, 66, 0.25);
}
.kb-card:hover { background: #ebecf0; }
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.card-header strong { font-size: 14px; color: #172b4d; }
.btn-edit-card { text-decoration: none;
    font-size: 16px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}


/* Alertes */
.alert { padding: 10px; margin-top: 10px; border-radius: 4px; }
.alert-error { background: #ffebe6; color: #de350b; border: 1px solid #ffbdad; }
.alert-success { background: #e3fcef; color: #006644; border: 1px solid #abf5d1; }

/* Indique que c'est fixe */
.fixed-col {
    cursor: default; /* Pas de main */
    background-color: #f4f5f7; /* Gris un peu plus foncé */
}
/* Indique que c'est bougeable */
.col-header-item[draggable="true"] {
    cursor: grab;
}
.col-header-item[draggable="true"]:active {
    cursor: grabbing;
}
.kb-card-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    margin-right: 8px;
    display: block;

    .swimlane-title-text {
        line-height: 1.2;
    }

    /* Fallback Bootstrap-like badge (si Bootstrap n'est pas inclus) */

    .badge {
        display: inline-block;
        padding: .35em .65em;
        font-size: .75em;
        font-weight: 600;
        line-height: 1;
        border-radius: .375rem;
        vertical-align: middle;
    }

    .bg-secondary {
        background-color: #6c757d !important;
        color: #fff !important;
    }

    .ms-2 {
        margin-left: .5rem !important;
    }

    .kb-col-header {
        padding: .6rem .8rem;
        border-bottom: 1px solid var(--border-color);
        font-weight: 600;
        overflow-wrap: break-word;
        word-wrap: break-word;
        hyphens: auto;
    }

    /* évite que .col-header-top impose sa typo/couleur au badge */

    .col-header-top {
        font-weight: inherit;
        color: inherit;
    }

    .story-detail-truncate {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-height: none;
        display: block;
        -webkit-box-orient: unset;
        word-wrap: normal;
        overflow-wrap: normal;

    }
}