/* =========================================================
   css/corpus.css — Styles consolidés pour tous les types de corpus
   Regroupe : fleurs, morphologique, intensite, hyperonymie, grille-semique, sacs
   ========================================================= */

/* =========================================================
   STYLES COMMUNS À TOUS LES CORPUS
   ========================================================= */

/* Wrappers */
.fleurs-wrapper,
.morpho-wrapper,
.intensite-wrapper,
.hyperonymie-wrapper,
.grille-wrapper,
.sacs-wrapper {
    padding-bottom: 1rem;
}

/* Layouts 2 colonnes (canvas + sidebar) */
.fleurs-layout,
.morpho-layout,
.intensite-layout,
.hyperonymie-layout,
.grille-layout,
.sacs-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr);
    gap: 1rem;
    margin-top: 0.5rem;
}

.sacs-layout {
    align-items: start;
}

/* Conteneurs canvas */
.fleurs-canvas-container,
.morpho-canvas-container,
.intensite-canvas-container,
.hyperonymie-canvas-container {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e5e7f0;
    padding: 0.75rem;
}

.morpho-canvas-container,
.grille-canvas-container,
.sacs-canvas-container {
    overflow-x: auto;
}

.grille-canvas-container,
.sacs-canvas-container {
    width: 100%;
    padding-bottom: 0.5rem;
}

/* Sidebars */
.fleurs-sidebar,
.morpho-sidebar,
.intensite-sidebar,
.hyperonymie-sidebar,
.grille-sidebar,
.sacs-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Panneaux latéraux */
.corpus-panel,
.fleurs-panel,
.morpho-panel,
.intensite-panel,
.hyperonymie-panel,
.grille-panel,
.sacs-panel {
    border-radius: 14px;
    border: 1px solid #e5e7f0;
    background: #f9fafb;
    padding: 0.75rem 0.85rem;
}

.corpus-panel h3,
.fleurs-panel h3,
.morpho-panel h3,
.intensite-panel h3,
.hyperonymie-panel h3,
.grille-panel h3,
.sacs-panel h3 {
    font-size: 1rem;
    margin-bottom: 0.4rem;
}

/* Panneaux de liens / interconnexions */
.fleurs-links-panel,
.morpho-links-panel,
.intensite-links-panel,
.hyperonymie-links-panel,
.grille-links-panel,
.sacs-links-panel {
    min-height: 80px;
    max-height: 200px;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e5e7f0;
    padding: 0.5rem 0.6rem;
}

.morpho-links-panel {
    max-height: 220px;
}

/* Titres de panneaux de liens */
.fleurs-links-panel-title,
.morpho-links-panel-title,
.intensite-links-title,
.grille-links-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

/* Listes de liens */
.fleurs-links-list,
.morpho-links-list,
.intensite-links-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.fleurs-links-list li,
.morpho-links-list li,
.intensite-links-list li,
.grille-links-panel li {
    font-size: 0.85rem;
    padding: 0.25rem 0.35rem;
    border-radius: 8px;
    cursor: pointer;
}

.fleurs-links-list li:hover,
.morpho-links-list li:hover,
.intensite-links-list li:hover,
.grille-links-panel li:hover {
    background: #eef2ff;
}

.grille-links-panel ul {
    list-style: none;
    margin: 0;
    padding-left: 0;
}

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

@media (max-width: 900px) {
    .fleurs-layout,
    .morpho-layout,
    .intensite-layout,
    .hyperonymie-layout,
    .grille-layout,
    .sacs-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .fleurs-canvas,
    .intensite-canvas,
    .hyperonymie-canvas {
        height: 480px;
    }

    .grille-canvas,
    .sacs-canvas {
        max-height: none;
    }
}


/* =========================================================
   FLEURS LEXICALES
   ========================================================= */

.fleurs-header-actions {
    display: flex;
    gap: 0.5rem;
}

