:root {
    --primary: #6d28d9;
    --primary-dark: #5b21b6;
    --primary-light: #ede9fe;
    --success: #16a34a;
    --success-light: #dcfce7;
    --success-text: #166534;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --danger-text: #991b1b;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --warning-text: #92400e;
    --info: #2563eb;
    --info-light: #dbeafe;
    --info-text: #1e40af;
    --gray-bg: #f3f4f6;
    --border: #e5e7eb;
    --text: #1f2937;
    --text-muted: #6b7280;
    --bg: #f9fafb;
    --card-bg: #ffffff;
    --radius: 10px;
    --shadow-color: rgba(17, 24, 39, .06);
}

:root[data-theme="dark"] {
    --primary: #a78bfa;
    --primary-dark: #c4b5fd;
    --primary-light: #362a5c;
    --success: #4ade80;
    --success-light: #14371f;
    --success-text: #86efac;
    --danger: #f87171;
    --danger-light: #451a1a;
    --danger-text: #fca5a5;
    --warning: #fbbf24;
    --warning-light: #452c05;
    --warning-text: #fcd34d;
    --info: #60a5fa;
    --info-light: #1e2f4d;
    --info-text: #93c5fd;
    --gray-bg: #2a3341;
    --border: #333f52;
    --text: #e5e7eb;
    --text-muted: #9aa4b2;
    --bg: #10151f;
    --card-bg: #1a2130;
    --shadow-color: rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }

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

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

.topbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.nav-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.15em;
    color: var(--text);
    margin-left: auto;
    flex: none;
}
.topbar-collapse { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.topbar-inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 60px;
    flex-wrap: nowrap;
    overflow-x: auto;
    position: relative;
}
.brand { font-weight: 700; font-size: 1.1em; color: var(--text); flex: none; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.mainnav { display: flex; gap: 2px; flex: none; }
.mainnav a {
    color: var(--text-muted);
    padding: 7px 9px;
    border-radius: 8px;
    font-weight: 500;
    font-size: .89em;
    white-space: nowrap;
}
.mainnav a:hover { background: var(--primary-light); text-decoration: none; color: var(--primary); }
.mainnav a.active { background: var(--primary-light); color: var(--primary); }
.user-menu { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: .92em; flex: none; white-space: nowrap; }
.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    font-size: .82em;
    flex: none;
}
.logout-form { margin: 0; display: inline; }
.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 6px 11px;
    border-radius: 999px;
    font-size: .85em;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.btn-logout:hover { background: var(--danger-light); color: var(--danger-text); border-color: var(--danger-light); }

.topbar-divider { width: 1px; align-self: stretch; margin: 6px 0; background: var(--border); flex: none; }

.topbar-search { flex: none; margin-left: auto; position: relative; display: flex; align-items: center; }
.topbar-search-icon {
    position: absolute;
    left: 12px;
    font-size: .8em;
    opacity: .55;
    pointer-events: none;
}
.topbar-search input {
    width: 150px;
    padding: 7px 12px 7px 30px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: .85em;
    background: var(--bg);
    color: var(--text);
    transition: width .15s ease, border-color .15s ease, background .15s ease;
}
.topbar-search input:focus { outline: none; border-color: var(--primary); width: 220px; background: var(--card-bg); box-shadow: 0 0 0 3px var(--primary-light); }

.theme-toggle {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.05em;
    color: var(--text-muted);
    flex: none;
}
.theme-toggle:hover { background: var(--gray-bg); }

.auth-wrap {
    max-width: 400px;
    margin: 60px auto;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
}
.auth-wrap h1 { margin-top: 0; font-size: 1.4em; text-align: center; }
.auth-wrap .sub { text-align: center; color: var(--text-muted); margin-bottom: 24px; font-size: .9em; }
.auth-switch { text-align: center; margin-top: 16px; font-size: .9em; color: var(--text-muted); }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}
.page-header h1 { margin: 0; font-size: 1.5em; }
.page-header .sub { color: var(--text-muted); font-size: .9em; margin-top: 4px; }

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}
.card h2, .card h3 { margin-top: 0; }

