/* Reset et variables */
:root {
    --primary-color: rgb(233,101,49);
    --primary-color-rgb: 233, 101, 49;
    --secondary-color: #1F52A5;
    --secondary-light: #56def0;
    --crm-color: #1F52A5;
    --crm-color-rgb: 31, 82, 165;
    --context-color: var(--crm-color);
    --context-color-rgb: var(--crm-color-rgb);
    
    --bg-color: #F9FBFC;
    --text-color: #2C3E50;
    --text-light: #7F8C9F;
    --border-color: #E4E7EB;
    --white: #FFFFFF;
    --success: #4CAF50;
    --warning: #FFC107;
    --danger: #FF5722;
    --sidebar-width: 230px;
    --sidebar-collapsed-width: 70px;
    --header-height: 70px;
    --border-radius: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
.orange{
    color: var(--context-color);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 14px;
    line-height: 1.5;
}

/* Header */
.header {
    background: var(--bg-color);
    height: var(--header-height);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 18px;
    font-weight: 400;
    color: var(--text-color);
    gap: 0.5rem;
}

.logo span.logo-text {
    font-weight: 900;
    color: var(--text-color);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    border-radius: var(--border-radius);
    color: var(--text-color);
    transition: background 0.2s;
    position: relative;
}

.picto-icon{
    width: 20px;
    height: 20px;
}

.icon-btn:hover {
    background: var(--bg-color);
}

.icon-btn .badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

.user-info {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius);
    background: var(--secondary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Company Switcher */
.company-switcher {
    position: relative;
}

.company-switcher-btn {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-color);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.company-switcher-btn:hover {
    background: var(--bg-color);
    border-color: var(--context-color);
}

.company-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 250px;
    max-width: 350px;
    display: none;
    z-index: 1000;
    overflow: hidden;
    max-height: 80vh;
  overflow-y: auto;
}

.company-dropdown.open {
    display: block;
}

.company-dropdown-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.company-dropdown-item:last-child {
    border-bottom: none;
}

.company-dropdown-item:hover {
    background: var(--bg-color);
}

.company-dropdown-item.active {
    background: rgba(var(--context-color-rgb), 0.05);
    color: var(--context-color);
    font-weight: 500;
}

.company-dropdown-item svg {
    color: var(--context-color);
}

/* Context Switcher (CRM / Plateforme) */
.context-switcher {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--white);
    padding: 4px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    margin-left: 24px;
}

.context-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.context-btn:hover {
    color: var(--text-color);
    background: var(--bg-color);
}

.context-btn.active {
    background: var(--context-color);
    color: white;
    box-shadow: 0 2px 4px rgba(var(--context-color-rgb), 0.3);
}

.context-btn.active svg {
    stroke: white;
}

.context-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Plateforme context specific styles */
body.context-plateforme {
    --context-color: var(--primary-color);
    --context-color-rgb: var(--primary-color-rgb);
}

body.context-plateforme .context-btn.active[data-context="plateforme"] {
    background: var(--context-color);
    box-shadow: 0 2px 4px rgba(var(--context-color-rgb), 0.3);
}

body.context-plateforme #context-label {
    color: var(--context-color);
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: var(--header-height);
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-color);
    transition: width 0.3s ease;
    overflow-x: hidden;
    z-index: 90;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-top {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 0;
}

.sidebar-toggle {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 10;
}

.sidebar-context-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--context-color, var(--orange));
    white-space: nowrap;
    transition: opacity 0.3s;
}

.sidebar.collapsed .sidebar-top {
    justify-content: center;
    padding: 20px 0 0;
}

.sidebar.collapsed .sidebar-context-label {
    display: none;
}

.nav-menu {
    margin-top: 16px;
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
    gap: 12px;
}

.nav-item:hover {
    background: var(--bg-color);
}

.nav-item.active {
    background: var(--context-color);
    color: white;
}
.nav-item.active img{
    filter: brightness(0) invert(1);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar.collapsed .nav-item span {
    opacity: 0;
}

.menu-badge {
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    margin-left: auto;
    line-height: 1.3;
}

.sidebar.collapsed .menu-badge {
    display: none;
}

/* Nav Submenu */
.nav-submenu-group {
    position: relative;
}

.nav-submenu-toggle {
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
    position: relative;
}

.nav-submenu-arrow {
    margin-left: auto;
    flex-shrink: 0;
    transition: transform 0.2s ease;
    opacity: 0.5;
}

.nav-submenu-group.open > .nav-submenu-toggle .nav-submenu-arrow {
    transform: rotate(180deg);
}

.nav-submenu-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}

.nav-submenu-group.open > .nav-submenu-items {
    max-height: 600px;
}

.nav-subitem {
    padding-left: 48px !important;
    font-size: 13px;
    padding-top: 9px !important;
    padding-bottom: 9px !important;
}

.nav-subitem::before {
    content: '';
    position: absolute;
    left: 30px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-muted);
}

.nav-subitem.active::before {
    background: white;
}

.sidebar.collapsed .nav-submenu-arrow {
    display: none;
}

.sidebar.collapsed .nav-submenu-items {
    display: none;
}

/* Nav Separator - for superadmin menu */
.nav-separator {
    display: flex;
    align-items: center;
    padding: 16px 24px 8px;
    margin-top: 12px;
    border-top: 1px solid var(--border-color);
}

.nav-separator span {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
}

.sidebar.collapsed .nav-separator {
    padding: 16px 12px 8px;
}

.sidebar.collapsed .nav-separator span {
    display: none;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 30px;
    transition: margin-left 0.3s ease;
    min-height: calc(100vh - var(--header-height));
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* KPI Cards */
.kpi-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

/* Mobile-only header elements: hidden by default, shown in mobile media query below */
.mobile-header-back,
.mobile-header-title {
    display: none;
}

/* Mobile FAB (floating action button) — hidden on desktop, shown on mobile */
.mobile-fab {
    display: none;
}

/* Impersonation banner (superadmin) */
.impersonate-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10001;
    background: #E96531;
    color: #fff;
    padding: 10px 20px;
    font-size: 13px;
    font-family: sans-serif;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.impersonate-banner-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.impersonate-banner-btn {
    flex-shrink: 0;
    background: #fff;
    color: #E96531;
    border: none;
    padding: 6px 16px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.impersonate-banner-btn-short {
    display: none;
}

.kpi-header .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.kpi-container {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    overflow-x: auto;
}

.kpi-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 24px;
    flex: 1;
    min-width: 200px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.kpi-value {
    font-size: 30px;
    font-weight: 700;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.kpi-evolution {
    font-size: 13px;
    color: var(--success);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.kpi-evolution.negative {
    color: var(--danger);
}

.kpi-label {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Content Card */
.content-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Societe edit field layout */
.se-field-group { display: flex; flex-direction: column; gap: 12px; }
.se-field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-light); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.3px; }
.se-field input, .se-field textarea, .se-field select { width: 100%; padding: 8px 12px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 14px; transition: border-color 0.2s, box-shadow 0.2s; background: white; }
.se-field input:focus, .se-field textarea:focus, .se-field select:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.se-field-row { display: flex; gap: 12px; }
@media (max-width: 768px) { .se-field-row { flex-direction: column; } }
details[open] > summary svg { transform: rotate(90deg); }

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.content-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    max-width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    padding: 12px 20px;
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-size: 14px;
    white-space: nowrap;
    flex-shrink: 0;
}

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

.tab.active {
    color: var(--context-color);
    border-bottom-color: var(--context-color);
    font-weight: 500;
}

/* Search and Actions Bar */
.actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0 12px;
    flex: 1;
    max-width: 400px;
}

.search-box input {
    border: none;
    background: none;
    padding: 10px;
    width: 100%;
    outline: none;
    font-size: 14px;
}
.actions-cell{ display: flex; gap: 5px;}
/* Filters Bar */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-color);
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filters-bar .search-box {
    min-width: 250px;
    flex: 1;
}

.filter-select {
    padding: 10px 36px 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--white);
    font-size: 14px;
    color: var(--text-color);
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%237F8C9F' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    min-width: 180px;
    transition: all 0.2s;
}

.filter-select:hover {
    border-color: var(--context-color);
}

.filter-select:focus {
    border-color: var(--context-color);
    box-shadow: 0 0 0 3px rgba(var(--context-color-rgb), 0.1);
}

.filter-select option {
    padding: 8px;
}

/* Filter tags/badges for active filters */
.active-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(var(--context-color-rgb), 0.1);
    color: var(--context-color);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.filter-tag .remove-filter {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.filter-tag .remove-filter:hover {
    opacity: 1;
}

.clear-filters-btn {
    padding: 6px 12px;
    font-size: 12px;
    color: var(--text-light);
    background: none;
    border: 1px dashed var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-filters-btn:hover {
    color: var(--danger);
    border-color: var(--danger);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: rgb(213, 90, 42);
}

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-color);
}

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

.btn-outline {
    background: transparent;
    color: var(--text-light);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    background: var(--bg-color);
    color: var(--text-color);
}

.btn-success {
    background: #059669;
    color: white;
}

.btn-success:hover {
    background: #047857;
}

.btn-success:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* Readonly banner */
.readonly-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    color: #92400e;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 16px;
    font-size: 14px;
}

.readonly-banner svg {
    flex-shrink: 0;
}

/* Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

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

.data-table th {
    padding: 12px;
    text-align: left;
    font-weight: 500;
    color: var(--text-light);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 16px 12px;
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr {
    transition: background 0.2s;
}

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

.data-table tbody tr.selected {
    background: #FFF4F3;
}

/* Colonnes triables */
.data-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 28px;
}

.data-table th.sortable:hover {
    background: rgba(0, 0, 0, 0.04);
}

/* Conteneur des icônes de tri */
.data-table th.sortable .sort-icons {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
}

/* Toutes les icônes de tri masquées par défaut */
.data-table th.sortable .sort-icon {
    transition: opacity 0.2s;
}

/* Icône neutre (double flèche) visible par défaut */
.data-table th.sortable .sort-icon-neutral {
    display: block;
    opacity: 0.3;
}
.data-table th.sortable:hover .sort-icon-neutral {
    opacity: 0.5;
}
.data-table th.sortable .sort-icon-asc,
.data-table th.sortable .sort-icon-desc {
    display: none;
}

/* État trié ASC : chevron haut visible */
.data-table th.sortable.sort-asc {
    background: rgba(0, 0, 0, 0.03);
}
.data-table th.sortable.sort-asc .sort-icon-neutral {
    display: none;
}
.data-table th.sortable.sort-asc .sort-icon-asc {
    display: block;
    opacity: 1;
    color: var(--context-color);
}

/* État trié DESC : chevron bas visible */
.data-table th.sortable.sort-desc {
    background: rgba(0, 0, 0, 0.03);
}
.data-table th.sortable.sort-desc .sort-icon-neutral {
    display: none;
}
.data-table th.sortable.sort-desc .sort-icon-desc {
    display: block;
    opacity: 1;
    color: var(--context-color);
}

/* Column Visibility Dropdown */
.column-visibility-wrapper {
    position: relative;
    display: inline-flex;
    margin-left: auto;
}

.column-visibility-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 13px;
    white-space: nowrap;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    color: var(--text-color);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.column-visibility-btn:hover {
    border-color: var(--context-color);
    box-shadow: 0 0 0 2px rgba(var(--context-color-rgb), 0.1);
}

.column-visibility-btn svg {
    width: 16px;
    height: 16px;
    color: var(--text-light);
}

.column-visibility-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 100;
    min-width: 220px;
    max-height: 320px;
    overflow-y: auto;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    margin-top: 4px;
    padding: 8px 0;
}

.column-visibility-dropdown.open {
    display: block;
}

.column-visibility-header {
    padding: 8px 14px;
    font-weight: 600;
    font-size: 11px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
}

.column-visibility-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-color);
    transition: background 0.15s;
}

.column-visibility-item:hover {
    background: var(--bg-color);
}

.column-visibility-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--context-color);
}

/* Tags */
.tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--border-radius);
    font-size: 12px;
    font-weight: 500;
    margin: 2px;
}

.tag-cyan {
    background: #E0F7FA;
    color: #00838F;
}

.tag-orange {
    background: #FFE0B2;
    color: #E65100;
}

.tag-green {
    background: #E8F5E9;
    color: #2E7D32;
}

.tag-yellow {
    background: #FFF9C4;
    color: #F57F17;
}

.tag-pink {
    background: #FCE4EC;
    color: #C2185B;
}

/* Status Badge */
.status-badge {
    padding: 6px 12px;
    border-radius: var(--border-radius);
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}

.status-contact {
    background: #EF6C00;
    color: #E1F5FE;
}

.status-prospect {
    background: #37474F;
    color: #ECEFF1;
}

.status-client {
    background: #2E7D32;
    color: #E8F5E9;
}
.status-client_facture {
    background: #2E7D32;
    color: #FFF3E0;
}
.status-perdu{
    background: #df1b1b;
    color: #FFEBEE;
}

/* Action Icons */
.action-icons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.action-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.action-icon:hover {
    background: var(--bg-color);
    border-color: var(--text-light);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.pagination-info {
    color: var(--text-light);
    font-size: 13px;
}

.pagination-buttons {
    display: flex;
    gap: 8px;
}

.pagination-buttons button {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.pagination-buttons button:hover:not(:disabled) {
    background: var(--bg-color);
}

.pagination-buttons button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-page {
    min-width: 32px;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-color);
    transition: all 0.2s;
}

.pagination-page:hover:not(.active) {
    background: var(--bg-color);
}

.pagination-page.active {
    background: var(--primary-color, #1f2937);
    color: white;
    border-color: var(--primary-color, #1f2937);
    font-weight: 600;
    cursor: default;
}

.pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    padding: 0 6px;
    color: var(--text-light);
    font-size: 13px;
    user-select: none;
}

/* Side Panel */
.side-panel {
    position: fixed;
    top: var(--header-height);
    right: 0;
    bottom: 0;
    width: 400px;
    background: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 95;
    overflow-y: auto;
}

.side-panel.open {
    transform: translateX(0);
}

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

.side-panel-title {
    font-size: 18px;
    font-weight: 600;
}

.side-panel-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius);
    color: var(--text-color);
}

.side-panel-close:hover {
    background: var(--bg-color);
}

.side-panel-content {
    padding: 24px;
}

