/* LBL CRM — Flux Dashboard design tokens (hex, compatibles mobile) */
:root {
    --radius: 0.875rem;
    --background: #fafafb;
    --foreground: #1a1a2e;
    --card: #ffffff;
    --card-foreground: #1a1a2e;
    --primary: #7c3aed;
    --primary-foreground: #fafafb;
    --secondary: #f4f4f8;
    --secondary-foreground: #2d2d44;
    --muted: #f4f4f8;
    --muted-foreground: #73738c;
    --accent: #3b82f6;
    --accent-foreground: #fafafb;
    --destructive: #ef4444;
    --destructive-foreground: #fafafb;
    --success: #22c55e;
    --success-foreground: #fafafb;
    --warning: #f59e0b;
    --warning-foreground: #2d2d44;
    --border: #e8e8ef;
    --input: #e8e8ef;
    --ring: #7c3aed;
    --sidebar: #fafafb;
    --sidebar-foreground: #3d3d5c;
    --sidebar-accent: #f0f0f7;
    --sidebar-primary: #7c3aed;
    --sidebar-border: #e8e8ef;
}

html {
    overflow-x: clip;
}

@supports not (overflow: clip) {
    html {
        overflow-x: hidden;
    }
}

body {
    overflow-x: clip;
    width: 100%;
    max-width: 100vw;
    background-color: var(--background);
    color: var(--foreground);
}

@supports not (overflow: clip) {
    body {
        overflow-x: hidden;
    }
}

/* Fallback couleurs Tailwind si CDN indisponible */
.bg-background { background-color: var(--background); }
.bg-card { background-color: var(--card); }
.bg-primary { background-color: var(--primary); }
.bg-muted { background-color: var(--muted); }
.bg-sidebar { background-color: var(--sidebar); }
.bg-sidebar-accent { background-color: var(--sidebar-accent); }
.text-foreground { color: var(--foreground); }
.text-primary { color: var(--primary); }
.text-primary-foreground { color: var(--primary-foreground); }
.text-muted-foreground { color: var(--muted-foreground); }
.text-sidebar-foreground { color: var(--sidebar-foreground); }
.text-sidebar-primary { color: var(--sidebar-primary); }
.border-border { border-color: var(--border); }
.border-sidebar-border { border-color: var(--sidebar-border); }

.crm-app {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
}

.crm-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.625rem 0.75rem;
    min-height: 3.5rem;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.92);
    padding: 0.625rem 1rem;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.crm-header-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: calc(var(--radius) - 4px);
    padding: 0.375rem;
    color: var(--muted-foreground);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.crm-header-menu-toggle:hover {
    background: var(--muted);
    color: var(--foreground);
}

@media (min-width: 1024px) {
    .crm-header-menu-toggle {
        display: none;
    }
}

.crm-header-title {
    min-width: 0;
    flex: 1 1 auto;
}

@media (min-width: 640px) {
    .crm-header {
        flex-wrap: nowrap;
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.crm-main {
    min-width: 0;
    width: 100%;
}

@media (min-width: 1024px) {
    .crm-app {
        padding-left: 260px;
    }
}

@media (max-width: 1023px) {
    .crm-app {
        padding-left: 0;
    }
}

/* Cards */
.crm-card {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--card-foreground);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.crm-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    padding: 0.875rem 1rem;
}

.crm-dashboard-compact-card .crm-card-header {
    padding: 0.3125rem 0.5rem;
}

.crm-dashboard-compact-card .crm-card-header h3 {
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--foreground);
}

.crm-dashboard-compact-link {
    font-size: 0.5625rem;
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
}

.crm-dashboard-compact-link:hover {
    text-decoration: underline;
}

.crm-dashboard-compact-list {
    overflow: visible;
}

.crm-dashboard-compact-empty {
    margin: 0;
    padding: 0.3125rem 0.5rem;
    text-align: center;
    font-size: 0.5625rem;
    line-height: 1.2;
    color: var(--muted-foreground);
}

.crm-dashboard-list-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    text-decoration: none;
    color: inherit;
}

.crm-dashboard-list-row:hover {
    background: color-mix(in srgb, var(--muted) 40%, transparent);
}

.crm-dashboard-list-avatar.crm-client-avatar {
    width: 1.5rem;
    height: 1.5rem;
    font-size: 0.5rem;
    margin-bottom: 0;
    box-shadow: none;
}

.crm-dashboard-list-body {
    min-width: 0;
    flex: 1;
}

.crm-dashboard-list-title {
    display: block;
    font-size: 0.625rem;
    font-weight: 500;
    line-height: 1.25;
    color: var(--foreground);
    word-break: break-word;
}

.crm-dashboard-list-meta {
    display: block;
    margin-top: 0.0625rem;
    font-size: 0.5625rem;
    line-height: 1.25;
    color: var(--muted-foreground);
    word-break: break-word;
}

.crm-dashboard-today-notes .crm-card-header {
    padding: 0.3125rem 0.5rem;
}

.crm-dashboard-today-notes .crm-card-header h3 {
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.2;
}

.crm-dashboard-today-notes .crm-card-header a {
    font-size: 0.5625rem;
}

.crm-dashboard-today-notes-body {
    overflow: visible;
}

.crm-dashboard-note-row,
.crm-dashboard-note-item {
    display: block;
    padding: 0.1875rem 0.5rem;
    text-decoration: none;
    color: inherit;
}

.crm-dashboard-note-row:hover {
    background: color-mix(in srgb, var(--muted) 40%, transparent);
}

.crm-dashboard-note-content {
    min-width: 0;
}

.crm-dashboard-note-title {
    margin: 0;
    font-size: 0.625rem;
    font-weight: 500;
    line-height: 1.25;
    color: var(--foreground);
    word-break: break-word;
}

.crm-dashboard-note-meta {
    margin: 0.0625rem 0 0;
    font-size: 0.5625rem;
    line-height: 1.25;
    color: var(--muted-foreground);
    word-break: break-word;
}

.crm-dashboard-today-notes-empty {
    margin: 0;
    padding: 0.3125rem 0.5rem;
    text-align: center;
    font-size: 0.5625rem;
    line-height: 1.2;
    color: var(--muted-foreground);
}

.crm-dashboard-notes-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: stretch;
}

@media (min-width: 1024px) {
    .crm-dashboard-notes-actions {
        grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
    }
}

.crm-dashboard-info-column,
.crm-dashboard-actions-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-self: start;
    min-width: 0;
}

.crm-dashboard-info-column > .crm-card,
.crm-dashboard-actions-column > .crm-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.crm-dashboard-quick-actions .crm-card-header {
    padding: 0.5rem 0.75rem;
}

.crm-dashboard-quick-actions .crm-card-header h3 {
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.25;
}

.crm-dashboard-quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    padding: 0.625rem 0.75rem 0.75rem;
    align-content: start;
}

/* Tableau de bord — pas de caret clignotant sur texte non éditable */
body[data-current-page="dashboard"] .crm-main :is(
    .crm-stat-card,
    .crm-stat-card-label,
    .crm-stat-card-value,
    .crm-stat-card-badge,
    .crm-dashboard-list-row,
    .crm-dashboard-list-title,
    .crm-dashboard-list-meta,
    .crm-dashboard-note-row,
    .crm-dashboard-note-item,
    .crm-dashboard-note-title,
    .crm-dashboard-note-meta,
    .crm-dashboard-compact-empty,
    .crm-dashboard-today-notes-empty,
    .crm-dashboard-compact-card h3,
    .crm-dashboard-compact-link,
    .crm-quick-action,
    .crm-quick-action-label
) {
    caret-color: transparent;
}

.crm-quick-action {
    position: relative;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 0.375rem;
    padding: 0.4375rem 0.625rem;
    border-radius: calc(var(--radius) - 4px);
    border: 1px solid transparent;
    text-decoration: none;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.crm-quick-action::before {
    content: '';
    position: absolute;
    top: -1rem;
    right: -1rem;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.22);
    pointer-events: none;
}

.crm-quick-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
}

.crm-quick-action-icon {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.375rem;
    height: 1.375rem;
    flex-shrink: 0;
    border-radius: calc(var(--radius) - 4px);
    background: rgba(255, 255, 255, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.24);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.crm-quick-action-icon .crm-field-icon {
    width: 0.875rem;
    height: 0.875rem;
    color: #fff;
}

.crm-quick-action-label {
    position: relative;
    z-index: 1;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.2;
    color: #fff;
    white-space: nowrap;
}

.crm-quick-action-client {
    background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%);
    border-color: rgba(124, 58, 237, 0.35);
}

.crm-quick-action-contrat {
    background: linear-gradient(135deg, #2563eb 0%, #0891b2 100%);
    border-color: rgba(37, 99, 235, 0.35);
}

.crm-quick-action-note {
    background: linear-gradient(135deg, #ea580c 0%, #f59e0b 100%);
    border-color: rgba(234, 88, 12, 0.35);
}

.crm-quick-action-task {
    background: linear-gradient(135deg, #059669 0%, #14b8a6 100%);
    border-color: rgba(5, 150, 105, 0.35);
}

.crm-stat-card {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
    padding: 1rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
}

.crm-stat-card:hover {
    border-color: #dcdce8;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.08);
}

.crm-stat-card-gradient {
    position: relative;
    overflow: hidden;
    border: none;
    padding: 0;
    color: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.crm-stat-card-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
}

.crm-stat-card-clients {
    background: linear-gradient(135deg, #7c3aed 0%, #6366f1 52%, #4f46e5 100%);
}

.crm-stat-card-contrats {
    background: linear-gradient(135deg, #2563eb 0%, #0284c7 52%, #0891b2 100%);
}

.crm-stat-card-taches {
    background: linear-gradient(135deg, #ea580c 0%, #f59e0b 52%, #d97706 100%);
}

.crm-stat-card-glow {
    position: absolute;
    top: -2.5rem;
    right: -2.5rem;
    width: 8rem;
    height: 8rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.14);
    pointer-events: none;
}

.crm-stat-card-glow::after {
    content: '';
    position: absolute;
    bottom: -4.5rem;
    left: -6rem;
    width: 7rem;
    height: 7rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.08);
}

.crm-stat-card-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 1.125rem 1rem 1rem;
}

.crm-stat-card-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: calc(var(--radius) - 2px);
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.crm-stat-card-icon .crm-field-icon {
    width: 1.375rem;
    height: 1.375rem;
    color: #fff;
}

.crm-stat-card-body {
    min-width: 0;
    flex: 1;
}

.crm-stat-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.crm-stat-card-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: rgba(255, 255, 255, 0.88);
}

.crm-stat-card-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #fff;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.22);
}

.crm-stat-card-value {
    margin-top: 0.375rem;
    font-size: 1.75rem;
    line-height: 1.1;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

/* ---- Compact responsive tables (Flux style) ---- */
.crm-table-card {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
    overflow: hidden;
}

.crm-table-scroll {
    position: relative;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.crm-table-scroll:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: -2px;
}

/* Pas de caret clignotant sur les zones focusables non éditables (tableaux, lignes cliquables). */
.crm-app [tabindex="0"]:not(input):not(textarea):not(select):not([contenteditable="true"]) {
    caret-color: transparent;
}

/* Libellés et valeurs en lecture seule — pas de caret au clic. */
.crm-info-label,
.crm-editable-label,
.crm-label,
.crm-dt {
    caret-color: transparent;
}

.crm-info-value,
.crm-editable-field:not(.is-editing) .crm-editable-value,
.crm-field-readonly .crm-editable-value {
    caret-color: transparent;
}

.crm-table {
    width: 100%;
    min-width: 640px;
    caption-side: bottom;
    border-collapse: collapse;
    font-size: 0.8125rem;
    line-height: 1.25rem;
    text-align: left;
}

.crm-table thead tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.crm-table th {
    height: 2rem;
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--foreground);
    white-space: nowrap;
    vertical-align: middle;
    background: var(--muted);
}

/* En-têtes de colonnes triables. */
.crm-th-sort {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s;
}

.crm-th-sort:hover {
    color: var(--primary);
}

.crm-th-sort.is-active {
    color: var(--primary);
    font-weight: 600;
}

.crm-th-sort-arrow {
    font-size: 0.5rem;
    line-height: 1;
}

.crm-table td {
    padding: 0.375rem 0.5rem;
    color: var(--foreground);
    white-space: nowrap;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
}

.crm-table tbody tr {
    transition: background 0.15s;
}

.crm-table tbody tr:hover {
    background: rgba(244, 244, 248, 0.5);
}

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

.crm-table .cell-muted {
    color: var(--muted-foreground);
}

.crm-table .cell-link {
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
}

.crm-table .cell-link:hover {
    color: #6d28d9;
    text-decoration: underline;
}

.crm-table .cell-mono {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.crm-table-empty td {
    padding: 2rem 0.5rem;
    text-align: center;
    color: var(--muted-foreground);
    white-space: normal;
}

.crm-table-compact th {
    height: 1.625rem;
    padding: 0.25rem 0.4375rem;
    font-size: 0.6875rem;
}

.crm-table-compact td {
    padding: 0.25rem 0.4375rem;
    font-size: 0.75rem;
}

.crm-table-compact .crm-cell-name {
    font-weight: 500;
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crm-table-compact .cell-mono {
    font-size: 0.6875rem;
}

.crm-table-compact .crm-col-actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.crm-users-table-card .crm-scroll-hint {
    display: none;
}

.crm-table-users th,
.crm-table-users td {
    padding: 0.125rem 0.3125rem;
    font-size: 0.625rem;
    line-height: 1.2;
}

.crm-table-users .crm-user-cell-name {
    font-weight: 500;
    color: var(--foreground);
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-user-name-btn {
    display: inline;
    max-width: 100%;
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    font-weight: 500;
    color: inherit;
    cursor: pointer;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-user-name-btn:hover {
    color: hsl(var(--primary));
    text-decoration: underline;
}

.crm-table-users .crm-user-cell-email {
    font-size: 0.625rem;
    max-width: 11rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-table-users .crm-user-cell-email .cell-link {
    color: inherit;
}

.crm-table-users .crm-user-cell-email .cell-link:hover {
    color: var(--primary);
}

.crm-table-users .crm-user-role {
    font-size: 0.625rem;
    color: var(--muted-foreground);
    white-space: nowrap;
}

.crm-table-users .crm-user-last-login {
    font-size: 0.625rem;
    white-space: nowrap;
}

.crm-table-users .crm-user-ip {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.625rem;
    white-space: nowrap;
}

.crm-table-users .crm-user-device {
    font-size: 0.625rem;
    max-width: 7rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-table-users .crm-status-sm {
    padding: 0.0625rem 0.3125rem;
    font-size: 0.5625rem;
}

.crm-table-users .crm-col-actions .crm-btn-icon-xs svg {
    width: 0.75rem;
    height: 0.75rem;
}

.crm-user-history {
    margin-top: 0.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.crm-user-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
}

.crm-user-history-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--foreground);
}

.crm-user-history-count {
    font-size: 0.625rem;
    color: var(--muted-foreground);
}

.crm-user-history-table-wrap {
    max-height: 9rem;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
}

.crm-user-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.625rem;
}

.crm-user-history-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--muted);
    padding: 0.25rem 0.375rem;
    text-align: left;
    font-weight: 600;
    color: var(--muted-foreground);
    white-space: nowrap;
}

.crm-user-history-table td {
    padding: 0.25rem 0.375rem;
    border-top: 1px solid var(--border);
    vertical-align: top;
}

.crm-user-history-date {
    white-space: nowrap;
    color: var(--muted-foreground);
}

.crm-user-history-detail {
    color: var(--foreground);
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-user-history-empty {
    padding: 0.625rem;
    text-align: center;
    color: var(--muted-foreground);
}

.crm-user-history-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.375rem;
}

.crm-user-history-page {
    font-size: 0.625rem;
    color: var(--muted-foreground);
    min-width: 3rem;
    text-align: center;
}

.crm-client-history {
    margin-top: 0;
}

.crm-client-history-table-wrap {
    max-height: 11rem;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
}

.crm-client-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.5625rem;
    line-height: 1.35;
}

.crm-client-history-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--muted);
    padding: 0.2rem 0.3rem;
    text-align: left;
    font-weight: 600;
    color: var(--muted-foreground);
    white-space: nowrap;
}