.fleurs-canvas {
    position: relative;
    width: 100%;
    height: 580px;
    background: #ffffff;
    border-radius: 14px;
    border: 1px dashed #e5e7f0;
    overflow: auto;
    padding: 0.4rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

/* Conteneur pour centrer verticalement sans couper le haut */
.fleurs-canvas > .fleurs-row:first-child {
    margin-top: auto;
}

.fleurs-canvas > .fleurs-center {
    margin-top: 0;
    margin-bottom: 0;
}

.fleurs-canvas > .fleurs-row:last-child {
    margin-bottom: auto;
}

/* Lignes de catégories */
.fleurs-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.4rem;
    align-items: flex-start;
}

.fleurs-row-top {
    margin-bottom: 0.25rem;
}

.fleurs-row-bottom {
    margin-top: 0.25rem;
}

.fleurs-row-top,
.fleurs-row-bottom {
    justify-content: center;
}

/* Centre de la fleur */
.fleurs-center {
    width: 260px;
    min-height: 70px;
    padding: 0.6rem 0.9rem;
    border-radius: 999px;
    background: #f3f4ff;
    border: 2px solid #4f46e5;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: 600;
    cursor: pointer;
    box-sizing: border-box;
}

/* Colonnes de catégories */
.fleurs-category-col {
    min-width: 150px;
    max-width: fit-content;
    width: auto;
    min-height: 100px;
    padding: 0.5rem 0.6rem;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid #e5e7f0;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: visible;
}

.fleurs-category-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
    overflow: visible;
    width: 100%;
}

.fleurs-category-title:hover {
    background: #eef2ff;
}

/* Par défaut : colonne simple sans images */
.fleurs-category-words {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    align-items: center;
    width: 100%;
}

/* Sans images mais 8 mots ou plus : deux colonnes */
.fleurs-category-words.two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.1rem 0.5rem;
    align-items: start;
    justify-items: center;
    width: 100%;
}

/* Entrées multi-mots en deux colonnes : occuper toute la largeur */
.fleurs-category-words.two-columns .fleurs-word-chip.multi-word {
    grid-column: span 2;
    justify-self: stretch;
}

/* Avec images : grille de 3 colonnes adaptative */
.fleurs-category-words.has-images {
    display: grid;
    grid-template-columns: repeat(3, minmax(min-content, 1fr));
    gap: 0.35rem 0.5rem;
    align-items: start;
    justify-items: center;
    width: 100%;
}

/* Entrées multi-mots avec images : occuper toute la largeur (3 colonnes) */
.fleurs-category-words.has-images .fleurs-word-chip.multi-word {
    grid-column: span 3;
    justify-self: stretch;
}

/* Texte des entrées multi-mots : garder sur une ligne */
.fleurs-word-chip.multi-word .lex-word-card-label {
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

/* Sans images : entrées multi-mots prennent toute la largeur aussi */
.fleurs-category-words:not(.has-images) .fleurs-word-chip.multi-word {
    width: 100%;
}

/* Style par défaut : simple sans images */
.fleurs-word-chip {
    display: inline-block;
    font-size: 0.85rem;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
}

/* Style avec images : colonne flexible */
.fleurs-category-words.has-images .fleurs-word-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: auto;
    max-width: none;
    box-sizing: border-box;
    overflow: visible;
}

.fleurs-word-chip .lex-word-card-label {
    white-space: nowrap;
    overflow: visible;
}

.fleurs-category-words.has-images .fleurs-word-chip .lex-word-card-image-slot {
    max-width: 100%;
}

.fleurs-category-words.has-images .fleurs-word-chip .lex-word-card-image-slot img {
    max-width: 100%;
    max-height: 50px;
    object-fit: contain;
}

.fleurs-word-chip:hover {
    text-decoration: underline;
    background: transparent;
}

.fleurs-canvas-empty-message {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.4rem;
}

/* Édition des catégories */
.fleurs-category-editor {
    margin-bottom: 0.6rem;
    padding: 0.45rem 0.55rem;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid #e5e7f0;
}