.info-group {
    margin-bottom: 24px;
}

.info-label {
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.info-value {
    font-size: 14px;
    color: var(--text-color);
    font-weight: 500;
}

.panel-actions {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* Progress Bar */
.progress-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--success);
    transition: width 0.3s;
}

.progress-fill.warning {
    background: var(--warning);
}

.progress-fill.danger {
    background: var(--danger);
}

/* Tabs */
.tabs-container {
    padding: 0 20px;
    margin-bottom: 0;
}

.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0;
    max-width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tab,
.tab-btn {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-light);
    transition: all 0.2s;
    border-radius: 8px 8px 0 0;
    white-space: nowrap;
    flex-shrink: 0;
}

.tab:hover,
.tab-btn:hover {
    color: var(--text-color);
    background: var(--bg-color);
}

.tab.active,
.tab-btn.active {
    color: var(--context-color);
    border-bottom-color: var(--context-color);
    background: rgba(var(--context-color-rgb), 0.05);
}

.tab-content {
    display: none;
    padding-top: 20px;
}

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

/* Tabs responsive */
@media (max-width: 768px) {
    .tabs-container {
        padding: 0 12px;
    }

    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .tabs::-webkit-scrollbar {
        display: none;
    }

    .tab,
    .tab-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* Company Cards */
.company-card {
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: white;
    transition: all 0.2s;
}

.company-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.company-card.active {
    border-color: var(--context-color);
    background: rgba(255, 107, 90, 0.03);
}

/* Form Groups */
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 8px;
}

.form-group input:not([type="checkbox"]),
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    min-width: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--context-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 90, 0.1);
}

.form-group input:disabled,
.form-group input:read-only:not([type="radio"]):not([type="checkbox"]) {
    background: #f5f5f5;
    cursor: not-allowed;
}

/* Checkbox multiselect dropdown */
.checkbox-multiselect {
    position: relative;
}

.checkbox-multiselect-trigger {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 42px;
    transition: all 0.2s;
}

.checkbox-multiselect-trigger:hover {
    border-color: #999;
}

.checkbox-multiselect.open .checkbox-multiselect-trigger {
    border-color: var(--context-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 90, 0.1);
}

.checkbox-multiselect-trigger .trigger-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.checkbox-multiselect-trigger .trigger-text.placeholder {
    color: #999;
}

.checkbox-multiselect-trigger .trigger-arrow {
    flex-shrink: 0;
    font-size: 10px;
    color: #666;
    transition: transform 0.2s;
}

.checkbox-multiselect.open .trigger-arrow {
    transform: rotate(180deg);
}

.checkbox-multiselect-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-top: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    max-height: 240px;
    overflow-y: auto;
}

.checkbox-multiselect.open .checkbox-multiselect-dropdown {
    display: block;
}

.checkbox-multiselect-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s;
    user-select: none;
}

.checkbox-multiselect-option:hover {
    background: #f5f5f5;
}

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

.checkbox-multiselect-option label {
    cursor: pointer;
    flex: 1;
    font-size: 14px;
    font-weight: 400;
    margin: 0;
}

.checkbox-multiselect-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex: 1;
    overflow: hidden;
}

.checkbox-multiselect-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--context-color);
    color: #fff;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    white-space: nowrap;
}

.checkbox-multiselect-tag .tag-remove {
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    opacity: 0.8;
}

.checkbox-multiselect-tag .tag-remove:hover {
    opacity: 1;
}

.form-static-value {
    padding: 10px 12px;
    background: #f5f5f5;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    color: var(--text-color);
}

.tag-checkbox-item input[type="checkbox"] {
    display: none;
}
.tag-checkbox-item label {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 13px;
    font-weight: 500;
    color: var(--context-color);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}
.tag-checkbox-item input[type="checkbox"]:checked + label{
    background-color: var(--context-color);
    color: var(--border-color);
}


.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--border-radius);
    font-size: 12px;
    font-weight: 500;
}

.status-success {
    background: #E8F5E9;
    color: #2E7D32;
}

.status-inactive {
    background: #FFEBEE;
    color: #C62828;
}

.status-warning {
    background: #FFF3E0;
    color: #E65100;
}

.status-info {
    background: #E3F2FD;
    color: #1565C0;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: var(--border-radius);
    font-size: 11px;
    font-weight: 500;
    background: var(--border-color);
    color: var(--text-color);
}

/* User Card */
.user-card {
    margin-bottom: 10px;
}

/* Button Variants */
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

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

.btn.btn-secondary:hover {
    background: #d0d3d9;
}

/* Company Selector (in header) */
.company-selector-wrapper {
    display: flex;
    align-items: center;
    margin-left: 30px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: var(--border-radius);
    gap: 8px;
}

.company-selector {
    border: none;
    background: transparent;
    color: var(--text-color);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    outline: none;
    min-width: 200px;
}

.company-selector option {
    background: white;
    color: var(--text-color);
}

/* Content Header */
.content-header {
    margin-bottom: 24px;
}

.content-header h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
}

.content-header p {
    color: var(--text-light);
}

/* Notifications */
.notification {
    position: fixed;
    top: 90px;
    right: 30px;
    padding: 16px 20px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.success {
    border-left: 4px solid var(--success);
}

.notification.error {
    border-left: 4px solid var(--danger);
}

.notification.warning {
    border-left: 4px solid var(--warning);
}

/* Responsive */
@media (max-width: 768px) {
    .company-selector-wrapper {
        display: none;
    }
}




/****** LOGIN PAGE SPECIFIC ******/
.login-container {
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            background: var(--primary-color);
        }

        .login-box {
            background: white;
            padding: 48px;
            border-radius: var(--border-radius);
            box-shadow: 0 10px 40px rgba(0,0,0,0.2);
            width: 100%;
            max-width: 420px;
        }

        .login-logo {
            text-align: center;
            margin-bottom: 32px;
        }

        .login-logo h1 {
            font-size: 28px;
            color: var(--text-color);
            margin-bottom: 8px;
        }

        .login-logo p {
            color: var(--text-light);
            font-size: 14px;
        }

        .form-label {
            display: block;
            margin-bottom: 8px;
            font-weight: 500;
            color: var(--text-color);
        }

        .form-input {
            width: 100%;
            padding: 12px 16px;
            border: 1px solid var(--border-color);
            border-radius: var(--border-radius);
            font-size: 14px;
            transition: all 0.2s;
        }

        .form-input:focus {
            outline: none;
            border-color: var(--context-color);
            box-shadow: 0 0 0 3px rgba(255, 107, 90, 0.1);
        }

        .login-btn {
            width: 100%;
            padding: 14px;
            background: var(--primary-color);
            color: white;
            border: none;
            border-radius: var(--border-radius);
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
        }

        .login-btn:hover {
            background:  var(--context-color);
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(255, 107, 90, 0.3);
        }

        .login-btn:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }

        .error-message {
            background: #FFF5F5;
            color: #C53030;
            padding: 12px 16px;
            border-radius: var(--border-radius);
            margin-bottom: 24px;
            font-size: 14px;
            display: none;
        }

        .error-message.show {
            display: block;
        }

        .demo-info {
            margin-top: 24px;
            padding: 16px;
            background: var(--bg-color);
            border-radius: var(--border-radius);
            font-size: 13px;
            color: var(--text-light);
        }

        .demo-info strong {
            color: var(--text-color);
        }

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.modal-body{
    background: white;
}
.modal-content {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    margin: auto;
    position: relative;
}

.modal-header {
    background: white;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color);
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    transition: all 0.2s;
}

.close-btn:hover {
    background: var(--bg-color);
    color: var(--text-color);
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: var(--bg-color);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* Form Tabs */
.form-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 24px;
}

.form-tab-btn {
    padding: 10px 16px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    transition: all 0.2s;
}

.form-tab-btn:hover {
    color: var(--text-color);
    background: rgba(0, 0, 0, 0.02);
}

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

.form-tab-content {
    display: none;
}

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

/* Form Row */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.required {
    color: var(--danger);
}

.field-warning {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    font-size: 12px;
    color: #e67e22;
}

.field-warning svg {
    color: #e67e22;
    flex-shrink: 0;
}

/* Product lines grid for commande form */
.ligne-item {
    border: 1px solid var(--border-color);
    padding: 16px;
    margin-bottom: 12px;
    border-radius: var(--border-radius);
    background: var(--bg-color);
}

.ligne-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 12px;
    align-items: end;
}

.ligne-grid .form-group {
    margin-bottom: 0;
}

.ligne-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    padding-bottom: 4px;
}

.ligne-action .btn-icon {
    padding: 4px;
    min-width: 28px;
    min-height: 28px;
}

.btn-icon {
    padding: 8px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.btn-danger:hover {
    background: #e64a19;
}

.input-readonly {
    background: #f5f5f5 !important;
    cursor: not-allowed;
}

/* Address autocomplete dropdown */
.address-autocomplete-container {
    position: relative;
}

.address-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: none;
}

.address-dropdown.show {
    display: block;
}

.address-dropdown .dropdown-item {
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    line-height: 1.4;
}

.address-dropdown .dropdown-item:last-child {
    border-bottom: none;
}

.address-dropdown .dropdown-item:hover,
.address-dropdown .dropdown-item.active {
    background: var(--bg-color);
}

.address-dropdown .dropdown-item .address-main {
    font-weight: 500;
    color: var(--text-color);
}

.address-dropdown .dropdown-item .address-context {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}

.address-dropdown .dropdown-item.no-result {
    color: var(--text-light);
    cursor: default;
    font-style: italic;
}

.address-dropdown .dropdown-item.no-result:hover {
    background: transparent;
}

/* Product & client search dropdown */
.produit-search-container,
.teinte-search-container,
.client-search-container {
    position: relative;
}

.produit-dropdown,
.teinte-dropdown,
.client-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.produit-dropdown.show,
.teinte-dropdown.show,
.client-dropdown.show {
    display: block;
}

.produit-dropdown .dropdown-item,
.teinte-dropdown .dropdown-item,
.client-dropdown .dropdown-item {
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border-color);
}

.produit-dropdown .dropdown-item:last-child,
.teinte-dropdown .dropdown-item:last-child,
.client-dropdown .dropdown-item:last-child {
    border-bottom: none;
}

.produit-dropdown .dropdown-item:hover,
.teinte-dropdown .dropdown-item:hover,
.client-dropdown .dropdown-item:hover {
    background: var(--bg-color);
}

.produit-dropdown .dropdown-item.no-result,
.teinte-dropdown .dropdown-item.no-result,
.client-dropdown .dropdown-item.no-result {
    color: var(--text-light);
    cursor: default;
    font-style: italic;
}

.produit-dropdown .dropdown-item.no-result:hover,
.teinte-dropdown .dropdown-item.no-result:hover,
.client-dropdown .dropdown-item.no-result:hover {
    background: transparent;
}

/* Zone repeater rows */
.zone-row {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    align-items: flex-start;
}

.zone-row-fields {
    flex: 1;
    min-width: 0;
}

.zone-row-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding-top: 24px;
    min-width: 90px;
}

.zone-row .form-group {
    margin-bottom: 0;
}

.zone-row .form-group label {
    font-size: 12px;
    margin-bottom: 4px;
}

.zone-row input,
.zone-row select {
    padding: 8px 10px;
    font-size: 13px;
}

/* Nuancier custom fields */
.ligne-nuancier-custom {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-color);
}

.ligne-nuancier-custom .form-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

/* Poids commande info */
.poids-commande-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding: 12px 16px;
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    color: var(--text-color);
}

.poids-commande-info .poids-icon {
    font-size: 18px;
}

.poids-commande-info .poids-franco {
    color: var(--text-light);
    font-size: 13px;
}

.poids-commande-info.franco-atteint {
    background: #e8f5e9;
    border-color: var(--success);
}

.poids-commande-info.franco-atteint .poids-franco {
    color: var(--success);
    font-weight: 500;
}

/* Commande total info */
.commande-total-info {
    display: flex;
    align-items: center;
    margin-top: 16px;
    padding: 16px 20px;
    background: var(--bg-secondary, #f8f9fa);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

/* Delivery options */
.delivery-options {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.radio-option {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: all 0.2s;
}

.radio-option:hover {
    border-color: var(--primary);
    background: rgba(0, 119, 182, 0.05);
}

.radio-option input[type="radio"] {
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
}

.radio-option input[type="radio"]:checked + .radio-label {
    color: var(--primary);
    font-weight: 500;
}

.radio-option:has(input:checked) {
    border-color: var(--primary);
    background: rgba(0, 119, 182, 0.08);
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Delivery address display */
.delivery-address-display {
    margin-top: 12px;
    padding: 16px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.delivery-address-display .address-preview strong {
    display: block;
    color: var(--text-color);
    margin-bottom: 4px;
}

.delivery-address-display .address-preview p {
    margin: 0;
    color: var(--text-light);
    font-size: 14px;
}

/* Product grid layout - poubelle à gauche */
.ligne-grid-produit {
    grid-template-columns: 40px 2fr 100px !important;
    align-items: end;
}

.ligne-grid-produit .ligne-action {
    justify-content: center;
    padding-bottom: 4px;
}

.form-group-produit {
    min-width: 150px;
}

.ligne-nuancier-teinte-row {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    padding-left: 52px;
}

.ligne-nuancier-teinte-row .form-group {
    margin-bottom: 0;
}

.ligne-nuancier-teinte-row .ligne-nuancier-group {
    flex: 0 0 200px;
}

.ligne-nuancier-teinte-row .ligne-teinte-container {
    flex: 1;
}

@media (max-width: 1024px) {
    .ligne-grid-produit {
        grid-template-columns: 40px 1fr 80px;
    }

    .ligne-nuancier-teinte-row {
        padding-left: 52px;
    }
}

@media (max-width: 768px) {
    .ligne-nuancier-teinte-row {
        flex-direction: column;
        padding-left: 0;
    }

    .ligne-nuancier-teinte-row .ligne-nuancier-group {
        flex: 1;
    }
}

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

    .ligne-grid .form-group:first-child {
        grid-column: 1 / -1;
    }

    .ligne-action {
        grid-column: 2;
        justify-content: flex-end;
    }

    .ligne-grid-produit {
        grid-template-columns: 40px 1fr 1fr;
    }

    .ligne-grid-produit .ligne-action {
        grid-row: 1 / 3;
    }

    .form-group-produit {
        grid-column: 2 / -1;
    }

    .ligne-nuancier-group,
    .ligne-teinte-container {
        min-width: auto;
    }

    .ligne-nuancier-custom .form-row {
        grid-template-columns: 1fr 1fr;
    }
}

/* Checkbox Label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* Modal Responsive */
@media (max-width: 768px) {
    .modal-content {
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }
}

/* Form Tabs Navigation (for side panel) */
.form-tabs-navigation {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
    padding: 0 24px;
    overflow-x: auto;
}

.form-tab-nav {
    padding: 14px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    transition: all 0.2s;
    white-space: nowrap;
    position: relative;
    margin-bottom: -1px;
}

.form-tab-nav:hover {
    color: var(--text-color);
    background: rgba(0, 0, 0, 0.02);
}

.form-tab-nav.active {
    color: var(--context-color);
    border-bottom-color: var(--context-color);
    background: white;
}

/* Status Selector (radio buttons styled as badges) */
.status-selector {
    display: flex;
    flex-wrap: wrap;
}

.status-selector input[type="radio"] {
    display: none;
}

.status-option {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    
    font-size: 13px;
    font-weight: 500;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s;
    background: white;
    user-select: none;
}

.status-option:nth-child(2){
    border-radius: var(--border-radius) 0 0 var(--border-radius);
}

.status-option:last-child {
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.status-option:hover {
    border-color: var(--context-color);
    background: rgba(var(--context-color-rgb), 0.05);
}

.status-selector input[type="radio"]:checked + .status-option {
    border-color: var(--context-color);
    background: var(--context-color);
    color: white;
}

/* Tags Checkboxes */
.tags-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 250px;
    overflow-y: auto;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-color);
}

.tag-checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tag-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--context-color);
}

.tag-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-color);
    flex: 1;
    user-select: none;
}

