@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display&display=swap');

:root {
    --bg: #f4f6fb;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #6b7280;
    --border: #e4e7ef;
    --primary: #2f4fce;
    --primary-soft: #e9edff;
    --accent: #fff7e5;
    --danger: #dc2626;
    --shadow: 0 18px 38px rgba(15, 23, 42, 0.06);
    --card-alt: #f9fafb;
    --card-grad: linear-gradient(135deg, #ffffff, #f6f8ff);
    --hover-bg: #eef1f7;
    --input-bg: #fbfbfe;
    --success: #16a34a;
    --warning: #f59e0b;
    /* Typography scale */
    --text-2xs: 0.65rem;
    --text-xs: 0.75rem;
    --text-caption: 0.8rem;
    --text-sm: 0.85rem;
    --text-body-sm: 0.9rem;
    --text-base: 1rem;
    --text-md: 1.1rem;
    --text-lg: 1.25rem;
    --text-xl: 1.5rem;
    --text-2xl: 2.1rem;
    /* Spacing scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    /* Border radius scale */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-input: 12px;
    --radius-lg: 14px;
    --radius-xl: 16px;
    --radius-full: 999px;
    /* Shadow depth scale */
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 10px 22px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 18px 38px rgba(15, 23, 42, 0.1);
    /* Focus ring */
    --focus-ring: 0 0 0 3px rgba(47, 79, 206, 0.2);
    /* Modal sizes */
    --modal-sm: 440px;
    --modal-md: 620px;
    --modal-lg: 780px;
    /* Z-index scale */
    --z-sidebar: 20;
    --z-sidebar-overlay: 19;
    --z-sidebar-tooltip: 30;
    --z-modal: 50;
    --z-confetti: 100;
    --z-toast: 200;
    /* Semantic aliases */
    --card-bg: var(--card);
    --text-primary: var(--text);
    --text-secondary: var(--muted);
    --text-muted: var(--muted);
    /* Button & action colors */
    --btn-primary-bg: linear-gradient(135deg, var(--primary), #223bb0);
    --success-action: #16a34a;
    --success-action-hover: #15803d;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

h1, h2, h3 {
    font-family: "DM Serif Display", Georgia, serif;
    font-weight: 400;
}

[data-theme="dark"] {
    --bg: #0f1117;
    --card: #1a1d27;
    --text: #e2e4ea;
    --muted: #9ca0b0;
    --border: #2a2e3a;
    --primary: #5b7cf7;
    --primary-soft: #1e2545;
    --accent: #2a2518;
    --danger: #f87171;
    --shadow: 0 18px 38px rgba(0, 0, 0, 0.25);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 10px 22px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 18px 38px rgba(0, 0, 0, 0.35);
    --card-alt: #1e2130;
    --card-grad: linear-gradient(135deg, #1a1d27, #1e2130);
    --hover-bg: #252836;
    --input-bg: #151720;
    --success: #4ade80;
    --warning: #fbbf24;
    --focus-ring: 0 0 0 3px rgba(91, 124, 247, 0.25);
    --btn-primary-bg: linear-gradient(135deg, var(--primary), #4563d0);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: radial-gradient(circle at 20% 20%, #fdfcff, var(--bg));
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
[data-theme="dark"] body {
    background: var(--bg);
}

/* ---- Sidebar navigation ---- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 220px;
    background: var(--card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: var(--z-sidebar);
    box-shadow: 4px 0 20px rgba(15, 23, 42, 0.04);
    overflow-y: auto;
    overflow-x: hidden;
}
.sidebar__brand {
    padding: 1.25rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar__logo {
    height: 56px;
    width: auto;
    object-fit: contain;
    border-radius: 8px;
}
.sidebar__nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.75rem 0.6rem;
    gap: 0.15rem;
}
.sidebar__link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--muted);
    font-size: var(--text-sm);
    font-weight: 500;
    transition: color 0.15s ease, background 0.15s ease;
    position: relative;
    white-space: nowrap;
}
.sidebar__link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}
.sidebar__link:hover {
    color: var(--text);
    background: var(--hover-bg);
}
.sidebar__link:hover svg { opacity: 1; }
.sidebar__link.active {
    color: var(--primary);
    background: var(--primary-soft);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}
.sidebar__link.active svg { opacity: 1; }
.sidebar__link.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}
.sidebar__badge {
    background: var(--danger);
    color: #fff;
    font-size: var(--text-2xs);
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 9px;
    min-width: 1.1rem;
    text-align: center;
    margin-left: auto;
    line-height: 1.3;
}
.sidebar__separator {
    padding: 0.6rem 1rem 0.25rem;
    font-size: var(--text-2xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
}
.sidebar__footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar__footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.sidebar__collapse-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--muted);
    transition: color 0.15s, background 0.15s, transform 0.25s ease;
    padding: 0;
}
.sidebar__collapse-btn:hover { color: var(--text); background: var(--hover-bg); }
.sidebar__collapse-btn svg { width: 16px; height: 16px; }

/* ---- Sidebar transitions (desktop only) ---- */
@media (min-width: 901px) {
    .sidebar { transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1); }
    .container { transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1); }
}

/* ---- Collapsed sidebar (desktop only) ---- */
@media (min-width: 901px) {
    .sidebar-collapsed .sidebar {
        width: 60px;
    }
    .sidebar-collapsed .container {
        margin-left: 60px;
    }
    .sidebar-collapsed .sidebar__brand {
        padding: 0.85rem 0.5rem;
    }
    .sidebar-collapsed .sidebar__logo {
        height: 36px;
    }
    .sidebar-collapsed .sidebar__nav {
        padding: 0.75rem 0.35rem;
        align-items: center;
        overflow: visible;
    }
    .sidebar-collapsed .sidebar {
        overflow: visible;
    }
    .sidebar-collapsed .sidebar__link {
        justify-content: center;
        padding: 0.55rem;
        gap: 0;
    }
    .sidebar-collapsed .sidebar__link span:not(.sidebar__badge) {
        display: none;
    }
    .sidebar-collapsed .sidebar__badge {
        position: absolute;
        top: -2px;
        right: -4px;
        min-width: 16px;
        padding: 0.05rem 0.3rem;
        font-size: var(--text-2xs);
        line-height: 1.3;
        border-radius: 9px;
    }
    .sidebar-collapsed .sidebar__link.active::before {
        top: 25%;
        bottom: 25%;
    }
    .sidebar-collapsed .sidebar__footer {
        padding: 0.6rem 0.35rem;
    }
    .sidebar-collapsed .sidebar__footer-row {
        flex-direction: column;
        gap: 0.4rem;
    }
    .sidebar-collapsed .sidebar__collapse-btn svg {
        transform: rotate(180deg);
    }
    .sidebar-collapsed .sidebar__separator {
        padding: 0.5rem 0;
    }
    .sidebar-collapsed .sidebar__separator span {
        display: none;
    }
    .sidebar-collapsed .sidebar__separator::after {
        content: "";
        display: block;
        height: 1px;
        background: var(--border);
        margin: 0 0.5rem;
    }
    /* Tooltip on hover */
    .sidebar-collapsed .sidebar__link::after {
        content: attr(data-tip);
        position: absolute;
        left: calc(100% + 10px);
        top: 50%;
        transform: translateY(-50%);
        background: var(--card);
        border: 1px solid var(--border);
        padding: 0.3rem 0.6rem;
        border-radius: var(--radius-sm);
        font-size: var(--text-sm);
        font-weight: 500;
        white-space: nowrap;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        z-index: var(--z-sidebar-tooltip);
        color: var(--text);
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.15s ease;
    }
    .sidebar-collapsed .sidebar__link:hover::after {
        opacity: 1;
    }
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: var(--z-sidebar-overlay);
}
[data-theme="dark"] .sidebar-overlay { background: rgba(0, 0, 0, 0.55); }
.sidebar-overlay.visible { display: block; animation: sidebarFadeIn 0.2s ease; }
@keyframes sidebarFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Mobile header (hidden on desktop) */
.mobile-header {
    display: none;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 0.6rem 0.75rem;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}
.mobile-header__logo {
    height: 44px;
    width: auto;
    object-fit: contain;
    border-radius: var(--radius-sm);
}
.mobile-header__spacer { width: 44px; }

@keyframes pageIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.container { padding: 1.75rem 1.5rem; margin-left: 220px; animation: pageIn 0.3s ease backwards; }
[data-theme="dark"] .sidebar__logo,
[data-theme="dark"] .mobile-header__logo,
[data-theme="dark"] .page-header__logo {
    filter: drop-shadow(0 0 1px rgba(255,255,255,0.15));
    background: rgba(255,255,255,0.08);
    border-radius: var(--radius-md);
    padding: 2px;
}
.page-header__logo {
    height: 100px;
    width: auto;
    object-fit: contain;
}

.page-header { margin-bottom: 1.25rem; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.page-header--brand {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: var(--text-caption); color: var(--muted); margin: 0; }
.muted { color: var(--muted); }
.small { font-size: var(--text-body-sm); }
.brand-lockup {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--card-grad);
    box-shadow: var(--shadow);
}
.brand-lockup img {
    width: auto;
    height: 100px;
    border-radius: var(--radius-input);
    object-fit: contain;
    border: none;
}
.brand-lockup__text { display: flex; flex-direction: column; gap: 0.15rem; }
.brand-lockup__name { font-weight: 700; }

.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid.four { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.five { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.metric-grid { align-items: stretch; }
.metric-grid > a { display: flex; }
.metric-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--card-grad);
    padding: 1rem 1.1rem;
    box-shadow: var(--shadow);
    width: 100%;
}
.metric-card__value {
    font-size: var(--text-2xl);
    font-weight: 800;
    margin: 0.1rem 0 0.2rem 0;
}
.metric-card__alert {
    display: inline-block;
    font-size: var(--text-caption);
    font-weight: 700;
    color: var(--danger);
    margin-top: 0.1rem;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}
.card.accent { background: var(--accent); }
.card.soft { background: var(--card-grad); }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
}
.callout {
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 0.85rem 1rem;
    background: var(--card-grad);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow);
}
details.collapsible { width: 100%; }
details.collapsible summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-weight: 700;
    font-size: 1.05rem;
    margin: 0;
    padding: 0.1rem 0;
}
details.collapsible summary::-webkit-details-marker { display: none; }
details.collapsible summary::after {
    content: "";
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--muted);
    transition: transform 0.15s ease;
}
details.collapsible[open] summary::after { transform: rotate(180deg); }
details.collapsible .collapsible__content {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}
details.collapsible.contact-collapsible {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow);
}

.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field span { font-size: var(--text-body-sm); color: var(--muted); }
.field input, .field select, .field textarea {
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    padding: 0.65rem 0.85rem;
    font-size: 1rem;
    background: var(--input-bg);
    color: var(--text);
}
.field textarea { resize: vertical; }
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}
.field.wide { grid-column: 1 / -1; }