.crm-client-history-table td {
    padding: 0.2rem 0.3rem;
    border-top: 1px solid var(--border);
    vertical-align: top;
}

.crm-client-history-date {
    white-space: nowrap;
    color: var(--muted-foreground);
}

.crm-client-history-table-name {
    white-space: nowrap;
    font-weight: 600;
}

.crm-client-history-detail {
    color: var(--foreground);
    word-break: break-word;
}

.crm-client-history-empty {
    padding: 0.5rem;
    text-align: center;
    color: var(--muted-foreground);
}

.crm-client-history-row.hidden {
    display: none;
}

.crm-badge-sm {
    padding: 0.0625rem 0.375rem;
    font-size: 0.625rem;
}

.crm-status-sm {
    padding: 0.0625rem 0.375rem;
    font-size: 0.625rem;
}

.crm-btn-xs {
    padding: 0.1875rem 0.4375rem;
    font-size: 0.6875rem;
    min-height: 1.5rem;
}

.crm-scroll-hint {
    display: block;
    padding: 0.375rem 0.75rem;
    font-size: 0.625rem;
    color: var(--muted-foreground);
    text-align: center;
    border-bottom: 1px solid var(--border);
    background: var(--muted);
}

@media (min-width: 1024px) {
    .crm-scroll-hint {
        display: none;
    }
}

/* Toolbar responsive */
.crm-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

@media (min-width: 640px) {
    .crm-toolbar {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
        gap: 0.75rem;
    }
}

.crm-toolbar-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

@media (min-width: 640px) {
    .crm-toolbar-form {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        flex: 1;
    }
}

.crm-toolbar-search {
    position: relative;
    width: 100%;
}

@media (min-width: 640px) {
    .crm-toolbar-search {
        flex: 1;
        min-width: 12rem;
        max-width: 22rem;
    }
}

.crm-toolbar-search-icon {
    pointer-events: none;
    position: absolute;
    left: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0.875rem;
    height: 0.875rem;
    color: var(--muted-foreground);
}

.crm-toolbar-search .crm-input {
    width: 100%;
    padding-left: 2rem;
}

.crm-toolbar-heading {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--foreground);
    line-height: 1.3;
    white-space: nowrap;
}

.crm-notes-page-toolbar .crm-toolbar-form {
    align-items: center;
}

@media (min-width: 640px) {
    .crm-notes-page-toolbar .crm-toolbar-heading {
        margin-left: 0.75rem;
        flex: 1;
        min-width: 0;
    }
}

.crm-clients-page-toolbar .crm-toolbar-form,
.crm-contrats-page-toolbar .crm-toolbar-form {
    align-items: center;
}

@media (min-width: 640px) {
    .crm-clients-page-toolbar .crm-toolbar-form,
    .crm-contrats-page-toolbar .crm-toolbar-form {
        flex-wrap: nowrap;
    }

    .crm-clients-page-toolbar .crm-toolbar-search,
    .crm-contrats-page-toolbar .crm-toolbar-search {
        flex: 1 1 auto;
        width: auto;
        min-width: 12rem;
        max-width: 22rem;
    }

    .crm-contrats-page-toolbar {
        flex-wrap: wrap;
        align-items: center;
    }

    .crm-contrats-page-toolbar .crm-toolbar-export-form {
        flex: 1 1 100%;
    }
}

.crm-toolbar-export-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    width: 100%;
}

.crm-toolbar-export-form .crm-select {
    min-width: 8.5rem;
    max-width: 14rem;
    flex: 1 1 8.5rem;
}

button.crm-toolbar-export-btn {
    cursor: pointer;
    font-family: inherit;
}

.crm-toolbar-export-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4375rem;
    flex-shrink: 0;
    height: 2.125rem;
    padding: 0 0.875rem;
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--border));
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--primary) 10%, #ffffff) 0%,
        color-mix(in srgb, var(--primary) 4%, #ffffff) 100%
    );
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    box-shadow:
        0 1px 0 color-mix(in srgb, #ffffff 80%, transparent) inset,
        0 1px 3px color-mix(in srgb, var(--primary) 12%, transparent);
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.crm-toolbar-export-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 9999px;
    background: color-mix(in srgb, var(--primary) 14%, #ffffff);
    color: var(--primary);
}

.crm-toolbar-export-btn-icon svg {
    width: 0.8125rem;
    height: 0.8125rem;
}

@media (hover: hover) and (pointer: fine) {
    .crm-toolbar-export-btn:hover {
        border-color: color-mix(in srgb, var(--primary) 42%, var(--border));
        background: linear-gradient(
            180deg,
            color-mix(in srgb, var(--primary) 16%, #ffffff) 0%,
            color-mix(in srgb, var(--primary) 8%, #ffffff) 100%
        );
        box-shadow:
            0 1px 0 color-mix(in srgb, #ffffff 80%, transparent) inset,
            0 3px 8px color-mix(in srgb, var(--primary) 18%, transparent);
        transform: translateY(-1px);
        color: var(--primary);
    }
}

.crm-toolbar-export-btn:active {
    transform: translateY(0);
}

/* Export avec filtres (godmode) */
.crm-export-filters-card {
    margin-top: -0.5rem;
}

.crm-export-filters-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.crm-export-filters-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--foreground);
    white-space: nowrap;
}

.crm-export-filters-selects {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    flex: 1;
    min-width: 0;
}

.crm-export-filters-selects .crm-select {
    flex: 1;
    min-width: 8rem;
    max-width: 14rem;
}

.crm-select-sm {
    padding: 0.3125rem 0.5rem;
    font-size: 0.75rem;
}

.crm-export-filters-btn {
    white-space: nowrap;
}

@media (max-width: 639px) {
    .crm-export-filters-selects .crm-select {
        min-width: 0;
        max-width: none;
    }
}

@media (max-width: 639px) {
    .crm-notes-page-toolbar .crm-toolbar-heading {
        white-space: normal;
        margin-top: 0.125rem;
    }

    .crm-clients-page-toolbar .crm-toolbar-form,
    .crm-contrats-page-toolbar .crm-toolbar-form {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
    }

    .crm-clients-page-toolbar .crm-toolbar-search,
    .crm-contrats-page-toolbar .crm-toolbar-search {
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
    }

    .crm-toolbar-export-btn {
        width: auto;
        padding: 0 0.6875rem;
    }
}

.crm-toolbar-filters {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

@media (min-width: 640px) {
    .crm-toolbar-filters {
        width: auto;
    }
}

.crm-toolbar-filters .crm-select {
    flex: 1;
    min-width: 0;
}

@media (min-width: 640px) {
    .crm-toolbar-filters .crm-select {
        flex: none;
        min-width: 9rem;
    }
}

.crm-toolbar-actions {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

@media (min-width: 640px) {
    .crm-toolbar-actions {
        width: auto;
        flex-shrink: 0;
    }
}

.crm-toolbar-actions .crm-btn {
    flex: 1;
}

@media (min-width: 640px) {
    .crm-toolbar-actions .crm-btn {
        flex: none;
    }
}

.crm-page {
    min-width: 0;
}

.crm-page-loading {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.crm-form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

@media (min-width: 480px) {
    .crm-form-grid-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Modal responsive */
@media (max-width: 639px) {
    .crm-modal {
        align-items: flex-end;
        padding: 0;
    }

    .crm-modal-content {
        max-width: none;
        max-height: 92vh;
        border-radius: var(--radius) var(--radius) 0 0;
        overflow-y: auto;
    }

    .crm-modal-footer {
        flex-direction: column-reverse;
    }

    .crm-modal-footer .crm-btn {
        width: 100%;
    }
}

/* Detail page */
.crm-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.crm-detail-actions .crm-btn {
    flex: 1;
    min-width: calc(50% - 0.25rem);
}

@media (min-width: 640px) {
    .crm-detail-actions .crm-btn {
        flex: none;
        min-width: auto;
    }
}

/* Toast mobile */
@media (max-width: 639px) {
    #toast-container {
        left: 0.75rem;
        right: 0.75rem;
        bottom: 0.75rem;
    }

    #toast-container .crm-toast {
        width: 100%;
    }
}


/* Form elements */
.crm-input {
    border-radius: calc(var(--radius) - 4px);
    border: 1px solid var(--input);
    background: var(--card);
    padding: 0.4375rem 0.625rem;
    font-size: 0.8125rem;
    color: var(--foreground);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.crm-input::placeholder {
    color: var(--muted-foreground);
}

.crm-input:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.crm-select {
    border-radius: calc(var(--radius) - 4px);
    border: 1px solid var(--input);
    background: var(--card);
    padding: 0.4375rem 0.625rem;
    font-size: 0.8125rem;
    color: var(--foreground);
    outline: none;
}

.crm-select:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.crm-label {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--muted-foreground);
}

.crm-dt {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-foreground);
}

.crm-dd {
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: var(--foreground);
}

/* Buttons — Flux gradient primary */
.crm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    border-radius: calc(var(--radius) - 4px);
    padding: 0.4375rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all 0.15s;
    cursor: pointer;
    border: none;
    white-space: nowrap;
}

.crm-btn-primary {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: var(--primary-foreground);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.35);
}

.crm-btn-primary:hover {
    background: linear-gradient(135deg, #7338e8, #5b21b6);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.45);
}

.crm-btn-secondary {
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--foreground);
}

.crm-btn-secondary:hover {
    background: var(--muted);
}

.crm-btn-danger {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.crm-btn-danger:hover {
    background: #fee2e2;
    color: #991b1b;
}

.crm-btn-sm {
    padding: 0.3125rem 0.625rem;
    font-size: 0.6875rem;
}

.crm-btn-icon {
    width: 0.875rem;
    height: 0.875rem;
    flex-shrink: 0;
}

/* Badges — Flux semantic colors */
.crm-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 1rem;
    white-space: nowrap;
}

.crm-badge-violet  { background: rgba(124, 58, 237, 0.12); color: #6528d7; }
.crm-badge-blue    { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.crm-badge-emerald { background: rgba(34, 197, 94, 0.12); color: #16a34a; }
.crm-badge-orange  { background: rgba(245, 158, 11, 0.15); color: #d97706; }

/* Status badges */
.crm-status {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 1rem;
    white-space: nowrap;
}

.crm-status-actif, .crm-status-confirme, .crm-status-termine {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
}

.crm-status-inactif, .crm-status-annule, .crm-status-resilie {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.crm-status-prospect, .crm-status-en_cours, .crm-status-planifie, .crm-status-a_faire {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

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

/* Modal */
.crm-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

@media (min-width: 1024px) {
    .crm-modal {
        padding-left: calc(260px + 1rem);
    }
}

.crm-modal.hidden { display: none; }

.crm-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.crm-modal-content {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 32rem;
    border-radius: var(--radius);
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.crm-modal-panel {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 32rem;
    border-radius: var(--radius);
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.crm-modal-content-lg {
    max-width: 36rem;
}

/* Popup modifier utilisateur : footer toujours visible */
#user-edit-modal .crm-modal-content {
    max-height: min(92vh, calc(100dvh - 2rem));
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#user-edit-modal .crm-user-edit-form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    padding-bottom: 0;
}

#user-edit-modal .crm-user-edit-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
}

#user-edit-modal .crm-modal-footer {
    flex-shrink: 0;
    margin: 0 -1rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
    background: var(--card);
}

@media (max-width: 639px) {
    #user-edit-modal .crm-modal-content {
        max-height: 92vh;
        max-height: 92dvh;
    }
}

.crm-search-select {
    position: relative;
}

.crm-search-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    border-radius: calc(var(--radius) - 4px);
    border: 1px solid var(--input);
    background: var(--card);
    padding: 0.4375rem 0.625rem;
    font-size: 0.8125rem;
    color: var(--foreground);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.crm-search-select-trigger:hover,
.crm-search-select-trigger:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
    outline: none;
}

.crm-search-select-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-search-select-value.is-placeholder {
    color: var(--muted-foreground);
}

.crm-search-select-chevron {
    color: var(--muted-foreground);
    font-size: 0.75rem;
    line-height: 1;
}

.crm-search-select-dropdown {
    position: absolute;
    z-index: 40;
    left: 0;
    right: 0;
    top: calc(100% + 0.25rem);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
    background: var(--card);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.14);
    overflow: hidden;
}

.crm-search-select-search-wrap {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--muted);
}

.crm-search-select-search {
    width: 100%;
    border-radius: calc(var(--radius) - 6px);
    border: 1px solid var(--input);
    background: var(--card);
    padding: 0.4375rem 0.625rem;
    font-size: 0.8125rem;
    color: var(--foreground);
    outline: none;
}

.crm-search-select-search:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.crm-search-select-options {
    max-height: 14rem;
    overflow-y: auto;
    margin: 0;
    padding: 0.25rem 0;
    list-style: none;
}

.crm-search-select-option,
.crm-search-select-empty {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    cursor: pointer;
}

.crm-search-select-option:hover,
.crm-search-select-option.is-active {
    background: var(--accent);
}

.crm-search-select-empty {
    color: var(--muted-foreground);
    cursor: default;
}

.crm-search-select-cp {
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    min-width: 3.25rem;
}

.crm-search-select-label {
    color: var(--foreground);
}

.crm-combobox {
    position: relative;
}

.crm-combobox-control {
    position: relative;
}

.crm-combobox-clear {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    font-size: 1rem;
    line-height: 1;
    color: var(--muted-foreground);
    background: var(--muted);
}

.crm-combobox-clear:hover {
    color: var(--foreground);
}

.crm-combobox-list {
    position: absolute;
    z-index: 30;
    left: 0;
    right: 0;
    top: calc(100% + 0.25rem);
    max-height: 14rem;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
    background: var(--card);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

.crm-combobox-option,
.crm-combobox-empty {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.625rem;
    font-size: 0.8125rem;
    cursor: pointer;
}

.crm-combobox-option:hover,
.crm-combobox-option.is-active {
    background: var(--accent);
}

.crm-combobox-empty {
    color: var(--muted-foreground);
    cursor: default;
}

.crm-combobox-cp {
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 0.75rem;
    color: var(--muted-foreground);
    min-width: 3.5rem;
}

.crm-combobox-ville {
    color: var(--foreground);
}

.crm-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    padding: 0.875rem 1rem;
}

.crm-modal-body { padding: 0.875rem 1rem; }

.crm-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    border-top: 1px solid var(--border);
    padding: 0.875rem 1rem;
}

.crm-modal-close {
    font-size: 1.5rem;
    line-height: 1;
    color: var(--muted-foreground);
    background: none;
    border: none;
    cursor: pointer;
}

.crm-modal-close:hover { color: var(--foreground); }

/* Toast */
#toast-container {
    z-index: 10000;
    pointer-events: none;
}

#toast-container .crm-toast {
    pointer-events: auto;
}

.crm-toast {
    border-radius: calc(var(--radius) - 4px);
    padding: 0.625rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.crm-toast-success { background: var(--success); color: var(--success-foreground); }
.crm-toast-error   { background: var(--destructive); color: var(--destructive-foreground); }

/* Sidebar groups */
.crm-sidebar-group-title {
    padding: 0.375rem 0.625rem;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted-foreground);
}

.crm-sidebar-group + .crm-sidebar-group {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--sidebar-border);
}

/* Sidebar — fond photo ville (Paris) */
#sidebar {
    position: fixed;
    overflow: hidden;
}

.crm-sidebar-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.crm-sidebar-bg-photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 75%;
    opacity: 0.65;
    filter: saturate(0.88);
}

.crm-sidebar-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(250, 250, 251, 0.72) 0%,
        rgba(250, 250, 251, 0.62) 50%,
        rgba(250, 250, 251, 0.75) 100%
    );
}

.crm-sidebar-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

#sidebar .border-sidebar-border {
    border-color: rgba(232, 232, 239, 0.65);
}

#sidebar .crm-sidebar-group + .crm-sidebar-group {
    border-top-color: rgba(232, 232, 239, 0.55);
}

#sidebar .bg-sidebar-accent {
    background: rgba(240, 240, 247, 0.72);
    backdrop-filter: blur(4px);
}

/* Sidebar active indicator (Flux) */
.flux-active-indicator::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    border-radius: 0 2px 2px 0;
    background: var(--sidebar-primary);
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-foreground); }