.tag-checkbox-label:hover {
    color: var(--context-color);
}

.tag-color {
    width: 15px;
    height: 15px;
    border-radius: var(--border-radius);
    display: inline-block;
    margin-right: 0.5rem;
      border: 1px solid white;
}

/* Side Panel Form Specific Styles */
#client-form-panel .side-panel-content {
    padding-top: 0;
}

#client-form-panel .form-tab-content {
    padding: 24px;
}

/* Responsive for form tabs navigation */
@media (max-width: 768px) {
    .form-tabs-navigation {
        padding: 0 16px;
    }

    .form-tab-nav {
        padding: 12px 16px;
        font-size: 12px;
    }

    .status-selector {
        gap: 6px;
    }

    .status-option {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* Form Page (Full Page Form) */
.form-page-container {
    margin: 0 auto;
}

.form-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    padding-top: 24px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-light);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 12px;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--context-color);
}

.form-page-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.form-page-content {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.form-page-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    background: var(--bg-color);
    padding: 0 32px;
}

.form-page-tab {
    padding: 16px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-light);
    transition: all 0.2s;
    white-space: nowrap;
    margin-bottom: -2px;
}

.form-page-tab:hover {
    color: var(--text-color);
    background: rgba(0, 0, 0, 0.02);
}

.form-page-tab.active {
    color: var(--context-color);
    border-bottom-color: var(--context-color);
    background: white;
}

.form-tab-content {
    display: none;
    padding: 32px;
}

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

.form-section {
    padding: 0.5rem 1.5rem;
}

.form-section:last-child {
    margin-bottom: 0;
}

.form-section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.form-page-actions {
    display: flex;
    gap: 16px;
    justify-content: flex-end;
    padding: 24px 32px;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
}

.form-page-actions .btn {
    min-width: 150px;
}

/* Tags Checkboxes for page version */
.tags-checkboxes-page {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

/* Responsive for form page */
@media (max-width: 768px) {
    .form-page-container {
        padding: 0 16px 24px;
    }

    .form-page-header {
        flex-direction: column;
        gap: 16px;
    }

    .form-page-tabs {
        padding: 0 16px;
    }

    .form-page-tab {
        padding: 12px 16px;
        font-size: 13px;
    }

    .form-tab-content {
        padding: 24px 16px;
    }

    .form-section-title {
        font-size: 16px;
    }

    .form-page-actions {
        flex-direction: column;
        padding: 20px 16px;
    }

    .form-page-actions .btn {
        width: 100%;
    }

    .tags-checkboxes-page {
        grid-template-columns: 1fr;
        padding: 16px;
    }
}



select {
  appearance: none;
  @supports (appearance: base-select) {
    @media (hover: hover) {
      &,
      &::picker(select) {
        appearance: base-select;
      }
    }
  }
}
/*
select {
  display: flex;
  justify-content: space-between;
  min-width: 200px;
  align-items: center;
  color: var(--text-color);
  padding-block: 10px;
  padding-inline: 30px 40px;
  border-radius: var(--border-radius);
  border: 2px solid var(--context-color);
  cursor: pointer;
  font-weight: 700;
  background: var(--bg-color)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='1.5' stroke='%23000' class='size-6'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='m19.5 8.25-7.5 7.5-7.5-7.5' /%3E%3C/svg%3E%0A")
    right 10px center / 20px no-repeat;
  @media (hover: hover) {
    @supports (appearance: base-select) {
      padding-inline: 20px;
      background-image: none;
      &::picker-icon {
        content: "";
        width: 20px;
        height: 20px;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='1.5' stroke='%23000' class='size-6'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='m19.5 8.25-7.5 7.5-7.5-7.5' /%3E%3C/svg%3E%0A");
        transition: rotate 0.2s ease-out;
      }
      &:open::picker-icon {
        rotate: 180deg;
      }
      &::picker(select) {
        padding: 0;
        margin-top: 5px;
        border: 2px solid var(--context-color);
        background: var(--text-color);
        border-radius: var(--border-radius);
        font-weight: 400;

        opacity: 0;
        height: 0;
        overflow: clip;
        transition: height 0.5s ease-out, opacity 0.5s ease-out, overlay 0.5s,
          display 0.5s;

        transition-behavior: allow-discrete;
      }
      &:open::picker(select) {
        opacity: 1;
        height: calc-size(auto, size);
        overflow: auto;
        @starting-style {
          opacity: 0;
          height: 0;
        }
      }
      option {
        padding: 15px 20px;
        border-top: 1px solid var(--context-color);
        cursor: pointer;
        transition-property: color, background;
        transition-duration: 0.2s;
        transition-timing-function: ease-out;
        &:where(:hover, :focus, :active) {
          background: dodgerblue;
          color: white;
        }
        &:checked {
          background: var(--context-color);
          color: white;
        }
        &::checkmark {
          display: none;
        }
        &:first-child {
          border: 0;
        }
      }
    }
  }
}*/

/* Notification Dropdown */
.notification-wrapper {
    position: relative;
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 380px;
    max-height: 500px;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.notification-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notification-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.notification-dropdown-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.notification-mark-all {
    background: none;
    border: none;
    color: var(--context-color);
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.notification-mark-all:hover {
    background: rgba(var(--context-color-rgb), 0.1);
}

.notification-dropdown-content {
    max-height: 400px;
    overflow-y: auto;
}

.notification-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.notification-empty p {
    margin-top: 12px;
    font-size: 14px;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    padding: 14px 20px;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}

.notification-item:hover {
    background: var(--bg-color);
}

.notification-item.unread {
    background: rgba(var(--context-color-rgb), 0.05);
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--context-color);
}

.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-icon-info {
    background: rgba(0, 188, 212, 0.1);
    color: var(--secondary-color);
}

.notification-icon-success {
    background: rgba(76, 175, 80, 0.1);
    color: var(--success);
}

.notification-icon-warning {
    background: rgba(255, 193, 7, 0.1);
    color: var(--warning);
}

.notification-icon-error {
    background: rgba(255, 87, 34, 0.1);
    color: var(--danger);
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-color);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-message {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-time {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

.notification-delete {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0;
    transition: all 0.2s;
    flex-shrink: 0;
}

.notification-item:hover .notification-delete {
    opacity: 1;
}

.notification-delete:hover {
    background: rgba(255, 87, 34, 0.1);
    color: var(--danger);
}

/* Badge ajustements */
#notification-badge {
    min-width: 18px;
    height: 18px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Notification dropdown footer */
.notification-dropdown-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.notification-dropdown-footer a {
    color: var(--primary);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.notification-dropdown-footer a:hover {
    text-decoration: underline;
}

/* Page Notifications */
.notifications-page-list {
    display: flex;
    flex-direction: column;
}

.notif-page-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.notif-page-empty p {
    margin-top: 12px;
    font-size: 15px;
}

.notif-page-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
    position: relative;
}

.notif-page-item:hover {
    background: var(--bg-secondary);
}

.notif-page-item.unread {
    background: rgba(0, 188, 212, 0.04);
    border-left: 4px solid var(--primary);
    padding-left: 16px;
}

.notif-page-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notif-page-icon-info {
    background: rgba(0, 188, 212, 0.1);
    color: #00bcd4;
}

.notif-page-icon-success {
    background: rgba(76, 175, 80, 0.1);
    color: #4caf50;
}

.notif-page-icon-warning {
    background: rgba(255, 193, 7, 0.1);
    color: #ffa000;
}

.notif-page-icon-error {
    background: rgba(255, 87, 34, 0.1);
    color: #ff5722;
}

.notif-page-body {
    flex: 1;
    min-width: 0;
}

.notif-page-header-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.notif-page-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.notif-page-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
    flex-shrink: 0;
}

.notif-page-badge-info {
    background: rgba(0, 188, 212, 0.1);
    color: #00838f;
}

.notif-page-badge-success {
    background: rgba(76, 175, 80, 0.1);
    color: #2e7d32;
}

.notif-page-badge-warning {
    background: rgba(255, 193, 7, 0.1);
    color: #e65100;
}

.notif-page-badge-error {
    background: rgba(255, 87, 34, 0.1);
    color: #c62828;
}

.notif-page-message {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 6px;
}

.notif-page-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-light);
}

.notif-page-ago {
    color: var(--primary);
    font-weight: 500;
}

.notif-page-link-hint {
    color: var(--primary);
    font-style: italic;
}

.notif-page-delete {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    opacity: 0;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-top: 2px;
}

.notif-page-item:hover .notif-page-delete {
    opacity: 1;
}

.notif-page-delete:hover {
    background: rgba(255, 87, 34, 0.1);
    color: var(--danger);
}

@media (max-width: 768px) {
    .notif-page-item {
        gap: 10px;
        padding: 12px 8px;
    }

    .notif-page-item.unread {
        padding-left: 6px;
        border-left-width: 3px;
    }

    .notif-page-icon {
        width: 32px;
        height: 32px;
        border-radius: 8px;
    }

    .notif-page-icon svg {
        width: 18px;
        height: 18px;
    }

    .notif-page-header-row {
        flex-wrap: wrap;
        gap: 6px;
    }

    .notif-page-meta {
        flex-wrap: wrap;
        gap: 6px 10px;
    }

    .notif-page-delete {
        opacity: 1;
        padding: 4px;
    }
}

.btn-danger-outline {
    color: var(--danger);
    border-color: var(--danger);
}

.btn-danger-outline:hover {
    background: var(--danger);
    color: #fff;
}

/* Styles RDV */
.rdv-section {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 16px;
}

.rdv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.rdv-header span {
    color: var(--text-secondary);
    font-size: 14px;
}

.rdv-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rdv-empty {
    color: var(--text-muted);
    text-align: center;
    padding: 24px;
    font-style: italic;
}

.rdv-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
}

.rdv-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.rdv-item-title {
    font-weight: 600;
    color: var(--text-primary);
}

.rdv-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.rdv-status.status-pending {
    background: rgba(255, 193, 7, 0.15);
    color: #f59e0b;
}

.rdv-status.status-confirmed {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.rdv-status.status-completed {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.rdv-status.status-cancelled {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.rdv-item-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.rdv-item-datetime,
.rdv-item-lieu {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.rdv-item-datetime svg,
.rdv-item-lieu svg {
    flex-shrink: 0;
}

.rdv-item-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--bg-secondary);
    color: var(--primary);
}

.btn-icon.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Modal RDV */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    margin: 50px auto;
}

.modal.open {
    display: flex;
}

.modal-overlay,
.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: var(--bg-primary);
    border-radius: 12px;
    width: 100%;
    max-width: 1300px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    width: 100%;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-secondary);
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    width: 100%;
}

/* RDV Type Pills */
.rdv-type-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.rdv-pill {
    cursor: pointer;
    margin: 0;
}

.rdv-pill input[type="checkbox"] {
    display: none;
}

.rdv-pill-label {
    display: inline-block;
    padding: 8px 18px;
    border: 2px solid var(--border-color);
    border-radius: 24px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-primary);
    transition: all 0.2s ease;
    user-select: none;
}

.rdv-pill-label:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.rdv-pill input[type="checkbox"]:checked + .rdv-pill-label {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb, 59, 130, 246), 0.3);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

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

.modal-small .modal-content {
    max-width: 400px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 400;
}

.toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--context-color);
}

/* Upload Zone */
.upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--context-color);
    background: rgba(230, 126, 34, 0.05);
}

.upload-zone p {
    margin: 8px 0;
    color: var(--text-secondary);
}

.upload-zone .text-muted {
    font-size: 13px;
    opacity: 0.7;
}

