/* Jetons de couleur : source unique, partagee avec les plugins.
   L'@import doit rester la PREMIERE instruction du fichier. */
@import url('bec-tokens.css');

:root {

    /* Surfaces */
    --bg-color: #f4f5f7;
    --body-bg: #f4f5f7;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --table-header-bg: #f9fafb;

    /* Text */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;

    /* Elevation */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.03);
    --shadow-lg: 0 10px 20px rgba(0,0,0,0.06), 0 4px 8px rgba(0,0,0,0.04);

    /* Layout */
    --header-bg: #ffffff;
    --footer-bg: #1f2937;
    --footer-text: #e5e7eb;
    --hover-bg: rgba(30,64,175,0.04);
    --focus-ring: rgba(30,64,175,0.15);
    --modal-overlay: rgba(17,24,39,0.5);

    /* Status */
    --view-badge-bg: #7c3aed;
    --input-only-badge-bg: #059669;
    --btn-secondary-hover: #4b5563;
    --btn-danger-hover: #b91c1c;
    --danger-hover-bg: rgba(220,38,38,0.06);
    --planning-today-bg: rgba(30,64,175,0.06);
    --planning-other-bg: #f9fafb;

    /* Spacing scale (8px grid) */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;
    --sp-10: 40px;
    --sp-12: 48px;

    /* Radius — minimal for professional look */
    --radius-sm: 3px;
    --radius: 4px;
    --radius-lg: 6px;
    --radius-xl: 8px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition: 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--body-bg);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    background: var(--header-bg);
    color: var(--header-text, var(--text-primary));
    padding: var(--sp-2) var(--sp-6);
    box-shadow: var(--shadow-xs);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}
header h1, header .subtitle, header .nav-icon-btn { color: var(--header-text, var(--text-primary)); }

/* Nav icon buttons */
.nav-icons {
    display: flex;
    align-items: center;
    gap: 2px;
}
.nav-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.1rem;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    position: relative;
}
.nav-icon-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
    transform: translateY(-1px);
}
.nav-icon-btn:active {
    transform: translateY(0);
}
/* Tooltip natif amélioré via title — ou custom */
.nav-icon-btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--footer-bg, #1f2937);
    color: #fff;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    font-weight: 500;
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
    letter-spacing: 0.01em;
}
/* Pastille de comptage sur les icones de navigation (validations workflow,
   validations stock, etc.). Centralisee ici (au lieu de validation.css) pour
   etre disponible sur TOUTES les pages, y compris superadmin/admin qui ne
   chargent pas validation.css. */
.validation-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
    line-height: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.nav-icon-btn .validation-badge {
    position: absolute;
    top: -4px;
    right: -4px;
}
.nav-icon-logout {
    color: #fff !important;
    background: rgba(220,38,38,0.85);
    border: 1px solid rgba(255,255,255,0.3);
    font-size: 1rem;
    font-weight: 700;
}
.nav-icon-logout:hover {
    background: rgba(220,38,38,1);
    border-color: rgba(255,255,255,0.6);
    box-shadow: 0 0 8px rgba(220,38,38,0.4);
}