.fleurs-category-editor-header {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.3rem;
}

.fleurs-category-editor-header input[type="text"] {
    flex: 1;
}

/* Boutons de déplacement (flèches) */
.btn-arrow-move {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn-arrow-move:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.btn-arrow-move:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.fleurs-category-editor textarea {
    width: 100%;
    min-height: 70px;
    resize: vertical;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    padding: 0.4rem 0.5rem;
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
}

.fleurs-category-editor textarea:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.15);
}

/* Scroll horizontal pour fleurs */
#fleurs-corpus-frame,
.fleurs-canvas-container {
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.25rem;
}

#fleurs-canvas {
    min-width: max-content;
}


/* =========================================================
   CORPUS MORPHOLOGIQUE
   ========================================================= */

.morpho-canvas {
    background: #ffffff;
    border-radius: 14px;
    border: 1px dashed #e5e7f0;
    padding: 0.75rem;
    box-sizing: border-box;
    min-height: 220px;
}

.morpho-main-title {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.morpho-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
    align-items: flex-start;
}

.morpho-category-box {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #d1d5e5;
    padding: 0.5rem 0.6rem;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.04);
    box-sizing: border-box;
    overflow: hidden;
}

.morpho-cat-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    cursor: pointer;
    text-align: center;
}

.morpho-cat-title:hover {
    color: #4f46e5;
}

.morpho-cat-words {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    font-size: 0.9rem;
}

.morpho-word {
    cursor: pointer;
}

.morpho-word:hover {
    text-decoration: underline;
}

.morpho-resizer {
    position: absolute;
    width: 14px;
    height: 14px;
    bottom: 6px;
    right: 6px;
    border-radius: 4px;
    background: #e5e7eb;
    cursor: se-resize;
}

/* Éditeurs morpho */
.morpho-editor-block {
    margin-bottom: 0.6rem;
    padding: 0.45rem 0.55rem;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid #e5e7f0;
}

.morpho-editor-header {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.3rem;
}

.morpho-editor-header input[type="text"] {
    flex: 1;
}

.morpho-editor-header .remove-class {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.morpho-editor-header .remove-class:hover {
    color: #ef4444;
    background: #fef2f2;
}

.morpho-editor-block textarea {
    width: 100%;
    min-height: 70px;
    resize: vertical;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    padding: 0.4rem 0.5rem;
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
}

.morpho-editor-block textarea:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.15);
}


/* =========================================================
   ÉCHELLES D'INTENSITÉ
   ========================================================= */

.intensite-canvas {
    position: relative;
    width: 100%;
    height: 580px;
    background: #ffffff;
    border-radius: 14px;
    border: 1px dashed #e5e7f0;
    overflow: auto;
    padding: 0.75rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.6rem;
}

.intensite-scale-wrapper {
    position: relative;
    width: 360px;
    margin: 0 auto;
}

.intensite-scale-wrapper::before,
.intensite-scale-wrapper::after {
    content: "";
    position: absolute;
    top: 10px;
    bottom: 10px;
    width: 0;
    border-left: 2px solid #4b5563;
}

.intensite-scale-wrapper::before {
    left: 30%;
}

.intensite-scale-wrapper::after {
    left: 60%;
}

.intensite-scale-line {
    display: none;
}

.intensite-rung {
    position: absolute;
    left: 30%;
    right: 40%;
    height: 0;
    border-top: 2px solid #4b5563;
}

.intensite-word {
    position: absolute;
    left: calc(60% + 8px);
    font-size: 0.95rem;
    cursor: pointer;
    white-space: nowrap;
    transform: translateY(-50%);
}

.intensite-word:hover {
    text-decoration: underline;
}

.intensite-corpus-label {
    display: inline-block;
    margin-bottom: 0.2rem;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #9ca3af;
    background: #f9fafb;
    font-size: 1rem;
    font-weight: 600;
}