.upload-zone svg {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* ============================================
   CALENDRIER STYLES
   ============================================ */

/* Header Navigation */
.calendar-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.calendar-header h2 {
    min-width: 200px;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.btn-icon {
    padding: 8px;
    min-width: auto;
}

/* Legende */
.calendar-legend {
    display: flex;
    gap: 24px;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend-rdv {
    background: var(--context-color);
}

.legend-chantier {
    background: var(--secondary-color);
}

/* Grille Calendrier */
.calendar-grid {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

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

.calendar-weekdays > div {
    padding: 12px;
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.calendar-days {
    display: flex;
    flex-direction: column;
}

/* Week row: 7-column grid with day headers + chantier bars + RDV */
.calendar-week-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: min-content;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

/* Day header cells in row 1 */
.calendar-day-header {
    padding: 8px 8px 4px;
    border-right: 1px solid var(--border-color);
    background: var(--bg-primary);
    cursor: pointer;
    transition: background 0.2s;
}

.calendar-day-header:hover {
    background: rgba(var(--context-color-rgb), 0.03);
}

.calendar-day-header.drag-over {
    background: var(--primary-light);
    outline: 2px dashed var(--primary-color);
    outline-offset: -2px;
}

.calendar-spanning-event[draggable="true"] {
    cursor: grab;
}

.calendar-spanning-event[draggable="true"]:active {
    cursor: grabbing;
}

.calendar-spanning-event.dragging {
    opacity: 0.5;
}

.calendar-day-header.calendar-day-today {
    background: rgba(var(--context-color-rgb), 0.05);
}

.calendar-day-header.calendar-day-weekend {
    background: rgba(0, 0, 0, 0.02);
}

/* RDV cells below chantier bars */
.calendar-day-rdv {
    padding: 2px 8px 4px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.calendar-week-row > .calendar-day-empty {
    border-right: 1px solid var(--border-color);
    background: var(--bg-secondary);
    cursor: default;
}

/* Spanning event bars */
.calendar-spanning-event {
    display: flex;
    align-items: center;
    padding: 2px 6px;
    color: white;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    min-height: 22px;
    margin: 0 1px;
    transition: opacity 0.15s;
    z-index: 1;
}

.calendar-spanning-event:hover {
    opacity: 0.85;
}

.spanning-event-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Remove right border on last column (Sunday) */
.calendar-col-last {
    border-right: none !important;
}

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

.calendar-day-number {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

/* Evenements dans le calendrier */
.calendar-day-events {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.calendar-event {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 11px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.1s;
}

.calendar-event:hover {
    transform: translateX(2px);
}

.calendar-event-rdv {
    background: rgba(var(--context-color-rgb), 0.15);
    color: var(--context-color);
    border-left: 3px solid var(--context-color);
}

.calendar-event-chantier {
    background: rgba(0, 188, 212, 0.15);
    color: #00838F;
    border-left: 3px solid var(--secondary-color);
}

.calendar-event svg {
    flex-shrink: 0;
}

.event-time {
    font-weight: 600;
    white-space: nowrap;
}

.event-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-more {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 2px 6px;
    cursor: pointer;
}

.calendar-more:hover {
    color: var(--context-color);
}

/* Side Panel Evenement */
.event-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--border-radius);
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 8px;
}

.event-type-badge.rdv {
    background: rgba(var(--context-color-rgb), 0.15);
    color: var(--context-color);
}

.event-type-badge.chantier {
    background: rgba(0, 188, 212, 0.15);
    color: #00838F;
}

/* Status badges pour RDV */
.rdv-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.rdv-status-planifie {
    background: rgba(59, 130, 246, 0.15);
    color: #2563eb;
}

.rdv-status-confirme {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

.rdv-status-termine {
    background: rgba(107, 114, 128, 0.15);
    color: #4b5563;
}

.rdv-status-annule {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

/* Status badges pour Chantiers */
.chantier-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.chantier-status-en_cours {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

.chantier-status-en_attente {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.chantier-status-termine {
    background: rgba(107, 114, 128, 0.15);
    color: #4b5563;
}

.chantier-status-annule {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

/* Modal liste evenements du jour */
.day-events-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.day-event-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s;
}

.day-event-item:hover {
    transform: translateX(4px);
}

.day-event-rdv {
    background: rgba(var(--context-color-rgb), 0.08);
    border-left: 4px solid var(--context-color);
}

.day-event-rdv:hover {
    background: rgba(var(--context-color-rgb), 0.12);
}

.day-event-chantier {
    background: rgba(0, 188, 212, 0.08);
    border-left: 4px solid var(--secondary-color);
}

.day-event-chantier:hover {
    background: rgba(0, 188, 212, 0.12);
}

.day-event-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-secondary);
}

.day-event-rdv .day-event-icon {
    color: var(--context-color);
}

.day-event-chantier .day-event-icon {
    color: var(--secondary-color);
}

.day-event-content {
    flex: 1;
    min-width: 0;
}

.day-event-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.day-event-details {
    font-size: 12px;
    color: var(--text-secondary);
}

.day-event-badge {
    flex-shrink: 0;
}

/* Responsive */
@media (max-width: 768px) {
    /* Compact calendar header: prev | title | next on row 1, today + mode toggle on row 2 */
    .calendar-header {
        display: grid;
        grid-template-columns: auto 1fr auto;
        grid-template-areas:
            "prev title next"
            "actions actions actions";
        gap: 8px;
        align-items: center;
    }

    .calendar-header h2 {
        grid-area: title;
        font-size: 16px;
        margin: 0;
        text-align: center;
    }

    .calendar-header #prev-period { grid-area: prev; }
    .calendar-header #next-period { grid-area: next; }

    .calendar-header #today-btn,
    .calendar-header #btn-print-calendar,
    .calendar-header .calendar-mode-toggle {
        grid-area: actions;
        justify-self: start;
    }

    .calendar-header > div[style*="flex: 1"] {
        display: none;
    }

    .calendar-header .calendar-mode-toggle {
        justify-self: end;
        margin-right: 0;
    }

    .calendar-header #today-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    /* Calendar grid: horizontal scroll with readable cells */
    #calendar-view-classique {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -12px;
        padding: 0 12px;
    }

    #calendar-view-classique .calendar-grid {
        min-width: 560px;
    }

    .calendar-day {
        min-height: 80px;
        padding: 4px;
    }

    /* Allow event titles to wrap to 2 lines */
    .calendar-event,
    .calendar-spanning-event {
        padding: 3px 5px;
        font-size: 11px;
        white-space: normal;
        line-height: 1.25;
    }

    .calendar-spanning-event {
        min-height: 18px;
    }

    .event-time {
        display: none;
    }

    .calendar-legend {
        flex-wrap: wrap;
        gap: 12px;
    }

    .calendar-weekdays > div {
        padding: 8px 4px;
        font-size: 10px;
    }
}

/* =====================================================
   DOCUMENTATION MODULE STYLES
   ===================================================== */

.documentation-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
}

.doc-sidebar {
    background: var(--white);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    padding: 16px;
    height: fit-content;
    position: sticky;
    top: calc(var(--header-height) + 24px);
}

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

.doc-sidebar-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
}

.doc-categories {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-light);
}

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

.category-item.active {
    background: rgba(var(--context-color-rgb), 0.1);
    color: var(--context-color);
}

.category-item svg {
    flex-shrink: 0;
}

.category-item span:not(.category-count) {
    flex: 1;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-count {
    background: var(--bg-color);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

/* Category toggle buttons for expand/collapse */
.category-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    border-radius: 3px;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.category-toggle:hover {
    background: var(--bg-color);
    color: var(--text-color);
}

.category-toggle svg {
    transition: transform 0.2s ease;
}

.category-toggle-placeholder {
    width: 18px;
    flex-shrink: 0;
    flex: initial !important;
}

/* Category children container */
.category-children {
    overflow: hidden;
    transition: max-height 0.2s ease, opacity 0.2s ease;
}

.category-children.collapsed {
    max-height: 0;
    opacity: 0;
}

.category-children.expanded {
    max-height: 1000px;
    opacity: 1;
}

.doc-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color);
}

.stat-label {
    font-size: 11px;
    color: var(--text-light);
    text-transform: uppercase;
}

.doc-main {
    min-width: 0;
}

/* ---- Grid view ---- */
.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

/* ---- List view ---- */
.documents-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

/* ---- Card: default (grid) ---- */
.document-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    transition: all 0.2s;
    cursor: pointer;
}

.document-card:hover {
    border-color: var(--context-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.document-preview-drive {
    height: 80px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    color: var(--text-light);
    overflow: hidden;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.document-preview-drive img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.doc-type-image { background: rgba(var(--context-color-rgb), 0.1); color: var(--context-color); }
.doc-type-pdf { background: rgba(220, 53, 69, 0.1); color: #dc3545; }
.doc-type-video { background: rgba(111, 66, 193, 0.1); color: #6f42c1; }
.doc-type-document { background: rgba(0, 123, 255, 0.1); color: #007bff; }

.document-info {
    padding: 12px;
    min-width: 0;
}

.document-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.document-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.doc-type-badge {
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
}

.doc-size {
    font-size: 11px;
    color: var(--text-light);
}

.document-card.dragging {
    opacity: 0.4;
    border: 2px dashed var(--context-color);
}

.category-item.drop-target {
    background: rgba(var(--context-color-rgb), 0.15);
    outline: 2px dashed var(--context-color);
    outline-offset: -2px;
}

.documents-grid.drop-zone-active,
.documents-list.drop-zone-active {
    outline: 2px dashed var(--context-color);
    outline-offset: -2px;
    background: rgba(var(--context-color-rgb), 0.05);
    border-radius: var(--border-radius);
    min-height: 200px;
}

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

/* ---- Card: list view overrides ---- */
.documents-list .document-card {
    flex-direction: row;
    align-items: center;
}

.documents-list .document-preview {
    width: 64px;
    min-width: 64px;
    height: 64px;
    min-height: 64px;
    border-radius: var(--border-radius) 0 0 var(--border-radius);
}

.documents-list .document-preview svg {
    width: 28px;
    height: 28px;
}

.documents-list .document-info {
    flex: 1;
    padding: 8px 12px;
}

.documents-list .document-actions {
    border-top: none;
    border-left: 1px solid var(--border-color);
    padding: 8px 12px;
    flex-shrink: 0;
}

.view-toggle {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.view-btn {
    padding: 8px 12px;
    background: var(--white);
    border: none;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.2s;
}

.view-btn:hover {
    background: var(--bg-color);
}

.view-btn.active {
    background: var(--context-color);
    color: white;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 40px;
    text-align: center;
    transition: all 0.2s;
}

.upload-zone:hover {
    border-color: var(--context-color);
    background: rgba(var(--context-color-rgb), 0.02);
}

.upload-zone.dragover {
    border-color: var(--context-color);
    background: rgba(var(--context-color-rgb), 0.05);
}

.upload-zone p {
    margin: 12px 0;
    color: var(--text-light);
}

.text-muted {
    color: var(--text-light) !important;
}

/* Preview Modal */
.modal-large .modal-content {
    max-width: 900px;
}

.preview-container {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    border-radius: var(--border-radius);
    margin-bottom: 16px;
}

.preview-placeholder {
    text-align: center;
    color: var(--text-light);
}

.pdf-viewer {
    width: 100%;
}

.pdf-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 10px;
    background: var(--white);
    border-radius: var(--border-radius);
    margin-bottom: 8px;
}

.pdf-controls .btn-sm {
    padding: 4px 12px;
    font-size: 13px;
}

#pdf-page-info {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-color);
    min-width: 100px;
    text-align: center;
}

.preview-info {
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.preview-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

/* =====================================================
   PLATEFORME MODULE STYLES
   ===================================================== */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.dashboard-card-large {
    grid-column: span 2;
}

.chart-container {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-placeholder {
    text-align: center;
    color: var(--text-light);
}

.recent-list {
    display: flex;
    flex-direction: column;
}

.recent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
}

.recent-item:last-child {
    border-bottom: none;
}

.recent-item:hover {
    background: var(--bg-color);
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
}

.recent-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
}

.recent-item-icon.urgent {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.recent-item-content {
    flex: 1;
    min-width: 0;
}

.recent-item-title {
    display: block;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 4px;
}

.recent-item-meta {
    font-size: 12px;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.2s;
}

.quick-action-btn:hover {
    background: rgba(var(--context-color-rgb), 0.1);
    color: var(--context-color);
}

.quick-action-btn svg {
    color: var(--context-color);
}

.quick-action-btn span {
    font-size: 12px;
    text-align: center;
}

.realisations-preview {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.realisation-mini-card {
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.realisation-mini-image {
    height: 80px;
    background: var(--bg-color);
}

.realisation-mini-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.realisation-mini-title {
    display: block;
    padding: 8px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Requests/Demandes */
.kpi-small {
    gap: 12px;
}

.kpi-small .kpi-card {
    padding: 16px;
}

.kpi-small .kpi-value {
    font-size: 24px;
}

.kpi-small .kpi-label {
    font-size: 11px;
}

.requests-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.request-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    transition: all 0.2s;
}

.request-card:hover {
    border-color: var(--context-color);
}

.request-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.request-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.request-type {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--bg-color);
}

.request-priority {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
}

.priority-basse { background: rgba(108, 117, 125, 0.1); color: #6c757d; }
.priority-normale { background: rgba(0, 123, 255, 0.1); color: #007bff; }
.priority-haute { background: rgba(255, 193, 7, 0.1); color: #ffc107; }
.priority-urgente { background: rgba(220, 53, 69, 0.1); color: #dc3545; }

.request-date {
    font-size: 11px;
    color: var(--text-light);
}

.request-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 8px;
}

.request-description {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 12px;
}

.request-page {
    font-size: 12px;
    color: var(--text-light);
    background: var(--bg-color);
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 12px;
}

.request-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.request-author {
    font-size: 12px;
    color: var(--text-light);
}

/* Realisations Grid */
.realisations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 16px;
}

.realisation-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: all 0.2s;
}

.realisation-card:hover {
    border-color: var(--context-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.realisation-image {
    height: 180px;
    background: var(--bg-color);
    position: relative;
}

.realisation-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.realisation-image .no-image {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
}

.realisation-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    opacity: 0;
    transition: opacity 0.2s;
}

.realisation-card:hover .realisation-overlay {
    opacity: 1;
}

.realisation-overlay .btn-icon {
    background: var(--white);
    color: var(--text-color);
}

.photo-count {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
}

.realisation-info {
    padding: 16px;
}

.realisation-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 8px;
}

.realisation-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.realisation-date {
    font-size: 12px;
    color: var(--text-light);
}

/* ---- Realisations list view ---- */
.realisations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}
.realisations-list .realisation-card {
    display: flex;
    flex-direction: row;
    align-items: stretch;
}
.realisations-list .realisation-image {
    width: 160px;
    min-width: 160px;
    height: auto;
    min-height: 100px;
}
.realisations-list .realisation-image .no-image {
    min-height: 100px;
}
.realisations-list .realisation-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 14px 20px;
    min-width: 0;
}
.realisations-list .realisation-title {
    font-size: 15px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.realisations-list .realisation-description {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.realisations-list .realisation-meta {
    margin-bottom: 0;
}
.realisations-list .realisation-list-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    flex-shrink: 0;
}
.realisations-list .realisation-list-actions .btn {
    font-size: 13px;
    padding: 6px 14px;
    white-space: nowrap;
}
.realisations-list .photo-count {
    bottom: 6px;
    right: 6px;
    font-size: 10px;
    padding: 2px 6px;
}
.realisations-list .realisation-overlay {
    display: none;
}
.realisations-list .star-toggle {
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    font-size: 15px;
}

/* Stats Page */
.stats-controls {
    margin-bottom: 24px;
}

.date-range-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.range-btn {
    padding: 8px 16px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.range-btn:hover {
    border-color: var(--context-color);
}

.range-btn.active {
    background: var(--context-color);
    border-color: var(--context-color);
    color: white;
}

.custom-range {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 16px;
}

.custom-range input[type="date"] {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 13px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.stats-card-large {
    grid-row: span 2;
}

.chart-legend {
    display: flex;
    gap: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-light);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.source-item {
    margin-bottom: 12px;
}

.source-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.source-name {
    font-size: 13px;
    color: var(--text-color);
}

.source-value {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-color);
}

.source-bar {
    height: 6px;
    background: var(--bg-color);
    border-radius: 3px;
    overflow: hidden;
}

.source-bar-fill {
    height: 100%;
    background: var(--context-color);
    border-radius: 3px;
}

.top-page-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.top-page-item:last-child {
    border-bottom: none;
}

.top-page-rank {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
}

.top-page-name {
    flex: 1;
    font-size: 13px;
    color: var(--text-color);
}

.top-page-views {
    font-size: 12px;
    color: var(--text-light);
}

.simple-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 200px;
    padding: 20px;
}

.chart-bar-wrapper {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: flex-end;
}

.chart-bar {
    width: 100%;
    background: var(--context-color);
    border-radius: 2px 2px 0 0;
    min-height: 2px;
}

.chart-labels {
    display: flex;
    justify-content: space-between;
    padding: 8px 20px 0;
    font-size: 11px;
    color: var(--text-light);
}

/* Photos Upload */
.photos-upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.photos-upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.photos-upload-zone:hover {
    border-color: var(--context-color);
}

.photos-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.photo-preview-item {
    width: 80px;
    height: 80px;
    border-radius: var(--border-radius);
    overflow: hidden;
    position: relative;
}

.photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-remove-photo {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.btn-rotate-photo {
    position: absolute;
    top: 4px;
    right: 28px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.btn-rotate-photo:hover {
    background: var(--primary-color, #ed6f2d);
}

/* KPI Evolution */
.kpi-evolution {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    margin-left: 8px;
}

.kpi-evolution.positive {
    color: var(--success);
}

.kpi-evolution.negative {
    color: var(--danger);
}

/* Empty states */
.empty-state-small {
    text-align: center;
    padding: 24px;
    color: var(--text-light);
}

.no-data {
    text-align: center;
    padding: 16px;
    color: var(--text-light);
    font-size: 13px;
}

/* Link external */
.link-external {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--context-color);
    text-decoration: none;
}

.link-external:hover {
    text-decoration: underline;
}

/* Spin animation */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin {
    animation: spin 1s linear infinite;
}

/* Responsive */
@media (max-width: 1024px) {
    .documentation-layout {
        grid-template-columns: 1fr;
    }

    .doc-sidebar {
        position: static;
    }

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

    .dashboard-card-large {
        grid-column: span 1;
    }

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

    .stats-card-large {
        grid-row: span 1;
    }
}

/* =====================================================
   CLIENT DOCUMENTS SECTION
   ===================================================== */

.client-documents-section,
.documents-section {
    padding: 16px 0;
}

.client-documents-header,
.documents-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.client-documents-header h4,
.documents-header h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.client-documents-list,
.documents-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.client-documents-empty,
.documents-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
    background: var(--bg-color);
    border-radius: var(--border-radius);
}

.client-documents-empty svg,
.documents-empty svg {
    margin-bottom: 12px;
    opacity: 0.5;
}

.client-documents-empty p,
.documents-empty p {
    margin: 0;
    font-size: 14px;
}

/* Document Item */
.client-document-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: all 0.2s;
}

.client-document-item:hover {
    border-color: var(--context-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.client-document-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    background: var(--bg-color);
    color: var(--text-light);
}

.client-document-icon.type-image {
    background: rgba(var(--context-color-rgb), 0.1);
    color: var(--context-color);
}

.client-document-icon.type-pdf {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.client-document-icon.type-video {
    background: rgba(111, 66, 193, 0.1);
    color: #6f42c1;
}

.client-document-icon.type-document {
    background: rgba(0, 123, 255, 0.1);
    color: #007bff;
}

.client-document-content {
    flex: 1;
    min-width: 0;
}

.client-document-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.client-document-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.client-document-size {
    font-size: 12px;
    color: var(--text-light);
    flex-shrink: 0;
}

.client-document-note {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.client-document-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-light);
}

.client-document-meta svg {
    width: 12px;
    height: 12px;
    margin-right: 4px;
    vertical-align: middle;
}

.client-document-links {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.client-document-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    padding: 2px 8px;
    background: var(--bg-color);
    border-radius: 4px;
    color: var(--text-secondary);
    text-decoration: none;
}

.client-document-link:hover {
    background: rgba(var(--context-color-rgb), 0.1);
    color: var(--context-color);
}

.client-document-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.client-document-actions .btn-icon {
    opacity: 0.6;
    transition: opacity 0.2s;
}

.client-document-item:hover .client-document-actions .btn-icon {
    opacity: 1;
}

/* Document Upload Zone */
.document-upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-color);
}

.document-upload-zone:hover {
    border-color: var(--context-color);
    background: rgba(var(--context-color-rgb), 0.02);
}

.document-upload-zone.dragover {
    border-color: var(--context-color);
    background: rgba(var(--context-color-rgb), 0.08);
    border-style: solid;
}

.document-upload-zone svg {
    color: var(--text-light);
    margin-bottom: 12px;
}

.document-upload-zone p {
    margin: 0 0 8px 0;
    color: var(--text-color);
    font-weight: 500;
}

.document-upload-zone small {
    color: var(--text-light);
    font-size: 12px;
}

/* File Preview in Modal */
.file-preview-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: var(--border-radius);
    margin-bottom: 16px;
}

.file-preview-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    border-radius: var(--border-radius);
    color: var(--text-light);
}

.file-preview-info {
    flex: 1;
    min-width: 0;
}

.file-preview-name {
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-preview-size {
    font-size: 12px;
    color: var(--text-light);
}

.file-preview-remove {
    padding: 4px;
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.file-preview-remove:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

/* Document Preview Modal */
.document-preview-modal {
    text-align: center;
}

.document-preview-frame {
    min-height: 400px;
    max-height: 70vh;
    background: var(--bg-color);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 16px;
}

.document-preview-frame img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

.document-preview-frame iframe {
    width: 100%;
    height: 70vh;
    border: none;
}

.document-preview-frame video {
    max-width: 100%;
    max-height: 70vh;
}

.document-preview-placeholder {
    padding: 60px;
    color: var(--text-light);
}

.document-preview-placeholder svg {
    margin-bottom: 12px;
}

.document-preview-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

/* Chantier Documents Section */
.chantier-documents-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.chantier-documents-section h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 16px 0;
}

.chantier-documents-section h4 svg {
    color: var(--context-color);
}

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

    .client-document-icon {
        width: 36px;
        height: 36px;
    }

    .client-document-actions {
        justify-content: flex-end;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid var(--border-color);
    }

    .client-document-meta {
        flex-wrap: wrap;
    }
}

/* =====================================================
   CLIENT VIEW PAGE
   ===================================================== */

.client-view-container {
    padding: 0;
}

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

.client-view-header-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.client-view-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.client-view-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.client-view-header-actions {
    display: flex;
    gap: 12px;
}

/* Grid Layout */
.client-view-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
}

.client-view-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.client-view-sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Cards */
.client-view-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.client-view-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
}

.client-view-card-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.client-view-card-header h3 svg {
    color: var(--context-color);
}

.client-view-card-body {
    padding: 20px;
}

/* Info Grid */
.client-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.client-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.client-info-item.full-width {
    grid-column: span 3;
}

.client-info-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-light);
    text-transform: uppercase;
}

.client-info-value {
    font-size: 14px;
    color: var(--text-color);
}

.client-link {
    color: var(--context-color);
    text-decoration: none;
}

.client-link:hover {
    text-decoration: underline;
}

#nearby-projects-section {
    max-height: 300px;
    overflow-y: auto;
    border-top: 1px solid var(--border-color);
}

.nearby-projects-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    background: var(--bg-color);
    position: sticky;
    top: 0;
    z-index: 1;
    gap: 8px;
}