/* ===== Flux Calendar ===== */
.crm-cal-nav-btn {
    display: inline-flex;
    height: 2rem;
    width: 2rem;
    align-items: center;
    justify-content: center;
    border-radius: calc(var(--radius) - 4px);
    border: 1px solid var(--border);
    background: var(--card);
    font-size: 1.25rem;
    line-height: 1;
    color: var(--foreground);
    text-decoration: none;
    transition: background 0.15s;
}

.crm-cal-nav-btn:hover {
    background: var(--muted);
}

.crm-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
}

.crm-calendar-weekday {
    padding: 0.5rem 0.25rem;
    text-align: center;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted-foreground);
}

.crm-calendar-day {
    display: flex;
    min-height: 3.5rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    border-radius: calc(var(--radius) - 4px);
    border: 1px solid transparent;
    padding: 0.375rem;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s, border-color 0.15s;
}

@media (min-width: 640px) {
    .crm-calendar-day {
        min-height: 4.5rem;
        padding: 0.5rem;
    }
}

.crm-calendar-day:hover {
    background: var(--muted);
}

.crm-calendar-day-empty {
    pointer-events: none;
    background: transparent;
}

.crm-calendar-day-today {
    border-color: rgba(124, 58, 237, 0.35);
    background: rgba(124, 58, 237, 0.06);
}

.crm-calendar-day-selected {
    border-color: var(--primary);
    background: rgba(124, 58, 237, 0.12);
    box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.2);
}

.crm-calendar-day-num {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--foreground);
}

.crm-calendar-day-empty .crm-calendar-day-num {
    color: transparent;
}

.crm-calendar-dots {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: auto;
}

.crm-calendar-dot {
    display: block;
    height: 5px;
    width: 5px;
    border-radius: 9999px;
    background: var(--primary);
}

.crm-cal-event {
    border-radius: calc(var(--radius) - 4px);
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--muted) 55%, transparent);
    padding: 0.4375rem 0.5rem;
}

.crm-cal-event + .crm-cal-event {
    margin-top: 0.375rem;
}

.crm-agenda-sidebar-card {
    overflow: hidden;
}

.crm-agenda-sidebar-section + .crm-agenda-sidebar-section {
    border-top: 1px solid var(--border);
}

.crm-agenda-sidebar-header {
    padding: 0.4375rem 0.625rem;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--muted) 35%, transparent);
}

.crm-agenda-sidebar-title {
    margin: 0;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--foreground);
}

.crm-agenda-sidebar-body {
    padding: 0.4375rem 0.5rem;
    max-height: 14rem;
    overflow-y: auto;
}

.crm-agenda-sidebar-section:last-child .crm-agenda-sidebar-body {
    max-height: 16rem;
}

.crm-agenda-sidebar-empty {
    margin: 0;
    padding: 0.25rem 0.125rem;
    font-size: 0.625rem;
    line-height: 1.35;
    color: var(--muted-foreground);
}

.crm-agenda-event-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.crm-agenda-event-row {
    display: flex;
    align-items: flex-start;
    gap: 0.375rem;
}

.crm-agenda-event-main {
    flex: 1;
    min-width: 0;
}

.crm-agenda-event-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.375rem;
}

.crm-agenda-event-title {
    margin: 0;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--foreground);
}

.crm-agenda-event-badge {
    font-size: 0.5625rem;
    padding: 0.0625rem 0.3125rem;
    line-height: 1.2;
}

.crm-agenda-event-meta {
    margin: 0.125rem 0 0;
    font-size: 0.625rem;
    line-height: 1.3;
    color: var(--muted-foreground);
}

.crm-agenda-event-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.125rem;
    flex-shrink: 0;
}

.crm-agenda-trash-btn {
    color: var(--muted-foreground);
}

.crm-agenda-trash-btn:hover {
    color: hsl(var(--destructive));
    background: hsl(var(--destructive) / 0.08);
}

/* ===== Flux Files ===== */
.crm-files-tab {
    display: inline-flex;
    align-items: center;
    border-radius: calc(var(--radius) - 4px);
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--muted-foreground);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.crm-files-tab:hover {
    background: var(--muted);
    color: var(--foreground);
}

.crm-files-tab-active {
    background: rgba(124, 58, 237, 0.12);
    color: var(--primary);
}

.crm-files-view-toggle {
    display: inline-flex;
    overflow: hidden;
    border-radius: calc(var(--radius) - 4px);
    border: 1px solid var(--border);
}

.crm-files-view-btn {
    display: inline-flex;
    height: 2rem;
    width: 2rem;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--card);
    font-size: 0.875rem;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.crm-files-view-btn + .crm-files-view-btn {
    border-left: 1px solid var(--border);
}

.crm-files-view-btn-active {
    background: var(--muted);
    color: var(--primary);
}

.crm-file-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
    padding: 1rem 0.75rem;
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.crm-file-card-folder:hover,
.crm-file-card:hover {
    border-color: rgba(124, 58, 237, 0.35);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.1);
    transform: translateY(-1px);
}

.crm-file-icon {
    display: flex;
    height: 3rem;
    width: 3rem;
    align-items: center;
    justify-content: center;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.6875rem;
    font-weight: 700;
    margin-bottom: 0.625rem;
}

.crm-file-icon-folder {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.crm-file-icon-pdf {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
    font-size: 1.125rem;
}

.crm-file-icon-image {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

.crm-file-icon-doc {
    background: rgba(124, 58, 237, 0.12);
    color: #6528d7;
}

.crm-file-icon-sheet {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
}

.crm-file-icon-file {
    background: var(--muted);
    color: var(--muted-foreground);
}

.crm-file-name {
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--foreground);
}

.crm-file-meta {
    margin-top: 0.25rem;
    font-size: 0.6875rem;
    color: var(--muted-foreground);
}

.crm-file-client {
    margin-top: 0.25rem;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.625rem;
    color: var(--muted-foreground);
}

/* ---- Profil client ---- */
.crm-client-profile {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    min-width: 0;
}

.crm-client-back {
    flex-shrink: 0;
    align-self: flex-start;
    width: fit-content;
    max-width: 100%;
    margin-bottom: 0.125rem;
}

.crm-client-profile-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    min-width: 0;
}

@media (min-width: 1024px) {
    .crm-client-profile-grid {
        grid-template-columns: minmax(160px, 20%) 1fr;
        align-items: stretch;
    }
}

.crm-client-profile-left {
    padding: 0.625rem 0.75rem;
    min-width: 0;
    font-size: 0.75rem;
}

.crm-client-profile-right {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    min-width: 0;
}

.crm-client-identity-block {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 0.625rem;
    padding: 1.25rem 0.75rem 1rem;
    border-radius: calc(var(--radius) - 2px);
    overflow: hidden;
    isolation: isolate;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-bottom: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.45);
    background: linear-gradient(145deg, rgba(124, 58, 237, 0.07) 0%, rgba(79, 70, 229, 0.04) 45%, rgba(14, 165, 233, 0.05) 100%);
}

.crm-client-identity-block::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background-image: var(--identity-bg);
    background-size: cover;
    background-position: center;
    transform: scale(1.08);
    filter: saturate(1.05) brightness(0.85);
}

.crm-client-identity-block::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        radial-gradient(120% 80% at 20% 0%, rgba(255, 255, 255, 0.38) 0%, transparent 55%),
        radial-gradient(90% 70% at 90% 100%, rgba(56, 189, 248, 0.22) 0%, transparent 50%),
        linear-gradient(165deg, rgba(255, 255, 255, 0.22) 0%, rgba(15, 23, 42, 0.35) 55%, rgba(15, 23, 42, 0.45) 100%);
    backdrop-filter: blur(2px) saturate(1.5);
    -webkit-backdrop-filter: blur(2px) saturate(1.5);
    box-shadow: inset 0 0 40px rgba(255, 255, 255, 0.12);
    pointer-events: none;
}

.crm-client-identity-sheen {
    position: absolute;
    z-index: 2;
    inset: -20% -10%;
    background: linear-gradient(
        115deg,
        transparent 38%,
        rgba(255, 255, 255, 0.14) 48%,
        rgba(255, 255, 255, 0.32) 50%,
        rgba(255, 255, 255, 0.1) 52%,
        transparent 62%
    );
    transform: rotate(8deg);
    pointer-events: none;
    mix-blend-mode: soft-light;
    opacity: 0.75;
}

.crm-client-identity-block > *:not(.crm-client-identity-sheen) {
    position: relative;
    z-index: 3;
}

.crm-client-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 9999px;
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-bottom: 0.375rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.crm-client-identity-block .crm-client-avatar {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.08));
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.crm-avatar-gradient-0 { background: linear-gradient(135deg, #7c3aed, #4f46e5); }
.crm-avatar-gradient-1 { background: linear-gradient(135deg, #2563eb, #0891b2); }
.crm-avatar-gradient-2 { background: linear-gradient(135deg, #059669, #0d9488); }
.crm-avatar-gradient-3 { background: linear-gradient(135deg, #d97706, #ea580c); }
.crm-avatar-gradient-4 { background: linear-gradient(135deg, #db2777, #e11d48); }
.crm-avatar-gradient-5 { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.crm-avatar-gradient-6 { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.crm-avatar-gradient-7 { background: linear-gradient(135deg, #16a34a, #2563eb); }

.crm-client-display-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--foreground);
    line-height: 1.3;
    word-break: break-word;
}

.crm-client-identity-block .crm-client-display-name {
    color: #fff;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

.crm-client-profession {
    margin-top: 0.125rem;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--muted-foreground);
    line-height: 1.3;
    word-break: break-word;
}

.crm-client-identity-block .crm-client-profession {
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
}

.crm-client-profile .crm-dt {
    font-size: 0.625rem;
    margin-bottom: 0.0625rem;
    line-height: 1.2;
}

.crm-client-profile .crm-dd {
    font-size: 0.75rem;
    line-height: 1.3;
}

.crm-client-info-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.crm-info-field {
    padding-bottom: 0.375rem;
    border-bottom: 1px solid var(--border);
}

.crm-info-field:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.crm-info-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.125rem;
    font-size: 0.5625rem;
    font-weight: 600;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.2;
}

.crm-field-icon {
    width: 0.75rem;
    height: 0.75rem;
    flex-shrink: 0;
    opacity: 0.7;
}

.crm-info-value {
    font-size: 0.75rem;
    line-height: 1.35;
    color: var(--foreground);
    word-break: break-word;
}

.crm-etat-symbole {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.375rem;
    padding: 0.0625rem 0.3125rem;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.2;
    cursor: default;
}

.crm-etat-symbole.crm-status-actif {
    background: rgba(34, 197, 94, 0.15);
    color: #15803d;
}

.crm-etat-symbole.crm-status-resilie {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.crm-etat-symbole.crm-status-inactif {
    background: rgba(107, 114, 128, 0.15);
    color: #4b5563;
}

.crm-etat-symbole.crm-status-en_cours {
    background: rgba(124, 58, 237, 0.12);
    color: var(--primary);
}

.crm-editable-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.crm-editable-label .crm-editable-pencil {
    margin-left: auto;
}

.crm-editable-pencil {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.125rem;
    height: 1.125rem;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--muted-foreground);
    opacity: 0;
    cursor: pointer;
    transition: opacity 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}

.crm-editable-pencil svg {
    width: 0.75rem;
    height: 0.75rem;
}

.crm-editable-field:hover .crm-editable-pencil,
.crm-editable-field.is-editing .crm-editable-pencil {
    opacity: 1;
}

.crm-editable-pencil:hover {
    color: var(--primary);
}

.crm-editable-value {
    cursor: pointer;
    min-height: 1.125rem;
    word-break: break-word;
}

.crm-editable-value:hover {
    color: var(--foreground);
}

.crm-editable-input {
    font-size: 0.75rem !important;
    padding: 0.25rem 0.375rem !important;
}

.crm-editable-field.is-saving .crm-editable-value {
    opacity: 0.5;
}

.crm-field-readonly .crm-editable-value {
    cursor: default;
}

.crm-search-select-inline {
    width: 100%;
}

.crm-search-select-inline .crm-search-select-trigger {
    font-size: 0.75rem;
    padding: 0.25rem 0.375rem;
    min-height: 1.75rem;
}

.crm-contract-detail-grid .crm-editable-field {
    padding-bottom: 0.25rem;
}

.crm-client-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.375rem 0.625rem;
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 5;
    overflow: visible;
}

.crm-client-panel-header-left {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-width: 0;
}

.crm-client-panel-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    flex-shrink: 0;
}

.crm-ddc-menu {
    position: relative;
}

.crm-client-ddc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    height: 1.875rem;
    padding: 0 0.7rem;
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--foreground);
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.crm-client-ddc-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    border-radius: calc(var(--radius) - 4px);
    background: color-mix(in srgb, #dc2626 12%, #ffffff);
    color: #dc2626;
    font-size: 0.625rem;
}

.crm-client-ddc-btn:hover .crm-client-ddc-btn-icon,
.crm-ddc-menu.is-open .crm-client-ddc-btn-icon {
    background: color-mix(in srgb, #dc2626 18%, #ffffff);
}

.crm-client-ddc-btn:hover,
.crm-ddc-menu.is-open .crm-client-ddc-btn {
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
    background: color-mix(in srgb, var(--primary) 8%, var(--card));
    color: var(--primary);
}

.crm-ddc-chevron {
    font-size: 0.625rem;
    opacity: 0.75;
}

.crm-ddc-dropdown {
    position: absolute;
    top: calc(100% + 0.25rem);
    right: 0;
    z-index: 80;
    min-width: 10.5rem;
    padding: 0.375rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    background: var(--card);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--foreground) 12%, transparent);
}

.crm-ddc-dropdown.hidden {
    display: none;
}

.crm-ddc-dropdown-label {
    margin: 0 0 0.25rem;
    padding: 0.2rem 0.4rem;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted-foreground);
}

.crm-ddc-dropdown-item {
    display: block;
    padding: 0.4rem 0.5rem;
    border-radius: calc(var(--radius) - 4px);
    color: var(--foreground);
    font-size: 0.75rem;
    font-weight: 500;
    text-decoration: none;
}

.crm-ddc-dropdown-item:hover {
    background: color-mix(in srgb, var(--primary) 10%, transparent);
    color: var(--primary);
}

.crm-client-add-contrat-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4375rem;
    flex-shrink: 0;
    height: 1.875rem;
    padding: 0 0.75rem;
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border));
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--primary) 12%, #ffffff) 0%,
        color-mix(in srgb, var(--primary) 5%, #ffffff) 100%
    );
    color: var(--primary);
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    box-shadow:
        0 1px 0 color-mix(in srgb, #ffffff 80%, transparent) inset,
        0 1px 3px color-mix(in srgb, var(--primary) 14%, transparent);
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.crm-client-add-contrat-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    border-radius: 9999px;
    background: color-mix(in srgb, var(--primary) 16%, #ffffff);
}

.crm-client-add-contrat-btn-icon svg {
    width: 0.75rem;
    height: 0.75rem;
}

@media (hover: hover) and (pointer: fine) {
    .crm-client-add-contrat-btn:hover {
        border-color: color-mix(in srgb, var(--primary) 44%, var(--border));
        background: linear-gradient(
            180deg,
            color-mix(in srgb, var(--primary) 18%, #ffffff) 0%,
            color-mix(in srgb, var(--primary) 9%, #ffffff) 100%
        );
        box-shadow:
            0 1px 0 color-mix(in srgb, #ffffff 80%, transparent) inset,
            0 3px 8px color-mix(in srgb, var(--primary) 18%, transparent);
        transform: translateY(-1px);
    }
}

.crm-client-add-contrat-btn:active {
    transform: translateY(0);
}

.crm-client-contrat-modal-intro {
    margin: 0 0 0.875rem;
    padding: 0.625rem 0.75rem;
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid color-mix(in srgb, var(--primary) 16%, var(--border));
    background: color-mix(in srgb, var(--primary) 6%, #ffffff);
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.crm-client-contrat-modal-intro strong {
    color: var(--foreground);
    font-weight: 600;
}

.crm-client-panel-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--foreground);
}

.crm-client-panel-header .crm-badge {
    padding: 0.125rem 0.375rem;
    font-size: 0.625rem;
}

.crm-client-contracts-panel {
    overflow: visible;
}

.crm-client-contracts-scroll {
    max-height: 22rem;
    overflow-y: auto;
}

.crm-compagnie-cell-compact {
    gap: 0.25rem;
}

.crm-compagnie-cell-compact .crm-compagnie-icon {
    width: 0.875rem;
    height: 0.875rem;
    border-radius: 0.1875rem;
    flex-shrink: 0;
}

.crm-compagnie-cell-compact .crm-compagnie-icon-fallback {
    font-size: 0.4375rem;
}

.crm-compagnie-cell-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-client-contracts-table .crm-compagnie-cell-label {
    max-width: 5.5rem;
}

#contrats-table .crm-compagnie-cell-label {
    max-width: 7rem;
    font-size: 0.6875rem;
}

.crm-input-readonly {
    background: var(--muted);
    color: var(--muted-foreground);
    cursor: default;
}

.crm-client-contracts-table th,
.crm-client-contracts-table td {
    padding: 0.5rem 0.5rem;
    font-size: 0.6875rem;
    line-height: 1.35;
}

.crm-client-contracts-table th {
    font-size: 0.625rem;
    padding-top: 0.4375rem;
    padding-bottom: 0.4375rem;
}

.crm-client-contracts-table .crm-status {
    padding: 0.0625rem 0.3125rem;
    font-size: 0.5625rem;
}

.crm-client-contracts-table .crm-contract-date-cell {
    white-space: nowrap;
    width: 1%;
}

.crm-client-contracts-table tbody tr {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.crm-client-contracts-table tbody tr:hover {
    background: var(--muted);
}

.crm-contract-row-active {
    background: rgba(124, 58, 237, 0.16) !important;
    box-shadow: inset 4px 0 0 var(--primary);
    outline: 1px solid rgba(124, 58, 237, 0.25);
    outline-offset: -1px;
}

.crm-contract-row-active td {
    font-weight: 500;
    color: var(--foreground);
}

.crm-contract-row-active td.cell-muted {
    color: var(--foreground);
    opacity: 0.85;
}

.crm-client-actions {
    display: flex;
    gap: 0.375rem;
    margin-top: 0.625rem;
    padding-top: 0.625rem;
    border-top: 1px solid var(--border);
}

.crm-client-actions .crm-btn {
    flex: 1;
}

.crm-merge-intro {
    margin: 0 0 0.75rem;
}

.crm-client-actions .crm-btn-icon-only {
    flex: 0 0 auto;
    min-width: 2rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.crm-client-actions .crm-btn-icon-only .crm-btn-icon {
    margin: 0;
}

.crm-merge-results {
    margin-top: 0.25rem;
    max-height: 9rem;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
    background: var(--muted);
}

.crm-merge-result {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.3rem 0.5rem;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--foreground);
    font-size: 0.75rem;
    line-height: 1.25;
    cursor: pointer;
}

.crm-merge-result:last-child {
    border-bottom: 0;
}

.crm-merge-result:hover {
    background: color-mix(in srgb, var(--primary) 12%, transparent);
}

.crm-merge-empty {
    margin: 0;
    padding: 0.5rem;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.crm-merge-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
}

.crm-merge-footer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.crm-merge-hint {
    margin: 0;
    padding: 0.625rem 0.75rem;
    font-size: 0.6rem;
    line-height: 1.4;
    color: #5d3c13;
    background: color-mix(in srgb, var(--primary) 8%, transparent);
    border-radius: calc(var(--radius) - 4px);
}

.crm-contract-detail-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
	gap: 0.375rem;
}

.crm-status-badge {
    display: inline-flex;
    padding: 0.125rem 0.4375rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: calc(var(--radius) - 2px);
}

.crm-client-tabs-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
    overflow: hidden;
}

.crm-client-tabs-panel:has(#tab-details.crm-tab-panel-active) {
    overflow: visible;
}

.crm-client-tabs-panel .crm-tabs {
    gap: 0.25rem;
    padding: 0.375rem 0.5rem 0;
}

.crm-client-tabs-panel .crm-tab {
    padding: 0.4375rem 0.8125rem;
    font-size: 0.8125rem;
    gap: 0.375rem;
}

.crm-client-tabs-panel .crm-tab-icon {
    width: 0.9375rem;
    height: 0.9375rem;
}

@media (hover: hover) and (pointer: fine) {
    .crm-client-tabs-panel .crm-tab:hover:not(.crm-tab-active) {
        color: var(--foreground);
        background: color-mix(in srgb, var(--foreground) 6%, transparent);
    }

    .crm-client-tabs-panel .crm-tab-active:hover {
        color: #fff;
        background: #1e293b;
    }
}

.crm-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.125rem;
    padding: 0.25rem 0.375rem 0;
    border-bottom: 1px solid var(--border);
    background: var(--muted);
}

.crm-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3125rem 0.5rem;
    border: none;
    border-radius: calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0 0;
    background: transparent;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
    white-space: nowrap;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) and (pointer: fine) {
    .crm-tab:hover {
        color: var(--foreground);
        background: rgba(255, 255, 255, 0.5);
    }
}

.crm-tab-active {
    color: #fff;
    background: #1e293b;
    box-shadow: none;
    transform: translateZ(0);
}

.crm-tab-active .crm-tab-icon {
    color: #fff;
}

.crm-tab-icon {
    width: 0.8125rem;
    height: 0.8125rem;
    flex-shrink: 0;
}

.crm-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0.875rem;
    height: 0.875rem;
    padding: 0 0.1875rem;
    border-radius: 9999px;
    background: var(--primary);
    color: var(--primary-foreground);
    font-size: 0.5625rem;
    font-weight: 600;
    line-height: 1;
}

.crm-tab-active .crm-tab-badge {
    background: #fff;
    color: var(--primary);
}

.crm-tab-badge.hidden {
    display: none;
}

.crm-nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-width: 1.125rem;
    height: 1.125rem;
    padding: 0 0.25rem;
    border-radius: 9999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 0 0 1px rgb(220 38 38 / 0.2);
}

.crm-nav-badge.hidden {
    display: none;
}

.crm-tab-panels {
    flex: 1;
    padding: 0.5rem 0.625rem;
    min-height: 140px;
    overflow: visible;
}

.crm-tab-panel {
    animation: crm-tab-fade 0.15s ease;
}

@keyframes crm-tab-fade {
    from { opacity: 0; transform: translateY(2px); }
    to   { opacity: 1; transform: translateY(0); }
}

.crm-client-profile .crm-empty-state {
    gap: 0.375rem;
    padding: 0.75rem 0.5rem;
    font-size: 0.75rem;
}

.crm-empty-state-sm {
    padding: 0.5rem;
    font-size: 0.6875rem;
}

.crm-empty-icon {
    width: 1.5rem;
    height: 1.5rem;
    opacity: 0.4;
}

.crm-contract-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.375rem 0.75rem;
}