/* ---- Form validation states ---- */
.field--error input,
.field--error select,
.field--error textarea {
    border-color: var(--danger);
}
.field--error input:focus-visible,
.field--error select:focus-visible,
.field--error textarea:focus-visible {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}
.field--error .field__message {
    color: var(--danger);
}
.field--success input,
.field--success select,
.field--success textarea {
    border-color: var(--success);
}
.field--success input:focus-visible,
.field--success select:focus-visible,
.field--success textarea:focus-visible {
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}
.field--success .field__message {
    color: var(--success);
}
.field__message {
    font-size: var(--text-sm);
    margin-top: 0.15rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: none;
    border-radius: var(--radius-input);
    padding: 0.6rem 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.btn.primary {
    background: var(--btn-primary-bg);
    color: white;
    box-shadow: 0 10px 24px rgba(47, 79, 206, 0.25);
}
.btn.ghost {
    background: transparent;
    border: 1px solid var(--border);
}
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.small { padding: 0.35rem 0.55rem; font-size: 0.85rem; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.badge {
    display: inline-flex;
    align-items: center;
    background: var(--primary-soft);
    color: var(--text);
    border-radius: var(--radius-full);
    padding: 0.2rem 0.65rem;
    font-size: 0.85rem;
}
.badge.muted { background: var(--hover-bg); color: var(--muted); }
.badge.ghost { background: transparent; border: 1px solid var(--border); }

.pill {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--card-alt);
    font-size: var(--text-body-sm);
}

.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.stack { display: flex; flex-direction: column; gap: 0.75rem; }
.stack.tight { gap: 0.35rem; }
.actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.actions.tight { gap: 0.35rem; }
.align-end { align-items: flex-end; }

.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.list li { border-bottom: 1px solid var(--border); padding-bottom: 0.6rem; }
.list li:last-child { border-bottom: none; }
.list.tight { gap: 0.35rem; }
.list.tight li { padding-bottom: 0.35rem; }

.table { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.75rem; border-bottom: 1px solid var(--border); text-align: left; }
th { color: var(--muted); font-weight: 600; }
tr:hover td { background: var(--hover-bg); }

.listing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.75rem;
    align-items: stretch;
}
.listing-chip {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--card-grad);
    padding: 0.85rem 0.95rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    box-shadow: var(--shadow);
}
.listing-chip__media {
    height: 140px;
    border-radius: var(--radius-input);
    overflow: hidden;
    background: var(--hover-bg);
}
.listing-chip__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.listing-chip__header { display: flex; justify-content: space-between; gap: 0.5rem; align-items: flex-start; }
.listing-chip__header > div:first-child { min-width: 0; overflow: hidden; }
.listing-chip__price { font-weight: 800; white-space: nowrap; line-height: 1.3; }
.inscription-card .listing-chip__price { font-size: var(--text-body-sm); }
.listing-chip__stats { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: auto; }
.listing-chip strong { line-height: 1.3; display: block; word-break: break-word; }

.property-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.property-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: var(--card);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}
.property-card__media { position: relative; height: 180px; background: var(--hover-bg); }
.property-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.property-card__status { position: absolute; top: 0.75rem; left: 0.75rem; }
.property-card__body { padding: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.property-card__header { display: flex; justify-content: space-between; gap: 0.75rem; align-items: flex-start; }
.property-card__title { margin: 0; font-size: 1.05rem; }
.property-card__price { font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.property-card__stats { gap: 0.35rem; }
.property-card__footer {
    padding: 0.75rem 1rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    border-top: 1px solid var(--border);
}

h2[id] { scroll-margin-top: 1.5rem; }
@media (max-width: 900px) { h2[id] { scroll-margin-top: 4.5rem; } }

.kanban { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.kanban-column { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1rem; display: flex; flex-direction: column; gap: 0.6rem; box-shadow: 0 12px 24px rgba(15, 23, 42, 0.05); }
.kanban-header h4 { margin: 0 0 0.05rem 0; font-size: 1rem; }
.kanban-header { display: flex; align-items: center; justify-content: space-between; }
.kanban-header .badge { padding: 0.18rem 0.5rem; font-size: var(--text-caption); }
.kanban-header .small { font-size: var(--text-sm); }
.kanban-list {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    min-height: 90px;
    padding: 0.2rem;
    border-radius: var(--radius-md);
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.kanban-list.drag-over {
    background: var(--primary-soft);
    border: 1px dashed var(--primary);
    box-shadow: 0 8px 20px rgba(47, 79, 206, 0.08);
    animation: kanban-pulse 1.5s ease-in-out infinite;
}
@keyframes kanban-pulse {
    0%, 100% { box-shadow: 0 8px 20px rgba(47, 79, 206, 0.08); }
    50% { box-shadow: 0 8px 28px rgba(47, 79, 206, 0.18); }
}
.kanban-list.drag-over::after {
    content: "Déposer ici";
    position: absolute;
    top: 6px;
    right: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 0.02em;
    pointer-events: none;
    opacity: 0;
    animation: drop-hint-in 0.2s ease forwards;
}
@keyframes drop-hint-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Placeholder left behind when a card is picked up */
.kanban-drag-placeholder {
    border: 2px dashed var(--border);
    border-radius: var(--radius-input);
    background: var(--hover-bg);
    opacity: 0.5;
    flex-shrink: 0;
    pointer-events: none;
}

/* Snap-in animation when a card lands */
@keyframes card-snap-in {
    0% { opacity: 0; transform: scale(0.95) translateY(-6px); }
    60% { opacity: 1; transform: scale(1.01) translateY(0); }
    100% { transform: scale(1) translateY(0); }
}
.card-snap-in {
    animation: card-snap-in 0.3s ease forwards;
}

/* Global grabbing cursor during drag */
html.is-dragging, html.is-dragging * {
    cursor: grabbing !important;
}

.deal-card {
    background: var(--card-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.1rem;
    cursor: grab;
    box-shadow: 0 10px 22px rgba(0,0,0,0.04);
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.deal-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(0,0,0,0.06);
    border-color: var(--primary);
}
.deal-card.dragging {
    opacity: 0.55;
    transform: rotate(-1.5deg) scale(1.03);
    box-shadow: 0 22px 44px rgba(47, 79, 206, 0.22);
    cursor: grabbing;
    z-index: 100;
    transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.deal-card.dropping {
    cursor: grabbing;
}
.deal-card.stale { border: 1px dashed #f97316; box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.08); }
.deal-card__header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.5rem;
    align-items: flex-start;
    margin-bottom: 0.25rem;
}
.deal-card__title,
.deal-card__value-group { min-width: 0; }
.deal-card__handle {
    width: 30px;
    height: 30px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--card);
    color: var(--muted);
    box-shadow: 0 4px 14px rgba(0,0,0,0.05);
}
.deal-card__grip {
    width: 12px;
    height: 12px;
    background-image: radial-gradient(circle, var(--muted) 25%, transparent 26%);
    background-size: 6px 6px;
    background-repeat: repeat;
}
.deal-card__title strong {
    font-size: 1rem;
    display: -webkit-box;
    line-height: 1.25;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}
.deal-card__title .muted {
    margin-top: 0.1rem;
    display: block;
    font-size: var(--text-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.deal-card__value-group {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 0.35rem;
    flex-wrap: wrap;
    row-gap: 0.2rem;
}
.deal-card__value {
    font-weight: 700;
    white-space: nowrap;
    font-size: var(--text-base);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}
.deal-card__stage {
    border-style: dashed;
    background: var(--card);
    color: var(--muted);
    font-size: var(--text-caption);
    padding: 0.12rem 0.55rem;
    max-width: 100%;
    white-space: normal;
    line-height: 1.15;
    word-break: break-word;
}
.deal-card__meta-line {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.2rem;
    min-width: 0;
}
.deal-card__meta-line span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
    word-break: break-word;
}
.deal-card__meta-label { font-weight: 600; color: var(--text); font-size: var(--text-sm); }
.deal-card__notes {
    margin: 0.2rem 0 0.4rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}
.deal-card__actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.4rem;
    width: 100%;
}
.deal-card__actions .badge {
    display: flex;
    padding: 0.2rem 0.65rem;
    font-size: var(--text-caption);
    width: 100%;
    justify-content: center;
    white-space: normal;
    text-align: center;
    line-height: 1.3;
}
.deal-card__drawer { margin-top: 0.35rem; }
.deal-card__drawer summary { cursor: pointer; font-weight: 600; }
.deal-card__drawer-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.35rem 0.65rem;
    margin: 0.35rem 0 0.5rem;
}
.deal-card__drawer-meta > div { display: flex; gap: 0.35rem; align-items: baseline; }

.pipeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.75rem; }
.pipeline-card { border: 1px solid var(--border); border-radius: var(--radius-input); padding: 0.75rem; background: var(--card-alt); }
.big-number { font-size: 1.6rem; font-weight: 700; }

.dossier-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1.25rem 1.35rem;
    box-shadow: var(--shadow);
}
.hero-title { display: flex; flex-direction: column; gap: 0.25rem; }
.hero-title h1 { margin: 0; }
.hero-chips { gap: 0.4rem; }
.hero-inline { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.dossier-grid { align-items: start; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem; }
.detail-grid dt { margin: 0 0 0.15rem 0; color: var(--muted); font-size: var(--text-body-sm); }
.detail-grid dd { margin: 0; }
.deal-chip {
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    padding: 0.75rem;
    background: var(--card-alt);
}
.deal-chip__top { display: flex; justify-content: space-between; gap: 0.5rem; }
.deal-chip__value { font-weight: 700; }

.contacte-toggle { display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; }
.contacte-toggle input[type="checkbox"] { width: 1.1rem; height: 1.1rem; accent-color: var(--primary); cursor: pointer; }
.contacte-date { white-space: nowrap; }
.contacte-cell { white-space: nowrap; }

.inscription-card__owner {
    font-weight: 600;
    font-size: var(--text-sm);
    line-height: 1.3;
    margin-top: 0.15rem;
    color: var(--text);
    display: block;
}
.inscription-card__address {
    font-size: var(--text-body-sm);
    line-height: 1.3;
    min-height: 1.3em;
}
.inscription-card__city {
    font-size: var(--text-sm);
}
.inscription-card__actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 0.35rem;
    gap: 0.4rem;
}
.inscription-card[data-centris-id]:hover { box-shadow: var(--shadow-md); }
.vendor-card { padding: 0.5rem 0.65rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card-alt); }
.vendor-card__name { font-weight: 600; font-size: var(--text-body-sm); }
.vendor-card__detail { font-size: 0.85rem; color: var(--text-muted); }
.vendor-vcard-btn { margin-top: 0.25rem; }
.additional-vendor-row { padding: 0.5rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card-alt); position: relative; }
.additional-vendor-row .remove-vendor-btn { position: absolute; top: 0.25rem; right: 0.25rem; }