.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); gap: 12px; }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid-3, .grid-4 { grid-template-columns: 1fr; } }
@media (max-width: 1100px) { .grid-6 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .grid-6 { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 12px;
    min-width: 0;
}
.stat-card .value { font-size: 1.5em; font-weight: 700; color: var(--primary); line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card .label { color: var(--text-muted); font-size: .78em; margin-top: 4px; line-height: 1.25; }
.grid-6 .stat-card .label a { color: inherit; }

form .field { margin-bottom: 16px; }
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .9em; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number],
select, textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .95em;
    font-family: inherit;
    background: var(--card-bg);
    color: var(--text);
    -webkit-appearance: none;
    appearance: none;
}
input[type=date] { min-height: 38px; }
textarea { resize: vertical; min-height: 70px; }

/* Select : on retire le style natif (Safari/Chrome) et on ajoute notre propre flèche */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
    cursor: pointer;
}
select:focus, input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Cases à cocher : rendu cohérent entre navigateurs (Safari en particulier) */
.checkbox-field { display: flex; align-items: center; gap: 10px; }
.checkbox-field input[type=checkbox],
input[type=checkbox].styled-checkbox {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 1.5px solid var(--border);
    border-radius: 5px;
    background: var(--card-bg);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    position: relative;
    margin: 0;
    vertical-align: middle;
    transition: background .12s ease, border-color .12s ease, transform .06s ease;
}
.checkbox-field input[type=checkbox]:checked,
input[type=checkbox].styled-checkbox:checked {
    background: var(--primary);
    border-color: var(--primary);
}
.checkbox-field input[type=checkbox]:checked::after,
input[type=checkbox].styled-checkbox:checked::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.checkbox-field input[type=checkbox]:focus-visible,
input[type=checkbox].styled-checkbox:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-light);
}
.checkbox-field input[type=checkbox]:hover,
input[type=checkbox].styled-checkbox:hover {
    border-color: var(--primary);
}
.checkbox-field input[type=checkbox]:active,
input[type=checkbox].styled-checkbox:active {
    transform: scale(.92);
}
.checkbox-field label { margin: 0; font-weight: 500; cursor: pointer; }

/* Colonne de sélection du tableau des prospects */
.col-select { width: 36px; text-align: center; }
.col-select input[type=checkbox].styled-checkbox { width: 18px; height: 18px; min-width: 18px; }

.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row > .field { flex: 1; min-width: 160px; }

.btn {
    display: inline-block;
    padding: 9px 16px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: .92em;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; color: #fff; }
.btn-secondary { background: var(--card-bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--gray-bg); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--gray-bg); color: var(--text); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { filter: brightness(.88); }
.btn-sm { padding: 5px 10px; font-size: .82em; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; font-size: .9em; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-muted); font-weight: 600; font-size: .85em; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sortable .sort-arrow { display: inline-block; margin-left: 4px; opacity: .5; }
th.sortable.sort-asc .sort-arrow::after { content: "▲"; opacity: 1; }
th.sortable.sort-desc .sort-arrow::after { content: "▼"; opacity: 1; }
th.sortable:not(.sort-asc):not(.sort-desc) .sort-arrow::after { content: "↕"; }
tr:hover td { background: color-mix(in srgb, var(--text) 4%, transparent); }
.table-wrap { overflow-x: auto; }
.cell-name { max-width: 220px; }
.contact-lines { margin-top: 3px; display: flex; flex-direction: column; gap: 1px; }
.contact-line { font-size: .82em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Règle de base pour l'attribut natif [hidden] : certains navigateurs
   (Safari en tête) laissent un élément visible si une règle d'auteur définit
   `display` sur ce même sélecteur, même quand [hidden] est présent — la
   spécificité étant égale, l'ordre des règles décide. On force donc
   explicitement le masquage ici, avec la priorité la plus haute possible. */
[hidden] { display: none !important; }

/* Chrono de session (page Temps de dev) */
.chrono-widget {
    background: linear-gradient(160deg, var(--primary-light), var(--card-bg) 65%);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px 18px;
    margin-bottom: 18px;
    text-align: center;
    transition: box-shadow .2s ease;
}
.chrono-widget.is-running {
    box-shadow: 0 0 0 3px var(--primary-light), 0 8px 24px rgba(109, 40, 217, .15);
}
.chrono-display {
    font-family: "SF Mono", "Menlo", "Consolas", monospace;
    font-size: 2.4em;
    font-weight: 700;
    letter-spacing: .02em;
    color: var(--primary);
    margin-bottom: 14px;
    font-variant-numeric: tabular-nums;
}
.chrono-widget.is-running .chrono-display {
    animation: chrono-pulse 1.6s ease-in-out infinite;
}
.chrono-display-done { color: var(--success); }
@keyframes chrono-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .55; }
}
.chrono-actions { display: flex; justify-content: center; }
.chrono-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    border-radius: 999px;
    padding: 12px 26px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: transform .1s ease, box-shadow .15s ease, background .15s ease;
    box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.chrono-btn:active { transform: scale(.97); }