.multi-select-wrapper {
    position: relative;
    display: inline-block;
}
.multi-select-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-color);
    cursor: pointer;
    white-space: nowrap;
}
.multi-select-btn:hover {
    border-color: var(--primary-color);
}
.multi-select-btn.has-selection {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(var(--primary-rgb, 59,130,246), 0.08);
}
.multi-select-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 20;
    min-width: 180px;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-top: 4px;
    padding: 4px 0;
}
.multi-select-wrapper.open .multi-select-dropdown {
    display: block;
}
.multi-select-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}
.multi-select-option:hover {
    background: var(--bg-color);
}
.multi-select-option input[type="checkbox"] {
    margin: 0;
    accent-color: var(--primary-color);
}

/* Document sections */
.doc-section {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.doc-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.doc-section:first-child {
    padding-top: 0;
}

.doc-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.doc-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Inline Editing */
.inline-editable {
    cursor: pointer;
    border-radius: 4px;
    padding: 2px 6px;
    margin: -2px -6px;
    transition: background-color 0.15s;
    position: relative;
}

.inline-editable:hover {
    background-color: rgba(var(--primary-color-rgb), 0.08);
}

.inline-editable:hover::after {
    content: '\270E';
    margin-left: 6px;
    font-size: 12px;
    color: var(--text-light);
}

.inline-edit-input {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.15);
    background: white;
}

.inline-edit-input:focus {
    border-color: var(--primary-color);
}

select.inline-edit-input {
    cursor: pointer;
}

.inline-edit-address {
    width: 100%;
}

.inline-edit-notes textarea.inline-edit-input {
    resize: vertical;
    min-height: 80px;
}

/* Status Badge */
.client-status-badge {
    margin-bottom: 16px;
}

/* Tags Section */
.client-tags-section {
    margin-top: 8px;
}

.client-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

/* Notes */
.client-note-input-section {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.client-note-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    min-height: 44px;
    outline: none;
    transition: border-color 0.15s;
}

.client-note-textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.12);
}

.client-notes-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.client-note-item {
    position: relative;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.client-note-item:last-child {
    border-bottom: none;
}

.client-note-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.client-note-auteur {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-color);
}

.client-note-date {
    font-size: 11px;
    color: var(--text-light);
}

.client-note-content {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    padding-right: 24px;
}

.client-note-delete {
    position: absolute;
    top: 10px;
    right: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 2px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}

.client-note-item:hover .client-note-delete {
    opacity: 1;
}

.client-note-delete:hover {
    color: var(--danger-color, #EF4444);
}

.client-note-input-actions {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
    margin-top: 6px;
}

.client-note-date-label {
    display: flex;
    flex-direction: column;
    font-size: 11px;
    color: var(--text-light);
    gap: 2px;
}

.client-note-date-input {
    padding: 4px 6px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
}

.client-note-edited {
    font-style: italic;
    color: var(--text-light);
    font-size: 10px;
    margin-left: 4px;
}

.client-note-actions {
    position: absolute;
    top: 10px;
    right: 0;
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
}

.client-note-item:hover .client-note-actions {
    opacity: 1;
}

.client-note-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 2px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background-color 0.15s;
}

.client-note-action-btn:hover {
    color: var(--primary-color);
    background-color: rgba(0, 0, 0, 0.04);
}

.client-note-action-btn--danger:hover {
    color: var(--danger-color, #EF4444);
}

.client-note-item--editing {
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin: 6px 0;
}

.client-note-edit-row {
    margin-bottom: 6px;
}

.client-note-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 6px;
}

.client-notes-fullscreen-content {
    width: min(1200px, 96vw);
    max-width: 1200px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.client-notes-fullscreen-content .modal-body {
    overflow-y: auto;
    flex: 1;
}

.client-notes-list-fullscreen .client-note-item {
    padding: 14px 0;
}

.client-notes-list-fullscreen .client-note-content {
    font-size: 14px;
    line-height: 1.6;
    padding-right: 60px;
}

/* Rappels */
.client-rappels-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.client-rappels-list:not(:empty) {
    margin-bottom: 12px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
}

.client-rappel-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.client-rappel-item:last-child {
    border-bottom: none;
}

.client-rappel-item.rappel-done {
    opacity: 0.55;
}

.client-rappel-titre {
    font-size: 13px;
    color: var(--text-color);
    line-height: 1.4;
}

.client-rappel-titre.rappel-titre-done {
    text-decoration: line-through;
}

.client-rappel-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
    font-size: 11px;
    color: var(--text-light);
}

.rappel-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.rappel-badge-upcoming {
    background: var(--bg-color);
    color: var(--text-light);
}

.rappel-badge-today {
    background: #FEF3C7;
    color: #92400E;
}

.rappel-badge-overdue {
    background: #FEE2E2;
    color: #991B1B;
}

.rappel-badge-done {
    background: #D1FAE5;
    color: #065F46;
}

/* Photos Grid */
.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
}

.photo-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s;
}

.photo-thumb:hover img {
    transform: scale(1.05);
}

.photo-thumb-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--text-light);
}

.photo-thumb-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--text-light);
}

.photo-thumb-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.photo-thumb:hover .photo-thumb-delete {
    opacity: 1;
}

.photo-thumb-delete:hover {
    background: var(--danger-color, #EF4444);
}

/* Photo Lightbox */
.photo-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
}

.photo-lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.photo-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.photo-lightbox-content {
    position: relative;
    z-index: 5;
    max-width: 85vw;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-lightbox-content img {
    max-width: 85vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.photo-lightbox-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 200px;
    height: 200px;
    color: rgba(255, 255, 255, 0.5);
}

.photo-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.photo-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.25);
}

.photo-lightbox-prev {
    left: 20px;
}

.photo-lightbox-next {
    right: 20px;
}

.photo-lightbox-footer {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    padding: 10px 20px;
    border-radius: 10px;
    color: white;
}