.intensite-label {
    position: absolute;
    left: 0.75rem;
    bottom: 0.75rem;
    font-size: 0.8rem;
    color: #6b7280;
}

.intensite-empty-message {
    font-size: 0.8rem;
    color: #6b7280;
    text-align: center;
}


/* =========================================================
   HYPERONYMIE
   ========================================================= */

.hyperonymie-canvas {
    position: relative;
    width: 100%;
    height: 580px;
    background: #ffffff;
    border-radius: 14px;
    border: 1px dashed #e5e7f0;
    overflow: auto;
    padding: 0.75rem;
    box-sizing: border-box;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
}

.hyper-tree-root {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    min-width: max-content;
}

.hyper-node {
    min-width: 120px;
    max-width: 220px;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: #f3f4ff;
    border: 1px solid #4f46e5;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    box-sizing: border-box;
}

.hyper-node:hover {
    background: #e0e7ff;
}

.hyper-children-block {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.hyper-node-connector {
    width: 0;
    height: 16px;
    border-left: 2px solid #4b5563;
    margin: 6px auto 0;
}

.hyper-children-row {
    position: relative;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: 1.2rem;
    padding-top: 10px;
    box-sizing: border-box;
}

.hyper-children-row::before {
    content: none;
}

.hyper-child-wrapper {
    position: relative;
    padding-top: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hyper-child-wrapper::before {
    content: "";
    position: absolute;
    top: -8px;
    left: 50%;
    width: 0;
    height: 18px;
    border-left: 2px solid #4b5563;
    transform: translateX(-50%);
}

.hyper-children-line {
    position: absolute;
    top: 0;
    height: 0;
    border-top: 2px solid #4b5563;
    box-sizing: border-box;
    pointer-events: none;
}

/* Éditeur de noeuds */
.hyper-node-editor {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
}

.hyper-node-editor .field-input {
    flex: 1;
}

.hyper-node-editor-actions {
    display: flex;
    gap: 0.25rem;
}

.hyper-node-level-0 { margin-left: 0; }
.hyper-node-level-1 { margin-left: 0.8rem; }
.hyper-node-level-2 { margin-left: 1.6rem; }
.hyper-node-level-3,
.hyper-node-level-4 { margin-left: 2.4rem; }

.btn-icon {
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    padding: 0 0.35rem;
    font-size: 0.95rem;
    cursor: pointer;
}

.btn-icon:hover {
    background: #e5e7eb;
}

.hyperonymie-links-panel {
    font-size: 0.85rem;
}


/* =========================================================
   GRILLE SÉMIQUE
   ========================================================= */

.grille-canvas {
    position: relative;
    width: 100%;
    min-height: 300px;
    max-height: 580px;
    background: #ffffff;
    border-radius: 14px;
    border: 1px dashed #e5e7f0;
    overflow: auto;
    padding: 0.4rem;
    box-sizing: border-box;
}

.grille-corpus-label {
    font-size: 0.95rem;
    font-weight: 600;
    font-style: italic;
    text-align: center;
    margin-bottom: 0.4rem;
    color: #4b5563;
}

.grille-table {
    border-collapse: collapse;
    width: max-content;
    min-width: 100%;
    border: 1px solid #d1d5db;
}

.grille-table th,
.grille-table td {
    border: 1px solid #d1d5db;
    padding: 0.25rem 0.5rem;
    text-align: center;
}

.grille-table th {
    background: #f9fafb;
    font-weight: 600;
}

.grille-word-header,
.grille-crit-header {
    cursor: pointer;
    user-select: none;
}

.grille-word-header:hover,
.grille-crit-header:hover {
    background: #eef2ff;
}

.grille-table-edit .grille-cell {
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.grille-table-edit .grille-cell:hover {
    background: #f3f4f6;
}

.grille-cell-checked {
    background: #ffffff;
    color: #111827;
    font-weight: 700;
}

/* Textareas grille */
.grille-panel .field-input[type="text"],
.grille-panel textarea.field-input {
    width: 100%;
    box-sizing: border-box;
}

.grille-panel textarea.field-input {
    min-height: 70px;
    resize: vertical;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    padding: 0.4rem 0.5rem;
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
}

.grille-panel textarea.field-input:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.15);
}

.grille-canvas .muted.small {
    font-size: 0.8rem;
}

/* Cellules texte */
.grille-cell {
    padding: 6px;
    vertical-align: middle;
}

.grille-cell-input {
    width: 100%;
    min-height: 34px;
    resize: vertical;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    border-radius: 0;
    background: transparent;
    padding: 0;
    margin: 0;
    font: inherit;
    text-align: center;
    line-height: 1.2;
}

.grille-cell-input:focus {
    background: rgba(0,0,0,0.03);
}

.grille-cell-input:disabled {
    background: transparent;
    color: inherit;
    opacity: 1;
}

.grille-cell-preview-text {
    text-align: center;
    white-space: pre-wrap;
}


/* =========================================================
   SACS DE MOTS
   ========================================================= */

#sacs-canvas {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    padding: 0.75rem;
}