.chrono-btn-icon { font-size: 1.1em; line-height: 1; }
.chrono-btn-start {
    background: var(--primary);
    color: #fff;
}
.chrono-btn-start:hover { background: var(--primary-dark); }
.chrono-btn-stop {
    background: var(--danger);
    color: #fff;
    animation: chrono-glow 2s ease-in-out infinite;
}
.chrono-btn-stop:hover { filter: brightness(1.05); }
@keyframes chrono-glow {
    0%, 100% { box-shadow: 0 4px 14px rgba(220, 38, 38, .25); }
    50% { box-shadow: 0 4px 22px rgba(220, 38, 38, .5); }
}
.chrono-hint { font-size: .8em; margin: 12px 0 0; }

/* Accessible mais retiré visuellement (ex: bouton "Filtrer" d'un formulaire
   à soumission automatique — conservé pour la touche Entrée et les lecteurs
   d'écran). */
.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Sélecteur de colonnes visibles (liste Prospection) */
.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.column-picker { position: relative; }
.column-picker-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 20;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(0,0,0,.18);
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 190px;
    max-width: 90vw;
    font-size: .85em;
    border-radius: var(--radius);
}
.column-picker-panel label { display: flex; align-items: center; gap: 8px; font-weight: 400; white-space: nowrap; }

#prospectsTable.hide-type [data-col="type"],
#prospectsTable.hide-invitations [data-col="invitations"],
#prospectsTable.hide-invitation_date [data-col="invitation_date"],
#prospectsTable.hide-response [data-col="response"],
#prospectsTable.hide-presentation_date [data-col="presentation_date"],
#prospectsTable.hide-post_zoom [data-col="post_zoom"],
#prospectsTable.hide-relance [data-col="relance"] {
    display: none;
}
.cell-name strong a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-name .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.field-empty-hint { margin: 4px 0 0; font-size: .78em; color: var(--text-muted); font-style: italic; }

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: .78em;
    font-weight: 600;
}
.badge-purple { background: var(--primary-light); color: var(--primary-dark); }
.badge-green { background: var(--success-light); color: var(--success-text); }
.badge-red { background: var(--danger-light); color: var(--danger-text); }
.badge-amber { background: var(--warning-light); color: var(--warning-text); }
.badge-gray { background: var(--gray-bg); color: var(--text-muted); }
.badge-blue { background: var(--info-light); color: var(--info-text); }

.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: .9em; }
.flash-success { background: var(--success-light); color: var(--success-text); }
.flash-error { background: var(--danger-light); color: var(--danger-text); }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}
.empty-state .icon { font-size: 2.4em; margin-bottom: 8px; }

.filters { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; align-items: end; }
.filters .field { margin-bottom: 0; min-width: 160px; }
.filters .checkbox-field { display: flex; align-items: center; min-width: auto; }
.filters .checkbox-field label { display: flex; align-items: center; gap: 6px; font-weight: 400; white-space: nowrap; }