.photo-lightbox-name {
    font-size: 14px;
    font-weight: 500;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.photo-lightbox-counter {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

/* History */
.client-history-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-label {
    font-size: 13px;
    color: var(--text-light);
}

.history-value {
    font-size: 13px;
    color: var(--text-color);
}

/* List Items */
.client-view-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.client-view-list-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: var(--border-radius);
    transition: all 0.2s;
}

.client-view-list-item:hover {
    background: rgba(var(--context-color-rgb), 0.05);
}

.list-item-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    background: var(--white);
    color: var(--text-light);
}

.list-item-icon.status-active {
    background: rgba(0, 188, 212, 0.1);
    color: var(--secondary-color);
}

.list-item-icon.status-success {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success);
}

.list-item-icon.status-warning {
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

.list-item-icon.status-danger {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger);
}

.list-item-content {
    flex: 1;
    min-width: 0;
}

.list-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.list-item-title {
    font-weight: 500;
    color: var(--text-color);
}

.list-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: var(--text-light);
}

.list-item-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--context-color);
    border-radius: 3px;
    transition: width 0.3s;
}

.progress-text {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 35px;
}

.list-item-actions {
    flex-shrink: 0;
}

/* RDV Items */
.client-view-rdv-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rdv-item {
    display: flex;
    gap: 12px;
    padding: 10px;
    background: var(--bg-color);
    border-radius: var(--border-radius);
    border-left: 3px solid var(--context-color);
    align-items: center;
}

.rdv-item.past {
    opacity: 0.6;
    border-left-color: var(--text-light);
}

.rdv-item .rdv-content {
    flex: 1;
    min-width: 0;
}

.rdv-actions {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
}

.rdv-action-btn {
    background: transparent;
    border: none;
    padding: 6px;
    border-radius: 4px;
    color: var(--text-light);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.rdv-action-btn:hover {
    background: var(--white);
    color: var(--context-color);
}

.rdv-action-btn.rdv-action-delete:hover {
    color: #ef4444;
}

.rdv-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 45px;
    padding: 4px 8px;
    background: var(--white);
    border-radius: 4px;
}

.rdv-day {
    font-size: 18px;
    font-weight: 600;
    color: var(--context-color);
    line-height: 1;
}

.rdv-item.past .rdv-day {
    color: var(--text-light);
}

.rdv-month {
    font-size: 11px;
    color: var(--text-light);
    text-transform: uppercase;
}

.rdv-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rdv-time {
    font-weight: 500;
    color: var(--text-color);
}

.rdv-type {
    font-size: 13px;
    color: var(--text-secondary);
}

.rdv-lieu {
    font-size: 12px;
    color: var(--text-light);
}

/* Empty State */
.empty-state {
    color: var(--text-light);
    font-size: 13px;
    text-align: center;
    padding: 16px;
}

/* Responsive */
@media (max-width: 1024px) {
    .client-view-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .client-view-header {
        flex-direction: column;
        align-items: stretch;
    }

    .client-view-header-actions {
        justify-content: flex-end;
    }

    .client-info-grid {
        grid-template-columns: 1fr;
    }

    .client-info-item.full-width {
        grid-column: span 1;
    }

    /* Prevent grid item from being forced wider than viewport by buttons.
       min-width: 0 lets the flex/grid item shrink below its content's min-content. */
    .client-view-grid,
    .client-view-main,
    .client-view-sidebar,
    .client-view-card {
        min-width: 0;
    }

    .client-view-container {
        padding: 0;
    }

    /* Compact card padding */
    .client-view-card-header {
        padding: 12px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .client-view-card-body {
        padding: 14px;
    }

    .client-view-card-header h3 {
        font-size: 14px;
    }

    /* Action buttons inside card headers: wrap to next line, take full width */
    .client-view-card-header > div:not(:first-child) {
        flex-basis: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .client-view-card-header > div:not(:first-child) > button,
    .client-view-card-header > div:not(:first-child) > a {
        flex: 1 1 auto;
        min-width: 0;
        white-space: normal;
    }

    /* Allow action buttons to wrap text */
    .client-view-card-header .btn {
        white-space: normal;
        line-height: 1.2;
    }

    /* Title smaller on mobile */
    .client-view-title {
        font-size: 20px;
    }

    /* Back link more compact */
    .back-link {
        font-size: 13px;
    }

    /* Status pipeline: allow horizontal scroll if it doesn't fit */
    .client-status-pipeline {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .client-status-pipeline::-webkit-scrollbar {
        display: none;
    }
}

/* ========================================
   Devis/Factures Form & Preview
   ======================================== */

/* Form with Preview Layout */
.form-with-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 20px;
}

.form-page-content form {
    max-width: 100%;
}

/* Preview Panel */
.preview-panel {
    position: sticky;
    top: calc(var(--header-height) + 20px);
    height: calc(100vh - var(--header-height) - 40px);
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.preview-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
}

.preview-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

.preview-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.document-preview {
    min-height: 100%;
}

.preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-light);
}

.preview-empty svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.preview-empty p {
    margin: 0;
    font-size: 14px;
}

/* Document Preview Content */
.document-preview-content {
    background: white;
    padding: 40px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 4px;
}

/* Lignes Grid */
.ligne-grid {
    display: grid;
    grid-template-columns: 40px 2fr 100px 120px;
    gap: 12px;
    align-items: end;
}

.ligne-item {
    background: var(--bg-color);
    padding: 15px;
    margin-bottom: 12px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.ligne-action {
    margin: 0 !important;
}

.form-group-description {
    grid-column: span 1;
}

/* Totals Section */
.devis-totals {
    margin-top: 30px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
}

.total-row.total-ttc {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 2px solid var(--border-color);
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
}

.total-label {
    font-weight: 500;
}

.total-value {
    font-weight: 600;
}

/* Responsive */
@media (max-width: 1400px) {
    .form-with-preview {
        grid-template-columns: 1fr;
    }

    .preview-panel {
        position: relative;
        height: 600px;
        top: 0;
    }
}

@media (max-width: 768px) {
    .ligne-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .ligne-action {
        order: -1;
    }

    .document-preview-content {
        padding: 20px;
    }
}

/* ========================================
   Lignes de titre et commentaires
   ======================================== */

/* Ligne de titre */
.ligne-titre-item {
    background: var(--primary-color)10 !important;
    border-left: 4px solid var(--primary-color) !important;
}

.ligne-titre-grid {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Ligne de commentaire */
.ligne-commentaire-item {
    background: #f9f9f9 !important;
    border-left: 4px solid var(--text-light) !important;
}

.ligne-commentaire-grid {
    display: flex;
    flex-direction: row;
    gap: 8px;
}

/* WYSIWYG Toolbar */
.wysiwyg-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.wysiwyg-btn {
    padding: 6px 10px;
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-color);
    transition: all 0.2s;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wysiwyg-btn:hover {
    background: var(--bg-color);
    border-color: var(--border-color);
}

.wysiwyg-btn:active,
.wysiwyg-btn.active {
    background: rgba(237, 111, 45, 0.1);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.wysiwyg-separator {
    width: 1px;
    background: var(--border-color);
    margin: 4px 6px;
}

/* Liste à tirets — utilisée par les éditeurs WYSIWYG (devis, facture, etc.) */
ul.dash-list {
    list-style-type: "- ";
    padding-left: 1.4em;
}
ul.dash-list li {
    padding-left: 4px;
}

.wysiwyg-editor:empty::before {
    content: attr(placeholder);
    color: var(--text-muted, #999);
    pointer-events: none;
}

.wysiwyg-editor a {
    color: var(--primary-color);
    text-decoration: underline;
}
.wysiwyg-editor blockquote {
    border-left: 3px solid var(--primary-color);
    margin: 8px 0;
    padding: 6px 14px;
    color: var(--text-light);
    background: var(--bg-color);
    border-radius: 0 4px 4px 0;
}
.wysiwyg-editor h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 12px 0 6px;
}

/* WYSIWYG Content Editor */
.ligne-commentaire-content {
    min-height: 120px;
    padding: 12px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-color);
    outline: none;
    overflow-y: auto;
}

.ligne-commentaire-content:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-color)10;
}

.ligne-commentaire-content:empty:before {
    content: attr(placeholder);
    color: var(--text-light);
}

.ligne-commentaire-content ul,
.ligne-commentaire-content ol {
    margin: 8px 0;
    padding-left: 24px;
}

.ligne-commentaire-content li {
    margin: 4px 0;
}

.ligne-commentaire-content strong {
    font-weight: 600;
}

.ligne-commentaire-content em {
    font-style: italic;
}

.ligne-commentaire-content u {
    text-decoration: underline;
}

/* Responsive pour lignes spéciales */
@media (max-width: 768px) {
    .ligne-titre-grid,
    .ligne-commentaire-grid {
        flex-direction: column;
    }

    .wysiwyg-toolbar {
        flex-wrap: wrap;
    }
}

/* ========================================
   OCR Import - Drop Zone
   ======================================== */

.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--white);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.04);
}

.ocr-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: ocr-spin 0.8s linear infinite;
}

@keyframes ocr-spin {
    to { transform: rotate(360deg); }
}

.travaux-item {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.travaux-item:last-child {
    border-bottom: none;
}

/* =====================================================
   CLIENT MAP & NEARBY PROJECTS
   ===================================================== */

#client-mini-map {
    height: 220px;
    border-radius: 0;
    z-index: 1;
    transition: height 0.3s ease;
}

#client-mini-map.map-expanded {
    height: 450px;
}

#client-mini-map .leaflet-control-attribution {
    font-size: 10px;
}

.map-external-links {
    display: flex;
    gap: 8px;
    align-items: center;
}

.map-external-links a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-color);
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    transition: all 0.15s ease;
}

.map-external-links a:hover {
    border-color: var(--context-color);
    color: var(--context-color);
}

.map-message {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    color: var(--text-light);
    font-size: 13px;
    padding: 16px;
}

.map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 100px;
    color: var(--text-light);
    font-size: 13px;
}

/* Leaflet popup overrides */
.leaflet-popup-content-wrapper {
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

.leaflet-popup-content {
    margin: 10px 14px !important;
    font-size: 13px;
    line-height: 1.4;
}

.leaflet-popup-content strong {
    display: block;
    margin-bottom: 2px;
}

.leaflet-popup-content .popup-distance {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--bg-color);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    margin-top: 4px;
}

/* Nearby projects section */
.nearby-radius-select {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-size: 13px;
    background: var(--white);
    cursor: pointer;
}

.nearby-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: var(--context-color);
    color: white;
    font-size: 12px;
    font-weight: 600;
    margin-left: 8px;
}

.nearby-project-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s ease;
}

.nearby-project-item:last-child {
    border-bottom: none;
}

.nearby-project-item:hover {
    background: rgba(var(--context-color-rgb), 0.03);
    margin: 0 -16px;
    padding: 10px 16px;
}

.nearby-project-marker {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--success);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 700;
    margin-top: 2px;
}

.nearby-project-content {
    flex: 1;
    min-width: 0;
}

.nearby-project-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nearby-project-address {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}

.nearby-project-description {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.nearby-project-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.nearby-project-distance {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border-radius: 4px;
    background: rgba(76, 175, 80, 0.1);
    color: var(--success);
    font-size: 12px;
    font-weight: 600;
}

.nearby-project-date {
    font-size: 12px;
    color: var(--text-light);
}

.nearby-project-link {
    flex-shrink: 0;
    align-self: center;
    color: var(--text-light);
    transition: color 0.15s ease;
}

.nearby-project-link:hover {
    color: var(--context-color);
}

/* ============================================
   COMPOSANTS REUTILISABLES (extraits des vues)
   ============================================ */

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--primary-color);
}

input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* Role Badges */
.role-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.role-badge.superadmin {
    background: #ffebee;
    color: #c62828;
}

.role-badge.admin {
    background: #e3f2fd;
    color: #1565c0;
}

.role-badge.franchiseur {
    background: #f3e5f5;
    color: #7b1fa2;
}

.role-badge.commercial {
    background: #e8f5e9;
    color: #2e7d32;
}

.role-badge.user,
.role-badge.nouveau_franchise {
    background: #f5f5f5;
    color: #666;
}