.crm-contract-detail-grid .crm-info-field {
    padding-bottom: 0.25rem;
    overflow: visible;
}

.crm-contract-detail-grid .crm-info-field-wide {
    grid-column: 1 / -1;
}

.crm-contract-detail-grid .crm-info-label {
    font-size: 0.625rem;
}

.crm-contract-detail-grid .crm-info-value {
    font-size: 0.8125rem;
}

.crm-contract-detail-form .crm-detail-input,
.crm-contract-detail-form .crm-search-select-trigger {
    font-size: 0.8125rem;
    min-height: 1.75rem;
    padding: 0.1875rem 0.375rem;
}

.crm-contract-detail-form textarea.crm-detail-input {
    min-height: 3.25rem;
    resize: vertical;
    line-height: 1.35;
}

.crm-contract-detail-form .crm-search-select {
    width: 100%;
}

.crm-contract-detail-form .crm-search-select-dropdown {
    z-index: 30;
}

.crm-contract-detail-grid .crm-field-icon {
    width: 0.8125rem;
    height: 0.8125rem;
}

.crm-contract-detail-grid .crm-etat-symbole {
    font-size: 0.6875rem;
}

@media (min-width: 1280px) {
    .crm-contract-detail-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.crm-note-list,
.crm-doc-list,
.crm-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.crm-note-item {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    background: var(--card);
}

.crm-note-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.375rem;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
}

.crm-note-body {
    font-size: 0.6875rem;
    color: var(--foreground);
    line-height: 1.4;
}

.crm-note-meta {
    margin-top: 0.25rem;
    font-size: 0.625rem;
}

.crm-doc-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
}

.crm-doc-icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    color: var(--primary);
}

.crm-doc-name {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--foreground);
}

.crm-doc-meta {
    font-size: 0.625rem;
    margin-top: 0.0625rem;
}

.crm-email-primary {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem;
    margin-bottom: 0.375rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    background: var(--muted);
    font-size: 0.75rem;
}

.crm-timeline-item {
    display: flex;
    gap: 0.5rem;
    position: relative;
    padding-left: 0.125rem;
}

.crm-timeline-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 0.3125rem;
    top: 0.875rem;
    bottom: -0.375rem;
    width: 1px;
    background: var(--border);
}

.crm-timeline-dot {
    flex-shrink: 0;
    width: 0.5rem;
    height: 0.5rem;
    margin-top: 0.1875rem;
    border-radius: 9999px;
    background: var(--primary);
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.12);
}

.crm-timeline-contrat .crm-timeline-dot {
    background: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.crm-timeline-label {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--foreground);
    line-height: 1.3;
}

.crm-timeline-date {
    font-size: 0.625rem;
    margin-top: 0.0625rem;
}

.crm-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
}

.hidden {
    display: none !important;
}

/* ---- Dialog (msgbox) ---- */
.crm-dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.18s ease;
}

.crm-dialog-overlay.crm-dialog-visible {
    opacity: 1;
}

.crm-dialog-overlay.crm-dialog-closing {
    opacity: 0;
}

.crm-dialog {
    width: 100%;
    max-width: 22rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18);
    transform: translateY(8px) scale(0.98);
    transition: transform 0.18s ease;
}

.crm-dialog-visible .crm-dialog {
    transform: translateY(0) scale(1);
}

.crm-dialog-header {
    padding: 1rem 1rem 0.5rem;
}

.crm-dialog-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--foreground);
}

.crm-dialog-body {
    padding: 0.5rem 1rem 1rem;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    line-height: 1.5;
}

.crm-dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid var(--border);
}

.crm-dialog-prompt .crm-dialog-message {
    margin: 0 0 0.625rem;
}

.crm-dialog-input {
    width: 100%;
}

.crm-dialog-hero {
    display: flex;
    justify-content: center;
    padding: 1.25rem 1rem 0;
}

.crm-dialog-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 9999px;
    background: rgba(124, 58, 237, 0.12);
    color: #7c3aed;
}

.crm-dialog-icon-svg {
    width: 1.625rem;
    height: 1.625rem;
}

.crm-dialog-tone-error .crm-dialog-icon {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.crm-dialog-tone-success .crm-dialog-icon {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
}

.crm-dialog-tone-info .crm-dialog-icon {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

.crm-dialog-tone-error {
    border-top: 3px solid #ef4444;
}

.crm-dialog-tone-success {
    border-top: 3px solid #22c55e;
}

.crm-dialog-tone-info {
    border-top: 3px solid #3b82f6;
}

.crm-dialog-tone-error .crm-dialog-title {
    color: #b91c1c;
}

.crm-dialog-tone-success .crm-dialog-title {
    color: #15803d;
}

.crm-dialog-text {
    margin: 0;
}

.crm-dialog-overlay-error {
    background: rgba(69, 10, 10, 0.42);
}

.crm-dialog-overlay-success {
    background: rgba(5, 46, 22, 0.38);
}

.crm-dialog-tone-error .crm-dialog-confirm {
    background: #dc2626;
    border-color: #dc2626;
}

.crm-dialog-tone-error .crm-dialog-confirm:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

.crm-dialog-tone-success .crm-dialog-confirm {
    background: linear-gradient(135deg, #16a34a, #059669);
    border-color: transparent;
}

.crm-dialog-tone-success .crm-dialog-confirm:hover {
    background: linear-gradient(135deg, #15803d, #047857);
}

.crm-loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    height: 2px;
    pointer-events: none;
    opacity: 0;
}

.crm-loading-bar-active {
    opacity: 1;
}

.crm-loading-bar-done {
    opacity: 0;
    transition: opacity 0.25s ease;
}

.crm-loading-bar-track {
    display: block;
    width: 100%;
    height: 100%;
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    overflow: hidden;
}

.crm-loading-bar-fill {
    display: block;
    height: 100%;
    width: 40%;
    background: var(--primary);
    box-shadow: 0 0 6px color-mix(in srgb, var(--primary) 55%, transparent);
    transform: translateX(-120%);
    animation: crm-loading-bar-slide 0.9s ease-in-out infinite;
}

.crm-loading-bar-done .crm-loading-bar-fill {
    animation: none;
    width: 100%;
    transform: translateX(0);
    transition: transform 0.25s ease, width 0.25s ease;
}

@keyframes crm-loading-bar-slide {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(320%); }
}

/* ---- Login ---- */
.crm-login-page {
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    font-family: Inter, system-ui, sans-serif;
}

.crm-login-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
}

.crm-login-bg-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(1.5px) brightness(0.88);
    transform: scale(1.02);
}

.crm-login-overlay {
    position: fixed;
    inset: 0;
    z-index: 1;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.52), rgba(49, 10, 80, 0.42));
}

.crm-login-main {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.crm-login-card {
    position: relative;
    width: 100%;
    max-width: 24rem;
    padding: 1.75rem 1.5rem 1.5rem;
    border-radius: calc(var(--radius) + 4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(18px);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    color: #fff;
    overflow: hidden;
}

.crm-login-card-accent {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #7c3aed, #6366f1, #2563eb);
}

.crm-login-brand {
    text-align: center;
    margin-bottom: 1.5rem;
}

.crm-login-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    margin-bottom: 0.75rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.crm-login-logo .crm-login-logo-img,
.crm-login-logo img {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 9999px;
}

.crm-login-title {
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.crm-login-subtitle {
    font-size: 0.8125rem;
    opacity: 0.88;
    margin-top: 0.375rem;
    font-weight: 500;
}

.crm-login-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.crm-login-field {
    width: 100%;
    max-width: 16rem;
    text-align: center;
}

.crm-login-form .crm-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    width: 100%;
    text-align: center;
    margin-bottom: 0.375rem;
    color: rgba(255, 255, 255, 0.92);
}

.crm-login-form .crm-label .crm-field-icon {
    color: rgba(255, 255, 255, 0.82);
}

.crm-login-input-wrap {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.crm-login-input-icon {
    position: absolute;
    top: 50%;
    left: 0.625rem;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    color: var(--muted-foreground);
}

.crm-login-input-icon .crm-field-icon {
    width: 1rem;
    height: 1rem;
}

.crm-login-input {
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    background: rgba(255, 255, 255, 0.94);
    border-color: rgba(255, 255, 255, 0.28);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.crm-login-input-with-icon {
    padding-left: 2.125rem;
}

.crm-login-input:focus {
    border-color: rgba(124, 58, 237, 0.55);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.18);
}

.crm-login-password-wrap {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.crm-login-password-input {
    box-sizing: border-box;
    padding-right: 2.25rem;
}

.crm-login-password-toggle {
    position: absolute;
    top: 50%;
    right: 0.5rem;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: 0;
    border-radius: calc(var(--radius) - 4px);
    background: transparent;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: color 0.15s;
}

.crm-login-password-toggle:hover {
    color: var(--foreground);
}

.crm-login-password-icon {
    width: 1rem;
    height: 1rem;
}

.crm-login-form-footer {
    width: 100%;
    max-width: 16rem;
    display: flex;
    justify-content: center;
}

.crm-login-forgot,
.crm-login-back {
    display: block;
    text-align: center;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
}

.crm-login-back {
    margin-top: 1.25rem;
}

.crm-login-forgot:hover,
.crm-login-back:hover {
    color: #fff;
    text-decoration: underline;
}

.crm-login-help {
    width: 100%;
    max-width: 16rem;
    text-align: center;
    font-size: 0.75rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.82);
    margin: 0 0 0.5rem;
}

.crm-login-error {
    color: #fecaca;
}

.crm-login-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 16rem;
    margin-top: 0.25rem;
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    border-color: transparent;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
}

.crm-login-submit:hover {
    background: linear-gradient(135deg, #6d28d9, #4f46e5);
}

.crm-login-submit-icon {
    width: 1rem;
    height: 1rem;
}

.crm-permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
}

.crm-perm-check {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--foreground);
}

.crm-perm-section {
    margin-bottom: 1.25rem;
}

.crm-perm-section-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 0.5rem;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid var(--border);
}