.bulk-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--accent-bg, var(--card-bg));
    border: 1px solid var(--border);
}
.bulk-toolbar .bulk-count { font-weight: 600; white-space: nowrap; }

.merge-table th, .merge-table td { vertical-align: top; padding: 10px 12px; }
.merge-option { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; font-weight: 400; }
.merge-option input { margin-top: 3px; }

.template-list { display: flex; flex-direction: column; gap: 12px; }
.template-item { border: 1px solid var(--border); padding: 10px 12px; }
.template-item-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; gap: 8px; }
.template-content { width: 100%; resize: vertical; font-family: inherit; background: var(--bg-alt, transparent); color: inherit; border: none; padding: 0; }

/* Calendrier des relances */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.calendar-weekday {
    font-weight: 600;
    font-size: .8em;
    text-align: center;
    padding: 4px 0;
    color: var(--text-muted);
    text-transform: uppercase;
}
.calendar-cell {
    min-height: 90px;
    border: 1px solid var(--border);
    padding: 6px;
    font-size: .82em;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.calendar-cell-empty { border-color: transparent; }
.calendar-cell-today { background: var(--accent-bg, var(--warning-light)); border-color: var(--accent, var(--warning)); }
.calendar-day-num { font-weight: 600; margin-bottom: 2px; }
.calendar-relance {
    display: block;
    background: var(--badge-gray-bg, var(--border));
    padding: 2px 5px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    color: inherit;
}
.calendar-relance-late { background: var(--danger-light, #fde2e2); color: var(--danger); }
.calendar-more { font-size: .85em; color: var(--text-muted); }

@media (max-width: 720px) {
    .calendar-grid { grid-template-columns: repeat(7, minmax(34px, 1fr)); }
    .calendar-cell { min-height: 60px; font-size: .7em; padding: 3px; }
    .calendar-relance { padding: 1px 3px; }
}

/* En-tête résumé de la fiche prospect */
.summary-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
    padding: 16px 20px;
}
.summary-banner-item { min-width: 130px; }
.summary-banner-label { font-size: .78em; color: var(--text-muted); text-transform: uppercase; margin-bottom: 4px; }
.summary-banner-value { font-weight: 600; }
.summary-banner-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

/* Frise chronologique de la fiche prospect */
.timeline { display: flex; flex-direction: column; }
.timeline-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-icon { font-size: 1.2em; line-height: 1; flex-shrink: 0; width: 24px; text-align: center; }
.timeline-body { flex: 1; min-width: 0; }
.timeline-date { font-size: .8em; color: var(--text-muted); margin-bottom: 2px; }
.timeline-text { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.timeline-delete { margin-top: 6px; }
.timeline-creation .timeline-text, .timeline-stage_change .timeline-text { color: var(--text-muted); font-style: italic; }

/* Sous-onglets (ex: Liste / Pipeline dans Prospection) */
.view-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.view-tabs a {
    padding: 8px 14px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: .9em;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.view-tabs a:hover { text-decoration: none; color: var(--primary); }
.view-tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Carte "Formulaire public de collecte" (Prospection) */
.public-form-card { padding: 0; }
.public-form-card > summary {
    cursor: pointer;
    padding: 14px 20px;
    font-weight: 600;
    list-style: none;
}
.public-form-card > summary::-webkit-details-marker { display: none; }
.public-form-card > summary::before { content: "▸ "; color: var(--text-muted); }
.public-form-card[open] > summary::before { content: "▾ "; }
.public-form-card[open] > summary { border-bottom: 1px solid var(--border); }
.public-form-card-body {
    padding: 20px;
    display: flex;
    gap: 24px;
    align-items: flex-start;
    flex-wrap: wrap;
}
.public-form-qr {
    flex-shrink: 0;
    width: 140px;
    height: 140px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
}
.public-form-qr svg { display: block; width: 100%; height: 100%; }
.public-form-link-block { flex: 1; min-width: 240px; }

.type-manager-list { list-style: none; padding: 0; margin: 0; }
.type-manager-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.type-manager-list li:last-child { border-bottom: none; }

.progress-bar { background: var(--gray-bg); border-radius: 999px; height: 8px; overflow: hidden; }
.progress-bar.progress-over > span { background: var(--danger); }
.progress-bar > span { display: block; height: 100%; background: var(--primary); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* Pipeline (Kanban) */
.kanban-board {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 8px;
    align-items: flex-start;
}
.kanban-column {
    background: var(--gray-bg);
    border-radius: var(--radius);
    width: 260px;
    min-width: 260px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 220px);
}
.kanban-column.drag-over { outline: 2px dashed var(--primary); outline-offset: -2px; }
.kanban-column-header {
    padding: 12px 14px;
    font-weight: 700;
    font-size: .88em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text);
    border-top: 3px solid transparent;
}
/* Couleurs harmonisées avec les badges d'étape utilisés sur la fiche prospect et les statistiques */
.stage-accent-gray { border-top-color: var(--text-muted); }
.stage-accent-blue { border-top-color: var(--info); }
.stage-accent-purple { border-top-color: var(--primary); }
.stage-accent-amber { border-top-color: var(--warning); }
.stage-accent-green { border-top-color: var(--success); }
.stage-accent-red { border-top-color: var(--danger); }

.stage-breakdown { display: flex; flex-wrap: wrap; gap: 16px 24px; }
.stage-breakdown-item { display: flex; align-items: center; gap: 8px; }
.kanban-count {
    background: var(--card-bg);
    border-radius: 999px;
    padding: 1px 8px;
    font-size: .85em;
    color: var(--text-muted);
}
.kanban-column-body {
    padding: 0 10px 10px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 40px;
}
.kanban-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    cursor: grab;
    font-size: .87em;
}
.kanban-card:hover { border-color: var(--primary); }
.kanban-card.dragging { opacity: .4; }
.kanban-card .name { font-weight: 600; margin-bottom: 4px; }
.kanban-card .name a { color: var(--text); }
.kanban-card .name a:hover { color: var(--primary); }
.kanban-card .meta { display: flex; gap: 4px; flex-wrap: wrap; }
.kanban-empty { color: var(--text-muted); font-size: .82em; text-align: center; padding: 16px 4px; }

mark { background: var(--warning-light); color: var(--text); padding: 0 2px; border-radius: 3px; }
.muted { color: var(--text-muted); }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }

/* Barre d'actions collante en bas des formulaires longs : reste visible
   pendant le scroll, plus besoin de descendre jusqu'en bas de la page. */
.form-actions-bar {
    position: sticky;
    bottom: 0;
    z-index: 15;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    padding: 14px 20px;
    margin: 20px -20px 0;
    display: flex;
    gap: 8px;
    box-shadow: 0 -6px 16px var(--shadow-color);
}

/* Menu mobile (hamburger) — sous ce seuil, la nav/recherche/thème/utilisateur
   se replient dans un panneau déroulant plutôt que de passer sur 2 lignes. */
@media (max-width: 1380px) {
    .nav-toggle { display: flex; }
    .topbar-collapse {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--card-bg);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 12px 20px 16px;
        box-shadow: 0 12px 20px var(--shadow-color);
    }
    .topbar-collapse.open { display: flex; }
    .mainnav { flex-direction: column; gap: 2px; width: 100%; }
    .mainnav a { padding: 10px 12px; }
    .topbar-search { margin-left: 0; width: 100%; order: -1; }
    .topbar-search input { width: 100%; }
    .topbar-search input:focus { width: 100%; }
    .theme-toggle { align-self: flex-start; }
    .topbar-divider { display: none; }
    .user-menu {
        width: 100%;
        justify-content: space-between;
        padding-top: 10px;
        margin-top: 4px;
        border-top: 1px solid var(--border);
    }
}
@media (max-width: 420px) {
    .logout-label { display: none; }
    .btn-logout { padding: 7px 9px; }
}