/* Text utility classes */
.text-danger { color: #c62828; font-weight: 600; }
.text-warning { color: #e65100; font-weight: 600; }

/* Temperature & Candidat Badges */
.badge-froid { background: #e3f2fd; color: #1565c0; }
.badge-tiede { background: #fff3e0; color: #e65100; }
.badge-chaud { background: #ffebee; color: #c62828; }
.badge-nouveau { background: #e8f5e9; color: #2e7d32; }
.badge-en_cours { background: #e3f2fd; color: #1565c0; }
.badge-accepte { background: #c8e6c9; color: #1b5e20; }
.badge-stand_by { background: #fff9c4; color: #f57f17; }
.badge-sans_suite_vertikal { background: #ffcdd2; color: #b71c1c; }
.badge-sans_suite_candidat { background: #f5f5f5; color: #757575; }
.badge-approuve { background: #c8e6c9; color: #1b5e20; }
.badge-refuse { background: #ffcdd2; color: #b71c1c; }
.badge-perdu { background: #f5f5f5; color: #757575; }

/* RDV Status Badges */
.badge-en_attente { background: #fff3e0; color: #e65100; }
.badge-confirme { background: #e3f2fd; color: #1565c0; }
.badge-termine { background: #e8f5e9; color: #2e7d32; }
.badge-annule { background: #f5f5f5; color: #757575; text-decoration: line-through; }
.badge-prioritaire { background: #ffebee; color: #c62828; }
.badge-normal { background: #f5f5f5; color: #757575; }
.badge-telephonique { background: #e3f2fd; color: #1565c0; }
.badge-visio { background: #f3e5f5; color: #7b1fa2; }

/* Evolution Badges */
.evolution-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.evolution-badge.positive { background: #e8f5e9; color: #2e7d32; }
.evolution-badge.negative { background: #ffebee; color: #c62828; }
.evolution-badge.neutral { background: #f5f5f5; color: #757575; }

/* Filter Row */
.filters-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 13px;
    color: var(--text-light);
    white-space: nowrap;
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: white;
}

.filter-group input[type="date"] {
    width: 150px;
}

.btn-reset {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-light);
}

.btn-reset:hover {
    background: var(--background-color);
}

/* Detail Grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-item .label {
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
}

.detail-item .value {
    font-size: 14px;
    font-weight: 500;
}

/* Chart Card */
.chart-card {
    background: var(--card-background, white);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 20px;
}

.chart-card h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-container {
    position: relative;
    height: 300px;
}

/* Table Card */
.table-card {
    background: var(--card-background, white);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 20px;
}

.table-card h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
}

.table-card table {
    width: 100%;
    border-collapse: collapse;
}

.table-card th,
.table-card td {
    padding: 10px 8px;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

.table-card th {
    font-weight: 500;
    color: var(--text-light);
    font-size: 11px;
    text-transform: uppercase;
}

.table-card th:first-child,
.table-card td:first-child {
    text-align: left;
}

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

/* Info Card */
.info-card {
    background: var(--card-background, white);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 20px;
    margin-bottom: 20px;
}

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

.info-card-header h3 {
    margin: 0;
    font-size: 16px;
}

.info-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-row:last-child {
    border-bottom: none;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 2px solid white;
    box-shadow: 0 0 0 2px var(--primary-color);
}

.timeline-item .timeline-date {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.timeline-item .timeline-content {
    background: var(--background-light, #f8f9fa);
    padding: 12px;
    border-radius: 8px;
}

.timeline-item .timeline-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    margin-bottom: 4px;
}

.timeline-item .timeline-type.appel { background: #e3f2fd; color: #1565c0; }
.timeline-item .timeline-type.email { background: #f3e5f5; color: #7b1fa2; }
.timeline-item .timeline-type.rdv { background: #e8f5e9; color: #2e7d32; }
.timeline-item .timeline-type.note { background: #fff3e0; color: #e65100; }
.timeline-item .timeline-type.document { background: #fce4ec; color: #c2185b; }
.timeline-item .timeline-type.changement_statut { background: #e0f2f1; color: #00695c; }
.timeline-item .timeline-type.changement_temperature { background: #fff9c4; color: #f57f17; }
.timeline-item .timeline-type.dip { background: #ffe0b2; color: #e65100; }
.timeline-item .timeline-type.cloture { background: #ffcdd2; color: #c62828; }

/* Documents Zone (drag & drop) */
.documents-zone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.documents-zone:hover {
    border-color: var(--primary-color);
    background: rgba(25, 118, 210, 0.02);
}

.documents-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(25, 118, 210, 0.05);
}

.documents-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.document-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--background-light, #f8f9fa);
    border-radius: 6px;
    margin-bottom: 8px;
}

.document-item .doc-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
}

.document-item .doc-info {
    flex: 1;
}

.document-item .doc-name {
    font-weight: 500;
}

.document-item .doc-meta {
    font-size: 12px;
    color: var(--text-light);
}

/* Modal overlay active state (for pages using modal-overlay as wrapper) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-overlay.active {
    display: flex;
}

.modal-overlay .modal {
    display: block;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.loading-overlay.hidden {
    display: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--text-light);
    opacity: 0.5;
    margin-bottom: 16px;
}

.empty-state h3 {
    color: var(--text-color);
    margin: 0 0 8px 0;
    font-size: 18px;
}

.empty-state p {
    color: var(--text-light);
    margin: 0 0 20px 0;
    max-width: 400px;
}

/* Loading Placeholder */
.loading-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 400px;
    color: var(--text-light);
}

/* Execution Preview Table */
.execution-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.execution-preview-table th {
    background: var(--bg-color);
    padding: 8px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    border-bottom: 2px solid var(--border-color);
}

.execution-preview-table td {
    padding: 4px 6px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.execution-preview-table td:first-child {
    text-align: center;
}

.execution-preview-table input[type="checkbox"] {
    margin: 0;
}

/* Stock - Inline quantity input */
.inline-qty-input {
    transition: border-color 0.3s, background-color 0.3s;
}

.inline-qty-input:focus {
    outline: none;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.15);
}

.inline-qty-input:hover {
    border-color: var(--primary-color) !important;
}

/* Status Pipeline / Frise de statuts */
.client-status-pipeline {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 20px;
    background: var(--bg-color, #fff);
    border-radius: var(--border-radius, 8px);
    border: 1px solid var(--border-color, #e5e7eb);
    padding: 0;
    overflow: hidden;
}

.status-pipeline-step {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    background: transparent;
    border: none;
    white-space: nowrap;
}

.status-pipeline-step:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 20%;
    height: 60%;
    width: 1px;
    background: var(--border-color, #e5e7eb);
}

.status-pipeline-step:hover {
    background: var(--bg-secondary, #f9fafb);
}

.status-pipeline-step.active {
    font-weight: 700;
    color: #fff;
}

.status-pipeline-step.active.status-prospect {
    background: var(--warning-color, #37474F);
}
.status-pipeline-step.active.status-contact {
    background: #EF6C00;;
}
.status-pipeline-step.active.status-client {
    background: var(--success-color, #2E7D32);
}
.status-pipeline-step.active.status-client_facture {
    background: var(--primary-color, #2E7D32);
}
.status-pipeline-step.active.status-perdu {
    background: var(--danger-color, #df1b1b);
}

.status-pipeline-step .step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--border-color, #e5e7eb);
    color: var(--text-secondary, #6b7280);
    font-size: 11px;
    font-weight: 600;
    margin-right: 8px;
    flex-shrink: 0;
}

.status-pipeline-step.active .step-number {
    background: rgba(255,255,255,0.3);
    color: #fff;
}

.status-pipeline-step.completed .step-number {
    background: var(--success-color, #10b981);
    color: #fff;
}

.status-pipeline-step.completed {
    color: var(--success-color, #10b981);
}

/* ============================================================
   SEARCHABLE SELECT
   ============================================================ */

.searchable-select {
    position: relative;
}

.searchable-select-input {
    cursor: text;
}

.searchable-select-input.has-value {
    font-weight: 500;
}

.searchable-select-dropdown {
    display: none;
    position: absolute;
    z-index: 100;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 240px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.searchable-select-dropdown.open {
    display: block;
}

.searchable-select-option {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid var(--bg-light, #f5f5f5);
}

.searchable-select-option:last-child {
    border-bottom: none;
}

.searchable-select-option:hover,
.searchable-select-option.highlighted {
    background: var(--bg-light, #f5f5f5);
}

.searchable-select-option .client-details {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}

.searchable-select-empty {
    padding: 12px;
    text-align: center;
    color: var(--text-light);
    font-size: 13px;
}

/* ========== MOBILE BOTTOM BAR ========== */
.mobile-bottom-bar {
    display: none;
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--white);
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.08);
    z-index: 200;
    padding: 8px 6px;
    align-items: center;
    gap: 0;
    min-width: 280px;
    max-width: 340px;
    width: auto;
}

.mobile-bottom-bar-section {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.mobile-bottom-bar-section:not(:last-child) {
    border-right: 1px solid var(--border-color);
}

.mobile-bottom-bar-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 16px;
    border-radius: 40px;
    transition: background 0.2s;
    color: var(--text-color);
}

.mobile-bottom-bar-btn:hover,
.mobile-bottom-bar-btn:active {
    background: var(--bg-color);
}

.mobile-bottom-bar-btn svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.8;
}

.mobile-bottom-bar-btn span {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: lowercase;
}

/* Center section: context toggle */
.mobile-context-toggle {
    display: flex;
    align-items: center;
    background: var(--bg-color);
    border-radius: 30px;
    padding: 3px;
    gap: 2px;
}

.mobile-context-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 14px;
    border: none;
    background: transparent;
    border-radius: 30px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.mobile-context-btn.active {
    background: var(--context-color);
    color: white;
    box-shadow: 0 2px 6px rgba(var(--context-color-rgb), 0.3);
}

.mobile-context-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Right panel (bottom sheet) */
.mobile-more-sheet-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 199;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.mobile-more-sheet-overlay.open {
    display: block;
    opacity: 1;
}

.mobile-more-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-radius: 20px 20px 0 0;
    z-index: 201;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    padding: 12px 20px calc(16px + env(safe-area-inset-bottom, 0px));
    max-height: 70vh;
    overflow-y: auto;
}

.mobile-more-sheet.open {
    transform: translateY(0);
}

.mobile-more-sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--border-color);
    border-radius: 4px;
    margin: 0 auto 16px;
}

.mobile-more-sheet-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 8px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: var(--text-color);
    font-size: 15px;
    font-weight: 500;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.mobile-more-sheet-item:hover,
.mobile-more-sheet-item:active {
    background: var(--bg-color);
}

.mobile-more-sheet-item svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    color: var(--text-light);
}

.mobile-more-sheet-item .badge {
    background: var(--danger);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
    font-weight: 600;
}

.mobile-more-sheet-separator {
    height: 1px;
    background: var(--border-color);
    margin: 6px 0;
}

.mobile-more-sheet-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    padding: 4px 8px 8px;
}

.mobile-more-company-item.active {
    background: var(--bg-color);
    color: var(--primary-color);
}

.mobile-more-company-item.active svg {
    color: var(--primary-color);
}

.mobile-more-company-check {
    width: 18px !important;
    height: 18px !important;
    margin-left: auto;
    color: var(--primary-color) !important;
}

.mobile-more-sheet-item.external::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: auto;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%237F8C9F' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.5;
}

/* Left panel (sidebar overlay on mobile) */
.mobile-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 189;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.mobile-sidebar-overlay.open {
    display: block;
    opacity: 1;
}

/* Tables responsive scroll */
.table-responsive-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -2px;
    padding: 0 2px;
}

.table-responsive-wrapper .data-table {
    min-width: 600px;
}

@media (max-width: 768px) {
    /* Show mobile bottom bar */
    .mobile-bottom-bar {
        display: flex;
    }

    /* Simplify header on mobile */
    .context-switcher {
        display: none;
    }

    .header-right {
        display: none;
    }

    .header {
        padding: 0 16px;
        height: 56px;
        justify-content: center;
    }

    /* Adjust header height variable for mobile */
    :root {
        --header-height: 56px;
    }

    /* Sidebar mobile overlay mode */
    .sidebar {
        width: 280px;
        transform: translateX(-100%);
        z-index: 190;
        box-shadow: none;
        top: 0;
        padding-top: 20px;
        background: var(--white);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
    }

    .sidebar .sidebar-toggle {
        display: none;
    }

    .sidebar .sidebar-context-label {
        font-size: 16px;
        padding-left: 4px;
    }

    .sidebar .nav-menu {
        margin-top: 0;
    }

    /* Main content adjustments */
    .main-content {
        margin-left: 0;
        padding: 16px 12px;
        padding-bottom: 90px;
    }

    .sidebar.collapsed ~ .main-content {
        margin-left: 0;
    }

    /* ---- Content cards & containers ---- */
    .content-card {
        padding: 16px 12px;
        border-radius: 6px;
    }

    .content-header {
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 12px;
    }

    .content-title {
        font-size: 17px;
    }

    /* ---- Tabs ---- */
    .tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        gap: 0;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .tabs::-webkit-scrollbar {
        display: none;
    }

    .tab {
        padding: 10px 14px;
        font-size: 13px;
        flex-shrink: 0;
    }

    .tab-content {
        padding-top: 12px;
    }

    /* ---- Search & filters ---- */
    .actions-bar {
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 12px;
    }

    .search-box {
        max-width: 100%;
        width: 100%;
    }

    .filter-group {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    .filter-select {
        min-width: 0;
        flex: 1;
        font-size: 13px;
    }

    /* ---- Tables: scroll horizontal ---- */
    .tab-content,
    .content-card,
    .card {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        min-width: 580px;
    }

    .data-table th {
        padding: 10px 8px;
        font-size: 11px;
    }

    .data-table td {
        padding: 12px 8px;
        font-size: 13px;
    }

    .actions-cell {
        gap: 4px;
    }

    /* Touch targets: minimum 40px on mobile (Apple HIG: 44px, Material: 48px) */
    .action-icon,
    .icon-btn,
    .data-table th.sortable .sort-icons,
    .data-table--mobile-cards .icon-btn,
    .data-table--mobile-cards .action-icon {
        min-width: 40px;
        min-height: 40px;
    }

    .action-icon,
    .data-table--mobile-cards .icon-btn {
        width: 40px;
        height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* ---- Pagination ---- */
    .pagination {
        flex-wrap: wrap;
        gap: 10px;
        padding-top: 12px;
        margin-top: 12px;
    }

    .pagination-buttons button {
        padding: 6px 12px;
        font-size: 12px;
    }

    /* ---- KPI ---- */
    .kpi-container {
        gap: 10px;
        margin-bottom: 16px;
    }

    .kpi-card {
        padding: 16px;
        min-width: 140px;
    }

    .kpi-value {
        font-size: 24px;
    }

    .kpi-label {
        font-size: 11px;
    }

    /* ---- Buttons ---- */
    .btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    /* ---- Side panel full screen on mobile ---- */
    .side-panel {
        width: 100%;
        top: 0;
    }

    .side-panel-header {
        padding: 16px;
    }

    .side-panel-content {
        padding: 16px;
    }

    /* ---- Header mobile: back + title ---- */
    .header {
        justify-content: flex-start;
        gap: 8px;
    }

    .header .logo {
        display: none;
    }

    .mobile-header-back.has-back {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: transparent;
        border: none;
        border-radius: 8px;
        cursor: pointer;
        color: var(--text-color);
        flex-shrink: 0;
    }

    .mobile-header-back:active {
        background: var(--bg-color);
    }

    .mobile-header-title {
        display: block;
        font-size: 16px;
        font-weight: 600;
        color: var(--text-color);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
    }

    /* ---- Impersonation banner: compact on mobile ---- */
    .impersonate-banner {
        padding: 6px 10px;
        font-size: 12px;
        gap: 8px;
    }

    .impersonate-banner-text {
        font-size: 11px;
    }

    .impersonate-banner-btn {
        padding: 5px 10px;
        font-size: 11px;
    }

    .impersonate-banner-btn-full {
        display: none;
    }

    .impersonate-banner-btn-short {
        display: inline;
    }

    /* When impersonating, push the floating bottom-bar above the banner */
    body.is-impersonating .mobile-bottom-bar {
        bottom: 50px;
    }

    /* ---- Collapsible filters on mobile ----
       Click "Filtres" button to toggle visibility of all non-essential filters.
       Search box stays always visible. */
    .actions-bar .mobile-filters-toggle {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        background: var(--white);
        border: 1px solid var(--border-color);
        border-radius: 6px;
        padding: 8px 12px;
        font-size: 13px;
        cursor: pointer;
        color: var(--text-color);
    }

    .actions-bar .mobile-filters-toggle:active {
        background: var(--bg-color);
    }

    /* When closed: hide all secondary filter elements (everything except search and toggle) */
    .actions-bar[data-mobile-filters="closed"] > *:not(.search-box):not(.mobile-filters-toggle) {
        display: none !important;
    }

    /* ---- WYSIWYG toolbars: scroll horizontally on mobile (no truncation) ---- */
    .wysiwyg-toolbar,
    .travaux-wysiwyg-toolbar {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .wysiwyg-toolbar > *,
    .travaux-wysiwyg-toolbar > * {
        flex-shrink: 0;
    }

    .wysiwyg-btn {
        min-width: 36px;
        min-height: 36px;
    }

    /* ---- Mobile FAB (Floating Action Button) ---- */
    .mobile-fab {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        right: 20px;
        bottom: 96px;  /* clear the bottom-bar (64px pill + 16px gap + extra) */
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--primary, #1d4ed8);
        color: #fff;
        text-decoration: none;
        border: none;
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(0,0,0,0.18);
        z-index: 199;
        transition: transform 0.15s, box-shadow 0.15s;
    }

    .mobile-fab:hover,
    .mobile-fab:active {
        transform: scale(0.96);
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    }

    body.is-impersonating .mobile-fab {
        bottom: 130px;
    }

    /* ---- KPI strip: fade indicator on right ---- */
    .kpi-container {
        position: relative;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        padding-right: 24px;
        -webkit-mask-image: linear-gradient(to right, black calc(100% - 24px), transparent 100%);
                mask-image: linear-gradient(to right, black calc(100% - 24px), transparent 100%);
    }

    .kpi-container::-webkit-scrollbar {
        display: none;
    }

    .kpi-container .kpi-card {
        scroll-snap-align: start;
        min-width: 160px;
    }
}

/* ============================================
   MOBILE CARD VIEW for data tables
   Activate by adding class "data-table--mobile-cards"
   on the <table>. Each row becomes a card on mobile.
   ============================================ */
@media (max-width: 768px) {
    .data-table--mobile-cards,
    .data-table--mobile-cards thead,
    .data-table--mobile-cards tbody,
    .data-table--mobile-cards tr,
    .data-table--mobile-cards td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .data-table--mobile-cards {
        min-width: 0 !important;
    }

    .data-table--mobile-cards thead {
        display: none;
    }

    .data-table--mobile-cards tbody tr {
        background: var(--white);
        border: 1px solid var(--border-color);
        border-radius: 10px;
        padding: 12px 14px;
        margin-bottom: 12px;
        box-shadow: 0 1px 2px rgba(0,0,0,0.03);
        cursor: pointer;
    }

    .data-table--mobile-cards tbody tr:hover {
        background: var(--white);
    }

    .data-table--mobile-cards td {
        padding: 4px 0;
        border: none;
        font-size: 14px;
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 12px;
    }

    .data-table--mobile-cards td::before {
        content: attr(data-label);
        font-weight: 500;
        color: var(--text-light);
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        flex-shrink: 0;
    }

    /* No label = primary identity row (client name, ref). Show big, full-width. */
    .data-table--mobile-cards td.cell-primary {
        font-size: 16px;
        font-weight: 600;
        padding-bottom: 6px;
        margin-bottom: 6px;
        border-bottom: 1px solid var(--border-color);
        justify-content: flex-start;
    }

    .data-table--mobile-cards td.cell-primary::before {
        display: none;
    }

    /* Hide bulk-select checkbox + sort handles on mobile */
    .data-table--mobile-cards td.cell-checkbox,
    .data-table--mobile-cards td.cell-hide-mobile {
        display: none;
    }

    /* Actions cell: bottom strip, right aligned */
    .data-table--mobile-cards td.cell-actions {
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid var(--border-color);
        justify-content: flex-end;
    }

    .data-table--mobile-cards td.cell-actions::before {
        display: none;
    }

    .data-table--mobile-cards td.cell-actions .icon-btn,
    .data-table--mobile-cards td.cell-actions .action-icon {
        width: 38px;
        height: 38px;
    }

    /* Empty-row td (colspan span) — keep table-like full width */
    .data-table--mobile-cards td[colspan] {
        text-align: center;
        padding: 24px 12px !important;
    }
    .data-table--mobile-cards td[colspan]::before {
        display: none;
    }

    /* Truncated text: long-press to reveal full content via :focus state.
       Combined with title attribute for accessibility. */
    .data-table--mobile-cards td {
        position: relative;
    }

    /* Form labels & tab labels: allow wrap on mobile so nothing gets cut off */
    label,
    .tab,
    .form-row label {
        white-space: normal;
        word-wrap: break-word;
    }

    /* When mobile-cards is active, table doesn't need a scroll wrapper */
    .data-table--mobile-cards-wrap .content-card {
        overflow-x: visible;
    }
}

/* =====================================================
   ASSISTANT VERTIKAL (chatbot IA)
   ===================================================== */

.chatbot-layout {
    max-width: 1120px;
    display: flex;
    gap: 16px;
    align-items: stretch;
}

/* Colonne des conversations (page /assistant) */
.chatbot-convs {
    width: 250px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chatbot-convs-list {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.chatbot-convs-empty {
    padding: 14px;
    font-size: 13px;
    color: var(--text-light);
    text-align: center;
}

.chatbot-conv-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--text-color);
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.12s;
}
.chatbot-conv-item:last-child { border-bottom: none; }
.chatbot-conv-item:hover { background: var(--bg-color); }
.chatbot-conv-item.active {
    background: rgba(var(--context-color-rgb), 0.08);
    border-left: 3px solid var(--context-color);
    padding-left: 9px;
}

.chatbot-conv-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chatbot-conv-delete {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 3px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    opacity: 0;
    transition: opacity 0.12s, color 0.12s;
}
.chatbot-conv-item:hover .chatbot-conv-delete { opacity: 1; }
.chatbot-conv-delete:hover { color: var(--danger); }

@media (max-width: 900px) {
    .chatbot-layout { flex-direction: column; }
    .chatbot-convs { width: 100%; }
    .chatbot-convs-list { max-height: 180px; }
}

.chatbot-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height) - 180px);
    min-height: 480px;
}

.chatbot-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-light);
}

.chatbot-status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--warning);
    flex-shrink: 0;
}
.chatbot-status-dot.ok { background: var(--success); }
.chatbot-status-dot.ko { background: var(--danger); }

.chatbot-reset {
    margin-left: auto;
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.chatbot-welcome {
    color: var(--text-light);
    font-size: 14px;
    padding: 8px 4px;
}

.chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.chatbot-suggestion {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 7px 14px;
    font-size: 13px;
    color: var(--text-color);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    text-align: left;
}
.chatbot-suggestion:hover {
    border-color: var(--context-color);
    background: rgba(var(--context-color-rgb), 0.06);
}

.chatbot-msg {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}
.chatbot-msg-user { align-self: flex-end; align-items: flex-end; }
.chatbot-msg-assistant, .chatbot-msg-error { align-self: flex-start; }

.chatbot-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.55;
}
.chatbot-msg-user .chatbot-bubble {
    background: var(--context-color);
    color: var(--white);
    border-bottom-right-radius: 4px;
}
.chatbot-msg-assistant .chatbot-bubble {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}
.chatbot-msg-error .chatbot-bubble {
    background: rgba(255, 87, 34, 0.08);
    border: 1px solid rgba(255, 87, 34, 0.3);
    color: var(--danger);
}

.chatbot-bubble p { margin: 0 0 8px; }
.chatbot-bubble p:last-child { margin-bottom: 0; }
.chatbot-bubble ul { margin: 4px 0 8px; padding-left: 20px; }
.chatbot-bubble li { margin-bottom: 3px; }
.chatbot-bubble code {
    background: rgba(0, 0, 0, 0.06);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 13px;
}
.chatbot-msg-user .chatbot-bubble code { background: rgba(255, 255, 255, 0.2); }

.chatbot-sources {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
    padding: 0 4px;
}

.chatbot-typing {
    display: flex;
    gap: 4px;
    padding: 12px 14px;
    align-self: flex-start;
}
.chatbot-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-light);
    animation: chatbot-blink 1.2s infinite;
}
.chatbot-typing span:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatbot-blink {
    0%, 60%, 100% { opacity: 0.25; }
    30% { opacity: 1; }
}

.chatbot-input-bar {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    padding: 14px 16px;
    border-top: 1px solid var(--border-color);
}

.chatbot-input-bar textarea {
    flex: 1;
    resize: none;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.4;
    max-height: 140px;
    outline: none;
}
.chatbot-input-bar textarea:focus {
    border-color: var(--context-color);
}

.chatbot-input-bar .btn {
    padding: 10px 14px;
}

.chatbot-disclaimer {
    font-size: 11px;
    color: var(--text-light);
    text-align: center;
    padding: 0 16px 12px;
    margin: 0;
}

@media (max-width: 768px) {
    .chatbot-card {
        height: calc(100vh - var(--header-height) - 130px);
    }
    .chatbot-msg { max-width: 95%; }
}

/* --- Widget flottant de l'assistant --- */

.chatbot-fab {
    position: fixed;
    bottom: 22px;
    right: 22px;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: none;
    background: var(--context-color);
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
    z-index: 1090;
    transition: transform 0.15s, box-shadow 0.15s;
}
.chatbot-fab:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}

.chatbot-widget {
    position: fixed;
    bottom: 88px;
    right: 22px;
    width: 390px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 120px);
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    z-index: 1091;
    overflow: hidden;
}
.chatbot-widget[hidden] { display: none; }

.chatbot-widget-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    background: var(--context-color);
    color: var(--white);
}

.chatbot-widget-title {
    font-size: 14px;
    font-weight: 600;
    margin-right: auto;
}

.chatbot-widget-action {
    background: none;
    border: none;
    color: var(--white);
    opacity: 0.85;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    border-radius: 4px;
}
.chatbot-widget-action:hover { opacity: 1; background: rgba(255, 255, 255, 0.15); }

.chatbot-widget .chatbot-messages { padding: 14px; }
.chatbot-widget .chatbot-msg { max-width: 92%; }
.chatbot-widget .chatbot-input-bar { padding: 10px 12px; }

@media (max-width: 600px) {
    .chatbot-widget {
        right: 8px;
        bottom: 80px;
        height: 70vh;
    }
    .chatbot-fab { bottom: 16px; right: 16px; }
}

/* Volet conversations du widget flottant */
.chatbot-w-convs {
    position: absolute;
    top: 42px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--white);
    z-index: 2;
    display: flex;
    flex-direction: column;
    padding: 10px;
}
.chatbot-w-convs[hidden] { display: none; }
.chatbot-w-convs .chatbot-convs-list { flex: 1; }
.chatbot-widget { position: fixed; } /* rappel : conteneur de positionnement du volet */
.chatbot-w-convs .chatbot-conv-item .chatbot-conv-delete { opacity: 1; }

/* --- Page superadmin : accès Assistant VERTIKAL --- */

.chatbot-access-info {
    background: rgba(var(--context-color-rgb), 0.06);
    border: 1px solid rgba(var(--context-color-rgb), 0.2);
    border-radius: var(--border-radius);
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-color);
    line-height: 1.5;
}

.chatbot-access-table {
    width: 100%;
    border-collapse: collapse;
}
.chatbot-access-table th,
.chatbot-access-table td {
    padding: 10px 14px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}
.chatbot-access-table th {
    background: var(--bg-color);
    font-weight: 600;
    font-size: 12px;
    color: var(--text-light);
}
.chatbot-access-table .role-col {
    text-align: center;
    width: 130px;
}
.chatbot-access-table tbody tr:hover { background: var(--bg-color); }
.chatbot-access-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--context-color);
}
.chatbot-access-table .toggle-all {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 400;
    font-size: 11px;
    color: var(--text-light);
    cursor: pointer;
    margin-top: 4px;
}
.chatbot-access-table .toggle-all input[type="checkbox"] {
    width: 13px;
    height: 13px;
}

/* Dérogations par compte : sociétés dépliables + tri-état par utilisateur */
.access-expand-btn {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--text-color);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.access-expand-btn:hover { color: var(--context-color); }
.access-chevron {
    font-size: 11px;
    color: var(--text-light);
    width: 12px;
}
.access-user-count {
    font-size: 11px;
    color: var(--text-light);
    font-weight: 400;
}
.access-users-row td {
    background: var(--bg-color);
    padding: 6px 14px 10px 32px;
}
.access-users-row:hover td { background: var(--bg-color); }
.access-users-empty {
    font-size: 12px;
    color: var(--text-light);
    padding: 6px 0;
}
.access-user-line {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
    border-bottom: 1px dashed var(--border-color);
}
.access-user-line:last-child { border-bottom: none; }
.access-user-name {
    min-width: 180px;
    font-size: 13px;
}
.access-user-role {
    font-size: 11px;
    color: var(--text-light);
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1px 8px;
    min-width: 70px;
    text-align: center;
}
.access-override-select {
    font-size: 12px;
    padding: 3px 6px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-bg, #fff);
    color: var(--text-color);
    cursor: pointer;
}
.access-effective {
    font-size: 11px;
    font-weight: 500;
    border-radius: 10px;
    padding: 2px 8px;
    margin-left: auto;
}
.access-effective-on  { background: #dcfce7; color: #15803d; }
.access-effective-off { background: #fee2e2; color: #b91c1c; }

/* --- Multi-agents de l'assistant --- */

.chatbot-agents {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.chatbot-agent-chip {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-color);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.chatbot-agent-chip:hover {
    border-color: var(--context-color);
}
.chatbot-agent-chip.active {
    background: var(--context-color);
    border-color: var(--context-color);
    color: var(--white);
}
.chatbot-agent-chip.disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.chatbot-conv-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chatbot-conv-agent {
    align-self: flex-start;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 1px 7px;
    border-radius: 9px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-light);
}
.chatbot-conv-agent-commercial { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.chatbot-conv-agent-marketing  { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.chatbot-conv-agent-gestion    { background: #fefce8; border-color: #fde68a; color: #a16207; }