/* Page paramètres — layout compact */
.crm-settings-page {
    font-size: 0.6875rem;
}

.crm-settings-shell {
    padding: 0.5rem;
}

.crm-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

@media (max-width: 900px) {
    .crm-settings-grid {
        grid-template-columns: 1fr;
    }
}

.crm-settings-panel {
    min-width: 0;
    padding: 0.4375rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
    background: var(--background);
    display: flex;
    flex-direction: column;
    gap: 0.3125rem;
}

.crm-settings-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.3125rem;
    min-height: 1.25rem;
}

.crm-settings-scroll {
    max-height: 10.5rem;
    overflow: auto;
    min-height: 0;
}

.crm-settings-page .crm-settings-title {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--foreground);
    line-height: 1.2;
}

.crm-settings-subtitle {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 0.25rem;
}

.crm-settings-desc {
    margin-top: 0.0625rem;
    font-size: 0.625rem;
    color: var(--muted-foreground);
    line-height: 1.3;
}

.crm-settings-head-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.3125rem;
}

.crm-settings-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
}

.crm-select-xs,
.crm-input-xs {
    padding: 0.125rem 0.3125rem;
    font-size: 0.625rem;
    height: 1.375rem;
    line-height: 1.2;
}

.crm-select-xs {
    min-width: 6.5rem;
    max-width: 8rem;
}

.crm-input-xs {
    min-width: 0;
}

.crm-btn-xxs {
    padding: 0.0625rem 0.3125rem;
    font-size: 0.625rem;
    line-height: 1.2;
    height: 1.375rem;
    min-width: 1.375rem;
}

.crm-btn-icon-xs {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    padding: 0;
    font-size: 0.6875rem;
    line-height: 1;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 6px);
    background: var(--muted);
    color: var(--foreground);
    cursor: pointer;
}

.crm-btn-icon-xs:hover {
    background: var(--accent);
}

.crm-select-sm {
    min-width: 9rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    height: 1.75rem;
}

.crm-input-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    height: 1.75rem;
}

.crm-settings-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
    gap: 0.25rem 0.5rem;
}

.crm-settings-info-grid .crm-dt {
    font-size: 0.5625rem;
}

.crm-settings-info-grid .crm-dd {
    font-size: 0.6875rem;
}

.crm-settings-table-card {
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 6px);
}

.crm-settings-etats-wrap {
    max-height: 10.5rem;
    overflow-x: hidden;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 6px);
    min-width: 0;
}

.crm-table-settings {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    font-size: 0.625rem;
    line-height: 1.2;
}

.crm-table-settings th,
.crm-table-settings td {
    padding: 0.125rem 0.1875rem;
    font-size: 0.625rem;
    line-height: 1.2;
    vertical-align: middle;
}

.crm-table-settings th {
    height: 1.25rem;
    padding: 0.125rem 0.1875rem;
    font-size: 0.5625rem;
    background: var(--muted);
}

.crm-table-settings .crm-col-symbole {
    width: 2.125rem;
    text-align: center;
}

.crm-table-settings .crm-col-libelle {
    width: auto;
}

.crm-table-settings .crm-col-actions {
    width: 2.625rem;
    padding-right: 0.125rem;
    text-align: right;
    white-space: nowrap;
}

.crm-table-settings .crm-etat-libelle-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 0;
}

.crm-table-settings .crm-table-empty td {
    padding: 0.375rem 0.25rem;
    font-size: 0.625rem;
    white-space: normal;
}

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

.crm-table-settings tr.is-editing .crm-etat-libelle-cell {
    max-width: none;
    overflow: visible;
}

.crm-table-settings .crm-col-actions .crm-btn-icon-xs {
    width: 1.125rem;
    height: 1.125rem;
    font-size: 0.5625rem;
}

.crm-table-settings tr.is-editing .crm-input-xs {
    width: 100%;
    min-width: 0;
    padding: 0.0625rem 0.1875rem;
    height: 1.25rem;
}

.crm-table-settings tr.is-editing .crm-col-symbole .crm-input-xs {
    width: 100%;
    text-align: center;
}

.crm-etat-symbole-xs {
    display: inline-block;
    min-width: 1.375rem;
    padding: 0 0.25rem;
    font-size: 0.5625rem;
    font-weight: 700;
    text-align: center;
    border-radius: calc(var(--radius) - 8px);
    background: var(--muted);
    color: var(--foreground);
}

.crm-etat-symbole-sm {
    display: inline-block;
    min-width: 2rem;
    padding: 0.0625rem 0.375rem;
    font-size: 0.625rem;
    font-weight: 600;
    text-align: center;
    border-radius: calc(var(--radius) - 6px);
    background: var(--muted);
    color: var(--foreground);
}

.crm-settings-inline-form {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.25rem;
}

.crm-settings-inline-form .crm-input-xs:first-of-type:not(.crm-settings-inline-grow) {
    width: 2.75rem;
    flex: 0 0 2.75rem;
    text-transform: uppercase;
}

.crm-settings-inline-grow {
    flex: 1 1 auto;
    min-width: 0;
}

.crm-settings-app-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-top: 0.4375rem;
    padding-top: 0.375rem;
    border-top: 1px solid var(--border);
    font-size: 0.625rem;
    color: var(--muted-foreground);
}

.crm-settings-app-label {
    font-weight: 600;
    color: var(--foreground);
    margin-right: 0.1875rem;
}

.crm-perm-sections-compact .crm-perm-section-compact {
    margin-bottom: 0.375rem;
}

.crm-perm-sections-compact .crm-perm-section-compact:last-child {
    margin-bottom: 0;
}

.crm-perm-sections-compact .crm-perm-section-title {
    font-size: 0.625rem;
    margin-bottom: 0.125rem;
    padding-bottom: 0.125rem;
}

.crm-permissions-grid-compact {
    grid-template-columns: repeat(auto-fill, minmax(6.75rem, 1fr));
    gap: 0.125rem 0.25rem;
}

.crm-permissions-grid-compact .crm-perm-check {
    font-size: 0.625rem;
    gap: 0.1875rem;
    line-height: 1.2;
}

.crm-permissions-grid-compact .crm-perm-check input {
    width: 0.625rem;
    height: 0.625rem;
    margin: 0;
}

/* ---- Header actions ---- */
.crm-header-actions {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-left: auto;
    flex-shrink: 0;
}

.crm-header-dropdown {
    position: relative;
}

.crm-header-user-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.25rem;
    padding: 0.3125rem 0.375rem 0.3125rem 0.3125rem;
    border: 1px solid var(--border);
    border-radius: 9999px;
    background: color-mix(in srgb, var(--muted) 35%, transparent);
    color: var(--foreground);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    max-width: 100%;
}

.crm-header-icon-btn:hover,
.crm-header-user-btn:hover {
    background: var(--muted);
}

.crm-header-dropdown.is-open .crm-header-user-btn {
    border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
    background: color-mix(in srgb, var(--primary) 8%, var(--muted));
}

.crm-header-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 9999px;
    background: var(--primary);
    color: var(--primary-foreground);
    font-size: 0.625rem;
    font-weight: 600;
    flex-shrink: 0;
}

.crm-header-avatar-lg {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 0.75rem;
}

.crm-header-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid transparent;
    border-radius: calc(var(--radius) - 2px);
    background: transparent;
    color: var(--foreground);
    cursor: pointer;
    transition: background 0.15s ease;
}

.crm-header-icon-btn:hover {
    background: var(--muted);
}

.crm-header-user-trigger {
    display: none;
}

.crm-header-tab-arrow {
    display: none;
}

.crm-header-user-name {
    max-width: 7.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 1.2;
}

.crm-header-user-chevron {
    width: 0.875rem;
    height: 0.875rem;
    flex-shrink: 0;
    color: var(--muted-foreground);
    transition: transform 0.15s ease, color 0.15s ease;
}

.crm-header-dropdown.is-open .crm-header-user-chevron {
    transform: rotate(180deg);
    color: var(--primary);
}

@media (max-width: 639px) {
    .crm-header-user-name {
        display: none;
    }

    .crm-header-user-btn {
        padding: 0.25rem 0.3125rem 0.25rem 0.25rem;
        gap: 0.1875rem;
    }

    .crm-header-user-chevron {
        display: block;
        width: 0.75rem;
        height: 0.75rem;
    }
}

@media (min-width: 480px) {
    .crm-header-user-name {
        max-width: 9rem;
    }
}

@media (min-width: 768px) {
    .crm-header-user-name {
        max-width: 11rem;
    }
}

.crm-header-presence-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    border: 2px solid var(--background);
    box-sizing: content-box;
}

.crm-presence-indicator {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    flex-shrink: 0;
}

.crm-presence-present {
    background: #22c55e;
}

.crm-presence-absent {
    background: #eab308;
}

.crm-presence-section {
    padding: 0.375rem 0.625rem 0.5rem;
}

.crm-presence-section-label {
    margin: 0 0 0.375rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.crm-presence-options {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.crm-presence-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.4375rem 0.5rem;
    border: 1px solid transparent;
    border-radius: calc(var(--radius) - 4px);
    background: transparent;
    font-size: 0.8125rem;
    color: var(--foreground);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.crm-presence-option:hover {
    background: var(--muted);
}

.crm-presence-option.is-active {
    background: var(--muted);
    border-color: var(--border);
}

.crm-header-badge {
    position: absolute;
    top: 0.125rem;
    right: 0.125rem;
    min-width: 0.875rem;
    height: 0.875rem;
    padding: 0 0.1875rem;
    border-radius: 9999px;
    background: var(--destructive);
    color: #fff;
    font-size: 0.5625rem;
    font-weight: 600;
    line-height: 0.875rem;
    text-align: center;
}

.crm-header-icon-btn {
    position: relative;
}

.crm-header-menu {
    position: absolute;
    top: calc(100% + 0.625rem);
    right: 0;
    z-index: 50;
    min-width: 12rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    padding: 0.375rem;
    display: none;
}

.crm-header-dropdown.is-open .crm-header-menu {
    display: block;
}

.crm-header-menu-arrow {
    position: absolute;
    top: -6px;
    right: 1.125rem;
    width: 10px;
    height: 10px;
    background: var(--card);
    border-left: 1px solid var(--border);
    border-top: 1px solid var(--border);
    transform: rotate(45deg);
    pointer-events: none;
}

.crm-header-dropdown#crm-user-menu .crm-header-menu-arrow {
    right: 1.75rem;
}

.crm-header-avatar-wrap {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
}

.crm-header-menu-header {
    padding: 0.5rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--foreground);
}

.crm-header-menu-empty {
    padding: 0.75rem 0.625rem;
    font-size: 0.75rem;
    color: var(--muted-foreground);
    text-align: center;
}

.crm-header-menu-user {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.625rem;
}

.crm-header-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 0.25rem 0;
}

.crm-header-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.625rem;
    border: none;
    border-radius: calc(var(--radius) - 4px);
    background: transparent;
    font-size: 0.8125rem;
    color: var(--foreground);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease;
}

.crm-header-menu-item svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    color: var(--muted-foreground);
}

.crm-header-menu-item:hover {
    background: var(--muted);
}

.crm-header-menu-item-danger {
    color: var(--destructive);
}

.crm-header-menu-item-danger svg {
    color: var(--destructive);
}

.crm-btn-destructive {
    background: var(--destructive);
    color: var(--destructive-foreground, #fff);
}

.crm-btn-destructive:hover {
    opacity: 0.9;
}

.crm-forgot-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    padding: 0.1875rem;
    background: var(--muted);
    border-radius: calc(var(--radius) - 2px);
}

.crm-forgot-tab {
    flex: 1;
    padding: 0.4375rem 0.625rem;
    border: none;
    border-radius: calc(var(--radius) - 4px);
    background: transparent;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.crm-forgot-tab-active {
    background: var(--card);
    color: var(--foreground);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.crm-forgot-panel {
    display: none;
}

.crm-forgot-panel-active {
    display: block;
}

.crm-forgot-panel.crm-login-form.crm-forgot-panel-active {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.crm-profile-divider {
    height: 1px;
    background: var(--border);
    margin: 1.5rem 0;
}

.crm-settings-panel-wide {
    margin-top: 0.5rem;
}

.crm-docs-empty {
    padding: 0.75rem 0;
    font-size: 0.6875rem;
}

.crm-docs-root {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    font-size: 0.6875rem;
}

.crm-docs-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem 0.5rem;
}

.crm-docs-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.125rem;
    min-width: 0;
}

.crm-docs-crumb-sep {
    color: var(--muted-foreground);
    user-select: none;
}

.crm-docs-crumb {
    font-size: 0.625rem;
    line-height: 1.3;
}

.crm-docs-crumb-btn {
    padding: 0;
    border: 0;
    background: none;
    color: var(--primary);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.crm-docs-crumb-current {
    color: var(--foreground);
    font-weight: 600;
}

.crm-docs-actions {
    flex-shrink: 0;
}

.crm-docs-dropzone {
    border: 1px dashed var(--border);
    border-radius: calc(var(--radius) - 4px);
    padding: 0.875rem 0.75rem;
    min-height: 3.25rem;
    text-align: center;
    cursor: pointer;
    background: var(--muted);
    transition: border-color 0.15s, background 0.15s;
}

.crm-docs-dropzone-over,
.crm-docs-dropzone:hover {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 8%, var(--muted));
}

.crm-docs-dropzone-busy {
    opacity: 0.6;
    pointer-events: none;
}

.crm-docs-dropzone-label {
    margin: 0;
    font-size: 0.6875rem;
    color: var(--muted-foreground);
}

.crm-docs-list {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    max-height: 14rem;
    overflow-y: auto;
}

.crm-client-profile #tab-documents {
    --crm-docs-row-h: 1.375rem;
    --crm-docs-list-cap: calc(var(--crm-docs-row-h) * 20 + 0.125rem * 19);
}

.crm-client-profile #tab-documents .crm-docs-list {
    max-height: none;
    min-height: 0;
    overflow-y: hidden;
}

.crm-client-profile #tab-documents .crm-docs-list.has-items {
    min-height: var(--crm-docs-list-cap);
    max-height: var(--crm-docs-list-cap);
}

.crm-client-profile #tab-documents .crm-docs-list.is-scrollable {
    overflow-y: auto;
}

.crm-client-profile #tab-documents .crm-docs-explorer {
    min-height: calc(var(--crm-docs-list-cap) + 3.5rem);
}

.crm-client-profile #tab-documents .crm-docs-tree {
    max-height: calc(var(--crm-docs-list-cap) + 2.75rem);
}

.crm-docs-item {
    display: grid;
    grid-template-columns: 1.125rem minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.25rem 0.375rem;
    padding: 0.1875rem 0.25rem;
    border-radius: calc(var(--radius) - 6px);
    line-height: 1.25;
}

.crm-docs-item-dir {
    cursor: pointer;
}

.crm-docs-item-dir:hover {
    background: var(--muted);
}

.crm-docs-icon {
    font-size: 0.75rem;
    line-height: 1;
}

.crm-docs-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.crm-docs-meta {
    font-size: 0.5625rem;
    color: var(--muted-foreground);
    white-space: nowrap;
}

.crm-docs-dl {
    font-size: 0.6875rem;
    color: var(--primary);
    text-decoration: none;
    padding: 0 0.125rem;
}

.crm-docs-hint,
.crm-docs-error {
    margin: 0;
    padding: 0.25rem 0;
    font-size: 0.625rem;
    color: var(--muted-foreground);
}

.crm-docs-error {
    color: var(--destructive);
}

.crm-docs-explorer {
    display: grid;
    grid-template-columns: minmax(7rem, 34%) minmax(0, 1fr);
    gap: 0.375rem;
    min-height: 12rem;
}

.crm-docs-tree {
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
    background: var(--background);
    padding: 0.375rem;
    overflow: auto;
    max-height: 16rem;
    font-size: 0.75rem;
    line-height: 1.35;
}

.crm-tree-node {
    display: flex;
    align-items: center;
    gap: 0.1875rem;
    padding: 0.125rem 0.1875rem;
    padding-left: calc(0.3125rem + var(--depth, 0) * 0.625rem);
    border-radius: calc(var(--radius) - 6px);
}