/* Stats strip on inscription cards */
.inscription-card__stats-strip {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    font-size: var(--text-sm);
    color: var(--muted);
    gap: 0;
    margin-top: 0.1rem;
    min-height: 1.3em;
}
.stats-strip__item + .stats-strip__item::before {
    content: " · ";
    margin: 0 0.3rem;
}
.stats-strip__expiry--ok { color: var(--success); }
.stats-strip__expiry--warn { color: #f59e0b; }
[data-theme="dark"] .stats-strip__expiry--warn { color: #fbbf24; }
.stats-strip__expiry--urgent { color: var(--danger); font-weight: 700; }
.stats-strip__leads { color: var(--primary); font-weight: 600; margin-left: auto; }
.stats-strip__leads::before { content: none !important; margin: 0 !important; }
.stats-strip__leads--clickable {
    cursor: pointer;
    text-decoration: none;
}
.stats-strip__leads--clickable:hover {
    text-decoration: underline;
}

/* Photo freshness indicator */
.stats-strip__photo-icon { vertical-align: -2px; }
.stats-strip__photo--warn { color: #ea580c; }
[data-theme="dark"] .stats-strip__photo--warn { color: #fb923c; }
.stats-strip__photo--stale { color: var(--danger); font-weight: 700; }
[data-theme="dark"] .stats-strip__photo--stale { color: #f87171; }

/* Photo stale card highlight */
.inscription-card--photo-stale {
    border-color: #ea580c;
    border-width: 2px;
    box-shadow: 0 0 8px rgba(234, 88, 12, 0.12);
}
[data-theme="dark"] .inscription-card--photo-stale {
    border-color: #fb923c;
    box-shadow: 0 0 8px rgba(251, 146, 60, 0.15);
}
.inscription-card--photo-stale.inscription-card--pa-accepte {
    border-color: #dc2626;
}

/* Leads modal table */
.leads-modal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-body-sm);
}
.leads-modal-table th,
.leads-modal-table td {
    padding: 0.45rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.leads-modal-table th {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.leads-modal-table input[type="checkbox"] {
    accent-color: var(--primary);
}
.leads-row--no-email {
    opacity: 0.5;
}

/* PA Accepté icon button */
.pa-accepte-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--success-action);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.1s;
    flex-shrink: 0;
}
.pa-accepte-icon:hover { background: var(--success-action-hover); transform: scale(1.1); }
.pa-accepte-icon svg { stroke: #fff; }

/* PA Accepté confirm button (modal) */
.pa-accepte-btn {
    background: var(--success-action);
    color: #fff;
    border: none;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: var(--text-body-sm);
    transition: background 0.15s;
}
.pa-accepte-btn:hover { background: var(--success-action-hover); }

/* PA Accepté card state */
.inscription-card--pa-accepte {
    border-color: #dc2626;
    border-width: 2px;
    background: var(--card-grad);
    box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.15), 0 0 12px rgba(220, 38, 38, 0.08);
    position: relative;
    overflow: hidden;
}

/* Stamp effect */
.pa-stamp {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-18deg);
    font-size: 2.4rem;
    font-weight: 900;
    font-family: 'DM Serif Display', serif;
    letter-spacing: 0.08em;
    color: #dc2626;
    opacity: 0.4;
    border: 5px solid #dc2626;
    border-radius: var(--radius-input);
    padding: 0.15em 0.5em;
    pointer-events: none;
    z-index: 1;
    white-space: nowrap;
    text-transform: uppercase;
}

.lead-card {
    background: var(--card-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.15rem;
    cursor: grab;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    box-shadow: 0 10px 22px rgba(0,0,0,0.04);
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.lead-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(0,0,0,0.06);
    border-color: var(--primary);
}
.lead-card.dragging {
    opacity: 0.55;
    transform: rotate(-1.5deg) scale(1.03);
    box-shadow: 0 22px 44px rgba(47, 79, 206, 0.22);
    cursor: grabbing;
    z-index: 100;
    transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.lead-card.dropping {
    cursor: grabbing;
}
.lead-card__top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}
.lead-card__address {
    font-size: 1rem;
    line-height: 1.3;
    word-break: break-word;
}
.lead-card__price {
    font-weight: 800;
    font-size: var(--text-base);
    white-space: nowrap;
    color: var(--text);
    flex-shrink: 0;
}
.lead-card__price-date {
    font-size: var(--text-xs);
    color: var(--muted);
    opacity: 0.8;
}
.lead-card__name {
    font-weight: 600;
    font-size: var(--text-body-sm);
    color: var(--muted);
}
.lead-card__notes {
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.45;
}

.lead-type-toggle {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 0.25rem;
}
.lead-type-option {
    cursor: pointer;
}
.lead-type-option input[type="radio"] {
    display: none;
}
.lead-type-option input[type="radio"] + .badge {
    border: 1px solid var(--border);
    background: var(--card-alt);
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.lead-type-option input[type="radio"]:checked + .badge {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ---- Confirm dialog ---- */
.confirm-card {
    width: 100%;
    max-width: 380px;
    margin: 1rem;
    text-align: center;
    padding: 1.75rem 1.5rem 1.25rem;
    animation: confirmPop 0.2s ease;
}
.confirm-card__icon {
    font-size: 2.5rem;
    line-height: 1;
    margin-bottom: 0.5rem;
}
.confirm-card__title {
    margin: 0 0 0.25rem;
    font-size: 1.15rem;
}
.confirm-card__message {
    margin: 0 0 1.25rem;
    font-size: var(--text-base);
    line-height: 1.5;
}
.confirm-card__actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}
.confirm-card__actions .btn {
    flex: 1;
    max-width: 160px;
}
@keyframes confirmPop {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

/* ---- Seller stage badges ---- */
.badge.seller-stage-a_evaluer { background: var(--primary-soft); color: var(--primary); }
.badge.seller-stage-evaluation_faite { background: #fef3c7; color: #92400e; }
.badge.seller-stage-gagne { background: #dcfce7; color: #166534; }
.badge.seller-stage-vole { background: #fee2e2; color: #991b1b; }
[data-theme="dark"] .badge.seller-stage-evaluation_faite { background: #422006; color: #fbbf24; }
[data-theme="dark"] .badge.seller-stage-gagne { background: #052e16; color: #4ade80; }
[data-theme="dark"] .badge.seller-stage-vole { background: #450a0a; color: #f87171; }

/* ---- Buyer status badges ---- */
.badge.buyer-status-nouveau { background: var(--primary-soft); color: var(--primary); }
.badge.buyer-status-contacte { background: #fef3c7; color: #92400e; }
.badge.buyer-status-gagne { background: #dcfce7; color: #166534; }
.badge.buyer-status-perdu { background: #fee2e2; color: #991b1b; }
[data-theme="dark"] .badge.buyer-status-contacte { background: #422006; color: #fbbf24; }
[data-theme="dark"] .badge.buyer-status-gagne { background: #052e16; color: #4ade80; }
[data-theme="dark"] .badge.buyer-status-perdu { background: #450a0a; color: #f87171; }

/* ---- Contact tag colors ---- */
.badge.contact-tag-acheteur { background: #dbeafe; color: #1e40af; }
.badge.contact-tag-vendeur { background: #fce7f3; color: #9d174d; }
.badge.contact-tag-investisseur { background: #ede9fe; color: #5b21b6; }
.badge.contact-tag-locataire { background: #e0f2fe; color: #075985; }
.badge.contact-tag-proprietaire { background: #fef3c7; color: #92400e; }
.badge.contact-tag-courtier { background: #f0fdf4; color: #166534; }
.badge.contact-tag-notaire { background: #f1f5f9; color: #334155; }
.badge.contact-tag-evaluateur { background: #fff7ed; color: #9a3412; }
.badge.contact-tag-vip { background: #fef9c3; color: #854d0e; }
.badge.contact-tag-inactif { background: #f3f4f6; color: #6b7280; }
.badge.contact-tag-rapport-de-marche { background: #e0e7ff; color: #3730a3; }
.badge.contact-tag-vendeurs-actifs { background: #dcfce7; color: #166534; border: 1px solid #86efac; }

[data-theme="dark"] .badge.contact-tag-acheteur { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge.contact-tag-vendeur { background: #4a1942; color: #f9a8d4; }
[data-theme="dark"] .badge.contact-tag-investisseur { background: #2e1065; color: #c4b5fd; }
[data-theme="dark"] .badge.contact-tag-locataire { background: #0c3547; color: #7dd3fc; }
[data-theme="dark"] .badge.contact-tag-proprietaire { background: #422006; color: #fbbf24; }
[data-theme="dark"] .badge.contact-tag-courtier { background: #052e16; color: #86efac; }
[data-theme="dark"] .badge.contact-tag-notaire { background: #1e293b; color: #94a3b8; }
[data-theme="dark"] .badge.contact-tag-evaluateur { background: #431407; color: #fdba74; }
[data-theme="dark"] .badge.contact-tag-vip { background: #422006; color: #fde047; }
[data-theme="dark"] .badge.contact-tag-inactif { background: #1f2937; color: #9ca3af; }
[data-theme="dark"] .badge.contact-tag-rapport-de-marche { background: #312e81; color: #a5b4fc; }
[data-theme="dark"] .badge.contact-tag-vendeurs-actifs { background: #052e16; color: #86efac; border-color: #166534; }

/* ---- Prospection status colors ---- */
.badge.prosp-status-pas_contacte { background: #f3f4f6; color: #6b7280; }
.badge.prosp-status-contacte { background: #dbeafe; color: #1e40af; }
.badge.prosp-status-interesse { background: #dcfce7; color: #166534; }
.badge.prosp-status-pas_interesse { background: #fce7f3; color: #9d174d; }
.badge.prosp-status-lead_cree { background: #ede9fe; color: #5b21b6; }
[data-theme="dark"] .badge.prosp-status-pas_contacte { background: #1f2937; color: #9ca3af; }
[data-theme="dark"] .badge.prosp-status-contacte { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge.prosp-status-interesse { background: #052e16; color: #86efac; }
[data-theme="dark"] .badge.prosp-status-pas_interesse { background: #4a1942; color: #f9a8d4; }
[data-theme="dark"] .badge.prosp-status-lead_cree { background: #2e1065; color: #c4b5fd; }

/* ---- Expiration table styles ---- */
.expir-toolbar {
    display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center;
}
.expir-status-filters {
    display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center;
}
.expir-centris-link {
    font-weight: 600; font-size: var(--text-sm); white-space: nowrap;
}
.expir-status-select {
    font-size: var(--text-xs); padding: 0.25rem 0.4rem;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--card-alt); color: var(--text-primary);
    cursor: pointer; min-width: 120px;
}
.expir-status-select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.prosp-select-pas_contacte { border-left: 3px solid #9ca3af; }
.prosp-select-contacte { border-left: 3px solid #3b82f6; }
.prosp-select-interesse { border-left: 3px solid #22c55e; }
.prosp-select-pas_interesse { border-left: 3px solid #ec4899; }
.prosp-select-lead_cree { border-left: 3px solid #8b5cf6; }
.expir-notes-input {
    font-size: var(--text-xs); padding: 0.25rem 0.4rem;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--card-alt); color: var(--text-primary);
    width: 100%; min-width: 140px;
}
.expir-notes-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---- Vendus Secteur ---- */
.vs-toolbar {
    display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center;
}
.vs-centris-link {
    font-weight: 600; font-size: var(--text-sm); white-space: nowrap;
}
.vs-notes-input {
    font-size: var(--text-xs); padding: 0.25rem 0.4rem;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--card-alt); color: var(--text-primary);
    width: 100%; min-width: 140px;
}
.vs-notes-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---- Echeancier card styles ---- */
.echeancier-card {
    background: var(--card-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.85rem 1rem;
    cursor: grab;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex-shrink: 0;
    box-shadow: 0 10px 22px rgba(0,0,0,0.04);
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.echeancier-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(0,0,0,0.06);
    border-color: var(--primary);
}
.echeancier-card.dragging {
    opacity: 0.55;
    transform: rotate(-1.5deg) scale(1.03);
    box-shadow: 0 22px 44px rgba(47, 79, 206, 0.22);
    cursor: grabbing;
    z-index: 100;
    transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.echeancier-card.dropping {
    cursor: grabbing;
}
.echeancier-card__media {
    height: 90px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--hover-bg);
    margin-bottom: 0.15rem;
}
.echeancier-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.echeancier-card__price {
    font-weight: 700;
    font-size: var(--text-sm);
}
.echeancier-card__top strong {
    font-size: var(--text-base);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}
.echeancier-card__adv-date {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: var(--text-sm);
    color: var(--muted);
    background: var(--hover-bg);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    width: fit-content;
}
.echeancier-card__progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.echeancier-card__progress-bar {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.echeancier-card__progress-fill {
    height: 100%;
    background: var(--success);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Echeancier stage tints */
.echeancier-card[data-stage="en_vigueur_achat"] { background: #fffbeb; border-color: #fde68a; }
.echeancier-card[data-stage="vendu"] { background: #f0fdf4; border-color: #bbf7d0; }
.echeancier-card[data-stage="notarie"] { background: #eef2ff; border-color: #c7d2fe; }
.echeancier-card[data-stage="pa_annulee"] { background: #fef2f2; border-color: #fecaca; }

[data-theme="dark"] .echeancier-card[data-stage="en_vigueur_achat"] { background: #332808; border-color: #5a4820; }
[data-theme="dark"] .echeancier-card[data-stage="vendu"] { background: #0d3020; border-color: #1e5038; }
[data-theme="dark"] .echeancier-card[data-stage="notarie"] { background: #1e2545; border-color: #3a4a80; }
[data-theme="dark"] .echeancier-card[data-stage="pa_annulee"] { background: #351515; border-color: #5a2828; }

/* Transaction stage badges */
.badge.tx-stage-achat { background: #fef3c7; color: #92400e; }
.badge.tx-stage-vendu { background: #dcfce7; color: #166534; }
.badge.tx-stage-notarie { background: var(--primary-soft); color: var(--primary); }
.badge.tx-stage-annulee { background: #fee2e2; color: #991b1b; }
[data-theme="dark"] .badge.tx-stage-achat { background: #422006; color: #fbbf24; }
[data-theme="dark"] .badge.tx-stage-vendu { background: #052e16; color: #4ade80; }
[data-theme="dark"] .badge.tx-stage-annulee { background: #450a0a; color: #f87171; }

/* Coup d'oeil feed */
.coup-doeil-card { margin-bottom: 1.25rem; }
.coup-doeil-scroll {
    overflow-y: auto;
}
.coup-doeil-item {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.4rem 0.6rem; font-size: var(--text-sm);
    border-bottom: 1px solid var(--border);
    cursor: pointer; transition: background 0.12s;
}
.coup-doeil-item:last-child { border-bottom: none; }
.coup-doeil-item:hover { background: var(--card-alt); }
.coup-doeil-date { white-space: nowrap; font-weight: 600; min-width: 15rem; }
.coup-doeil-past .coup-doeil-date { color: var(--danger); }
.coup-doeil-address { white-space: nowrap; font-weight: 600; min-width: 14rem; }
.coup-doeil-cond { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Échéancier calendar */
.ech-calendar-card { margin-bottom: 1.25rem; }
.ech-cal-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 0.75rem;
}
.ech-cal-nav {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem; border-radius: 8px;
    font-size: 1.1rem; font-weight: 700; text-decoration: none;
    color: var(--text); background: var(--card-alt); border: 1px solid var(--border);
    transition: background 0.12s;
}
.ech-cal-nav:hover { background: var(--border); }
.ech-calendar { width: 100%; border-collapse: collapse; table-layout: fixed; }
.ech-calendar th {
    padding: 0.4rem; text-align: center; font-size: var(--text-caption);
    color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border);
}
.ech-cal-day {
    padding: 0.35rem; vertical-align: top; min-height: 110px; height: 110px;
    border: 1px solid var(--border); font-size: var(--text-sm);
}
.ech-cal-empty { background: transparent; border-color: transparent; }
.ech-cal-num { font-weight: 700; font-size: var(--text-caption); margin-bottom: 0.2rem; }
.ech-cal-today { background: var(--primary-soft); }
.ech-cal-today .ech-cal-num { color: var(--primary); }
.ech-cal-event {
    font-size: var(--text-xs); padding: 0.15rem 0.3rem; border-radius: 4px;
    margin-bottom: 0.15rem; cursor: pointer; font-weight: 600;
    line-height: 1.3; word-wrap: break-word; white-space: normal;
}
.ech-cal-event:hover { opacity: 0.8; }
.ech-cal-completed { opacity: 0.45; text-decoration: line-through; }

/* Property color palette (8 colors) */
.ech-cal-prop-0 { background: #dbeafe; color: #1e40af; }
.ech-cal-prop-1 { background: #fef3c7; color: #92400e; }
.ech-cal-prop-2 { background: #dcfce7; color: #166534; }
.ech-cal-prop-3 { background: #fce7f3; color: #9d174d; }
.ech-cal-prop-4 { background: #e0e7ff; color: #3730a3; }
.ech-cal-prop-5 { background: #fed7aa; color: #9a3412; }
.ech-cal-prop-6 { background: #ccfbf1; color: #115e59; }
.ech-cal-prop-7 { background: #f5d0fe; color: #86198f; }
[data-theme="dark"] .ech-cal-prop-0 { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .ech-cal-prop-1 { background: #422006; color: #fbbf24; }
[data-theme="dark"] .ech-cal-prop-2 { background: #052e16; color: #4ade80; }
[data-theme="dark"] .ech-cal-prop-3 { background: #4a0d2e; color: #f9a8d4; }
[data-theme="dark"] .ech-cal-prop-4 { background: #1e2545; color: #a5b4fc; }
[data-theme="dark"] .ech-cal-prop-5 { background: #431407; color: #fdba74; }
[data-theme="dark"] .ech-cal-prop-6 { background: #0d3331; color: #5eead4; }
[data-theme="dark"] .ech-cal-prop-7 { background: #3b0764; color: #e879f9; }

/* Comptabilité — summary bar */
.compta-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}
@media (max-width: 900px) {
    .compta-summary { grid-template-columns: repeat(2, 1fr); }
}
.compta-summary__card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-5);
}
.compta-summary__label {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin-bottom: var(--space-1);
}
.compta-summary__value {
    font-size: var(--text-xl);
    font-weight: 700;
}
.compta-summary__card--paid { border-left: 3px solid #16a34a; }
.compta-summary__card--pending { border-left: 3px solid #f59e0b; }

/* Comptabilité — event cards in calendar */
.compta-event {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
    padding: 0.3rem 0.4rem;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--border);
    margin-top: 0.2rem;
    font-size: var(--text-xs);
    background: var(--card-alt);
    transition: background 0.15s, border-color 0.15s;
}
.compta-event__check { flex-shrink: 0; padding-top: 0.05rem; cursor: pointer; }
.compta-event__check input[type="checkbox"] { width: 0.95rem; height: 0.95rem; cursor: pointer; }
.compta-event__info { min-width: 0; }
.compta-event__title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 10rem;
}
.compta-event__amount { color: var(--muted); }

/* Color states */
.compta-event--paid {
    background: #dcfce7;
    border-left-color: #16a34a;
}
.compta-event--paid .compta-event__title {
    text-decoration: line-through;
    opacity: 0.7;
}
.compta-event--overdue {
    background: #fee2e2;
    border-left-color: #dc2626;
}
.compta-event--past {
    background: #fef9c3;
    border-left-color: #ca8a04;
}
.compta-event--normal {
    border-left-color: var(--border);
}

/* Dark mode variants */
[data-theme="dark"] .compta-event--paid {
    background: #052e16;
    border-left-color: #4ade80;
}
[data-theme="dark"] .compta-event--paid .compta-event__title { opacity: 0.6; }
[data-theme="dark"] .compta-event--overdue {
    background: #450a0a;
    border-left-color: #f87171;
}
[data-theme="dark"] .compta-event--past {
    background: #422006;
    border-left-color: #facc15;
}

/* Condition checklist rows */
.condition-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card-alt);
    transition: background 0.12s, border-color 0.12s;
}
.condition-row__check {
    flex-shrink: 0;
    padding-top: 0.1rem;
}
.condition-row__check input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--primary);
    cursor: pointer;
}
.condition-row__info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}
.condition-row__name {
    font-weight: 600;
    font-size: var(--text-body-sm);
}
.condition-row__dates {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.condition-row__due-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--muted);
}
.condition-row__due-text {
    cursor: pointer;
    color: var(--text);
    border-bottom: 1px dashed var(--border);
}
.condition-row__due-text.muted {
    color: var(--muted);
    border-bottom: none;
}
.condition-row__date-input {
    font-size: var(--text-caption);
    padding: 0.12rem 0.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text);
    max-width: 150px;
}
.condition-row__completed-date {
    font-size: var(--text-caption);
}
.condition-row.completed {
    opacity: 0.6;
}
.condition-row.completed .condition-row__name {
    text-decoration: line-through;
}
.condition-row.overdue {
    border-color: var(--danger);
    background: #fef2f2;
}
[data-theme="dark"] .condition-row.overdue {
    background: #2a1010;
    border-color: #7f1d1d;
}
.condition-row.upcoming {
    border-color: #f59e0b;
    background: #fffbeb;
}
[data-theme="dark"] .condition-row.upcoming {
    background: #2a2010;
    border-color: #92400e;
}

/* Linked companion conditions (indented) */
.condition-row--linked {
    margin-left: 1.5rem;
    border-left: 3px solid var(--primary-soft);
}

/* Specialist expandable fields */
.condition-row__specialist {
    width: 100%;
    margin-top: 0.35rem;
}
.condition-row__specialist-toggle {
    font-size: var(--text-xs);
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}
.condition-row__specialist-toggle:hover {
    color: var(--text);
}
.condition-row__specialist-body {
    padding: 0.25rem 0 0 0.5rem;
    border-left: 2px solid var(--border);
    margin-top: 0.25rem;
}
.condition-row__specialist-body textarea {
    width: 100%;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text);
    font-size: var(--text-sm);
    resize: vertical;
    min-height: 2.5rem;
}
.condition-row__specialist-body input[type="datetime-local"] {
    width: 100%;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text);
    font-size: var(--text-sm);
}

/* Create transaction condition rows */
.condition-row-create {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
}

/* Todo rows */
.todo-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card-alt);
    transition: background 0.12s, border-color 0.12s;
}
.todo-row__check {
    flex-shrink: 0;
    padding-top: 0.1rem;
}
.todo-row__check input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--primary);
    cursor: pointer;
}
.todo-row__info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}
.todo-row__name {
    font-weight: 600;
    font-size: var(--text-body-sm);
}
.todo-row__completed-date {
    font-size: var(--text-caption);
}
.todo-row.completed {
    opacity: 0.6;
}
.todo-row.completed .todo-row__name {
    text-decoration: line-through;
}
.todo-row__actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}
.todo-draft-btn {
    padding: 0.2rem 0.4rem !important;
    font-size: var(--text-xs) !important;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    color: var(--primary);
}
.todo-row--sub {
    border: none;
    padding: 0.3rem 0.4rem;
    background: transparent;
}
.todo-row--group {
    flex-direction: column;
}
.todo-row__header {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    width: 100%;
}
.todo-row__header .todo-row__info {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}
.todo-group-toggle {
    flex-shrink: 0;
    margin-left: auto;
    padding: 0.1rem 0.4rem !important;
    font-size: var(--text-sm) !important;
}
.todo-subgroups {
    display: none;
    width: 100%;
    margin-top: 0.35rem;
}
.todo-subgroups.open {
    display: block;
}
.todo-subgroup {
    border-left: 3px solid var(--primary-soft);
    padding-left: 0.5rem;
    margin-bottom: 0.35rem;
}
.todo-subgroup__label {
    margin-bottom: 0.15rem;
    color: var(--muted);
}
.todo-row__notes-input {
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text);
    font-size: var(--text-sm);
    font-family: inherit;
    resize: vertical;
    min-height: 2rem;
}
.echeancier-card__todo-progress {
    margin-top: 0.15rem;
}
.echeancier-card__progress-fill--todo {
    background: var(--primary);
}
[data-theme="dark"] .todo-row__notes-input {
    background: var(--input-bg);
    border-color: var(--border);
    color: var(--text);
}

/* Echeancier kanban - 5 columns */
.echeancier-kanban {
    grid-template-columns: repeat(5, minmax(220px, 1fr));
    align-items: start;
}
.echeancier-kanban .kanban-list {
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    min-height: 90px;
}
@media (max-width: 1200px) {
    .echeancier-kanban { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
@media (max-width: 640px) {
    .echeancier-kanban { grid-template-columns: 1fr; }
    .echeancier-kanban .kanban-column { max-height: none; }
}

/* ---- Kanban column colored left border ---- */
.kanban-column[data-stage="a_evaluer"] { border-left: 4px solid var(--primary); }
.kanban-column[data-stage="evaluation_faite"] { border-left: 4px solid #f59e0b; }
.kanban-column[data-stage="gagne"] { border-left: 4px solid #16a34a; }
.kanban-column[data-stage="vole"] { border-left: 4px solid #dc2626; }

/* ---- Lead card stage tints ---- */
.lead-card[data-stage="a_evaluer"] { background: #eef2ff; border-color: #c7d2fe; }
.lead-card[data-stage="evaluation_faite"] { background: #fffbeb; border-color: #fde68a; }
.lead-card[data-stage="gagne"] { background: #f0fdf4; border-color: #bbf7d0; }
.lead-card[data-stage="vole"] { background: #fef2f2; border-color: #fecaca; }

[data-theme="dark"] .lead-card[data-stage="a_evaluer"] { background: #1e2545; border-color: #3a4a80; }
[data-theme="dark"] .lead-card[data-stage="evaluation_faite"] { background: #332808; border-color: #5a4820; }
[data-theme="dark"] .lead-card[data-stage="gagne"] { background: #0d3020; border-color: #1e5038; }
[data-theme="dark"] .lead-card[data-stage="vole"] { background: #351515; border-color: #5a2828; }

/* ---- Acheteur detail: notes save icon ---- */
.field-label {
    font-size: var(--text-body-sm);
    color: var(--muted);
}
.btn-icon-save {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn-icon-save:hover {
    color: var(--text);
    border-color: var(--border);
    background: var(--hover-bg);
}
.btn-icon-save.saved {
    color: var(--success);
    border-color: var(--success);
}

/* ---- Acheteur detail: action bar ---- */
.acheteur-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.acheteur-actions__row {
    display: flex;
    gap: 0.5rem;
}
.acheteur-actions__row .btn {
    flex: 1;
    justify-content: center;
}
.acheteur-actions__closing {
    border-top: 1px solid var(--border);
    padding-top: 0.5rem;
}

/* ---- Gagné button ---- */
.btn.btn-gagne {
    background: linear-gradient(135deg, var(--success-action), var(--success-action-hover));
    color: #fff;
    box-shadow: 0 8px 20px rgba(22, 163, 74, 0.25);
}
.btn.btn-gagne:hover {
    box-shadow: 0 12px 28px rgba(22, 163, 74, 0.35);
}

/* ---- Confetti ---- */
.confetti-container {
    position: fixed;
    inset: 0;
    z-index: var(--z-confetti);
    pointer-events: none;
    overflow: hidden;
}
.confetti-piece {
    position: absolute;
    top: -3rem;
    animation: confettiFall 2.8s cubic-bezier(0.22, 0, 1, 1) forwards;
    opacity: 1;
    object-fit: contain;
}
@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    80% { opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ---- Document management ---- */
.doc-btn {
    font-size: var(--text-caption);
    padding: 0.25rem 0.5rem;
    gap: 0.3rem;
}
.doc-count-badge {
    font-size: var(--text-xs);
    padding: 0.1rem 0.45rem;
    min-width: 1.1rem;
    text-align: center;
    background: var(--primary);
    color: #fff;
}
.doc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}
.doc-row:last-child { border-bottom: none; }
.doc-row__info { min-width: 0; flex: 1; }
.doc-row__name {
    display: block;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: var(--text-body-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.doc-row__name:hover { text-decoration: underline; }

/* ---- Document picker (reply overlay) ---- */
.doc-picker-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card-alt);
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.doc-picker-row:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}
.doc-picker-row input[type="checkbox"] {
    margin-top: 0.2rem;
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--primary);
    flex-shrink: 0;
}
.doc-picker-row__info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}
.doc-picker-row__name {
    font-weight: 600;
    font-size: var(--text-body-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Vendeur table ---- */
.vendeur-row { cursor: pointer; }
.vendeur-row.hidden { display: none; }
.vendeurs-table-card { max-width: 100%; }
.vendeurs-table-card table { min-width: 580px; }
.vendeurs-table-card th:nth-child(1),
.vendeurs-table-card td:nth-child(1) { width: 10%; }
.vendeurs-table-card th:nth-child(2),
.vendeurs-table-card td:nth-child(2) { width: 22%; }
.vendeurs-table-card th:nth-child(3),
.vendeurs-table-card td:nth-child(3) { width: 14%; }
.vendeurs-table-card th:nth-child(4),
.vendeurs-table-card td:nth-child(4) { width: 11%; }
.vendeurs-table-card th:nth-child(5),
.vendeurs-table-card td:nth-child(5) { width: 12%; }
.vendeurs-table-card th:nth-child(6),
.vendeurs-table-card td:nth-child(6) { width: 12%; }
.vendeurs-table-card th:nth-child(7),
.vendeurs-table-card td:nth-child(7) { width: 19%; }

/* ---- Acheteur table ---- */
.acheteur-row { cursor: pointer; }
.acheteur-row.hidden { display: none; }
.acheteurs-table-card { max-width: 100%; }
.acheteurs-table-card table { min-width: 580px; }
.notes-cell { max-width: 260px; word-break: break-word; }
.acheteur-status-filter { cursor: pointer; }
.acheteur-status-filter:hover { opacity: 0.75; }
.acheteur-row.acheteur-overdue { border-left: 4px solid var(--danger); }
.acheteur-overdue-badge {
    display: inline-flex;
    align-items: center;
    background: #fee2e2;
    color: #991b1b;
    border-radius: var(--radius-full);
    padding: 0.1rem 0.45rem;
    font-size: var(--text-xs);
    font-weight: 700;
    vertical-align: middle;
    margin-left: 0.25rem;
}
[data-theme="dark"] .acheteur-overdue-badge { background: #450a0a; color: #f87171; }
.acheteur-sort-header { cursor: pointer; user-select: none; }
.acheteur-sort-header:hover { color: var(--text); }
.sort-icon { font-size: var(--text-xs); margin-left: 0.15rem; }

/* ---- Sidebar collapses to mobile at 900px ---- */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .sidebar.sidebar--open {
        transform: translateX(0);
    }
    .mobile-header {
        display: flex;
    }
    .container {
        margin-left: 0;
    }
    .dossier-hero { flex-direction: column; }
}

/* ---- Contacts page ---- */
.contacts-search-wrap {
    position: relative;
    margin-bottom: 0.75rem;
}
.contacts-search {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    padding: 0.7rem 1rem;
    font-size: 1rem;
    background: var(--card);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.contacts-search { padding-right: 2.5rem; }
.contacts-search:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(47, 79, 206, 0.12);
}
.contacts-search-clear {
    position: absolute;
    right: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}
.contacts-search-clear:hover { color: var(--text); background: var(--hover-bg); }
.contacts-tag-filters {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}
.contacts-tag-filters__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.contacts-tag-filters__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.contacts-tag-filter-option { cursor: pointer; }
.contacts-tag-filter-option input[type="checkbox"] { display: none; }
.contacts-tag-filter-option input[type="checkbox"]:not(:checked) + .badge {
    border: 1px solid var(--border) !important;
    background: var(--card-alt) !important;
    color: var(--muted) !important;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.contacts-tag-filter-option input[type="checkbox"]:not(:checked) + .badge:hover { opacity: 0.8; }
.contacts-tag-filter-option input[type="checkbox"]:checked + .badge.contact-tag-vendeurs-actifs {
    background: #166534; color: #fff; border-color: #166534;
}
[data-theme="dark"] .contacts-tag-filter-option input[type="checkbox"]:checked + .badge.contact-tag-vendeurs-actifs {
    background: #22c55e; color: #052e16; border-color: #22c55e;
}
.contact-sort-header { cursor: pointer; user-select: none; }
.contact-sort-header:hover { color: var(--text); }
.contacts-action-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 56px;
    margin-bottom: 0.75rem;
}
.contacts-action-bar .btn {
    padding: 0.75rem 1.2rem;
    font-size: 1rem;
}
.contacts-action-bar .btn svg {
    width: 20px;
    height: 20px;
}
.contacts-action-bar .badge {
    font-size: var(--text-base);
    padding: 0.35rem 0.85rem;
}
.contacts-table-card { max-width: 100%; }
.contacts-table-card table { min-width: 700px; table-layout: fixed; }
.contacts-table-card th:nth-child(1),
.contacts-table-card td:nth-child(1) { width: 40px; }
.contacts-table-card th:nth-child(2),
.contacts-table-card td:nth-child(2) { width: 18%; }
.contacts-table-card th:nth-child(3),
.contacts-table-card td:nth-child(3) { width: 22%; overflow: hidden; text-overflow: ellipsis; }
.contacts-table-card th:nth-child(4),
.contacts-table-card td:nth-child(4) { width: 12%; white-space: nowrap; }
.contacts-table-card th:nth-child(5),
.contacts-table-card td:nth-child(5) { width: auto; }
.contacts-table-card th:nth-child(6),
.contacts-table-card td:nth-child(6) { width: 20%; }
.contacts-tag-filter { cursor: pointer; }
.contacts-tag-filter:hover { opacity: 0.75; }
.contact-name-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}
.contact-name-link:hover { text-decoration: underline; }

/* ---- Address badge pills ---- */
.addr-cell { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; }
td.addr-cell { display: table-cell; }
.addr-badge {
    display: inline-block;
    background: var(--primary-soft);
    color: var(--text);
    border-radius: var(--radius-full);
    padding: 0.15rem 0.55rem;
    font-size: var(--text-caption);
    cursor: pointer;
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.12s;
}
.addr-badge:hover { background: var(--hover-bg); }
.addr-badge--legacy {
    background: var(--hover-bg);
    color: var(--muted);
    font-style: italic;
}
.addr-badge--manual {
    background: var(--hover-bg);
    color: var(--text);
}

/* ---- Address autocomplete ---- */
.addr-ac { position: relative; }
.addr-ac__input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    padding: 0.65rem 0.85rem;
    font-size: 1rem;
    background: var(--input-bg);
    color: var(--text);
    transition: border-color 0.15s;
    outline: none;
}
.addr-ac__input:focus { border-color: var(--primary); box-shadow: var(--focus-ring); }
.addr-ac__suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 60;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
    max-height: 260px;
    overflow-y: auto;
    display: none;
}
[data-theme="dark"] .addr-ac__suggestions { box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35); }
.addr-ac__suggestion {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background 0.1s;
}
.addr-ac__suggestion:hover,
.addr-ac__suggestion.active { background: var(--hover-bg); }
.addr-ac__suggestion strong {
    font-size: var(--text-sm);
    font-weight: 600;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.addr-ac__suggestion .muted { font-size: var(--text-xs); }
.addr-ac__no-match {
    padding: 0.5rem 0.75rem;
    color: var(--muted);
    font-size: 0.85rem;
}
.addr-ac__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.4rem;
}
.addr-ac__tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border-radius: var(--radius-full);
    padding: 0.2rem 0.5rem;
    font-size: var(--text-caption);
}
.addr-ac__tag--centris { background: var(--primary-soft, rgba(37,99,235,0.1)); color: var(--primary); }
.addr-ac__tag--manual { background: var(--hover-bg); color: var(--text); }
.addr-ac__tag-remove {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.15rem;
}
.addr-ac__tag-remove:hover { color: var(--danger); }

/* Interest address autocomplete (acheteur leads) */
.interest-ac { position: relative; }
.interest-ac__input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    padding: 0.5rem 0.75rem;
    font-size: var(--text-body-sm);
    background: var(--input-bg);
    color: var(--text);
    transition: border-color 0.15s;
    outline: none;
}
.interest-ac__input:focus { border-color: var(--primary); box-shadow: var(--focus-ring); }
.interest-ac__suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 60;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
    max-height: 220px;
    overflow-y: auto;
    display: none;
}
[data-theme="dark"] .interest-ac__suggestions { box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35); }
.interest-ac__suggestion {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background 0.1s;
}
.interest-ac__suggestion:hover,
.interest-ac__suggestion.active { background: var(--hover-bg); }
.interest-ac__suggestion strong {
    font-size: var(--text-sm);
    font-weight: 600;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.interest-ac__suggestion .muted { font-size: var(--text-xs); }
.interest-ac__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.4rem;
}
.interest-ac__tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border-radius: var(--radius-full);
    padding: 0.2rem 0.55rem;
    font-size: var(--text-xs);
    background: var(--primary-soft, rgba(37,99,235,0.1));
    color: var(--primary);
}
.interest-ac__tag-link {
    color: inherit;
    text-decoration: none;
}
.interest-ac__tag-link:hover { text-decoration: underline; }
.interest-ac__tag-mls {
    color: var(--muted);
    font-size: var(--text-xs);
}
.interest-ac__tag-remove {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.15rem;
}
.interest-ac__tag-remove:hover { color: var(--danger); }

/* Lead address autocomplete (simplified single-select) */
.lead-addr-ac { position: relative; }
.lead-addr-ac__input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    padding: 0.65rem 0.85rem;
    font-size: 1rem;
    background: var(--input-bg);
    color: var(--text);
    transition: border-color 0.15s;
    outline: none;
}
.lead-addr-ac__input:focus { border-color: var(--primary); box-shadow: var(--focus-ring); }
.lead-addr-ac__suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 60;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
    max-height: 260px;
    overflow-y: auto;
    display: none;
}
[data-theme="dark"] .lead-addr-ac__suggestions { box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35); }
.lead-addr-ac__option {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: var(--text-sm);
    transition: background 0.1s;
}
.lead-addr-ac__option:hover { background: var(--hover-bg); }

/* ---- Contact autocomplete ---- */
.contact-ac { position: relative; margin-bottom: 0.5rem; }
.contact-ac__input {
    width: 100%;
    padding: 0.45rem 0.65rem;
    font-size: var(--text-sm);
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 8px);
    background: var(--card);
    color: var(--text-primary);
    transition: border-color 0.15s;
}
.contact-ac__input:focus { border-color: var(--primary); outline: none; }
.contact-ac__suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 60;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
    max-height: 260px;
    overflow-y: auto;
    display: none;
}
[data-theme="dark"] .contact-ac__suggestions { box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35); }
.contact-ac__suggestion {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: var(--text-sm);
    transition: background 0.1s;
}
.contact-ac__suggestion:hover { background: var(--hover-bg); }
.contact-ac__suggestion strong { display: block; }
.contact-ac__suggestion .muted { font-size: var(--text-caption); color: var(--text-muted); }
.contact-ac__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    font-size: var(--text-sm);
    font-weight: 500;
    background: var(--primary-soft, rgba(79, 70, 229, 0.1));
    color: var(--primary);
    border-radius: var(--radius-full);
}
.contact-ac__clear {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    color: var(--text-muted);
    padding: 0.1rem 0.25rem;
}
.contact-ac__clear:hover { color: var(--text-primary); }
.contact-ac--inline { margin-bottom: 0.35rem; }
.contact-ac--inline .contact-ac__input { font-size: var(--text-sm); padding: 0.3rem 0.5rem; }

.contact-row.hidden { display: none; }
.contacts-tag-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.contacts-tag-option {
    cursor: pointer;
}
.contacts-tag-option input[type="checkbox"] {
    display: none;
}
.contacts-tag-option input[type="checkbox"] + .badge {
    border: 1px solid var(--border);
    background: var(--card-alt);
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.contacts-tag-option input[type="checkbox"]:checked + .badge {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.contacts-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    background: rgba(15, 23, 42, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: contactsFadeIn 0.15s ease;
}
[data-theme="dark"] .contacts-overlay {
    background: rgba(0, 0, 0, 0.55);
}
.contacts-detail-card {
    width: 100%;
    max-width: var(--modal-sm);
    margin: 1rem;
}
.contacts-detail-card--md {
    max-width: var(--modal-md);
}
.contacts-detail-card--lg {
    max-width: var(--modal-lg);
}
@keyframes contactsFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ---- Fiche Client (contact detail) ---- */
.fiche-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}
.fiche-header h3 { margin: 0; flex: 1; min-width: 0; }
.fiche-header-badges {
    display: flex;
    gap: var(--space-1);
    flex-wrap: wrap;
}
.fiche-header-actions {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    margin-left: auto;
}

/* Read / edit toggle */
.fiche-read { display: block; }
.fiche-edit { display: none; }
.fiche-editing .fiche-read { display: none; }
.fiche-editing .fiche-edit { display: block; }
.fiche-edit-actions { display: none; }
.fiche-editing .fiche-edit-actions { display: flex; }

/* Read-only field display */
.fiche-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3) var(--space-6);
}
.fiche-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.fiche-field__label {
    font-size: var(--text-xs);
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
}
.fiche-field__value {
    font-size: var(--text-sm);
    color: var(--text);
    word-break: break-word;
}
.fiche-field--full {
    grid-column: 1 / -1;
}

/* Fiche table (properties, transactions) */
.fiche-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}
.fiche-table thead th {
    text-transform: uppercase;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0.03em;
    padding: var(--space-2) var(--space-2);
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.fiche-table tbody td {
    padding: var(--space-2) var(--space-2);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.fiche-table tbody tr:last-child td {
    border-bottom: none;
}
.fiche-table tbody tr:hover {
    background: var(--hover-bg);
}

/* Section icon in collapse headers */
.fiche-section-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: var(--muted);
}

/* Badge variants for lifecycle stage */
.badge--en-vigueur { background: #dbeafe; color: #1d4ed8; }
.badge--en-vigueur-achat { background: #fef3c7; color: #92400e; }
.badge--vendu { background: #d1fae5; color: #065f46; }
.badge--notarie { background: #e9edff; color: var(--primary); }
[data-theme="dark"] .badge--en-vigueur { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .badge--en-vigueur-achat { background: #422006; color: #fcd34d; }
[data-theme="dark"] .badge--vendu { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .badge--notarie { background: #1e2545; color: #818cf8; }
.badge--evaluation { background: #dcfce7; color: #166534; }
[data-theme="dark"] .badge--evaluation { background: #14532d; color: #86efac; }

/* Fiche modal content scrollable */
.fiche-body {
    max-height: calc(85vh - 100px);
    overflow-y: auto;
    padding: var(--space-4);
}
.fiche-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--border);
}

/* Skeleton loaders for fiche sections */
.fiche-skeleton {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-3) 0;
}
.fiche-skeleton-row {
    height: 14px;
    background: linear-gradient(90deg, var(--hover-bg) 25%, var(--card-alt) 50%, var(--hover-bg) 75%);
    background-size: 200% 100%;
    border-radius: var(--radius-sm);
    animation: shimmer 1.5s ease-in-out infinite;
}
.fiche-skeleton-row:nth-child(2) { width: 75%; }
.fiche-skeleton-row:nth-child(3) { width: 50%; }

/* ---- Theme toggle ---- */
.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--muted);
    transition: color 0.15s, background 0.15s, border-color 0.15s;
    flex-shrink: 0;
}
.theme-toggle:hover {
    color: var(--text);
    background: var(--hover-bg);
}
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun  { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }

/* Dark mode: table text */
[data-theme="dark"] th { color: var(--muted); }

/* Dark mode: contacts search */
[data-theme="dark"] .contacts-search {
    background: var(--input-bg);
    color: var(--text);
}

/* Dark mode: primary button keeps light text */
[data-theme="dark"] .btn.primary {
    background: var(--btn-primary-bg);
    color: #fff;
}

/* ---- Metric card tints ---- */
.metric-card--acheteurs { border-left: 4px solid var(--primary); }
.metric-card--vendeurs { border-left: 4px solid #8b5cf6; }
.metric-card--evaluations { border-left: 4px solid #f59e0b; }
.metric-card--expirations { border-left: 4px solid #06b6d4; }
.metric-card--leads { border-left: 4px solid var(--danger); }
.metric-card--transactions { border-left: 4px solid #7c3aed; }
.metric-card--ni { border-left: 4px solid #14b8a6; }
.metric-card__icon {
    font-size: 1.3rem;
    margin-bottom: 0.1rem;
    line-height: 1;
}

/* ---- Activity log time group headers ---- */
.activity-group-header {
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    padding: 0.5rem 0 0.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.15rem;
}
.activity-group-header:first-child { padding-top: 0; }

.activity-user {
    color: var(--text-secondary);
    font-weight: 600;
}
.activity-address {
    color: var(--muted);
    font-weight: 500;
}
.activity-scroll {
    max-height: 400px;
    overflow-y: auto;
}
.activity-entry {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.35rem 0;
}
.activity-entry__icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}
.activity-entry__body {
    min-width: 0;
    flex: 1;
}
.activity-entry__detail {
    line-height: 1.4;
}
.dashboard-section {
    margin-top: var(--space-5);
}
.card-header__title {
    margin: 0;
}

/* ---- Condition list (dashboard) ---- */
.condition-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.condition-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    gap: 0.75rem;
}
.condition-item:last-child { border-bottom: none; }
.condition-overdue {
    background: rgba(220, 38, 38, 0.06);
}
[data-theme="dark"] .condition-overdue {
    background: rgba(248, 113, 113, 0.08);
}
.condition-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.condition-address {
    font-size: var(--text-sm);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.condition-name {
    font-size: var(--text-caption);
    color: var(--muted);
}
.condition-badge {
    flex-shrink: 0;
    font-size: var(--text-sm);
    font-weight: 700;
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-md);
    white-space: nowrap;
}
.condition-badge--safe {
    background: rgba(22, 163, 74, 0.12);
    color: var(--success);
}
.condition-badge--warning {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
}
[data-theme="dark"] .condition-badge--warning {
    color: #fbbf24;
}
.condition-badge--danger {
    background: rgba(220, 38, 38, 0.12);
    color: var(--danger);
}
.condition-badge--overdue {
    background: rgba(220, 38, 38, 0.12);
    color: var(--danger);
}

/* ---- Maintenance / under-construction ---- */
.maintenance-wrapper {
    position: relative;
    overflow: hidden;
    pointer-events: none;
    opacity: 0.45;
    border-radius: var(--radius-lg);
}
.maintenance-ribbon {
    position: absolute;
    z-index: 10;
    width: 300px;
    padding: 0.45rem 0;
    background: repeating-linear-gradient(
        -45deg,
        #fbbf24,
        #fbbf24 10px,
        #1a1a1a 10px,
        #1a1a1a 20px
    );
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.maintenance-ribbon--tl {
    top: 28px;
    left: -70px;
    height: 20px;
    transform: rotate(-35deg);
}
.maintenance-ribbon--br {
    bottom: 28px;
    right: -70px;
    height: 20px;
    transform: rotate(-35deg);
}
.maintenance-banner {
    position: absolute;
    z-index: 11;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--card);
    border: 2px solid #fbbf24;
    border-radius: var(--radius-input);
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    white-space: nowrap;
}
.maintenance-banner__icon {
    font-size: 1.5rem;
}

/* ---- Listing photo gradient overlay ---- */
.listing-chip__media {
    position: relative;
}
.listing-chip__media::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to top, rgba(0,0,0,0.15), transparent);
    border-radius: 0 0 12px 12px;
    pointer-events: none;
}

/* ---- Contacts alternating rows ---- */
.contacts-table-card tbody tr:nth-child(even) td {
    background: var(--card-alt);
}

/* ---- Acheteur table column widths ---- */
.acheteurs-table-card th:nth-child(1),
.acheteurs-table-card td:nth-child(1) { width: 40%; }
.acheteurs-table-card th:nth-child(2),
.acheteurs-table-card td:nth-child(2) { width: 15%; }
.acheteurs-table-card th:nth-child(3),
.acheteurs-table-card td:nth-child(3) { width: 20%; }
.acheteurs-table-card th:nth-child(4),
.acheteurs-table-card td:nth-child(4) { width: 25%; }

/* ---- Echeancier scroll fade ---- */
.echeancier-kanban .kanban-list {
    -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 30px), transparent 100%);
    mask-image: linear-gradient(to bottom, black calc(100% - 30px), transparent 100%);
}

/* ---- Kanban empty state ---- */
.kanban-list:empty::after {
    content: attr(data-empty-label);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 70px;
    font-size: 0.85rem;
    color: var(--muted);
    opacity: 0.6;
    text-align: center;
}

/* ---- Triage age indicators ---- */
.triage-age-fresh {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--success);
    margin-right: 0.35rem;
    vertical-align: middle;
}
.triage-age-stale {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #f59e0b;
    margin-right: 0.35rem;
    vertical-align: middle;
}
.triage-age-urgent {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--danger);
    margin-right: 0.35rem;
    vertical-align: middle;
    animation: urgentPulse 1.5s ease-in-out infinite;
}
@keyframes urgentPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ---- Expirations empty state ---- */
.empty-state-positive {
    text-align: center;
    padding: 2rem 1rem;
}
.empty-state-positive__icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

/* ---- Hamburger button (inside mobile-header) ---- */
.hamburger {
    display: inline-flex;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--muted);
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
    padding: 0;
}
.hamburger:hover { color: var(--text); background: var(--hover-bg); }
.hamburger svg { width: 22px; height: 22px; }

/* ---- Tablet (641–1024px) ---- */
@media (max-width: 1024px) {
    .container { padding: 1.25rem 1rem; }
    .metric-card__value { font-size: 1.7rem; }
    .contacts-table-card table { min-width: 600px; }
    .acheteurs-table-card table { min-width: 500px; }
    .vendeurs-table-card table { min-width: 500px; }
}

/* ---- Mobile (≤640px) ---- */
@media (max-width: 640px) {
    /* Container */
    .container { padding: 1rem 0.75rem; }

    /* Typography */
    h1 { font-size: 1.5rem; }
    .metric-card__value { font-size: 1.5rem; }

    /* Grids */
    .grid.two, .grid.three { grid-template-columns: 1fr; }
    .grid.four { grid-template-columns: repeat(2, 1fr); }
    .grid.five { grid-template-columns: repeat(2, 1fr); }

    /* Tables */
    .contacts-table-card table { min-width: 500px; }
    .acheteurs-table-card table { min-width: 400px; }
    .vendeurs-table-card table { min-width: 400px; }
    th, td { padding: 0.5rem 0.4rem; font-size: 0.9rem; }

    /* Listing cards */
    .listing-grid { grid-template-columns: 1fr; }

    /* Property cards */
    .property-grid { grid-template-columns: 1fr; }

    /* Kanban */
    .kanban { grid-template-columns: 1fr; }

    /* Buttons — touch targets */
    .btn { min-height: 44px; }

    /* Theme toggle — larger touch target */
    .theme-toggle { width: 44px; height: 44px; }

    /* Cards — tighter spacing */
    .card { padding: 1rem; border-radius: var(--radius-lg); }
    .metric-card { padding: 0.85rem 0.95rem; }

    /* Contact detail modal — full width */
    .contacts-detail-card { max-width: none; }
    .contacts-overlay { align-items: flex-end; }
    .contacts-detail-card,
    .contacts-overlay .card {
        max-width: none;
        margin: 0.5rem;
        max-height: 90vh;
        overflow-y: auto;
    }
    .fiche-fields { grid-template-columns: 1fr; }
    .fiche-header { flex-direction: column; align-items: flex-start; }
    .fiche-header-actions { margin-left: 0; width: 100%; justify-content: flex-end;
    }

    /* Page header — stack vertically */
    .page-header { flex-direction: column; align-items: stretch; }

    /* Deal card actions */
    .deal-card__actions { grid-template-columns: 1fr; }

    /* Dossier hero */
    .dossier-hero { flex-direction: column; padding: 1rem; }
}

/* ---- Nouvelle Inscription ---- */
.ni-checkbox-groups { display: flex; flex-direction: column; gap: 0.75rem; }
.ni-group {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    background: var(--card-alt);
}
.ni-group__title {
    font-weight: 600;
    font-size: var(--text-sm);
    margin-bottom: 0.4rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.ni-check {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.2rem 0;
    cursor: pointer;
    font-size: var(--text-body-sm);
}
.ni-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}
.ni-table__row { border-bottom: 1px solid var(--border); transition: background 0.15s; }
.ni-table__row:hover { background: var(--hover-bg); }
.ni-table th { border-bottom: 2px solid var(--border); font-size: var(--text-sm); text-transform: uppercase; color: var(--muted); letter-spacing: 0.03em; }

/* NI collapsible section on echeancier cards */
.ni-collapse {
    margin-top: 0.5rem;
    border-top: 1px solid var(--border);
    padding-top: 0.35rem;
}
.ni-collapse__toggle {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    background: none;
    border: none;
    padding: 0.25rem 0;
    cursor: pointer;
    color: var(--text);
    text-align: left;
}
.ni-collapse__toggle:hover { opacity: 0.8; }
.ni-collapse__chevron { transition: transform 0.2s ease; flex-shrink: 0; }
.ni-collapse__body {
    padding: 0.35rem 0 0.15rem 0;
}
.ni-collapse__item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.1rem 0;
    font-size: var(--text-sm);
}
.ni-collapse__item.done { color: var(--success); }
.ni-collapse__item:not(.done) { color: var(--muted); }

/* ---- Toast notification system ---- */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column-reverse;
    gap: 0.5rem;
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    font-size: var(--text-sm);
    color: var(--text);
    min-width: 260px;
    max-width: 380px;
    animation: toastIn 0.3s ease forwards;
    overflow: hidden;
    position: relative;
}
.toast--exiting {
    animation: toastOut 0.25s ease forwards;
}
.toast__icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}
.toast__icon svg {
    width: 20px;
    height: 20px;
}
.toast__message {
    flex: 1;
    line-height: 1.4;
}
.toast__close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 0.15rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}
.toast__close:hover { color: var(--text); background: var(--hover-bg); }
.toast__close svg { width: 14px; height: 14px; }
.toast__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    animation: toastProgress linear forwards;
}
.toast--success { border-left: 3px solid var(--success); }
.toast--success .toast__icon { color: var(--success); }
.toast--success .toast__progress { background: var(--success); }
.toast--error { border-left: 3px solid var(--danger); }
.toast--error .toast__icon { color: var(--danger); }
.toast--error .toast__progress { background: var(--danger); }
.toast--info { border-left: 3px solid var(--primary); }
.toast--info .toast__icon { color: var(--primary); }
.toast--info .toast__progress { background: var(--primary); }
.toast--warning { border-left: 3px solid var(--warning); }
.toast--warning .toast__icon { color: var(--warning); }
.toast--warning .toast__progress { background: var(--warning); }
@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px) scale(0.96); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0) scale(1); }
    to { opacity: 0; transform: translateX(20px) scale(0.96); }
}
@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}
@media (max-width: 640px) {
    .toast-container { left: 0.75rem; right: 0.75rem; bottom: 1rem; }
    .toast { max-width: none; min-width: 0; }
}

/* ---- Loading spinner ---- */
@keyframes spin {
    to { transform: rotate(360deg); }
}
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
    flex-shrink: 0;
}
.spinner--sm { width: 14px; height: 14px; border-width: 2px; }
.spinner--lg { width: 28px; height: 28px; border-width: 3px; }
.btn--loading {
    pointer-events: none;
    opacity: 0.75;
    position: relative;
}
.btn--loading::after {
    content: "";
    width: 14px;
    height: 14px;
    border: 2px solid var(--border);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-left: 0.4rem;
}
.btn--loading .spinner {
    border-top-color: currentColor;
    border-color: rgba(255,255,255,0.3);
    border-top-color: currentColor;
}

/* ---- Skeleton loading placeholders ---- */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.skeleton {
    background: linear-gradient(90deg, var(--hover-bg) 25%, var(--card-alt) 50%, var(--hover-bg) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}
.skeleton--text { height: 1rem; width: 60%; margin-bottom: 0.5rem; border-radius: 4px; }
.skeleton--text-sm { height: 0.75rem; width: 40%; border-radius: 4px; }
.skeleton--circle { width: 40px; height: 40px; border-radius: 50%; }
.skeleton--card { height: 120px; border-radius: var(--radius-lg); }

/* ---- Enhanced empty states ---- */
.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--muted);
}
.empty-state__icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    line-height: 1;
    opacity: 0.6;
}
.empty-state__icon svg {
    width: 48px;
    height: 48px;
    stroke: var(--muted);
    opacity: 0.5;
}
.empty-state__title {
    font-size: var(--text-base);
    font-weight: 600;
    margin: 0 0 0.25rem;
    color: var(--text);
}
.empty-state__message {
    font-size: var(--text-sm);
    margin: 0;
    max-width: 320px;
    margin-inline: auto;
    line-height: 1.5;
}
.empty-state--positive .empty-state__icon svg { stroke: var(--success); opacity: 0.7; }
.empty-state--positive .empty-state__title { color: var(--success); }

/* ---- Metric card SVG icons ---- */
/* ---- Utility classes ---- */
.hidden { display: none; }
.u-hidden { display: none; }
.u-flex { display: flex; }
.u-flex-center { display: flex; align-items: center; }
.u-gap-2 { gap: var(--space-2); }
.u-gap-3 { gap: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-8 { margin-top: var(--space-8); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.gap-3 { gap: var(--space-3); }
.w-full { width: 100%; }
.text-center { text-align: center; }

/* ---- Modal & section header patterns ---- */
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: var(--space-3); }
.modal-header--center { align-items: center; }
.section-row { display: flex; justify-content: space-between; align-items: center; }

.metric-card__link { text-decoration: none; color: inherit; }
.metric-card--alert { border-color: var(--danger); }
.metric-card__value--alert { color: var(--danger); }
.metric-card__icon svg {
    width: 22px;
    height: 22px;
    stroke-width: 2;
}

/* ---- Statistiques page ---- */
.stats-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-sm);
}
.stats-section h3 {
    margin: 0 0 var(--space-4) 0;
    font-size: var(--text-lg);
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}
@media (max-width: 700px) {
    .stats-grid { grid-template-columns: 1fr; }
}
.stats-metric {
    background: var(--card-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-5);
    text-align: center;
}
.stats-metric__label {
    font-size: var(--text-sm);
    color: var(--muted);
    margin-bottom: var(--space-1);
}
.stats-metric__value {
    font-family: "DM Serif Display", Georgia, serif;
    font-size: var(--text-xl);
    font-weight: 400;
    color: var(--text);
    line-height: 1.2;
}
.stats-metric__value--accent {
    color: var(--success);
}
.stats-metric__sub {
    font-size: var(--text-xs);
    color: var(--muted);
    margin-top: var(--space-1);
}
.stats-chart-wrap {
    position: relative;
    height: 260px;
    max-height: 300px;
}

/* ---- Notarié validation ---- */
.notarie-party {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-2);
    background: var(--card-alt);
}
.notarie-party__header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-1);
}
.notarie-party__warning {
    color: var(--danger, #dc2626);
    font-size: var(--text-sm);
    font-weight: 500;
    margin-top: var(--space-1);
}
.notarie-party__missing {
    margin-top: var(--space-1);
}
.notarie-missing-list {
    margin: var(--space-1) 0 0 var(--space-4);
    padding: 0;
    font-size: var(--text-sm);
    color: var(--danger, #dc2626);
}
.notarie-missing-list li {
    margin-bottom: 2px;
}
.notarie-party__ok {
    margin-top: var(--space-1);
}

/* ---- Tâches Vicky — weekly calendar ---- */
.tv-week-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}
.tv-week-label {
    font-weight: 600;
    font-size: var(--text-base);
    min-width: 220px;
    text-align: center;
}
.tv-week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: var(--space-2);
}
.tv-day-column {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    min-height: 200px;
    display: flex;
    flex-direction: column;
}
.tv-day-column.tv-day-today {
    border-color: var(--primary, #6366f1);
    box-shadow: 0 0 0 1px var(--primary, #6366f1);
}
.tv-day-header {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border);
    text-align: center;
}
.tv-day-label {
    display: block;
    font-weight: 600;
    font-size: var(--text-sm);
    text-transform: capitalize;
}
.tv-day-num {
    display: block;
    font-size: var(--text-xs);
    color: var(--muted);
    text-transform: capitalize;
}
.tv-day-body {
    padding: var(--space-2);
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}
.tv-task-card {
    display: flex;
    align-items: flex-start;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-alt);
    cursor: pointer;
    transition: background 0.15s;
}
.tv-task-card:hover {
    background: var(--bg);
}
.tv-task-card.tv-task-done {
    border-color: var(--success, #16a34a);
    background: color-mix(in srgb, var(--success, #16a34a) 8%, var(--card-alt));
}
.tv-task-card.tv-task-done .tv-task-title {
    text-decoration: line-through;
    color: var(--muted);
}
.tv-task-check {
    flex-shrink: 0;
    margin-top: 1px;
}
.tv-task-check input[type="checkbox"] {
    cursor: pointer;
}
.tv-task-title {
    font-size: var(--text-sm);
    word-break: break-word;
    flex: 1;
    cursor: pointer;
}
.tv-add-btn {
    margin-top: auto;
    padding: var(--space-1) var(--space-2);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    background: none;
    color: var(--muted);
    font-size: var(--text-sm);
    cursor: pointer;
    text-align: center;
    transition: color 0.15s, border-color 0.15s;
}
.tv-add-btn:hover {
    color: var(--text);
    border-color: var(--text);
}

/* Sub-item badge on task cards */
.tv-si-badge {
    flex-shrink: 0;
    font-size: var(--text-xs);
    background: var(--primary-soft);
    color: var(--primary);
    padding: 0 6px;
    border-radius: var(--radius-full);
    line-height: 1.6;
    font-weight: 600;
}
.tv-si-badge--done {
    background: color-mix(in srgb, var(--success) 15%, transparent);
    color: var(--success);
}

/* Sub-item rows in form modal */
.tv-sub-item-row {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    margin-bottom: var(--space-1);
}
.tv-sub-item-row input[type="checkbox"] {
    flex-shrink: 0;
    cursor: pointer;
}
.tv-sub-item-row input[type="text"] {
    flex: 1;
    font-size: var(--text-sm);
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text);
}
.tv-sub-item-row .tv-si-remove {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: var(--text-base);
    padding: 0 4px;
    line-height: 1;
}
.tv-sub-item-row .tv-si-remove:hover {
    color: var(--danger);
}

/* Sub-item rows in detail modal */
.tv-si-detail-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 3px 0;
    font-size: var(--text-sm);
}
.tv-si-detail-row.tv-si-done span {
    text-decoration: line-through;
    color: var(--muted);
}

/* Drag-and-drop states */
.tv-task-card[draggable="true"] {
    cursor: grab;
}
.tv-task-card.dragging {
    opacity: 0.4;
    transform: rotate(1deg);
}
.tv-day-body.tv-drag-over {
    outline: 2px dashed var(--primary);
    outline-offset: -2px;
    background: var(--primary-soft);
}
.tv-drag-placeholder {
    border: 2px dashed var(--primary);
    border-radius: var(--radius-sm);
    min-height: 32px;
    opacity: 0.5;
}

@media (max-width: 900px) {
    .tv-week-grid {
        grid-template-columns: 1fr;
    }
    .tv-day-column {
        min-height: auto;
    }
}

/* ---- Transaction party linked contact cards ---- */
.tx-party-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.tx-party-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.65rem;
    background: var(--card-bg);
    transition: border-color 0.15s;
}
.tx-party-card:hover {
    border-color: var(--primary);
}
.tx-party-card__header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.tx-party-card__icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--text-muted);
}
.tx-party-card__name {
    font-weight: 600;
    font-size: var(--text-sm);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tx-party-card__unlink {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 0.15rem;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}
.tx-party-card:hover .tx-party-card__unlink {
    opacity: 1;
}
.tx-party-card__unlink:hover {
    color: var(--danger);
}
.tx-party-card__details {
    margin-top: 0.25rem;
    padding-left: 1.4rem;
}
.tx-party-card__line {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: var(--text-caption);
    color: var(--text-secondary);
    line-height: 1.5;
}
.tx-party-card__line svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    color: var(--text-muted);
}
.tx-notaire-copy {
    margin-top: var(--space-1);
}
.tx-party-empty {
    font-style: italic;
    color: var(--text-muted);
    font-size: var(--text-sm);
    padding: 0.35rem 0;
}
[data-theme="dark"] .tx-party-card {
    background: var(--card-bg);
}