.sacs-corpus-title {
    text-align: center;
    font-weight: 800;
    font-size: 1.2rem;
    cursor: pointer;
    user-select: none;
}

.sacs-empty-message {
    text-align: center;
    opacity: 0.75;
    padding: 0.8rem;
}

.sacs-canvas {
    position: relative;
    width: 100%;
    min-height: 300px;
    max-height: 580px;
    background: #ffffff;
    border-radius: 14px;
    border: 1px dashed #e5e7f0;
    overflow: auto;
    padding: 0.75rem;
    box-sizing: border-box;
}

/* Inputs/textarea sacs */
.sacs-panel input[type="text"],
.sacs-panel textarea {
    width: 100%;
    box-sizing: border-box;
}

.sacs-panel textarea {
    min-height: 70px;
    resize: vertical;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    padding: 0.4rem 0.5rem;
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    background: #ffffff;
}

.sacs-panel input[type="text"] {
    border-radius: 999px;
    border: 1px solid #d1d5db;
    padding: 0.55rem 0.85rem;
    font-size: 0.95rem;
    outline: none;
    background: #f9fafb;
}

.sacs-panel input[type="text"]:focus,
.sacs-panel textarea:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.15);
    background: #ffffff;
}

/* Éditeurs sacs */
.sacs-bag-editor {
    border: 1px solid #e5e7f0;
    border-radius: 12px;
    padding: 0.6rem;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sacs-bag-editor-header {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.sacs-bag-editor-header input {
    flex: 1;
}

.sacs-bag-editor .remove-class {
    border-radius: 999px;
    border: none;
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
    cursor: pointer;
    background: transparent;
    color: #9ca3af;
}

.sacs-bag-editor .remove-class:hover {
    color: #ef4444;
}

/* Visuels sacs */
.sacs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    align-items: start;
}

.sacs-bag-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.sacs-bag-knot {
    width: 56px;
    height: 18px;
    border-radius: 999px;
    background: #d6a85b;
    position: relative;
    box-shadow: 0 2px 0 rgba(0,0,0,.12);
}

.sacs-bag-knot::before,
.sacs-bag-knot::after {
    content: "";
    position: absolute;
    top: 3px;
    width: 18px;
    height: 12px;
    border-radius: 6px;
    background: #c89445;
}

.sacs-bag-knot::before {
    left: -10px;
    transform: rotate(-18deg);
}

.sacs-bag-knot::after {
    right: -10px;
    transform: rotate(18deg);
}

.sacs-bag {
    width: 100%;
    max-width: min(520px, 100%);
    min-height: 190px;
    border-radius: 18px 18px 26px 26px;
    border: 2px solid rgba(0,0,0,.12);
    background: #f2d39a;
    position: relative;
    padding: 1.15rem 0.75rem 0.95rem;
    box-shadow: 0 10px 18px rgba(0,0,0,.08);
}

.sacs-bag-collar {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 28px;
    border-radius: 999px;
    border: 2px solid rgba(0,0,0,.12);
    background: #e8c27e;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.4rem;
    box-sizing: border-box;
}

.sacs-bag-collar-label {
    max-width: 95%;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.85rem;
    line-height: 1.1;
    text-align: center;
    color: #111827;
    background: rgba(255,255,255,.75);
    border: 1px solid rgba(229,231,240,.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    user-select: none;
}

.sacs-bag-empty {
    text-align: center;
    opacity: 0.7;
    margin-top: 2.2rem;
}

.sacs-bag-words {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 0.6rem;
    justify-items: stretch;
    align-items: start;
    margin-top: 0.9rem;
    padding-top: 0.2rem;
}

.sacs-word-chip {
    width: 100%;
    max-width: none;
}

@media (max-width: 420px) {
    .sacs-bag-words {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 1100px) {
    .sacs-bag {
        max-width: 640px;
        min-height: 240px;
    }
    .sacs-bag-collar-label {
        font-size: 1rem;
    }
}


/* =========================================================
   IMPRESSION COMMUNE
   ========================================================= */

@media print {
    @page {
        size: A4 landscape;
        margin: 1cm;
    }

    body {
        background: #ffffff !important;
    }

    /* Masquer header/footer/sidebar/breadcrumb */
    header,
    footer,
    .app-header,
    .app-footer,
    .breadcrumb,
    .fleurs-sidebar,
    .morpho-sidebar,
    .intensite-sidebar,
    .hyperonymie-sidebar,
    .grille-sidebar,
    .sacs-sidebar {
        display: none !important;
    }

    .app-main {
        margin: 0;
        padding: 0;
        max-width: 100%;
    }

    /* Forcer affichage des vues */
    #view-corpus-fleurs,
    #view-corpus-morphologique,
    #view-corpus-hyperonymie,
    #view-corpus-grille-semique,
    #view-corpus-sacs {
        display: block !important;
    }

    /* Reset des containers */
    .card,
    .fleurs-wrapper,
    .morpho-wrapper,
    .grille-wrapper,
    .sacs-wrapper,
    .fleurs-canvas-container,
    .morpho-canvas-container,
    .grille-canvas-container,
    .sacs-canvas-container {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Layouts en une colonne */
    .fleurs-layout,
    .morpho-layout,
    .grille-layout,
    .sacs-layout {
        grid-template-columns: minmax(0, 1fr);
        display: block !important;
    }

    /* Canvas sans hauteur fixe */
    .fleurs-canvas {
        height: 100vh;
        border: none;
        padding: 0.4cm;
    }

    .morpho-canvas,
    .grille-canvas,
    .sacs-canvas {
        max-height: none !important;
        height: auto !important;
        overflow: visible !important;
        border: none !important;
        padding: 0.4cm !important;
    }

    .morpho-canvas-container,
    .grille-canvas-container,
    .sacs-canvas-container {
        overflow: visible !important;
    }

    /* Morpho : grille comme à l'écran */
    .morpho-grid {
        display: grid !important;
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 0.75rem !important;
        align-items: flex-start;
    }

    .morpho-category-box {
        width: auto !important;
        height: auto !important;
        max-width: 100% !important;
    }

    /* Hyperonymie */
    .hyperonymie-canvas.hyper-printing {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        border: none !important;
        padding: 0.4cm !important;
    }

    /* Grille sémique */
    .grille-table {
        width: auto !important;
        min-width: 0 !important;
        border: 1px solid #000000;
    }

    .grille-table th,
    .grille-table td {
        border: 1px solid #000000;
        padding: 0.3rem 0.5rem;
    }

    .grille-table th {
        background: #ffffff !important;
    }

    .grille-cell-checked {
        background: #ffffff !important;
        color: #000000 !important;
        font-weight: 700;
    }
}