.crm-tree-node.is-selected {
    background: color-mix(in srgb, var(--primary) 12%, transparent);
}

.crm-docs-item-file[draggable="true"] {
    cursor: grab;
}

.crm-docs-item-file.is-dragging {
    opacity: 0.45;
}

.crm-tree-node.crm-docs-drop-target,
.crm-docs-item-dir.crm-docs-drop-target,
.crm-docs-crumb-btn.crm-docs-drop-target {
    background: color-mix(in srgb, var(--primary) 16%, transparent);
    outline: 1px solid color-mix(in srgb, var(--primary) 45%, transparent);
}

.crm-tree-toggle,
.crm-tree-toggle-spacer {
    width: 1rem;
    flex-shrink: 0;
    font-size: 0.5625rem;
    line-height: 1;
    color: var(--muted-foreground);
}

.crm-tree-toggle {
    border: 0;
    background: none;
    cursor: pointer;
    padding: 0;
}

.crm-tree-toggle.is-open {
    transform: rotate(90deg);
}

.crm-tree-label {
    border: 0;
    background: none;
    padding: 0;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
    color: var(--foreground);
    font-size: inherit;
    line-height: 1.35;
}

.crm-docs-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.crm-ficon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    display: block;
}

.crm-docs-item-file .crm-docs-name {
    cursor: pointer;
}

.crm-docs-item-file[data-ext="pdf"] .crm-docs-name:hover {
    color: var(--primary);
    text-decoration: underline;
}

.crm-docs-action {
    font-size: 0.6875rem;
    color: var(--primary);
    text-decoration: none;
    padding: 0 0.125rem;
}

.crm-docs-item-actions {
    display: flex;
    gap: 0.125rem;
    align-items: center;
    justify-content: flex-end;
}

.crm-emails-root {
    font-size: 0.6875rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.crm-emails-dropzone {
    min-height: 2.5rem;
    padding: 0.5rem 0.625rem;
}

.crm-emails-table-wrap {
    max-height: 16rem;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
}

.crm-emails-table {
    width: 100%;
}

.crm-emails-row {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.crm-emails-row:hover,
.crm-emails-row:focus-visible {
    background: hsl(var(--primary) / 0.06);
}

.crm-emails-cell-name {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    min-width: 0;
}

.crm-emails-cell-name span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-emails-cell-actions {
    width: 2rem;
    text-align: center;
}

.crm-emails-delete {
    opacity: 0.55;
}

.crm-emails-row:hover .crm-emails-delete,
.crm-emails-row:focus-within .crm-emails-delete {
    opacity: 1;
}

.crm-emails-list {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    max-height: 16rem;
    overflow-y: auto;
}

.crm-emails-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
    background: var(--background);
    padding: 0.3125rem 0.375rem;
    cursor: pointer;
    text-align: left;
}

.crm-emails-item:hover {
    background: var(--muted);
}

.crm-emails-item-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.0625rem;
}

.crm-emails-item-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.crm-emails-item-meta {
    font-size: 0.5625rem;
    color: var(--muted-foreground);
}

.crm-email-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.crm-email-modal.hidden {
    display: none;
}

.crm-email-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgb(0 0 0 / 0.45);
}

.crm-email-modal-panel {
    position: relative;
    z-index: 1;
    width: min(42rem, 100%);
    max-height: min(85vh, 40rem);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 12px 40px rgb(0 0 0 / 0.18);
}

.crm-email-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.625rem;
    border-bottom: 1px solid var(--border);
}

.crm-email-modal-title {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.crm-email-modal-head-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.crm-email-modal-trash {
    padding: 0.125rem 0.25rem;
}

.crm-email-modal-close {
    border: 0;
    background: none;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    color: var(--muted-foreground);
}

.crm-email-modal-meta {
    padding: 0.375rem 0.625rem;
    font-size: 0.625rem;
    border-bottom: 1px solid var(--border);
    color: var(--muted-foreground);
    display: grid;
    gap: 0.125rem;
}

.crm-email-modal-meta strong {
    color: var(--foreground);
}

.crm-email-modal-body {
    padding: 0.5rem 0.625rem;
    overflow: auto;
    flex: 1;
    font-size: 0.6875rem;
}

.crm-email-text {
    margin: 0;
    white-space: pre-wrap;
    font-family: inherit;
    font-size: inherit;
}

.crm-email-html {
    font-size: inherit;
    line-height: 1.45;
}

.crm-email-modal-attachments {
    padding: 0.375rem 0.625rem 0.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
    align-items: center;
}

.crm-email-att-title {
    margin: 0;
    font-size: 0.625rem;
    font-weight: 600;
    width: 100%;
}

.crm-email-att-link {
    font-size: 0.625rem;
    color: var(--primary);
}

.crm-docs-name-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.1875rem;
    min-width: 0;
    max-width: 100%;
}

.crm-docs-name-wrap .crm-docs-name {
    flex: 1 1 auto;
}

.crm-docs-rename {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted-foreground);
    cursor: pointer;
    opacity: 0.65;
}

.crm-docs-rename:hover {
    color: var(--primary);
    opacity: 1;
}

.crm-ficon-pencil {
    width: 0.75rem;
    height: 0.75rem;
}

.crm-docs-copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted-foreground);
    cursor: pointer;
    opacity: 0.65;
}

.crm-docs-copy:hover {
    color: var(--primary);
    opacity: 1;
}

.crm-ficon-copy {
    width: 0.8125rem;
    height: 0.8125rem;
}

.crm-docs-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: none;
    color: var(--destructive);
    cursor: pointer;
    opacity: 0.75;
}

.crm-docs-delete:hover {
    opacity: 1;
}

.crm-ficon-trash {
    width: 0.875rem;
    height: 0.875rem;
}

@media (max-width: 767px) {
    .crm-client-profile-right {
        gap: 1rem;
        min-width: 0;
    }

    .crm-client-contracts-panel {
        min-width: 0;
        max-width: 100%;
        overflow-x: hidden;
    }

    .crm-client-contracts-panel .crm-client-panel-header {
        flex-wrap: wrap;
        align-items: stretch;
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .crm-client-contracts-panel .crm-client-panel-header-left {
        flex: 1 1 auto;
        min-width: 0;
    }

    .crm-client-contracts-panel .crm-client-panel-header-actions {
        flex: 1 1 100%;
        flex-wrap: wrap;
        width: 100%;
        min-width: 0;
    }

    .crm-client-contracts-panel .crm-client-panel-header-actions > * {
        flex: 1 1 auto;
        min-width: 0;
    }

    .crm-client-contracts-panel .crm-client-ddc-btn,
    .crm-client-contracts-panel .crm-client-add-contrat-btn {
        width: 100%;
        max-width: 100%;
        justify-content: center;
    }

    .crm-client-contracts-panel .crm-ddc-menu {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: 0;
    }

    .crm-client-tabs-panel {
        min-width: 0;
        max-width: 100%;
        overflow-x: hidden;
        overflow-y: visible;
    }

    .crm-client-tabs-panel .crm-tab-panels {
        min-width: 0;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .crm-client-tabs-panel .crm-tabs {
        overflow-x: auto;
        overflow-y: hidden;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        margin-top: 0.25rem;
        padding-top: 0.5rem;
        padding-bottom: 0.25rem;
        max-width: 100%;
    }

    .crm-client-tabs-panel .crm-tab {
        flex-shrink: 0;
    }

    .crm-docs-explorer {
        grid-template-columns: 1fr;
    }

    .crm-docs-tree {
        max-height: 9rem;
    }

    .crm-docs-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .crm-docs-breadcrumb {
        font-size: 0.5625rem;
    }

    .crm-docs-list,
    .crm-emails-list {
        max-height: none;
    }

    .crm-client-profile #tab-documents .crm-docs-list.has-items {
        min-height: var(--crm-docs-list-cap);
        max-height: var(--crm-docs-list-cap);
    }

    .crm-client-profile #tab-documents .crm-docs-tree {
        max-height: calc(var(--crm-docs-list-cap) + 2.75rem);
    }

    .crm-email-modal {
        padding: 0.5rem;
    }

    .crm-email-modal-panel {
        width: 100%;
        max-height: 92vh;
    }

    .crm-docs-item {
        grid-template-columns: 1.125rem minmax(0, 1fr) auto;
        grid-template-areas:
            "icon name actions"
            "icon meta actions";
    }

    .crm-docs-icon { grid-area: icon; }
    .crm-docs-name { grid-area: name; }
    .crm-docs-meta { grid-area: meta; }
    .crm-docs-item-actions {
        grid-area: actions;
        display: flex;
        gap: 0.125rem;
        align-items: center;
    }
}

.crm-modal-content-xl {
    max-width: min(52rem, calc(100vw - 2rem));
    width: 100%;
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (min-width: 1024px) {
    .crm-modal-content-xl {
        max-width: min(48rem, calc(100vw - 280px));
    }
}

.crm-client-contrat-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

@media (max-width: 768px) {
    .crm-client-contrat-form-grid {
        grid-template-columns: 1fr;
    }
}

/* Popup nouveau client — compact */
.crm-client-modal form.crm-modal-body {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.crm-client-modal .crm-client-modal-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.5rem 0.875rem;
}

.crm-client-modal .crm-modal-header,
.crm-client-modal .crm-modal-footer {
    padding: 0.5rem 0.875rem;
    flex-shrink: 0;
}

.crm-client-modal .crm-modal-header h3 {
    font-size: 0.875rem;
}

.crm-client-modal .crm-modal-footer {
    gap: 0.375rem;
    border-top: 1px solid var(--border);
}

.crm-client-modal .crm-modal-footer .crm-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.crm-client-modal .crm-client-form-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.crm-client-modal .crm-client-form-section-title {
    margin: 0;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted-foreground);
}

.crm-client-modal .crm-label {
    margin-bottom: 0.125rem;
    font-size: 0.6875rem;
}

.crm-client-modal .crm-input,
.crm-client-modal .crm-search-select-trigger {
    padding: 0.3125rem 0.5rem;
    font-size: 0.75rem;
}

.crm-client-modal .crm-form-grid {
    gap: 0.5rem;
}

.crm-client-modal .crm-alert {
    padding: 0.4375rem 0.625rem;
    font-size: 0.6875rem;
    margin-bottom: 0.5rem;
}

.crm-client-modal .crm-search-select-dropdown {
    top: calc(100% + 0.125rem);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.crm-client-modal .crm-search-select-search-wrap {
    padding: 0.3125rem;
}

.crm-client-modal .crm-search-select-search {
    padding: 0.25rem 0.4375rem;
    font-size: 0.6875rem;
}

.crm-client-modal .crm-search-select-options {
    max-height: 8.5rem;
    padding: 0.125rem 0;
}

.crm-client-modal .crm-search-select-option,
.crm-client-modal .crm-search-select-empty {
    padding: 0.3125rem 0.5rem;
    font-size: 0.6875rem;
    gap: 0.375rem;
    line-height: 1.25;
}

.crm-client-modal .crm-search-select-cp {
    font-size: 0.625rem;
    min-width: 2.25rem;
}

.crm-client-modal .crm-search-select-label {
    font-size: 0.6875rem;
}

.crm-client-duplicate-status {
    margin: 0 0 0.5rem;
    font-size: 0.6875rem;
    color: var(--muted-foreground);
}

.crm-client-duplicate-status.is-found {
    color: hsl(221 83% 40%);
    font-weight: 500;
}

.crm-client-duplicate-status.is-searching {
    color: var(--muted-foreground);
}

.crm-client-form-section.is-readonly {
    opacity: 0.92;
}

.crm-client-form-section.is-readonly .crm-search-select-trigger:disabled {
    background: var(--muted);
    color: var(--muted-foreground);
    cursor: default;
    opacity: 1;
}

.crm-client-name-field {
    position: relative;
}

.crm-client-create-suggestions {
    margin: 0 0 0.5rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
    background: var(--card);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.1);
    max-height: 10rem;
    overflow-y: auto;
}

.crm-client-create-suggestions.hidden {
    display: none;
}

.crm-client-create-suggestion {
    display: block;
    width: 100%;
    border: none;
    border-bottom: 1px solid var(--border);
    background: transparent;
    padding: 0.4375rem 0.625rem;
    text-align: left;
    cursor: pointer;
    font-size: 0.6875rem;
    line-height: 1.35;
    color: var(--foreground);
}

.crm-client-create-suggestion:last-child {
    border-bottom: none;
}

.crm-client-create-suggestion:hover,
.crm-client-create-suggestion.is-active {
    background: var(--accent);
}

.crm-client-create-suggestion-name {
    display: block;
    font-weight: 600;
}

.crm-client-create-suggestion-meta {
    display: block;
    margin-top: 0.125rem;
    color: var(--muted-foreground);
}

.crm-client-create-suggestions-empty {
    padding: 0.5rem 0.625rem;
    font-size: 0.6875rem;
    color: var(--muted-foreground);
}

.crm-alert {
    padding: 0.625rem 0.75rem;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.75rem;
    line-height: 1.4;
}

.crm-alert-info {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: var(--foreground);
}

.crm-compagnie-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.crm-compagnie-icon {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 0.25rem;
    object-fit: contain;
    flex-shrink: 0;
}

.crm-compagnie-icon-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    font-weight: 700;
    color: #fff;
    background: hsl(var(--comp-hue, 220) 65% 45%);
}

.crm-email-html-frame {
    width: 100%;
    min-height: 280px;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    background: #fff;
}

.crm-contrat-row {
    cursor: pointer;
}

.crm-ficon-pdf {
    width: 1rem;
    height: 1rem;
    font-size: 1rem;
    line-height: 1;
    color: #dc2626;
}

.crm-form-grid .crm-field-span-2 {
    grid-column: 1 / -1;
}

.crm-notes-root {
    font-size: 0.6875rem;
}