header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Main Content Layout */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-header {
    padding: var(--sp-4) var(--sp-4);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

/* Sidebar Search (filtre tables) */
.sidebar-search {
    position: relative;
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}
.sidebar-search-icon {
    position: absolute;
    left: calc(var(--sp-4) + 0.5rem);
    font-size: 0.8125rem;
    opacity: 0.6;
    pointer-events: none;
}
.sidebar-search-input {
    width: 100%;
    padding: 0.4rem 1.9rem 0.4rem 2rem;
    font-size: 0.8125rem;
    color: var(--text-primary);
    background: var(--bg-secondary, var(--card-bg));
    border: 1px solid var(--border-color);
    border-radius: 6px;
    outline: none;
    transition: border-color 0.15s;
}
.sidebar-search-input:focus {
    border-color: var(--primary-color, #667eea);
}
.sidebar-search-clear {
    position: absolute;
    right: calc(var(--sp-4) + 0.4rem);
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    cursor: pointer;
    padding: 0.2rem;
    line-height: 1;
}
.sidebar-search-clear:hover {
    color: var(--text-primary);
}
.tables-search-empty {
    padding: 1rem 1.5rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Liens legaux (CGU, credits) : pied de barre laterale, tiroir mobile,
   modale de preferences. Volontairement discrets. */
.sidebar-legal {
    padding: 0.75rem 1.5rem;
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--text-muted);
    text-align: center;
}

.sidebar-legal a {
    color: var(--text-muted);
    text-decoration: none;
}

.sidebar-legal a:hover {
    color: var(--text-secondary);
    text-decoration: underline;
}

/* Sidebar Profile */
.sidebar-profile {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.sidebar-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--primary-color, #667eea);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sidebar-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.sidebar-avatar span {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1;
}
.sidebar-user-info {
    overflow: hidden;
    min-width: 0;
}
.sidebar-user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-groups {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Drawer Profile (mobile) */
.drawer-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}
.drawer-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--primary-color, #667eea);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.drawer-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.drawer-avatar span {
    color: white;
    font-size: 1rem;
    font-weight: 600;
}
.drawer-user-info {
    overflow: hidden;
}
.drawer-user-name {
    font-weight: 600;
    font-size: 0.875rem;
}
.drawer-user-groups {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.tables-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.table-item {
    padding: var(--sp-2) var(--sp-3);
    margin-bottom: 1px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    gap: var(--sp-2);
}

.table-item:hover {
    background-color: var(--hover-bg);
    color: var(--text-primary);
}

.table-item.active {
    background-color: var(--primary-color);
    color: white;
    font-weight: 500;
}

/* Category separators */
.category-group {
    margin-bottom: 0.25rem;
}

.category-separator {
    padding: 0.6rem 1rem 0.4rem;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: default;
    user-select: none;
}

.category-group:first-child .category-separator {
    margin-top: 0;
}

.category-color-bar {
    width: 3px;
    height: 14px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* Collapsible external groups */
.category-separator.collapsible {
    cursor: pointer;
}
.category-separator.collapsible:hover {
    background: var(--hover-bg, rgba(0,0,0,0.04));
}
.collapse-chevron {
    font-size: 0.7rem;
    transition: transform 0.15s;
    flex-shrink: 0;
}
.ext-table-count {
    margin-left: auto;
    font-size: 0.65rem;
    font-weight: 600;
    background: var(--border-color, #e2e8f0);
    color: var(--text-secondary);
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius);
}

/* Content Area */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

/* Welcome Screen */
.welcome-screen {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.welcome-content h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.welcome-content > p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.feature {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.feature-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.feature h3 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

/* Table View */
.table-view {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-header h2 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.table-info {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.table-actions {
    display: flex;
    gap: 1rem;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
}

.tab-btn {
    padding: 1rem 2rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
    padding: 2rem;
}

.tab-content.active {
    display: block;
}

/* Table Controls */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Filtres temporels */
.date-filters-container {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-bottom: 1rem;
}

.date-filter-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.date-filter-row label {
    font-weight: 600;
    font-size: 0.85rem;
    min-width: 120px;
    color: var(--text-color);
}

.date-filter-row select,
.date-filter-row input[type="date"],
.date-filter-row input[type="datetime-local"] {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    font-size: 0.85rem;
    background: var(--card-bg);
    color: var(--text-color);
}

.date-filter-row .btn-remove-filter {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.2rem 0.4rem;
    border-radius: 2px;
}

.date-filter-row .btn-remove-filter:hover {
    color: var(--danger-color);
    background: var(--danger-hover-bg);
}

.date-filters-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

#dateFilterBtn .filter-badge {
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    margin-left: 4px;
    font-weight: 700;
}

/* Groupes de filtres */
.filter-group {
    margin-bottom: 0.75rem;
}

.filter-group-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.5rem 0;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-color);
}

/* Filtres FK dropdown avec recherche (autocomplete) */
.filter-select-wrapper {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 350px;
}

.filter-fk-search {
    width: 100%;
    padding: 0.4rem 2rem 0.4rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    font-size: 0.85rem;
    background: var(--card-bg);
    color: var(--text-color);
    box-sizing: border-box;
}

.filter-fk-search:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filter-fk-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0 4px;
    line-height: 1;
    display: none;
}

.filter-fk-clear.visible {
    display: block;
}

.filter-fk-clear:hover {
    color: var(--danger-color);
}

.filter-fk-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 2px 2px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 100;
    font-size: 0.85rem;
}

.filter-fk-dropdown.open {
    display: block;
}

.filter-fk-option {
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-fk-option:hover,
.filter-fk-option.highlighted {
    background: var(--primary-color);
    color: white;
}

.filter-fk-option.no-results {
    color: var(--text-secondary);
    font-style: italic;
    cursor: default;
}

.filter-fk-option.no-results:hover {
    background: transparent;
    color: var(--text-secondary);
}

/* Recherche globale */
.search-box {
    position: relative;
}

.search-box input {
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.85rem;
    background: var(--card-bg);
    color: var(--text-color);
    width: 220px;
    transition: width 0.2s ease;
}

.search-box input:focus {
    width: 300px;
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}

/* Data Table */
.table-wrapper {
    overflow: auto;
    max-height: calc(100vh - 14rem);
    min-height: 200px;
}

/* La hauteur du wrapper de records est bornee dynamiquement en JS
   (_fitTableWrapperHeight, app.tableview.js) : le wrapper devient l'unique zone de
   defilement vertical -> thead sticky fige, scrollbars visibles. */

/* Barre de scroll horizontale dupliquee en haut du tableau */
.table-scrollbar-top {
    overflow-x: auto;
    overflow-y: hidden;
    height: 14px;
    margin-bottom: 0;
    display: none;
}
.table-scrollbar-top-inner {
    height: 1px;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8125rem;
}

.data-table.has-col-widths {
    table-layout: fixed;
}

.data-table.has-col-widths td,
.data-table.has-col-widths th {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-table thead {
    background-color: var(--bg-color);
}

.data-table thead th {
    /* Sticky pose sur chaque th : compatible cross-browser meme avec border-collapse:separate */
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: var(--bg-color);
}

.data-table th {
    padding: var(--sp-3) var(--sp-4);
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table th.sortable-header {
    cursor: pointer;
    user-select: none;
    position: relative;
}

/* BUGFIX sticky : .data-table th.sortable-header (position:relative) a une specificite
   superieure a .data-table thead th (position:sticky) et ECRASAIT donc le sticky ->
   seul le th sans .sortable-header (la checkbox) restait fige au defilement. On
   retablit le sticky pour les en-tetes triables avec une specificite suffisante.
   (sticky etablit aussi un bloc conteneur pour les enfants positionnes, comme relative.) */
.data-table thead th.sortable-header {
    position: sticky;
    top: 0;
}

.data-table th.sortable-header:hover {
    background-color: var(--border-color);
}

.sort-indicator {
    opacity: 0.3;
    margin-left: 4px;
    font-size: 0.75rem;
}

/* ── Controles colonnes (deplacement + masquage) ── */
.dt-th-controls {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    vertical-align: middle;
}
.dt-move-col, .dt-hide-col {
    background: none;
    border: none;
    color: var(--text-muted, #999);
    font-size: 9px;
    cursor: pointer;
    padding: 2px 3px;
    line-height: 1;
    transition: color .15s, background .15s;
    border-radius: 3px;
    opacity: 0;
    vertical-align: middle;
}
.data-table th:hover .dt-move-col,
.data-table th:hover .dt-hide-col { opacity: 1; }
.dt-move-col:hover { color: var(--primary-color, #5a67d8); background: rgba(90,103,216,.12); }
.dt-hide-col { font-size: 13px; padding: 0 2px 0 4px; }
.dt-hide-col:hover { color: var(--danger-color, #e53e3e); background: rgba(229,62,62,.08); }
.dt-col-moved { animation: dt-flash .3s ease; }
@keyframes dt-flash {
    0% { background: rgba(90,103,216,.2); }
    100% { background: transparent; }
}

/* Barre des colonnes masquees */
.dt-hidden-cols {
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: var(--card-bg, #fff);
    border: 1px dashed var(--border-color, #e2e8f0);
    border-radius: var(--radius);
    align-items: center;
}
.dt-hidden-cols::before {
    content: 'Colonnes masquees :';
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted, #999);
    margin-right: 4px;
}
.dt-hidden-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: var(--bg-color, #f7fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-lg);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-color, #333);
}
.dt-show-col {
    background: none;
    border: none;
    color: var(--text-muted, #999);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
    transition: color .15s;
}
.dt-show-col:hover { color: var(--danger-color, #e53e3e); }

/* Toggle style picker */
/* Toggle style picker cards */
.toggle-style-card {
    flex: 1; min-width: 120px; padding: 16px 12px; border-radius: var(--radius-lg);
    border: 2px solid var(--border-color, #e2e8f0); background: var(--card-bg, #fff);
    cursor: pointer; text-align: center; transition: .2s;
}
.toggle-style-card:hover { border-color: var(--primary-color, #5a67d8); background: rgba(90,103,216,.04); }
.toggle-style-card.active { border-color: var(--primary-color, #5a67d8); background: rgba(90,103,216,.08); box-shadow: 0 0 0 3px rgba(90,103,216,.15); }
.toggle-style-card span { display: block; margin-top: 10px; font-size: 12px; font-weight: 600; color: var(--text-color, #333); }
.toggle-style-preview { display: flex; justify-content: center; align-items: center; min-height: 40px; pointer-events: none; }

.sort-indicator.active {
    opacity: 1;
    color: var(--primary-color);
}

.data-table td {
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.data-table tbody tr:hover {
    background-color: var(--bg-color);
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Quand .action-buttons est applique directement sur un <td>, display:flex sort
   la cellule du flux table et casse l'alignement avec l'en-tete (les boutons
   debordent a droite de la colonne ACTIONS). On restaure table-cell et on
   espace les boutons via marges (gap ne s'applique pas en mode table-cell). */
td.action-buttons {
    display: table-cell;
    vertical-align: middle;
    white-space: nowrap;
}
td.action-buttons > .btn {
    margin-right: 0.4rem;
}
td.action-buttons > .btn:last-child {
    margin-right: 0;
}

/* Onglets administration (partages entre /admin, /admin/form-templates,
   /folder-connections via templates/partials/admin_tabs.html) */
.admin-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}
.admin-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}
.admin-tab {
    padding: 1rem 2rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: all 0.3s;
}
.admin-tab:hover {
    color: var(--primary-color);
}
.admin-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}
.admin-section {
    display: none;
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius, 4px);
    box-shadow: var(--shadow);
}
.admin-section.active {
    display: block;
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

/* Structure Info */
.structure-info {
    display: grid;
    gap: 2rem;
}

.column-card {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary-color);
}

.column-card h4 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.column-detail {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    font-size: 0.875rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 2px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.badge-primary {
    background-color: var(--primary-color);
    color: white;
}

.badge-success {
    background-color: var(--success-color);
    color: white;
}

.badge-warning {
    background-color: var(--warning-color);
    color: white;
}

/* Badge pour les vues */
.view-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 2px;
    font-size: 0.7rem;
    font-weight: 600;
    background-color: var(--view-badge-bg);
    color: white;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.view-badge-sm {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 2px;
    font-size: 0.65rem;
    font-weight: 600;
    background-color: var(--view-badge-bg);
    color: white;
    margin-left: 0.25rem;
}

/* Badge pour le mode saisie seule */
.badge-input-only {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 2px;
    font-size: 0.7rem;
    font-weight: 600;
    background-color: var(--input-only-badge-bg);
    color: white;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.badge-input-only-sm {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 2px;
    font-size: 0.65rem;
    font-weight: 600;
    background-color: var(--input-only-badge-bg);
    color: white;
    margin-left: 0.25rem;
}

/* Style pour les items en mode saisie seule dans la sidebar */
.table-item.input-only-item,
.drawer-table-item.input-only-item {
    border-left: 3px solid var(--input-only-badge-bg);
}

/* Style pour les items de vue dans la sidebar */
.table-item.view-item,
.drawer-table-item.view-item {
    border-left: 3px solid var(--view-badge-bg);
}

/* Style pour les tables externes dans la sidebar */
.table-item.external-item,
.drawer-table-item.external-item {
    border-left: 3px solid var(--warning-color);
}

.external-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 2px;
    font-size: 0.65rem;
    font-weight: 600;
    background-color: var(--warning-color);
    color: white;
    margin-left: 0.25rem;
    vertical-align: middle;
}

.external-separator {
    font-style: italic;
}

/* Gateway tables */
.table-item.gateway-item,
.drawer-table-item.gateway-item {
    border-left: 3px solid #0ea5e9;
}

.gateway-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 2px;
    font-size: 0.65rem;
    font-weight: 600;
    background-color: #0ea5e9;
    color: white;
    margin-left: 0.25rem;
    vertical-align: middle;
}

.gateway-separator {
    font-style: italic;
}

.external-group {
    border-top: 1px dashed rgba(245, 158, 11, 0.2);
    margin-top: 0.5rem;
    padding-top: 0.25rem;
}

/* Buttons */
.btn {
    padding: var(--sp-2) var(--sp-4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: inherit;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    background: var(--card-bg);
    color: var(--text-primary);
    line-height: 1.4;
    white-space: nowrap;
}
.btn:hover { background: var(--hover-bg); border-color: var(--primary-light); }
.btn:focus-visible { outline: 2px solid var(--primary-light); outline-offset: 1px; }
.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-xs);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-secondary {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
}
.btn-secondary:hover { background: var(--btn-secondary-hover); border-color: var(--btn-secondary-hover); }

.btn-danger {
    background: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
}
.btn-danger:hover { background: var(--btn-danger-hover); border-color: var(--btn-danger-hover); }

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--hover-bg); color: var(--text-primary); }

.btn-sm {
    padding: var(--sp-1) var(--sp-3);
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
}

.btn-icon {
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 1.1rem;
    padding: var(--sp-1);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    color: var(--text-secondary);
}
.btn-icon:hover { background: var(--hover-bg); color: var(--text-primary); }

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-overlay);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.15s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.08);
    animation: slideUp 0.25s ease;
    border: 1px solid var(--border-color);
}

.modal-content.modal-large {
    max-width: 1200px;
}

.modal-content.modal-fullscreen {
    width: 95vw;
    max-width: none;
    height: 95vh;
    max-height: 95vh;
}

.modal-header {
    padding: var(--sp-4) var(--sp-6);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.close-btn {
    background: none;
    border: 1px solid transparent;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: var(--sp-1);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.close-btn:hover {
    color: var(--text-primary);
    background: var(--hover-bg);
    border-color: var(--border-color);
}

.modal-body {
    padding: var(--sp-6);
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: var(--sp-4) var(--sp-6);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: var(--sp-3);
    flex-shrink: 0;
    background: var(--bg-color);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* Delete Confirmation Modal */
.delete-modal-header {
    border-bottom-color: var(--border-color);
}

.delete-modal-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.delete-modal-icon-warning {
    color: #f59e0b;
}

.delete-modal-icon-danger {
    color: #ef4444;
}

.delete-modal-message {
    text-align: center;
    font-size: 1.05rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.delete-modal-submessage {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.delete-modal-refs {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.75rem 0.75rem 2rem;
    margin-bottom: 1rem;
    list-style: disc;
}

.delete-modal-refs li {
    padding: 0.25rem 0;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.delete-modal-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.delete-option-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
}

.delete-option-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.delete-option-btn strong {
    display: block;
    margin-bottom: 0.15rem;
}

.delete-option-btn small {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.delete-option-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.delete-option-cascade {
    border-color: #fecaca;
}

.delete-option-cascade:hover {
    background: #fef2f2;
    border-color: #ef4444;
}

.delete-option-cascade .delete-option-icon {
    background: #fef2f2;
    color: #ef4444;
}

.delete-option-nullify {
    border-color: #fed7aa;
}

.delete-option-nullify:hover {
    background: #fff7ed;
    border-color: #f59e0b;
}

.delete-option-nullify .delete-option-icon {
    background: #fff7ed;
    color: #f59e0b;
}

/* Referencing records preview in delete modal */
.delete-ref-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.delete-ref-section {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.delete-ref-header {
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
}

.delete-ref-table-wrapper {
    overflow-x: auto;
    max-height: 180px;
    overflow-y: auto;
}

.delete-ref-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.delete-ref-table th {
    padding: 0.4rem 0.6rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.delete-ref-table td {
    padding: 0.35rem 0.6rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.delete-ref-table tbody tr:last-child td {
    border-bottom: none;
}

.delete-ref-more {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
    margin: 0;
}

.delete-ref-noaccess {
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
    margin: 0;
}

/* Detail View */
.detail-section {
    margin-bottom: 2rem;
}

.detail-section h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--sp-3);
}

.detail-item {
    background: var(--bg-color);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius);
    border-left: 3px solid transparent;
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.detail-item:hover {
    border-left-color: var(--primary-color);
    background: var(--hover-bg);
}

.detail-item-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.4;
}

.detail-item-value {
    font-size: 0.875rem;
    color: var(--text-primary);
    word-break: break-word;
    line-height: 1.5;
}

.detail-item-value.fk-value {
    color: var(--primary-color);
    font-weight: 500;
}
.fk-link {
    cursor: pointer;
    transition: all var(--transition-fast, 0.15s);
    border-bottom: 1px dashed var(--primary-color);
    padding-bottom: 1px;
}
.fk-link:hover {
    color: var(--primary-dark);
    border-bottom-style: solid;
}

.detail-item-value em {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.8125rem;
}

/* Booleans stylés */
.detail-item-value .bool-true {
    color: var(--success-color);
    font-weight: 500;
}
.detail-item-value .bool-false {
    color: var(--text-muted);
}

/* Related tables */
.related-table-section {
    margin-top: var(--sp-6);
    padding-top: var(--sp-5);
    border-top: 1px solid var(--border-color);
}

.related-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--sp-3);
}

.related-table-header h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.related-count {
    background: var(--primary-color);
    color: white;
    padding: 2px var(--sp-3);
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.related-table-wrapper {
    overflow-x: auto;
    background: var(--bg-color);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.related-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.related-table th {
    text-align: left;
    padding: 0.75rem;
    background: var(--table-header-bg);
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.related-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.related-table tbody tr:hover {
    background: var(--hover-bg);
}

.related-table tbody tr:last-child td {
    border-bottom: none;
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover {
    background-color: var(--hover-bg);
}

/* Form */
.form-group {
    margin-bottom: var(--sp-5);
}

.form-group label {
    display: block;
    margin-bottom: var(--sp-1);
    font-weight: 500;
    font-size: 0.8125rem;
    color: var(--text-primary);
    letter-spacing: 0.01em;
}

/* Les <label> utilises comme boutons (ex. selecteur de fichier du champ FILE)
   ne doivent pas heriter du style des labels de formulaire (couleur sombre,
   display:block) qui rendait le texte illisible sur les boutons colores. */
.form-group label.btn {
    display: inline-flex;
    margin-bottom: 0;
}
.form-group label.btn-primary,
.form-group label.btn-secondary,
.form-group label.btn-danger {
    color: #fff;
}

.form-control {
    width: 100%;
    padding: var(--sp-2) var(--sp-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: inherit;
    background: var(--card-bg);
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    line-height: 1.5;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--focus-ring);
}
.form-control::placeholder {
    color: var(--text-muted);
}

.form-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    display: none;
    animation: slideIn 0.3s;
}

.toast.show {
    display: block;
}

.toast.success {
    background-color: var(--success-color);
    color: white;
}

.toast.error {
    background-color: var(--danger-color);
    color: white;
}

.toast.info {
    background-color: var(--primary-color);
    color: white;
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        max-height: 200px;
    }

    .content {
        padding: 1rem;
    }

    .table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .table-actions {
        width: 100%;
        flex-direction: column;
    }

    .table-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .table-controls > div {
        flex-wrap: wrap;
        justify-content: center;
    }

    .pagination-controls {
        width: 100%;
        justify-content: center;
    }

    .features {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   AFFICHAGE EN TUILES
   ======================================== */

.tiles-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.tile-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tile-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

.tile-title {
    font-size: 18px;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tile-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tile-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-height: 60px;
}

.tile-field {
    font-size: 13px;
    color: var(--text-primary);
    padding: 4px 0;
    border-bottom: 1px solid var(--border-color);
}

.tile-field:last-child {
    border-bottom: none;
}

.tile-field strong {
    color: var(--text-secondary);
    font-weight: 600;
    margin-right: 8px;
}

.tile-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.tile-actions .btn {
    flex: 1;
    font-size: 12px;
    padding: 6px 12px;
}

/* Responsive pour les tuiles */
@media (max-width: 768px) {
    .tiles-container {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 769px) and (max-width: 1200px) {
    .tiles-container {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

/* ========================================
   VUE PLANNING (CALENDRIER)
   ======================================== */

.planning-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.planning-nav {
    display: flex;
    gap: 0.25rem;
}

.planning-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
}

.planning-view-selector {
    display: flex;
    gap: 0.25rem;
}

.planning-grid {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.planning-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
}

.planning-header-cell {
    padding: 0.5rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-color);
}

.planning-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.planning-week-body {
    grid-template-columns: repeat(7, 1fr);
}

.planning-day-cell {
    min-height: 100px;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 0.25rem;
    position: relative;
    background: var(--card-bg);
}

.planning-day-cell:nth-child(7n) {
    border-right: none;
}

.planning-day-cell.planning-today {
    background: var(--planning-today-bg);
}

.planning-day-cell.planning-other-month {
    background: var(--planning-other-bg);
    opacity: 0.6;
}

.planning-day-number {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.planning-today .planning-day-number {
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.planning-event {
    background: var(--primary-color);
    color: white;
    font-size: 0.7rem;
    padding: 2px 4px;
    border-radius: 3px;
    margin-bottom: 2px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.planning-event:hover {
    opacity: 0.85;
}

.planning-more {
    font-size: 0.65rem;
    color: var(--text-muted);
    padding: 1px 4px;
}

/* Vue jour - liste d'événements */
.planning-day-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
}

.planning-event-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.planning-event-card:hover {
    box-shadow: var(--shadow);
}

.planning-event-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.planning-event-dates {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.planning-event-field {
    font-size: 0.8rem;
    color: var(--text-color);
    padding: 0.1rem 0;
}

.planning-field-label {
    color: var(--text-muted);
    font-weight: 500;
}

/* Vue année - grille 12 mois */
.planning-year-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    padding: 0.5rem;
}

.planning-year-month {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.planning-year-month:hover {
    box-shadow: var(--shadow);
}

.planning-year-month-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.planning-year-month-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.planning-year-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
}

.planning-year-day {
    font-size: 0.6rem;
    text-align: center;
    padding: 2px;
    color: var(--text-muted);
    border-radius: 2px;
}

.planning-year-day.empty {
    visibility: hidden;
}

.planning-year-day.has-event {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.planning-year-day.planning-today {
    outline: 2px solid var(--primary-color);
}

/* Responsive planning */
@media (max-width: 768px) {
    .planning-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .planning-day-cell {
        min-height: 60px;
    }

    .planning-year-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Responsive tables → cards layout sur mobile.
 * S'applique a la table de donnees principale (.data-table), aux pages super admin
 * (.admin-table) et aux logs (.audit-table table). Le contenu reste une <table>
 * pour l'accessibilite ; CSS uniquement, JS injecte data-label sur chaque <td>.
 * Les <td sans data-label restent affiches comme une ligne sans libelle. */
@media (max-width: 768px) {
    .data-table,
    .admin-table,
    .audit-table table {
        display: block;
        width: 100%;
        border-collapse: separate;
    }
    .data-table thead,
    .admin-table thead,
    .audit-table table thead {
        display: none;
    }
    .data-table tbody,
    .admin-table tbody,
    .audit-table table tbody {
        display: block;
    }
    .data-table tr,
    .admin-table tr,
    .audit-table table tr {
        display: block;
        background: var(--card-bg, var(--bg-secondary, #fff));
        border: 1px solid var(--border-color, #e5e7eb);
        border-radius: 8px;
        padding: 0.75rem 1rem;
        margin-bottom: 0.75rem;
        box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    }
    .data-table td,
    .admin-table td,
    .audit-table table td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 1rem;
        padding: 0.35rem 0;
        border: none;
        font-size: 0.9rem;
        word-break: break-word;
        text-align: left;
    }
    .data-table td + td,
    .admin-table td + td,
    .audit-table table td + td {
        border-top: 1px dashed var(--border-color, #e5e7eb);
        padding-top: 0.5rem;
        margin-top: 0.25rem;
    }
    .data-table td[data-label]::before,
    .admin-table td[data-label]::before,
    .audit-table table td[data-label]::before {
        content: attr(data-label);
        font-weight: 600;
        flex: 0 0 40%;
        color: var(--text-secondary, #6b7280);
        font-size: 0.78rem;
        text-transform: uppercase;
        letter-spacing: 0.02em;
        padding-top: 0.05rem;
    }
    /* Les cellules sans data-label (checkbox de selection, actions) prennent la largeur entiere */
    .data-table td:not([data-label]),
    .admin-table td:not([data-label]),
    .audit-table table td:not([data-label]) {
        justify-content: flex-end;
    }
    /* Cellules d'etat vide (colspan="100" pour "Aucune donnee") : pleine largeur, centrees */
    .data-table td[colspan],
    .admin-table td[colspan],
    .audit-table table td[colspan] {
        display: block;
        justify-content: center;
        text-align: center;
    }
    /* Boutons d'action plus accessibles au tap */
    .data-table td.action-buttons,
    .data-table td.actions,
    .admin-table td.action-buttons,
    .admin-table td.actions {
        flex-wrap: wrap;
        gap: 0.4rem;
        padding-top: 0.5rem;
    }
    .data-table td.action-buttons .btn,
    .data-table td.actions .btn,
    .admin-table td.action-buttons .btn,
    .admin-table td.actions .btn {
        min-height: 36px;
        min-width: 36px;
    }
    /* Tete de table et controles : packer plus serre */
    .table-wrapper,
    .admin-table-wrapper,
    .audit-table {
        overflow-x: visible;
    }
    /* Masquer la scrollbar du haut puisqu'il n'y a plus de scroll horizontal */
    .table-scrollbar-top {
        display: none !important;
    }
    /* La colonne des cases a cocher selectionnees passe en pleine ligne */
    .data-table td .row-select-check,
    .data-table th #selectAllCheckbox {
        transform: scale(1.2);
    }
}

/* Page Footer */
.app-footer {
    background-color: var(--footer-bg);
    color: var(--footer-text);
    padding: 1rem 2rem;
    text-align: center;
    font-size: 0.875rem;
}

.app-footer a {
    color: var(--footer-text);
    opacity: 0.8;
    text-decoration: none;
}

.app-footer a:hover {
    opacity: 1;
}

/* ===== Custom Pages - Sidebar ===== */
.custom-pages-separator .category-color-bar {
    background: #8b5cf6 !important;
}

.custom-page-item {
    cursor: pointer;
}

.custom-page-item .widget-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    background: #8b5cf6;
    color: white;
    border-radius: 2px;
    font-size: 0.65rem;
    font-weight: 600;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* ===== Timesheet Widget ===== */
.timesheet-toolbar {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.timesheet-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.timesheet-table thead th {
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 1rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.timesheet-table thead th.ts-date-col,
.timesheet-table thead th.ts-day-col {
    text-align: left;
}

.timesheet-table tbody td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.timesheet-table .ts-date-cell {
    font-weight: 600;
    white-space: nowrap;
    padding-left: 1rem;
    min-width: 100px;
}

.timesheet-table .ts-day-cell {
    color: var(--text-secondary);
    font-size: 0.875rem;
    min-width: 90px;
}

.timesheet-table .ts-quarter-cell {
    text-align: center;
}

.timesheet-table .ts-select {
    width: 100%;
    min-width: 120px;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
}

.timesheet-table .ts-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Timesheet row states */
.ts-row-today {
    background: rgba(99, 102, 241, 0.08) !important;
}

.ts-row-today .ts-date-cell {
    color: var(--primary-color);
}

.ts-row-weekend {
    background: rgba(0, 0, 0, 0.03);
}

.ts-row-weekend .ts-day-cell {
    color: var(--warning-color);
}

.ts-row-filled .ts-select {
    border-color: var(--success-color);
}

/* ============================================================
   IMPORT EXCEL
   ============================================================ */

/* Steps indicator */
.import-steps-indicator {
    display: flex;
    align-items: center;
    gap: 0;
}

.step-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--card-bg);
    transition: all 0.3s;
}

.step-dot.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.step-dot.done {
    border-color: var(--success-color);
    background: var(--success-color);
    color: white;
}

.step-line {
    width: 20px;
    height: 2px;
    background: var(--border-color);
}

/* Steps */
.import-step {
    display: none;
}

.import-step.active {
    display: block;
}

/* Dropzone */
.import-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--card-bg);
}

.import-dropzone:hover {
    border-color: var(--primary-color);
    background: rgba(var(--primary-rgb, 99, 102, 241), 0.03);
}

.import-dropzone.dragover {
    border-color: var(--primary-color);
    background: rgba(var(--primary-rgb, 99, 102, 241), 0.08);
    transform: scale(1.01);
}

.dropzone-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.dropzone-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.dropzone-hint {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.dropzone-formats {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-top: 0.5rem;
    opacity: 0.7;
}

/* File info */
.import-file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--success-color);
    border-radius: var(--radius);
    margin-top: 1rem;
}

.import-file-info .file-icon {
    font-size: 1.5rem;
}

.import-file-info .file-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.import-file-info .file-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.import-file-info .file-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.import-file-info .btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem 0.5rem;
    border-radius: 2px;
}

.import-file-info .btn-icon:hover {
    color: var(--danger-color);
    background: rgba(220, 38, 38, 0.1);
}

/* Mapping toolbar */
.import-mapping-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.import-mapping-tabs {
    display: flex;
    gap: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.import-tab {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.import-tab:hover {
    background: rgba(var(--primary-rgb, 99, 102, 241), 0.05);
}

.import-tab.active {
    background: var(--primary-color);
    color: white;
}

.import-mapping-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    gap: 0.25rem;
}

/* Mapping mode toggle */
.mapping-mode {
    display: none;
}

.mapping-mode.active {
    display: block;
}

/* Mapping dropdown table */
.mapping-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.mapping-table thead th {
    background: var(--card-bg);
    padding: 0.6rem 0.75rem;
    border-bottom: 2px solid var(--border-color);
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    position: sticky;
    top: 0;
    z-index: 1;
}

.mapping-table tbody td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.mapping-table tbody tr:hover {
    background: rgba(var(--primary-rgb, 99, 102, 241), 0.03);
}

.mapping-select {
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    background: var(--card-bg);
    color: var(--text-color);
    max-width: 250px;
    width: 100%;
}

.mapping-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.badge-pk {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--primary-color);
    background: rgba(var(--primary-rgb, 99, 102, 241), 0.1);
    padding: 0.1rem 0.3rem;
    border-radius: 2px;
    vertical-align: middle;
}

.badge-required {
    color: var(--danger-color);
    font-weight: 700;
}

.type-badge {
    display: inline-block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.05);
    padding: 0.15rem 0.4rem;
    border-radius: 2px;
    font-family: monospace;
}

.mapping-sample {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
    max-width: 200px;
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mapping-sample.empty {
    opacity: 0.4;
}

/* Visual mapper */
.visual-mapper {
    display: flex;
    height: 420px;
    gap: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--card-bg);
}

.mapper-panel {
    width: 220px;
    flex-shrink: 0;
    overflow-y: auto;
    padding: 0.75rem;
    background: var(--card-bg);
    border-color: var(--border-color);
}

.mapper-left {
    border-right: 1px solid var(--border-color);
}

.mapper-right {
    border-left: 1px solid var(--border-color);
}

.mapper-panel h4 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin: 0 0 0.5rem 0;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-color);
}

.mapper-canvas {
    flex: 1;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.03) 0%, transparent 70%),
        var(--card-bg);
}

.mapper-canvas::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, var(--border-color) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    opacity: 0.4;
}

#mapperSvg {
    position: absolute;
    inset: 0;
    z-index: 1;
}

/* Mapper items */
.mapper-item {
    position: relative;
    padding: 0.45rem 0.6rem;
    margin-bottom: 0.3rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    background: var(--card-bg);
    transition: all 0.2s;
    cursor: default;
}

.mapper-item.connected {
    border-color: var(--primary-color);
    background: rgba(var(--primary-rgb, 99, 102, 241), 0.05);
}

.mapper-item-name {
    font-weight: 600;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mapper-item-type {
    font-size: 0.65rem;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.05);
    padding: 0.1rem 0.35rem;
    border-radius: 2px;
    font-family: monospace;
    flex-shrink: 0;
}

/* Dots de connexion */
.mapper-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    position: absolute;
    cursor: crosshair;
    transition: all 0.2s;
    z-index: 2;
}

.mapper-left .mapper-dot {
    right: -7px;
    top: 50%;
    transform: translateY(-50%);
}

.mapper-right .mapper-dot {
    left: -7px;
    top: 50%;
    transform: translateY(-50%);
}

.mapper-dot:hover,
.mapper-dot.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-50%) scale(1.3);
}

.mapper-item.connected .mapper-dot {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

/* SVG connexion lines */
#mapperSvg .connection-line {
    stroke: var(--primary-color);
    stroke-width: 2;
    fill: none;
    cursor: pointer;
    transition: stroke 0.2s, stroke-width 0.2s;
}

#mapperSvg .connection-line:hover {
    stroke: var(--danger-color);
    stroke-width: 3;
}

#mapperSvg .connection-temp {
    stroke: var(--primary-color);
    stroke-width: 2;
    fill: none;
    stroke-dasharray: 6, 4;
    opacity: 0.6;
}

/* Preview */
.preview-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.preview-stat {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.preview-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.preview-stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.import-preview-table {
    max-height: 350px;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.import-preview-table table {
    width: 100%;
    font-size: 0.8rem;
    border-collapse: collapse;
}

.import-preview-table th {
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 0.6rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 1;
}

.import-preview-table th small {
    display: block;
    font-weight: 400;
}

.import-preview-table td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.import-preview-table tbody tr:hover {
    background: rgba(var(--primary-rgb, 99, 102, 241), 0.03);
}

/* Results */
.import-result-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    padding: 1.25rem;
    border-radius: var(--radius);
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.import-result-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
    padding: 1rem;
    border-radius: var(--radius);
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    margin-top: 0.75rem;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.import-result-errors {
    margin-top: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    max-height: 250px;
    overflow-y: auto;
}

.import-result-errors table {
    width: 100%;
    font-size: 0.8rem;
    border-collapse: collapse;
}

.import-result-errors th {
    background: var(--card-bg);
    padding: 0.5rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
}

.import-result-errors td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
}

/* ===== Import FK Referentiels ===== */

.fk-step-header {
    margin-bottom: 1.25rem;
}

.fk-step-header h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.fk-step-desc {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.fk-config-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1rem;
    background: var(--card-bg);
}

.fk-config-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: rgba(99, 102, 241, 0.06);
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
}

.fk-config-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    min-width: 0;
}

.fk-col-name {
    color: var(--primary-color);
    white-space: nowrap;
}

.fk-arrow {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.fk-ref-name {
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    background: rgba(99, 102, 241, 0.1);
    padding: 0.15rem 0.5rem;
    border-radius: 2px;
    white-space: nowrap;
}

.fk-config-stats {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.fk-stat {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius);
    white-space: nowrap;
}

.fk-stat.existing {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}

.fk-stat.new {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
}

.fk-config-body {
    padding: 1rem;
}

.fk-mode-options {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.fk-mode-option {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    background: transparent;
}

.fk-mode-option:hover {
    border-color: rgba(99, 102, 241, 0.3);
}

.fk-mode-option.selected {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.04);
}

.fk-mode-option input[type="radio"] {
    margin-top: 0.15rem;
    accent-color: var(--primary-color);
    flex-shrink: 0;
}

.fk-mode-content {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.fk-mode-content strong {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.fk-mode-content span {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.fk-new-values {
    margin-top: 0.5rem;
}

.fk-new-values-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    font-weight: 500;
}

.fk-new-values-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.fk-new-value-tag {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 2px;
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.2);
    white-space: nowrap;
}

.fk-new-value-more {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Badges FK dans le tableau d'apercu */
.fk-badge-header {
    font-size: 0.65rem;
    padding: 0.1rem 0.35rem;
    border-radius: 2px;
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary-color);
    font-weight: 700;
    vertical-align: middle;
}

.fk-badge-existing {
    font-size: 0.65rem;
    padding: 0.1rem 0.35rem;
    border-radius: 2px;
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    font-weight: 600;
    margin-left: 0.35rem;
    white-space: nowrap;
}

.fk-badge-new {
    font-size: 0.65rem;
    padding: 0.1rem 0.35rem;
    border-radius: 2px;
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
    font-weight: 600;
    margin-left: 0.35rem;
    white-space: nowrap;
}

/* Bandeau info FK dans les resultats */
.import-result-info {
    background: rgba(99, 102, 241, 0.08);
    color: var(--primary-color);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    border: 1px solid rgba(99, 102, 241, 0.15);
}

/* ========================================
   ECRANS LARGES - reduire les marges
   ======================================== */
@media (min-width: 1600px) {
    .content {
        padding: 1.5rem 1rem;
    }
}

@media (min-width: 2000px) {
    .content {
        padding: 1.5rem 0.75rem;
    }
}

/* ========================================
   DESIGN SYSTEM — Status indicators
   ======================================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    padding: 2px var(--sp-2);
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.6;
}
.status-badge--success { background: rgba(5,150,105,0.1); color: #059669; }
.status-badge--warning { background: rgba(217,119,6,0.1); color: #d97706; }
.status-badge--danger { background: rgba(220,38,38,0.1); color: #dc2626; }
.status-badge--info { background: rgba(2,132,199,0.1); color: #0284c7; }
.status-badge--neutral { background: rgba(107,114,128,0.1); color: #6b7280; }

/* Micro-interactions */
.clickable { cursor: pointer; transition: all var(--transition-fast); }
.clickable:hover { transform: translateY(-1px); }
.clickable:active { transform: translateY(0); }

/* Card component */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--sp-5);
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-4);
    padding-bottom: var(--sp-3);
    border-bottom: 1px solid var(--border-color);
}
.card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Focus visible for accessibility */
:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

/* Selection */
::selection {
    background: rgba(30,64,175,0.15);
    color: var(--text-primary);
}


/* Spinners (utilises par geocode batch entre autres) */
.loading-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border-color, #e2e8f0);
    border-top-color: var(--primary-color, #1e40af);
    border-radius: 50%;
    animation: bec-spin 0.9s linear infinite;
    flex-shrink: 0;
}
.loading-spinner-inline {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-color, #e2e8f0);
    border-top-color: var(--primary-color, #1e40af);
    border-radius: 50%;
    animation: bec-spin 0.9s linear infinite;
    vertical-align: middle;
}
@keyframes bec-spin {
    to { transform: rotate(360deg); }
}