.crm-notes-table-scroll {
    max-height: 14rem;
    overflow-x: auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.crm-notes-page-card .crm-table-scroll {
    overflow-y: auto;
    overscroll-behavior: contain;
}

.crm-notes-page {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: calc(100dvh - 5.5rem);
    min-height: 0;
}

.crm-notes-page .crm-notes-calendar-card,
.crm-notes-page .crm-notes-page-toolbar {
    flex-shrink: 0;
}

.crm-notes-page .crm-notes-page-card {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow: visible;
}

.crm-notes-page .crm-notes-page-card .crm-table-scroll {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
}

.crm-notes-page .crm-notes-page-card > nav[aria-label="Pagination"] {
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    background: var(--card);
}

.crm-notes-page-card .crm-notes-page-table th,
.crm-notes-page-card .crm-notes-page-table td {
    padding: 0.5rem 0.5rem;
    font-size: 0.75rem;
    line-height: 1.4;
}

.crm-notes-page-card .crm-notes-page-table th {
    height: auto;
    min-height: 2.25rem;
}

.crm-notes-table th,
.crm-notes-table td {
    padding: 0.125rem 0.3125rem;
    font-size: 0.625rem;
    line-height: 1.2;
    vertical-align: middle;
}

.crm-notes-root .crm-notes-table th,
.crm-notes-root .crm-notes-table td {
    padding: 0.375rem 0.4375rem;
    font-size: 0.6875rem;
    line-height: 1.35;
}

.crm-notes-root .crm-notes-table th {
    height: auto;
    min-height: 1.875rem;
}

.crm-notes-table .crm-notes-cell-date {
    white-space: nowrap;
    width: 1%;
}

.crm-notes-table .crm-notes-cell-libelle {
    font-weight: 500;
    max-width: 7rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-notes-table .crm-notes-cell-client {
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.crm-notes-table .crm-notes-cell-detail {
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-notes-table .crm-notes-cell-user {
    max-width: 4.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-notes-col-termine {
    width: 2.5rem;
    text-align: center;
}

.crm-notes-col-trash,
.crm-client-contracts-table .crm-col-actions {
    width: 2.25rem;
    text-align: center;
    padding-left: 0.125rem !important;
    padding-right: 0.125rem !important;
}

.crm-note-trash-btn,
.crm-contrat-trash-btn {
    color: var(--muted-foreground);
}

.crm-note-trash-btn svg,
.crm-contrat-trash-btn svg {
    width: 0.75rem;
    height: 0.75rem;
    display: block;
}

.crm-note-trash-btn:hover,
.crm-contrat-trash-btn:hover {
    color: hsl(var(--destructive));
    background: hsl(var(--destructive) / 0.08);
}

.crm-notes-row {
    cursor: pointer;
}

.crm-notes-row:hover {
    background: var(--muted);
}

.crm-note-dot {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    vertical-align: middle;
}

.crm-note-dot-yes {
    background: #16a34a;
    box-shadow: 0 0 0 1px rgb(22 163 74 / 0.25);
}

.crm-note-dot-no {
    background: #dc2626;
    box-shadow: 0 0 0 1px rgb(220 38 38 / 0.25);
}

.crm-note-modal {
    max-width: min(56rem, calc(100vw - 1rem));
    width: 100%;
    max-height: calc(100vh - 1rem);
    display: flex;
    flex-direction: column;
    margin: auto;
}

#contract-note-modal.crm-modal {
    padding: 1rem;
    align-items: center;
    justify-content: center;
}

@media (min-width: 1024px) {
    #contract-note-modal.crm-modal {
        padding-left: 1rem;
    }
}

.crm-note-modal-header,
.crm-note-modal-footer {
    padding: 0.5rem 0.875rem;
}

.crm-note-modal-header h3,
.crm-note-modal-title {
    font-size: 0.875rem;
    margin: 0;
    line-height: 1.35;
}

.crm-note-modal-title-wrap {
    flex: 1;
    min-width: 0;
}

.crm-note-title-line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.125rem 0.25rem;
}

.crm-note-title-part {
    font-weight: 600;
    color: var(--foreground);
}

.crm-note-title-libelle {
    color: hsl(var(--primary));
}

.crm-note-title-police {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
}

.crm-note-title-compagnie {
    font-size: 0.8125rem;
    color: var(--muted-foreground);
}

.crm-note-title-sep {
    color: var(--border);
    font-weight: 400;
    user-select: none;
}

.crm-note-title-client {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--muted-foreground);
    padding: 0.0625rem 0.375rem;
    border-radius: 9999px;
    background: hsl(var(--muted) / 0.65);
    white-space: nowrap;
}

.crm-notes-add-btn {
    flex-shrink: 0;
    white-space: nowrap;
}

.crm-notes-tab-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.crm-notes-tab-search {
    position: relative;
    flex: 1 1 12rem;
    min-width: 10rem;
    max-width: 20rem;
}

.crm-notes-tab-search .crm-toolbar-search-icon {
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0.875rem;
    height: 0.875rem;
    color: var(--muted-foreground);
    pointer-events: none;
}

.crm-notes-search-input {
    width: 100%;
    padding-left: 1.75rem;
    font-size: 0.75rem;
    min-height: 1.75rem;
}

.crm-notes-tab-pagination {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-left: auto;
}

.crm-notes-tab-pagination-footer {
    margin-left: 0;
    margin-top: 0.375rem;
    justify-content: flex-end;
}

.crm-notes-page-info {
    font-size: 0.6875rem;
    color: var(--muted-foreground);
    white-space: nowrap;
}

.crm-notes-page-buttons {
    display: flex;
    gap: 0.125rem;
}

.crm-notes-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.25rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
    background: transparent;
    color: var(--muted-foreground);
    font-size: 0.6875rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.crm-notes-page-btn:hover {
    background: hsl(var(--muted) / 0.5);
    color: var(--foreground);
}

.crm-notes-page-btn-active {
    background: hsl(var(--primary));
    border-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.crm-notes-calendar-card {
    position: relative;
    overflow: hidden;
    padding: 0.4375rem 0.5rem 0.375rem;
    border: 1px solid hsl(var(--primary) / 0.14);
    background:
        linear-gradient(135deg, hsl(var(--primary) / 0.07) 0%, transparent 42%),
        linear-gradient(180deg, hsl(var(--card)) 0%, hsl(var(--muted) / 0.22) 100%);
    box-shadow: 0 1px 0 hsl(var(--primary) / 0.06) inset;
}

.crm-notes-calendar-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, hsl(var(--primary) / 0.15), hsl(var(--primary)), hsl(var(--primary) / 0.15));
    pointer-events: none;
}

.crm-notes-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.375rem;
    margin-bottom: 0.375rem;
}

.crm-notes-calendar-title-wrap {
    min-width: 0;
    flex: 1;
    text-align: center;
}

.crm-notes-calendar-title-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3125rem;
}

.crm-notes-calendar-icon {
    width: 0.875rem;
    height: 0.875rem;
    color: hsl(var(--primary));
    flex-shrink: 0;
}

.crm-notes-calendar-title {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--foreground);
    letter-spacing: 0.01em;
}

.crm-notes-calendar-legend {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin: 0.0625rem 0 0;
    font-size: 0.5625rem;
    color: var(--muted-foreground);
}

.crm-notes-calendar-legend-dot {
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 9999px;
    background: linear-gradient(90deg, #16a34a, hsl(var(--primary)));
    flex-shrink: 0;
}

   .crm-notes-calendar-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border: 1px solid hsl(var(--primary) / 0.22);
    border-radius: 9999px;
    background:linear-gradient(135deg, #e6e6e6, #c4c2c2);
    color: hsl(var(--primary));
    cursor: hand;
    flex-shrink: 0;
    transition:all 0.25s ease;  
    box-shadow: 0 4px 10px rgba(106, 17, 203, 0.25);
}

.crm-notes-calendar-nav svg {
    width: 0.75rem;
    height: 0.75rem;
}

.crm-notes-calendar-nav:hover {
    border-color: hsl(var(--primary) / 0.45);
    background:linear-gradient(135deg, #e6e6e6, #636161);
}

.crm-notes-calendar-nav:active {
    transform: scale(0.94);
}

.crm-notes-calendar-scroll {
    overflow-x: hidden;
    overflow-y: hidden;
    padding: 0.375rem 0.25rem 0.5rem;
    scrollbar-width: none;
}

.crm-notes-calendar-scroll::-webkit-scrollbar {
    display: none;
}

.crm-notes-calendar-track {
    display: grid;
    grid-template-columns: repeat(var(--cal-days, 31), minmax(0, 1fr));
    gap: 0.125rem;
    width: 100%;
}

.crm-notes-calendar-day {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.0625rem;
    min-width: 0;
    padding: 0.1875rem 0.0625rem 0.25rem;
    border: 1px solid hsl(var(--border) / 0.85);
    border-radius: calc(var(--radius) - 4px);
    background: hsl(var(--background) / 0.92);
    color: var(--foreground);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}

.crm-notes-calendar-day:hover {
    background: hsl(var(--primary) / 0.07);
    border-color: hsl(var(--primary) / 0.32);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px hsl(var(--primary) / 0.08);
}

.crm-notes-calendar-weekday {
    font-size: 0.5rem;
    font-weight: 800;
    color: var(--muted-foreground);
    line-height: 1;
    letter-spacing: 0.02em;
}

.crm-notes-calendar-num {
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1;
}

.crm-notes-calendar-stats {
    font-size: 0.5rem;
    font-weight: 700;
    color: hsl(var(--primary));
    line-height: 1;
    white-space: nowrap;
}

.crm-notes-calendar-day-empty .crm-notes-calendar-stats {
    color: var(--muted-foreground);
    font-weight: 500;
}

.crm-notes-calendar-day-weekend {
    background: hsl(var(--muted) / 0.28);
}

.crm-notes-calendar-day-weekend .crm-notes-calendar-weekday {
    color: hsl(var(--primary) / 0.72);
}

.crm-notes-calendar-day-pending {
    border-color: hsl(38 92% 50% / 0.28);
    background: hsl(38 92% 50% / 0.06);
}

.crm-notes-calendar-day-pending .crm-notes-calendar-stats {
    color: #c2410c;
}

.crm-notes-calendar-day-done {
    border-color: hsl(142 71% 45% / 0.24);
    background: hsl(142 71% 45% / 0.07);
}

.crm-notes-calendar-day-done .crm-notes-calendar-stats {
    color: #15803d;
}

.crm-notes-calendar-day-today {
    border-color: color-mix(in srgb, var(--primary) 65%, var(--border));
    background: linear-gradient(
        155deg,
        color-mix(in srgb, var(--primary) 48%, #ffffff) 0%,
        color-mix(in srgb, var(--primary) 28%, #ffffff) 52%,
        color-mix(in srgb, var(--accent) 24%, #ffffff) 100%
    );
    box-shadow:
        inset 0 1px 0 color-mix(in srgb, #ffffff 70%, transparent),
        0 2px 8px color-mix(in srgb, var(--primary) 32%, transparent);
    position: relative;
    z-index: 1;
}

.crm-notes-calendar-day-today:hover {
    background: linear-gradient(
        155deg,
        color-mix(in srgb, var(--primary) 56%, #ffffff) 0%,
        color-mix(in srgb, var(--primary) 34%, #ffffff) 52%,
        color-mix(in srgb, var(--accent) 30%, #ffffff) 100%
    );
    border-color: color-mix(in srgb, var(--primary) 75%, var(--border));
    box-shadow:
        inset 0 1px 0 color-mix(in srgb, #ffffff 70%, transparent),
        0 3px 10px color-mix(in srgb, var(--primary) 38%, transparent);
    transform: translateY(-1px);
}

.crm-notes-calendar-day-today .crm-notes-calendar-weekday {
    color: var(--primary);
    font-weight: 700;
}

.crm-notes-calendar-day-today .crm-notes-calendar-num {
    color: var(--primary);
    font-weight: 800;
    font-size: 0.95rem;
}

.crm-notes-calendar-day-today .crm-notes-calendar-stats {
    color: color-mix(in srgb, var(--primary) 88%, #1a1a2e);
    font-weight: 600;
}

.crm-notes-calendar-day-active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-foreground);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--primary) 35%, transparent);
    transform: none;
}

.crm-notes-calendar-day-active .crm-notes-calendar-weekday,
.crm-notes-calendar-day-active .crm-notes-calendar-stats,
.crm-notes-calendar-day-active .crm-notes-calendar-num {
    color: var(--primary-foreground);
}

.crm-notes-calendar-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.25rem;
    min-height: 1rem;
}

@media (max-width: 639px) {
    .crm-notes-calendar-scroll {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: hsl(var(--primary) / 0.45) hsl(var(--muted) / 0.35);
        padding: 0.375rem 0.375rem 0.5rem;
    }

    .crm-notes-calendar-scroll::-webkit-scrollbar {
        display: block;
        height: 4px;
    }

    .crm-notes-calendar-scroll::-webkit-scrollbar-track {
        background: hsl(var(--muted) / 0.35);
        border-radius: 9999px;
    }

    .crm-notes-calendar-scroll::-webkit-scrollbar-thumb {
        background: hsl(var(--primary) / 0.45);
        border-radius: 9999px;
    }

    .crm-notes-calendar-track {
        display: flex;
        gap: 0.1875rem;
        min-width: min-content;
        width: auto;
    }

    .crm-notes-calendar-day {
        flex: 0 0 2.125rem;
        min-width: 2.125rem;
        padding: 0.25rem 0.125rem 0.3125rem;
    }
}

.crm-note-detail-form {
    padding: 0.375rem 0.75rem 0.5rem;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.crm-note-detail-form.crm-note-modal-loading {
    visibility: hidden;
}

.crm-note-form-grid {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    flex: 1;
    min-height: 0;
}

.crm-note-field-libelle {
    flex-shrink: 0;
}

.crm-note-form-meta {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.375rem;
    flex-shrink: 0;
}

.crm-note-description-field {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.crm-note-form-grid .crm-label {
    font-size: 0.625rem;
    margin-bottom: 0.0625rem;
}

.crm-note-form-grid .crm-input,
.crm-note-form-grid textarea.crm-input {
    padding: 0.25rem 0.375rem;
    font-size: 0.6875rem;
    min-height: 1.5rem;
}

/* « Enregistrée par » (godmode) : select aligné sur les inputs compacts de la note. */
.crm-note-form-meta .crm-search-select-trigger {
    font-size: 0.6875rem;
    padding: 0.25rem 0.375rem;
    min-height: 1.5rem;
}

.crm-note-form-meta .crm-search-select-search {
    font-size: 0.6875rem;
    padding: 0.25rem 0.375rem;
}

.crm-note-form-meta .crm-search-select-option,
.crm-note-form-meta .crm-search-select-empty {
    font-size: 0.6875rem;
    padding: 0.3125rem 0.5rem;
}

.crm-note-form-meta .crm-search-select-options {
    max-height: 9rem;
}

/* Dernière colonne de la grille : le menu s'ouvre vers la gauche pour rester visible. */
.crm-note-form-meta .crm-search-select-dropdown {
    left: auto;
    right: 0;
    width: 13rem;
    max-width: calc(100vw - 3rem);
}

.crm-note-form-grid textarea.crm-note-description {
    flex: 1;
    min-height: 16rem;
    height: 100%;
    resize: vertical;
    font-size: 0.8125rem;
    line-height: 1.45;
    padding: 0.5rem 0.625rem;
}

.crm-note-modal-footer .crm-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

@media (max-width: 639px) {
    .crm-notes-table-scroll {
        max-height: 12rem;
    }

    .crm-notes-table th,
    .crm-notes-table td {
        padding: 0.4375rem 0.375rem;
        font-size: 0.6875rem;
        line-height: 1.35;
    }

    .crm-notes-table th {
        height: auto;
        min-height: 2rem;
    }

    .crm-notes-page-card .crm-notes-page-table th,
    .crm-notes-page-card .crm-notes-page-table td {
        padding: 0.5625rem 0.4375rem;
        font-size: 0.8125rem;
        line-height: 1.45;
    }

    .crm-notes-page-card .crm-notes-page-table th {
        min-height: 2.5rem;
    }

    .crm-note-modal {
        max-width: calc(100vw - 0.75rem);
        max-height: calc(100vh - 0.5rem);
    }

    .crm-note-form-meta {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .crm-note-form-grid textarea.crm-note-description {
        min-height: 12rem;
    }
}

/* Annuaire compagnies */
.crm-annuaire-table-card .crm-table-scroll {
    max-height: none;
}

.crm-annuaire-row {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.crm-annuaire-row:hover,
.crm-annuaire-row:focus-visible {
    background: hsl(var(--primary) / 0.06);
}

.crm-annuaire-row-active {
    background: hsl(var(--primary) / 0.12);
    box-shadow: inset 3px 0 0 hsl(var(--primary));
}

.crm-annuaire-detail {
    margin-top: 0.25rem;
}

.crm-annuaire-detail-shell {
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) + 2px);
    background: linear-gradient(180deg, hsl(var(--card)) 0%, hsl(var(--background)) 100%);
    box-shadow: 0 8px 24px hsl(var(--foreground) / 0.06);
    overflow: hidden;
}

.crm-annuaire-detail-hero {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.5rem 0.75rem;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(135deg, hsl(var(--primary) / 0.1) 0%, hsl(var(--primary) / 0.03) 55%, transparent 100%);
    border-bottom: 1px solid hsl(var(--border));
}

.crm-annuaire-detail-avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.625rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #fff;
    background: hsl(calc(var(--annuaire-hue, 262)) 58% 46%);
    box-shadow: 0 2px 8px hsl(calc(var(--annuaire-hue, 262)) 58% 46% / 0.25);
}

.crm-annuaire-detail-title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 700;
    line-height: 1.2;
    color: hsl(var(--foreground));
}

.crm-annuaire-detail-meta {
    margin: 0.15rem 0 0;
    font-size: 0.6875rem;
    color: hsl(var(--muted-foreground));
}

.crm-annuaire-detail-actions {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.crm-annuaire-detail-actions .crm-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3125rem 0.625rem;
    font-size: 0.6875rem;
}

.crm-annuaire-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.375rem 0.625rem 0;
    background: hsl(var(--muted) / 0.45);
    border-bottom: 1px solid hsl(var(--border));
}

.crm-annuaire-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3125rem 0.625rem;
    border: 1px solid transparent;
    border-radius: 0.5rem 0.5rem 0 0;
    background: transparent;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: hsl(var(--muted-foreground));
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.crm-annuaire-tab-icon {
    font-size: 0.6875rem;
    line-height: 1;
}

.crm-annuaire-tab[data-annuaire-tab="details"] .crm-annuaire-tab-icon { color: #7c3aed; }
.crm-annuaire-tab[data-annuaire-tab="sante"] .crm-annuaire-tab-icon { color: #059669; }
.crm-annuaire-tab[data-annuaire-tab="prevoyance"] .crm-annuaire-tab-icon { color: #2563eb; }
.crm-annuaire-tab[data-annuaire-tab="vie"] .crm-annuaire-tab-icon { color: #db2777; }
.crm-annuaire-tab[data-annuaire-tab="collectif"] .crm-annuaire-tab-icon { color: #ea580c; }
.crm-annuaire-tab[data-annuaire-tab="assur_pret"] .crm-annuaire-tab-icon { color: #d97706; }

.crm-annuaire-tab:hover:not(.crm-annuaire-tab-active) {
    color: hsl(var(--foreground));
    background: hsl(var(--background) / 0.85);
    border-color: hsl(var(--border));
}

.crm-annuaire-tab-active {
    color: #fff;
    background: linear-gradient(135deg, #7c3aed 0%, #6366f1 52%, #4f46e5 100%);
    border-color: transparent;
    box-shadow: 0 3px 10px hsl(262 58% 46% / 0.3);
}

.crm-annuaire-tab-active .crm-annuaire-tab-icon {
    color: #fff !important;
}

.crm-annuaire-panels {
    padding: 0.5rem 0.625rem 0.625rem;
    background: linear-gradient(180deg, hsl(var(--primary) / 0.02) 0%, transparent 1.5rem);
}

.crm-annuaire-panel {
    animation: crm-tab-fade 0.18s ease;
}

.crm-annuaire-form-card {
    padding: 0.5rem 0.625rem;
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) - 2px);
    background: hsl(var(--card));
}

.crm-annuaire-form {
    gap: 0.4375rem;
}

.crm-annuaire-detail .crm-field {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.crm-annuaire-detail .crm-label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0;
    font-size: 0.625rem;
    line-height: 1.2;
}

.crm-annuaire-detail .crm-input,
.crm-annuaire-detail textarea.crm-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.25rem 0.4375rem;
    font-size: 0.75rem;
    line-height: 1.35;
    min-height: 1.625rem;
}

.crm-annuaire-form-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0.125rem 0 0;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid hsl(var(--border));
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: hsl(var(--foreground));
}

.crm-annuaire-form-group:first-child {
    margin-top: 0;
}

.crm-annuaire-group-icon,
.crm-annuaire-label-icon {
    font-size: 0.6875rem;
    line-height: 1;
    flex-shrink: 0;
}

.crm-annuaire-group-icon-violet,
.crm-annuaire-label-icon-violet { color: #7c3aed; }
.crm-annuaire-group-icon-blue,
.crm-annuaire-label-icon-blue { color: #2563eb; }
.crm-annuaire-group-icon-green,
.crm-annuaire-label-icon-green { color: #059669; }
.crm-annuaire-group-icon-orange,
.crm-annuaire-label-icon-orange { color: #ea580c; }
.crm-annuaire-group-icon-indigo,
.crm-annuaire-label-icon-indigo { color: #4f46e5; }
.crm-annuaire-label-icon-teal { color: #0d9488; }
.crm-annuaire-label-icon-slate { color: #64748b; }
.crm-annuaire-label-icon-amber { color: #d97706; }

.crm-annuaire-branch-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 0.625rem 0.75rem;
    align-items: start;
}

.crm-annuaire-branch-form-left,
.crm-annuaire-branch-form-right {
    display: flex;
    flex-direction: column;
    gap: 0.4375rem;
    min-width: 0;
}

.crm-annuaire-field-comments {
    flex: 1;
    min-height: 0;
}

.crm-annuaire-comments {
    min-height: 9rem;
    resize: vertical;
    line-height: 1.4;
    white-space: pre-wrap;
}

.crm-annuaire-detail .crm-input[readonly],
.crm-annuaire-detail textarea.crm-input[readonly] {
    background: hsl(var(--muted) / 0.35);
    cursor: default;
}

.crm-badge-muted {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.625rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    background: hsl(var(--muted));
    color: hsl(var(--muted-foreground));
}

@media (max-width: 767px) {
    .crm-annuaire-detail-hero {
        grid-template-columns: auto 1fr;
    }

    .crm-annuaire-detail-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .crm-annuaire-branch-form {
        grid-template-columns: 1fr;
    }

    .crm-annuaire-comments {
        min-height: 7rem;
    }

    .crm-annuaire-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        scrollbar-width: thin;
    }
}

/* Support chat widget */
body:has(.crm-support-chat) .crm-toast-container {
    bottom: 7.75rem;
    z-index: 10000;
}

.crm-support-chat {
    position: fixed;
    right: 0.25rem;
    bottom: 1rem;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
    pointer-events: none;
}

.crm-support-chat > * {
    pointer-events: auto;
}

.crm-support-chat-launcher {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem;
    border: none;
    border-radius: 9999px;
    background: #25d366;
    color: #fff;
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.35);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    max-width: calc(100vw - 2rem);
}

.crm-support-chat-launcher:hover {
    transform: translateY(-2px);
    background: #20bd5a;
    box-shadow: 0 12px 28px rgba(37, 211, 102, 0.42);
}

.crm-support-chat-launcher.is-open {
    padding: 0.625rem;
    border-radius: 9999px;
    background: #128c7e;
}

.crm-support-chat-launcher.is-open:hover {
    background: #0f7a6e;
}

.crm-support-chat-launcher.is-open .crm-support-chat-launcher-label {
    display: none;
}

.crm-support-chat-launcher-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.crm-support-chat-launcher-label {
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
}

.crm-support-chat-panel {
    width: min(22rem, calc(100vw - 2rem));
    height: min(32rem, calc(100vh - 6rem));
    display: flex;
    flex-direction: column;
    border: none;
    border-radius: 14px;
    background: #efeae2;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.22);
    overflow: hidden;
}

.crm-support-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    border-bottom: none;
    background: #075e54;
    color: #fff;
}

.crm-support-chat-header-main {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
}

.crm-support-chat-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.crm-support-chat-title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.2;
    color: #fff;
}

.crm-support-chat-subtitle {
    margin: 0.125rem 0 0;
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.78);
}

.crm-support-chat-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border: none;
    border-radius: 9999px;
    background: transparent;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
}

.crm-support-chat-icon-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.crm-support-chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.75rem 0.625rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    background-color: #e5ddd5;
    background-image:
        radial-gradient(rgba(0, 0, 0, 0.025) 1px, transparent 1px),
        radial-gradient(rgba(255, 255, 255, 0.35) 1px, transparent 1px);
    background-size: 24px 24px, 36px 36px;
    background-position: 0 0, 12px 12px;
}

.crm-support-admin-messages {
    min-height: 18rem;
    max-height: 28rem;
}

.crm-support-chat-empty {
    margin: auto 0;
    padding: 1rem 0.75rem;
    text-align: center;
    font-size: 0.75rem;
    line-height: 1.45;
    color: rgba(17, 27, 33, 0.55);
    background: rgba(255, 255, 255, 0.72);
    border-radius: 8px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
}

.crm-support-chat-message-wrap {
    display: flex;
    flex-direction: column;
    max-width: 82%;
}

.crm-support-chat-message-wrap-out {
    align-self: flex-end;
    align-items: flex-end;
}

.crm-support-chat-message-wrap-in {
    align-self: flex-start;
    align-items: flex-start;
}

.crm-support-chat-bubble-sender {
    margin: 0 0 0.1875rem 0.375rem;
    font-size: 0.625rem;
    font-weight: 600;
    line-height: 1.2;
    color: #128c7e;
}

.crm-support-chat-bubble {
    position: relative;
    max-width: 100%;
    padding: 0.375rem 0.5rem 0.25rem 0.625rem;
    border-radius: 8px;
    border: none;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
}

.crm-support-chat-bubble-user {
    background: #d9fdd3;
    border-top-right-radius: 0;
}

.crm-support-chat-bubble-user::after {
    content: '';
    position: absolute;
    top: 0;
    right: -6px;
    width: 0;
    height: 0;
    border-top: 6px solid #d9fdd3;
    border-right: 6px solid transparent;
}

.crm-support-chat-bubble-staff {
    background: #fff;
    border-top-left-radius: 0;
}

.crm-support-chat-bubble-staff::after {
    content: '';
    position: absolute;
    top: 0;
    left: -6px;
    width: 0;
    height: 0;
    border-top: 6px solid #fff;
    border-left: 6px solid transparent;
}

.crm-support-chat-bubble-body {
    font-size: 0.8125rem;
    line-height: 1.45;
    color: #111b21;
    word-break: break-word;
    padding-right: 0.25rem;
}

.crm-support-chat-bubble-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.125rem;
}

.crm-support-chat-bubble-time {
    font-size: 0.625rem;
    line-height: 1;
    color: rgba(17, 27, 33, 0.45);
}

.crm-support-chat-date-separator {
    align-self: center;
    margin: 0.375rem 0 0.25rem;
    padding: 0.3125rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 1.2;
    color: rgba(17, 27, 33, 0.62);
    background: rgba(255, 255, 255, 0.92);
    border-radius: 8px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
}

.crm-support-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.crm-support-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(17, 27, 33, 0.18);
    border-radius: 9999px;
}

.crm-support-chat-header-btn {
    padding: 0.3125rem 0.625rem;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 9999px;
    background: transparent;
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.crm-support-chat-header-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.crm-support-chat-compose {
    padding: 0.5rem 0.625rem 0.625rem;
    border-top: none;
    background: #f0f2f5;
}

.crm-support-chat-compose-inner {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

.crm-support-chat-input {
    flex: 1;
    min-height: 2.375rem;
    max-height: 6rem;
    resize: none;
    padding: 0.5625rem 0.75rem;
    border: none;
    border-radius: 9999px;
    background: #fff;
    font-size: 0.8125rem;
    line-height: 1.35;
    color: #111b21;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.crm-support-chat-input:focus {
    outline: 2px solid rgba(18, 140, 126, 0.25);
    outline-offset: 0;
}

.crm-support-chat-send-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.375rem;
    height: 2.375rem;
    flex-shrink: 0;
    border: none;
    border-radius: 9999px;
    background: #00a884;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.crm-support-chat-send-btn:hover {
    background: #008f72;
}

.crm-support-chat-send-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.crm-support-chat-send-btn svg {
    width: 1.125rem;
    height: 1.125rem;
}

.crm-support-admin-panel {
    display: flex;
    flex-direction: column;
    width: min(42rem, calc(100vw - 1.5rem));
    max-width: min(42rem, calc(100vw - 1.5rem));
    overflow: hidden;
    border-radius: 14px;
    border: none;
}

.crm-support-admin-panel .crm-modal-header {
    padding: 0.625rem 0.75rem;
    background: #075e54;
    color: #fff;
    border-bottom: none;
}

.crm-support-cell-preview {
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-support-cell-date {
    white-space: nowrap;
}

.crm-support-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.crm-support-trash-btn {
    color: var(--muted-foreground);
}

.crm-support-trash-btn:hover {
    color: hsl(var(--destructive));
    background: hsl(var(--destructive) / 0.08);
}

@media (max-width: 639px) {
    .crm-support-chat {
        right: 0.25rem;
        bottom: 1rem;
    }

    .crm-support-chat-launcher-label {
        display: none;
    }

    .crm-support-chat-panel {
        width: calc(100vw - 1.5rem);
        height: min(26rem, calc(100vh - 5rem));
    }
}

/* Documentation — même explorateur que le tab Documents contrat */
.crm-knowledge-files {
    --crm-docs-row-h: 1.375rem;
    --crm-docs-list-cap: calc(var(--crm-docs-row-h) * 20 + 0.125rem * 19);
}

.crm-knowledge-files .crm-docs-list {
    max-height: none;
    min-height: 0;
    overflow-y: hidden;
}

.crm-knowledge-files .crm-docs-list.has-items {
    min-height: var(--crm-docs-list-cap);
    max-height: var(--crm-docs-list-cap);
}

.crm-knowledge-files .crm-docs-list.is-scrollable {
    overflow-y: auto;
}

.crm-knowledge-files .crm-docs-explorer {
    min-height: calc(var(--crm-docs-list-cap) + 3.5rem);
}

.crm-knowledge-files .crm-docs-tree {
    max-height: calc(var(--crm-docs-list-cap) + 2.75rem);
}

.crm-knowledge-page .crm-tab-panels {
    min-height: 18rem;
}

/* Base de données — compagnies / libellés */
.crm-bases-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.75rem;
    align-items: stretch;
}

.crm-bases-panel {
    display: flex;
    flex-direction: column;
    min-height: 24rem;
    padding: 0.625rem 0.75rem 0.75rem;
}

.crm-bases-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.crm-bases-title {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--foreground);
    line-height: 1.3;
}

.crm-bases-subtitle {
    font-weight: 500;
    color: var(--muted-foreground);
    font-size: 0.75rem;
}

.crm-bases-search {
    margin-bottom: 0.5rem;
}

.crm-bases-table-scroll {
    flex: 1;
    min-height: 0;
    max-height: min(32rem, calc(100vh - 14rem));
    overflow-x: hidden;
}

.crm-bases-panel .crm-table {
    min-width: 0;
    width: 100%;
    table-layout: fixed;
    font-size: 0.6875rem;
    line-height: 1.15;
}

.crm-bases-panel .crm-table th {
    height: 1.25rem;
    padding: 0.125rem 0.3125rem;
    font-size: 0.625rem;
}

.crm-bases-panel .crm-table td {
    padding: 0.125rem 0.3125rem;
    font-size: 0.6875rem;
    line-height: 1.2;
}

.crm-bases-panel .crm-table .cell-mono {
    font-size: 0.625rem;
}

.crm-bases-panel .crm-table .crm-table-empty td {
    padding: 0.75rem 0.3125rem;
}

.crm-bases-panel .crm-btn-icon-xs {
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0;
    font-size: 0.6875rem;
}

.crm-bases-panel .crm-cell-name {
    max-width: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-bases-compagnie-row {
    cursor: pointer;
}

.crm-bases-compagnie-row:hover {
    background: var(--muted);
}

.crm-bases-compagnie-row.is-selected {
    background: color-mix(in srgb, var(--primary) 12%, transparent);
}

.crm-bases-compagnie-row.is-selected td {
    font-weight: 600;
}

.crm-bases-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
    padding: 0.3125rem 0.375rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    background: color-mix(in srgb, var(--muted) 55%, transparent);
}

.crm-bases-pagination.hidden {
    display: none;
}

.crm-bases-pagination .crm-notes-page-info {
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--muted-foreground);
}

.crm-bases-pagination .crm-notes-page-buttons {
    display: flex;
    align-items: center;
    gap: 0.1875rem;
}

.crm-bases-pagination .crm-notes-page-btn {
    min-width: 1.625rem;
    height: 1.625rem;
    padding: 0 0.3rem;
    border: 1px solid color-mix(in srgb, var(--border) 80%, var(--foreground));
    border-radius: calc(var(--radius) - 3px);
    background: var(--card);
    color: var(--foreground);
    font-size: 0.6875rem;
    font-weight: 500;
    box-shadow: 0 1px 0 color-mix(in srgb, var(--foreground) 6%, transparent);
    transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.crm-bases-pagination .crm-notes-page-btn:hover {
    background: color-mix(in srgb, var(--primary) 12%, var(--card));
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
    color: var(--foreground);
    box-shadow: 0 1px 2px color-mix(in srgb, var(--primary) 18%, transparent);
}

.crm-bases-pagination .crm-notes-page-btn:active {
    transform: translateY(1px);
    box-shadow: none;
}

.crm-bases-pagination .crm-notes-page-btn-active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-foreground);
    box-shadow: 0 1px 2px color-mix(in srgb, var(--primary) 35%, transparent);
}

.crm-bases-pagination .crm-notes-page-btn-active:hover {
    background: color-mix(in srgb, var(--primary) 88%, #000);
    border-color: color-mix(in srgb, var(--primary) 88%, #000);
    color: var(--primary-foreground);
}

.crm-bases-panel .crm-col-actions {
    width: 2.25rem;
    text-align: right;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .crm-bases-layout {
        grid-template-columns: 1fr;
    }

    .crm-bases-table-scroll {
        max-height: 18rem;
    }
}
