@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ═══════════════════════════════════════════════
   VARIABLES
   ═══════════════════════════════════════════════ */
:root {
    /* — Couleurs — */
    --bg: #f8f6f2;
    --bg-warm: #f0ece5;
    --bg-white: #ffffff;
    --sidebar-bg: #0f1a2e;
    --sidebar-text: #8a9bb5;
    --sidebar-text-active: #e8edf5;
    --sidebar-hover: rgba(255,255,255,0.04);
    --sidebar-active: rgba(45,175,170,0.12);
    --sidebar-accent: #2dafa8;
    --sidebar-width: 260px;

    --surface: #ffffff;
    --surface-hover: #fdfcfa;
    --border: #e8e3db;
    --border-strong: #d5cec3;

    --primary: #2097a0;
    --primary-light: #2dafa8;
    --primary-dim: rgba(32,151,160,0.06);
    --primary-soft: rgba(32,151,160,0.12);

    --teal: #1b4f7a;
    --teal-light: #2566a0;
    --teal-dim: rgba(27,79,122,0.05);

    --emerald: #1e7a5a;
    --emerald-dim: rgba(30,122,90,0.06);
    --emerald-soft: rgba(30,122,90,0.13);
    --amber: #b08620;
    --amber-dim: rgba(176,134,32,0.07);
    --amber-soft: rgba(176,134,32,0.14);
    --red: #b53a2c;
    --red-dim: rgba(181,58,44,0.05);
    --red-soft: rgba(181,58,44,0.11);
    --blue: #2f6aaa;
    --blue-dim: rgba(47,106,170,0.06);
    --blue-soft: rgba(47,106,170,0.12);
    --violet: #6955b8;
    --violet-dim: rgba(105,85,184,0.06);
    --violet-soft: rgba(105,85,184,0.12);
    --pink: #a35278;
    --pink-dim: rgba(163,82,120,0.06);

    --text: #1a1613;
    --text-secondary: #6d645a;
    --text-dim: #a09688;
    --text-faint: #c8c0b6;
    --text-inverse: #faf8f5;

    /* — Typography — */
    --font-display: 'Sora', -apple-system, sans-serif;
    --font-body: 'Sora', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', Menlo, monospace;

    --text-xs: 0.75rem;    /* 12px */
    --text-sm: 0.8125rem;  /* 13px */
    --text-base: 0.9375rem;/* 15px */
    --text-lg: 1.125rem;   /* 18px */
    --text-xl: 1.25rem;    /* 20px */
    --text-2xl: 1.5rem;    /* 24px */
    --text-3xl: 1.75rem;   /* 28px */

    /* — Spacing — */
    --space-xs: 0.25rem;   /* 4px */
    --space-sm: 0.5rem;    /* 8px */
    --space-md: 1rem;       /* 16px */
    --space-lg: 1.5rem;    /* 24px */
    --space-xl: 2rem;       /* 32px */
    --space-2xl: 3rem;     /* 48px */

    /* — Layout — */
    --header-height-mobile: 56px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-pill: 100px;

    /* — Shadows — */
    --shadow-sm: 0 1px 2px rgba(26,22,19,0.04);
    --shadow: 0 1px 3px rgba(26,22,19,0.03), 0 6px 16px rgba(26,22,19,0.04);
    --shadow-md: 0 4px 12px rgba(26,22,19,0.05), 0 12px 32px rgba(26,22,19,0.07);
    --shadow-lg: 0 8px 24px rgba(26,22,19,0.06), 0 24px 64px rgba(26,22,19,0.10);
    --shadow-glow: 0 4px 24px rgba(32,151,160,0.15);
}

/* ═══════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--bg);
    font-family: var(--font-body);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    max-width: 100vw;
    font-size: 14px;
    line-height: 1.6;
}

/* Inherit font on form elements */
input, select, textarea, button {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

a { color: inherit; text-decoration: none; }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; }

/* ═══════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInLeft {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}
.fade-in { animation: fadeIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) both; }
.ambient-green, .ambient-blue { display: none; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ═══════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════ */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
    overflow-y: auto; overflow-x: hidden;
}
.sidebar-brand { padding: var(--space-lg) var(--space-lg) var(--space-lg); border-bottom: 1px solid rgba(255,255,255,0.06); }
.sidebar-logo { display: flex; align-items: center; gap: var(--space-sm); text-decoration: none; }
.sidebar-logo-img { height: 50px; width: auto; filter: brightness(1.5); }
.sidebar-logo-mark {
    width: 38px; height: 38px; border-radius: 10px;
    background: linear-gradient(135deg, #2dafa8, #1b6fa0);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display); font-size: 15px; font-weight: 700;
    color: #fff; flex-shrink: 0;
    box-shadow: 0 2px 12px rgba(45,175,168,0.3);
}
.sidebar-logo-text { display: flex; flex-direction: column; }
.sidebar-logo-title {
    font-family: var(--font-display); font-size: 16px; font-weight: 600;
    color: var(--sidebar-text-active); letter-spacing: -0.02em; line-height: 1.2;
}
.sidebar-logo-sub {
    font-size: 10px; color: rgba(255,255,255,0.25);
    letter-spacing: 0.1em; text-transform: uppercase; margin-top: 2px;
}
.sidebar-section { padding: 14px 10px; flex: 1; }
.sidebar-section-label {
    font-size: 9px; font-weight: 700; letter-spacing: 0.12em;
    text-transform: uppercase; color: rgba(255,255,255,0.18);
    padding: var(--space-xs) 14px 10px;
    margin-top: var(--space-lg);
}
.sidebar-section-label:first-child { margin-top: 0; }
.site-header { display: none; }
.site-nav { display: flex; flex-direction: column; gap: 1px; background: none; border-radius: 0; padding: 0; }
.nav-tab {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 14px; border-radius: var(--radius-sm);
    border: none; background: transparent;
    color: var(--sidebar-text); font-size: var(--text-sm); font-weight: 500;
    cursor: pointer; transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: var(--font-body); text-decoration: none;
    white-space: nowrap; position: relative;
}
.nav-tab:hover { color: var(--sidebar-text-active); background: var(--sidebar-hover); }
.nav-tab.active {
    color: var(--sidebar-accent); background: var(--sidebar-active); font-weight: 600;
}
.nav-tab.active::before {
    content: ''; position: absolute; left: 0; top: 6px; bottom: 6px;
    width: 3px; border-radius: 0 3px 3px 0;
    background: var(--sidebar-accent);
}
.nav-ico { font-size: var(--text-sm); opacity: 0.4; width: 20px; text-align: center; margin-right: 0; }
.nav-tab.active .nav-ico { opacity: 0.9; }
.sidebar-footer { padding: 14px 14px 18px; border-top: 1px solid rgba(255,255,255,0.06); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--radius-sm); }
.user-avatar {
    width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(135deg, #2dafa8, #1b6fa0);
    display: flex; align-items: center; justify-content: center;
    font-size: var(--text-xs); font-weight: 700; color: #fff; flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: var(--text-xs); font-weight: 600; color: var(--sidebar-text-active); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 10px; color: rgba(255,255,255,0.25); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 6px rgba(74,222,128,0.4); flex-shrink: 0; }

/* Sidebar footer buttons */
.sidebar-footer-actions { display: flex; gap: 6px; margin-top: 10px; }
.sidebar-footer-btn {
    flex: 1; padding: var(--space-sm);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.08);
    background: transparent; color: var(--sidebar-text);
    font-size: 11px; font-weight: 600; text-align: center;
    text-decoration: none; font-family: var(--font-body);
    cursor: pointer; transition: all 0.2s;
    display: block;
}
.sidebar-footer-btn:hover { background: rgba(255,255,255,0.04); color: var(--sidebar-text-active); }
.sidebar-footer-btn--logout { margin-top: 10px; width: 100%; }

/* Sidebar close button (mobile) */
.sidebar-close {
    display: none; position: absolute; top: 14px; right: 14px;
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.1); background: transparent;
    color: var(--sidebar-text); cursor: pointer;
    align-items: center; justify-content: center;
    transition: all 0.2s;
}
.sidebar-close:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-close svg { width: 18px; height: 18px; }

/* ═══════════════════════════════════════════════
   MAIN AREA
   ═══════════════════════════════════════════════ */
.app-main { margin-left: var(--sidebar-width); flex: 1; min-height: 100vh; display: flex; flex-direction: column; position: relative; z-index: 1; }
.main-topbar {
    padding: 14px var(--space-xl); display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid var(--border);
    background: rgba(248,246,242,0.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    position: sticky; top: 0; z-index: 10;
    min-height: var(--header-height-mobile);
}
.topbar-left { display: flex; align-items: center; gap: var(--space-sm); }
.topbar-date { font-size: var(--text-xs); color: var(--text-dim); font-weight: 500; }
.main-content { flex: 1; max-width: 1080px; width: 100%; margin: 0 auto; padding: 0 var(--space-xl) 64px; position: relative; z-index: 1; }
.page-title { padding: var(--space-xl) var(--space-xl) 0; max-width: 1080px; width: 100%; margin: 0 auto; position: relative; z-index: 1; }
.page-title h1 { font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--text); letter-spacing: -0.04em; }
.page-title-line { height: 0; margin-top: var(--space-lg); margin-bottom: var(--space-lg); border-bottom: 1px solid var(--border); }
.site-footer { border-top: 1px solid var(--border); padding: var(--space-md) var(--space-xl); display: flex; justify-content: space-between; font-size: 11px; color: var(--text-faint); z-index: 1; }

/* ═══════════════════════════════════════════════
   GLASS CARD
   ═══════════════════════════════════════════════ */
.glass-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: var(--space-lg);
    box-shadow: var(--shadow); transition: box-shadow 0.3s, transform 0.3s;
}
.glass-card:hover { box-shadow: var(--shadow-md); }
.glass-card-sm { padding: 18px; }
.glass-card-none { padding: 0; }

/* ═══════════════════════════════════════════════
   KPI CARDS
   ═══════════════════════════════════════════════ */
.kpi-card {
    padding: 0; border-radius: var(--radius); background: var(--surface);
    border: 1px solid var(--border); box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative; overflow: hidden;
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi-card-inner { padding: 20px 22px; }
.kpi-label {
    font-size: 10px; letter-spacing: 0.1em; color: var(--text-dim);
    font-weight: 700; margin-bottom: 10px; text-transform: uppercase;
    font-family: var(--font-body);
}
.kpi-value { font-size: 26px; font-weight: 700; font-family: var(--font-mono); line-height: 1; letter-spacing: -0.03em; }
.kpi-suffix { font-size: var(--text-xs); color: var(--text-dim); margin-left: 2px; font-weight: 500; letter-spacing: 0; }
/* Colored top strip on KPI cards */
.kpi-strip { height: 3px; width: 100%; }
.kpi-strip-emerald { background: linear-gradient(90deg, var(--emerald), #2aad7a); }
.kpi-strip-red { background: linear-gradient(90deg, var(--red), #d4523f); }
.kpi-strip-blue { background: linear-gradient(90deg, var(--blue), #4a8fd4); }
.kpi-strip-amber { background: linear-gradient(90deg, var(--amber), #d4a830); }
.kpi-strip-violet { background: linear-gradient(90deg, var(--violet), #8a7ae0); }
.kpi-strip-primary { background: linear-gradient(90deg, #1b6fa0, #2dafa8); }

/* KPI as clickable link */
.kpi-link { text-decoration: none; color: inherit; display: block; }
.kpi-link:hover .kpi-card { box-shadow: var(--shadow-md); transform: translateY(-2px); }

/* ═══════════════════════════════════════════════
   SECTION HEADERS
   ═══════════════════════════════════════════════ */
.section-header {
    font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--text-dim);
    padding-bottom: 14px; border-bottom: 1px solid var(--border);
    margin-bottom: 0; font-family: var(--font-body);
    display: flex; align-items: center; gap: var(--space-sm);
}
.section-header-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

/* ═══════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════ */
.badge-status {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: var(--radius-sm);
    font-size: 10px; font-weight: 700; letter-spacing: 0.02em; border: 1px solid;
}
.badge-emerald { color: var(--emerald); background: var(--emerald-dim); border-color: var(--emerald-soft); }
.badge-amber { color: var(--amber); background: var(--amber-dim); border-color: var(--amber-soft); }
.badge-red { color: var(--red); background: var(--red-dim); border-color: var(--red-soft); }
.badge-blue { color: var(--blue); background: var(--blue-dim); border-color: var(--blue-soft); }
.badge-violet { color: var(--violet); background: var(--violet-dim); border-color: var(--violet-soft); }
.badge-urgent { color: #fff; background: var(--red); border-color: var(--red); padding: 3px 10px; border-radius: var(--radius-sm); font-size: 10px; font-weight: 700; }

/* ═══════════════════════════════════════════════
   PILLS (FILTERS)
   ═══════════════════════════════════════════════ */
.pill-filter {
    padding: 7px 16px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--bg-white);
    color: var(--text-dim); font-size: var(--text-xs); font-weight: 600;
    cursor: pointer; transition: all 0.2s; font-family: var(--font-body);
}
.pill-filter:hover { border-color: var(--border-strong); color: var(--text); }
.pill-filter.active { border-color: var(--primary); background: var(--primary); color: #fff; box-shadow: var(--shadow-glow); }

/* ═══════════════════════════════════════════════
   PROGRESS BAR
   ═══════════════════════════════════════════════ */
.progress-custom { height: 6px; background: var(--bg-warm); border-radius: 6px; overflow: hidden; }
.progress-custom-bar { height: 100%; border-radius: 6px; transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1); }

/* ═══════════════════════════════════════════════
   DATA TABLE
   ═══════════════════════════════════════════════ */
.data-table { width: 100%; }
.data-table-header {
    display: grid; padding: var(--space-sm) 20px;
    font-size: 10px; color: var(--text-dim); font-weight: 700;
    letter-spacing: 0.1em; border-bottom: 1px solid var(--border-strong);
    text-transform: uppercase;
}
.data-table-row {
    display: grid; padding: var(--space-sm) 20px;
    border-bottom: 1px solid var(--border);
    font-size: var(--text-sm); align-items: center; transition: background 0.15s;
}
.data-table-row:hover { background: var(--bg-warm); }
.data-table-row:last-child { border-bottom: none; }

/* Amount colors */
.amount-positive { color: var(--emerald); font-family: var(--font-mono); }
.amount-negative { color: var(--red); font-family: var(--font-mono); }
.amount-neutral { color: var(--text); font-family: var(--font-mono); }
.amount-warning { color: var(--amber); font-family: var(--font-mono); }

/* ═══════════════════════════════════════════════
   VOTE CARD
   ═══════════════════════════════════════════════ */
.vote-card {
    background: var(--surface); border: 1px solid var(--violet-soft);
    border-radius: var(--radius); padding: var(--space-lg);
    box-shadow: var(--shadow), 0 0 40px rgba(105,85,184,0.04);
}
.vote-stat {
    text-align: center; padding: var(--space-md);
    background: var(--bg); border-radius: var(--radius-sm);
    flex: 1;
}
.vote-stat-value { font-family: var(--font-mono); font-size: 28px; font-weight: 700; }
.vote-stat-label { font-size: 11px; color: var(--text-dim); margin-top: var(--space-xs); }

/* ═══════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════ */
.font-mono { font-family: var(--font-mono); }
.font-display { font-family: var(--font-display); }
.text-emerald { color: var(--emerald); }
.text-amber { color: var(--amber); }
.text-red { color: var(--red); }
.text-blue { color: var(--blue); }
.text-violet { color: var(--violet); }
.text-pink { color: var(--pink); }
.text-dim { color: var(--text-dim); }
.text-secondary { color: var(--text-secondary); }
.text-faint { color: var(--text-faint); }
.bg-emerald-dim { background: var(--emerald-dim); }
.bg-amber-dim { background: var(--amber-dim); }
.bg-red-dim { background: var(--red-dim); }

/* Layout grids */
.grid-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-md); }
.grid-kpi-wide { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-md); }
.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-lg); }
.grid-3col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-md); }
.grid-docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.flex-col { display: flex; flex-direction: column; }
.flex-row { display: flex; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-24 { gap: var(--space-lg); }
.gap-20 { gap: 20px; }
.gap-16 { gap: var(--space-md); }
.gap-14 { gap: 14px; }
.gap-12 { gap: 12px; }
.gap-8 { gap: var(--space-sm); }
.gap-6 { gap: 6px; }
.gap-4 { gap: var(--space-xs); }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: var(--space-sm); }
.mt-16 { margin-top: var(--space-md); }
.mt-24 { margin-top: var(--space-lg); }
.mb-8 { margin-bottom: var(--space-sm); }
.mb-16 { margin-bottom: var(--space-md); }
.w-full { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none; }
.block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.flex-1 { flex: 1; min-width: 0; }
.flex-shrink-0 { flex-shrink: 0; }
.flex-end { display: flex; gap: var(--space-sm); justify-content: flex-end; }

/* Common inline patterns extracted */
.inline-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-sm); }
.inline-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-md); }
.inline-flex { display: flex; align-items: center; gap: var(--space-sm); }
.inline-flex-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm); }

/* Card variants */
.card-flush { padding: 0; overflow: hidden; }
.card-section { padding: 16px 22px; }
.card-section-body { padding: 0 22px 22px; }

/* Hover row for list items */
.hover-row { padding: 16px 22px; border-top: 1px solid var(--border); transition: background 0.15s; }
.hover-row:hover { background: var(--surface-hover); }

/* Form helpers */
.form-actions-end { display: flex; gap: var(--space-sm); justify-content: flex-end; }
.form-label-check { display: flex; align-items: center; gap: var(--space-sm); }
.form-input-sm { padding: 8px 10px; font-size: var(--text-xs); }
.form-mini-label { font-size: 10px; color: var(--text-dim); margin-bottom: 4px; }

/* Form card containers */
.form-card { max-width: 640px; }
.form-card-sm { max-width: 500px; }
.form-title { font-size: 15px; font-weight: 700; color: var(--text); margin: 0 0 20px 0; }
.form-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-md); }
.form-field-last { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-lg); }
.form-hint { font-size: 11px; color: var(--text-dim); }
.form-validation { font-size: 11px; }
.section-header-flush { border: none; padding: 0; margin: 0; }
.data-table-empty { padding: 24px 22px; text-align: center; color: var(--text-dim); font-size: var(--text-sm); }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: var(--space-lg); }
.d-inline-flex { display: inline-flex; align-items: center; gap: var(--space-sm); }
.btn-icon-danger { color: var(--red); }
.btn-icon-danger:hover { border-color: var(--red); color: var(--red); background: var(--red-dim); }
.btn-icon-emerald { color: var(--emerald); }
.btn-icon-emerald:hover { border-color: var(--emerald); color: var(--emerald); }

/* Aide/help page */
.aide-heading { font-size: 15px; font-weight: 700; color: var(--text); margin: 20px 0 8px; }
.aide-body { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.8; }
.aide-body ul { margin: 8px 0 0 20px; }
.aide-border-top { border-top: 1px solid var(--border); padding-top: var(--space-md); }

/* Document link card */
.doc-link { text-decoration: none; color: inherit; display: block; padding: 18px; transition: all 0.25s; }
.doc-link:hover { box-shadow: var(--shadow-md); }
.doc-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.doc-name { font-weight: 600; font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; margin-right: 8px; }
.doc-meta { font-size: 11px; color: var(--text-dim); }

/* Factures section */
.factures-section { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 14px; }
.factures-title { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 12px; }
.facture-row { padding: 12px 16px; margin-bottom: 8px; background: var(--bg); border-radius: var(--radius-sm); border: 1px solid var(--border); }
.facture-payment-form { display: grid; grid-template-columns: 110px 130px 110px 1fr auto; gap: 8px; align-items: end; padding-top: 12px; border-top: 1px dashed var(--border); }

/* Fournisseur card */
.fournisseur-header { padding: 18px 22px; display: flex; justify-content: space-between; align-items: center; }
.fournisseur-name { font-weight: 600; font-size: 15px; }
.fournisseur-desc { font-size: var(--text-xs); color: var(--text-dim); margin-top: 2px; }

/* Reclamation */
.rec-response { margin-top: 8px; padding: 8px 12px; background: var(--bg); border-radius: var(--radius-sm); font-size: var(--text-xs); color: var(--text-secondary); }
.rec-response-label { color: var(--text-dim); font-weight: 600; }
.rec-reply-form { display: flex; gap: 8px; margin-top: 8px; align-items: end; }

/* Vote result stat */
.vote-result-value { font-size: 20px; font-weight: 700; }
.vote-result-label { font-size: 10px; }
.vote-result-card { padding: 10px; }
.vote-buttons { display: flex; gap: 8px; margin-top: 4px; }
.vote-buttons button { flex: 1; }

/* File upload label */
.file-upload-label {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 14px; border-radius: var(--radius-sm);
    border: 1px dashed var(--border-strong); background: var(--bg);
    cursor: pointer; transition: all 0.2s;
    font-size: var(--text-sm); color: var(--text-secondary);
}
.file-upload-browse { color: var(--primary); font-weight: 600; }
.file-upload-name { color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ═══════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════ */
.form-input {
    width: 100%; padding: 11px 14px; border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong); background: var(--bg-white);
    color: var(--text); font-size: var(--text-sm); font-family: var(--font-body); outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-dim); }
.form-input::placeholder { color: var(--text-faint); }
.form-label { font-size: var(--text-xs); color: var(--text-secondary); margin-bottom: 6px; display: block; font-weight: 600; }
select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236d645a' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
}
textarea.form-input { resize: vertical; min-height: 100px; }

/* Form field group */
.form-group { display: flex; flex-direction: column; }
.form-group label { font-size: var(--text-xs); color: var(--text-secondary); margin-bottom: 6px; font-weight: 600; }
.form-actions { display: flex; gap: var(--space-sm); align-items: center; margin-top: var(--space-lg); }

/* Validation */
.field-validation-error,
.text-danger,
.validation-summary-errors { color: var(--red); font-size: var(--text-xs); margin-top: var(--space-xs); }

/* ═══════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════ */
.btn-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-sm);
    padding: 10px 24px; border: none; border-radius: var(--radius-sm);
    background: var(--teal); color: var(--text-inverse);
    font-weight: 600; font-size: var(--text-sm); cursor: pointer;
    font-family: var(--font-body); transition: all 0.2s;
    text-decoration: none; min-height: 44px;
}
.btn-primary:hover { background: var(--teal-light); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(26,74,74,0.15); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-secondary {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-sm);
    padding: 10px 24px; border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); background: var(--bg-white);
    color: var(--text-secondary); font-weight: 600; font-size: var(--text-sm);
    cursor: pointer; font-family: var(--font-body); transition: all 0.2s;
    text-decoration: none; min-height: 44px;
}
.btn-secondary:hover { border-color: var(--teal); color: var(--teal); }
.btn-danger {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-sm);
    padding: 10px 24px; border: none; border-radius: var(--radius-sm);
    background: var(--red); color: #fff;
    font-weight: 600; font-size: var(--text-sm); cursor: pointer;
    font-family: var(--font-body); transition: all 0.2s;
    text-decoration: none; min-height: 44px;
}
.btn-danger:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-sm { padding: 6px 14px; font-size: var(--text-xs); min-height: 36px; }
.btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; padding: 0;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--bg-white); color: var(--text-secondary);
    cursor: pointer; transition: all 0.2s;
}
.btn-icon:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-dim); }
.btn-icon svg { width: 16px; height: 16px; }
.btn-pay {
    flex: 1; min-width: 160px; padding: 18px 20px;
    border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--bg-white); color: var(--text);
    font-weight: 600; font-size: var(--text-sm); cursor: pointer;
    font-family: var(--font-body); text-align: center;
    transition: all 0.3s; box-shadow: var(--shadow-sm);
}
.btn-pay:hover { border-color: var(--primary); background: var(--primary-dim); color: var(--primary); box-shadow: var(--shadow-glow); transform: translateY(-2px); }

.add-card { background: var(--surface-hover); cursor: pointer; border: 2px dashed var(--border-strong); text-align: center; border-radius: var(--radius); transition: all 0.25s; }
.add-card:hover { border-color: var(--primary); background: var(--primary-dim); color: var(--primary); }

/* ═══════════════════════════════════════════════
   TOASTS
   ═══════════════════════════════════════════════ */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; }
.toast { padding: 14px 20px; border-radius: var(--radius); font-size: var(--text-sm); font-weight: 600; margin-bottom: var(--space-sm); animation: fadeIn 0.3s; border: 1px solid; box-shadow: var(--shadow-md); }
.toast-success { background: #f2f9f5; color: var(--emerald); border-color: var(--emerald-soft); }
.toast-error { background: #fdf5f4; color: var(--red); border-color: var(--red-soft); }

/* ═══════════════════════════════════════════════
   HAMBURGER MENU & MOBILE NAV
   ═══════════════════════════════════════════════ */
.hamburger-toggle { display: none; }
.hamburger-btn {
    display: none;
    width: 44px; height: 44px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--bg-white);
    cursor: pointer; align-items: center; justify-content: center;
    flex-shrink: 0; z-index: 60;
}
.hamburger-btn svg { width: 20px; height: 20px; stroke: var(--text); }
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.4); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
    z-index: 49;
}
.hamburger-toggle:checked ~ .sidebar-overlay { display: block; }
.hamburger-toggle:checked ~ .sidebar {
    display: flex !important; z-index: 55;
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 260px; box-shadow: var(--shadow-lg);
    animation: slideInLeft 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.hamburger-toggle:checked ~ .sidebar .sidebar-close { display: flex; }
/* Lock body scroll when sidebar open */
body:has(.hamburger-toggle:checked) { overflow: hidden; }

/* Scrollable table wrapper */
.table-scroll {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    position: relative;
}
/* Scroll shadow indicator */
.table-scroll::after {
    content: ''; position: absolute; top: 0; right: 0; bottom: 0; width: 24px;
    background: linear-gradient(to left, rgba(248,246,242,0.8), transparent);
    pointer-events: none; opacity: 0; transition: opacity 0.2s;
}
.table-scroll.has-scroll::after { opacity: 1; }

/* Empty state */
.empty-state {
    text-align: center; padding: var(--space-2xl) var(--space-lg);
    color: var(--text-dim);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: var(--space-md); opacity: 0.3; }
.empty-state p { font-size: var(--text-sm); }

/* HTMX loading indicator */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { display: inline-block; }
.spinner {
    width: 18px; height: 18px; border: 2px solid var(--border);
    border-top-color: var(--primary); border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════ */
.login-page { display: flex; min-height: 100vh; }
.login-brand {
    flex: 1; background: linear-gradient(135deg, #0c1929 0%, #162d4a 100%);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    padding: var(--space-2xl); color: var(--text-inverse); position: relative; overflow: hidden;
}
.login-brand::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(circle at 30% 50%, rgba(45,175,168,0.15) 0%, transparent 60%);
}
.login-brand-content { position: relative; z-index: 1; text-align: center; max-width: 400px; }
.login-brand-logo { height: 80px; width: auto; filter: brightness(1.5); margin-bottom: var(--space-lg); }
.login-brand-title { font-family: var(--font-display); font-size: var(--text-3xl); font-weight: 700; margin-bottom: var(--space-sm); }
.login-brand-sub { font-size: var(--text-sm); color: rgba(255,255,255,0.6); margin-bottom: var(--space-xl); }
.login-brand-divider { width: 60px; height: 2px; background: rgba(45,175,168,0.4); margin: 0 auto var(--space-xl); }
.login-brand-stats { display: flex; gap: var(--space-lg); justify-content: center; }
.login-brand-stat { text-align: center; }
.login-brand-stat-value { font-family: var(--font-mono); font-size: var(--text-xl); font-weight: 700; color: #2dafa8; }
.login-brand-stat-label { font-size: var(--text-xs); color: rgba(255,255,255,0.4); margin-top: var(--space-xs); }
.login-form-panel {
    flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center;
    padding: var(--space-2xl); background: var(--bg);
}
.login-form-container { width: 100%; max-width: 400px; }
.login-form-title { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 700; margin-bottom: var(--space-xs); }
.login-form-subtitle { font-size: var(--text-sm); color: var(--text-secondary); margin-bottom: var(--space-xl); }
.login-form .form-group { margin-bottom: var(--space-md); }
.login-form .form-input { font-size: 16px; padding: 12px 14px; } /* 16px prevents iOS zoom */
.login-form .btn-primary { width: 100%; padding: 14px; font-size: var(--text-base); }
.login-error {
    background: var(--red-dim); border: 1px solid var(--red-soft);
    border-radius: var(--radius-sm); padding: 12px var(--space-md);
    font-size: var(--text-sm); color: var(--red); margin-bottom: var(--space-md);
}
/* Login brand background animations */
.login-brand-bg1, .login-brand-bg2, .login-brand-bg3 { position: absolute; border-radius: 50%; }
.login-brand-bg1 {
    top: -30%; right: -20%; width: 700px; height: 700px;
    background: radial-gradient(circle, rgba(45,175,168,0.07), transparent 65%);
    animation: loginFloat1 20s ease-in-out infinite;
}
.login-brand-bg2 {
    bottom: -25%; left: -15%; width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(27,111,160,0.05), transparent 60%);
    animation: loginFloat2 25s ease-in-out infinite;
}
.login-brand-bg3 {
    top: 50%; left: 50%; transform: translate(-50%,-50%);
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(45,175,168,0.04), transparent 70%);
    filter: blur(40px);
}
.login-brand-logo-wrap { animation: fadeIn 0.8s cubic-bezier(0.16,1,0.3,1) 0.1s both; }
.login-brand-desc {
    font-size: var(--text-sm); color: rgba(200,210,225,0.35); line-height: 1.7;
}
.login-brand-footer {
    position: absolute; bottom: 24px; left: 0; right: 0;
    text-align: center; font-size: 10px; color: rgba(200,210,225,0.15);
    letter-spacing: 0.06em; z-index: 1;
}
@keyframes loginFloat1 {
    0%, 100% { transform: translate(0,0); }
    50% { transform: translate(-20px,15px); }
}
@keyframes loginFloat2 {
    0%, 100% { transform: translate(0,0); }
    50% { transform: translate(15px,-20px); }
}

/* ═══════════════════════════════════════════════
   AUTH PAGES (MagicLogin, AccessDenied, MagicLinkSent)
   ═══════════════════════════════════════════════ */
.auth-page {
    font-family: var(--font-body); background: var(--bg); color: var(--text);
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: var(--space-lg); -webkit-font-smoothing: antialiased;
}
.auth-card {
    width: 100%; max-width: 420px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 14px;
    padding: 44px; box-shadow: var(--shadow-md);
}
.auth-card--center { text-align: center; }
.auth-logo { margin: 0 auto var(--space-lg); text-align: center; }
.auth-logo img { height: 100px; width: auto; }
.auth-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; text-align: center; }
.auth-subtitle { font-size: var(--text-sm); color: var(--text-secondary); text-align: center; margin-top: 6px; margin-bottom: var(--space-xl); line-height: 1.6; }
.auth-link { text-align: center; margin-top: var(--space-lg); padding-top: 18px; border-top: 1px solid var(--border); }
.auth-link a { color: var(--primary); text-decoration: none; font-size: var(--text-sm); font-weight: 600; }
.auth-link a:hover { opacity: 0.7; }
.auth-magic-link {
    display: block; margin-top: var(--space-lg); padding: 12px 20px;
    border-radius: var(--radius-sm); background: var(--primary-dim);
    border: 1px solid var(--primary-soft); color: var(--primary);
    font-weight: 600; font-size: var(--text-sm); text-decoration: none;
    word-break: break-all; transition: background 0.2s;
}
.auth-magic-link:hover { background: var(--primary-soft); }

/* ═══════════════════════════════════════════════
   DASHBOARD COMPONENTS
   ═══════════════════════════════════════════════ */
/* List card (annonces, impayés, réclamations) */
.list-card { padding: 0; overflow: hidden; }
.list-card-header { padding: 18px 22px; }
.list-card-item {
    padding: 12px 22px; border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
    transition: background 0.15s; text-decoration: none; color: inherit;
}
a.list-card-item:hover, .list-card-item--hover:hover { background: var(--bg-warm); }
.list-card-item-body { flex: 1; min-width: 0; }
.list-card-item-title { font-weight: 600; font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-card-item-meta { font-size: 11px; color: var(--text-dim); margin-top: 3px; }
.list-card-empty { padding: 20px 22px; color: var(--text-dim); font-size: var(--text-sm); }
/* Rank badge for top impayés */
.rank-badge {
    width: 24px; height: 24px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700; font-family: var(--font-mono);
    flex-shrink: 0; border: 1px solid;
}
.rank-badge--danger { background: var(--red-dim); color: var(--red); border-color: var(--red-soft); }
.rank-badge--muted { background: var(--bg-warm); color: var(--text-dim); border-color: var(--border); }
/* Dot indicator (annonces) */
.dot-indicator {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--border-strong); flex-shrink: 0; margin-top: 7px;
}
/* Section header link */
.section-header a { color: inherit; text-decoration: none; }
.section-header a:hover { color: var(--primary); }
/* Vote card layout */
.vote-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: var(--space-lg); }
.vote-card-title { font-size: 18px; font-weight: 700; margin-top: var(--space-sm); letter-spacing: -0.02em; }
.vote-card-meta { font-size: var(--text-xs); color: var(--text-dim); margin-top: 6px; }
.vote-stats-row { display: flex; gap: 12px; margin-bottom: var(--space-md); }

/* ═══════════════════════════════════════════════
   PROFILE CARD (MonEspace / Detail)
   ═══════════════════════════════════════════════ */
.profile-header {
    padding: var(--space-lg); border-radius: var(--radius);
    background: linear-gradient(135deg, #2dafa8, #1b6fa0);
    color: #fff; display: flex; align-items: center; gap: var(--space-md);
}
.profile-header--debt { background: linear-gradient(135deg, var(--red), #d4523f); }
.profile-avatar {
    width: 52px; height: 52px; border-radius: var(--radius);
    background: rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center;
    font-size: var(--text-xl); font-weight: 700; flex-shrink: 0;
}
.profile-info { flex: 1; min-width: 0; }
.profile-name { font-size: var(--text-lg); font-weight: 700; }
.profile-detail { font-size: var(--text-sm); opacity: 0.8; }

/* ═══════════════════════════════════════════════
   FOCUS & ACCESSIBILITY
   ═══════════════════════════════════════════════ */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
/* Remove default outline for mouse clicks */
:focus:not(:focus-visible) { outline: none; }

/* ═══════════════════════════════════════════════
   RESPONSIVE — Mobile base adjustments
   Breakpoints: 640 / 768 / 1024 / 1280
   ═══════════════════════════════════════════════ */

/* Mobile: sidebar hidden, hamburger visible */
@media (max-width: 1023px) {
    :root { --sidebar-width: 0px; }
    .sidebar { display: none; }
    .app-main { margin-left: 0; }
    .hamburger-btn { display: flex; }
    .sidebar-close { display: none; } /* shown via JS/checkbox when open */

    .main-topbar { padding: 10px var(--space-md); min-height: var(--header-height-mobile); }
    .main-content { padding: 0 var(--space-md) 40px; }
    .page-title { padding: var(--space-md) var(--space-md) 0; }
    .page-title h1 { font-size: 22px; }
    .site-footer { padding: var(--space-sm) var(--space-md); flex-direction: column; gap: var(--space-xs); }
}

/* Tablet portrait & below: stack grids */
@media (max-width: 767px) {
    .grid-2col, .grid-3col { grid-template-columns: 1fr; }
    .grid-kpi { grid-template-columns: repeat(2, 1fr) !important; }
    .inline-grid-2, .inline-grid-3 { grid-template-columns: 1fr; }

    .pill-filter { padding: var(--space-sm) 14px; font-size: 11px; }
    .btn-primary, .btn-secondary, .btn-danger { padding: 10px var(--space-md); font-size: var(--text-xs); min-height: 44px; }
    .kpi-value { font-size: 22px; }

    /* Forms: inline form grids → 1 column on mobile */
    form *[style*="grid-template-columns"],
    .glass-card > div[style*="grid-template-columns"]:not(.data-table-header):not(.data-table-row) {
        grid-template-columns: 1fr !important;
    }
    /* Data tables → horizontal scroll (NEVER collapse) */
    .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
    .table-scroll > * { min-width: 600px; }
    /* Prevent page overflow — calc matches main-content padding (16px × 2) */
    .glass-card, .kpi-card, .vote-card, .alerte-item { max-width: calc(100vw - 32px); overflow: hidden; }
    .glass-card .table-scroll { overflow-x: auto; }
    /* Forms inside glass-card must not clip date pickers */
    form.glass-card { overflow: visible; }
    /* Inputs → full width + iOS date fix */
    .form-input, input[type="date"], input[type="number"], select, textarea {
        width: 100% !important; min-width: 0 !important;
        max-width: 100% !important; box-sizing: border-box !important;
        font-size: 16px; /* prevents iOS zoom */
        -webkit-appearance: none; appearance: none;
    }
    /* Flex wrapping */
    div[style*="display:flex"] { flex-wrap: wrap; }
    .vote-stat { min-width: 0; padding: 10px var(--space-sm); }

    /* Login: hide brand panel */
    .login-brand { display: none; }
    .login-form-panel { padding: var(--space-lg); }

    /* Profile header stack on mobile */
    .profile-header { flex-direction: column; text-align: center; }

    /* Fournisseur header stacking */
    .fournisseur-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    /* Facture payment form stacking */
    .facture-payment-form { grid-template-columns: 1fr !important; }
    /* Reclamation items */
    .hover-row > .flex-between { flex-direction: column; gap: 8px; }
    /* Vote buttons */
    .vote-buttons { flex-direction: column; }
}

/* Small phone: further compression */
@media (max-width: 479px) {
    .grid-kpi { grid-template-columns: 1fr !important; }
    .grid-docs { grid-template-columns: 1fr; }
    .main-content { padding: 0 var(--space-sm) var(--space-xl); }
    /* Recalc max-width for smaller padding (8px × 2) */
    .glass-card, .kpi-card, .vote-card, .alerte-item { max-width: calc(100vw - 16px); }
    .main-topbar { padding: var(--space-sm) var(--space-sm); }
    .page-title { padding: var(--space-sm) var(--space-sm) 0; }
    .page-title h1 { font-size: 20px; }
    .topbar-date { font-size: 10px; }
    .kpi-label { font-size: 9px; }
    .kpi-value { font-size: 20px; }
    .data-table-header { font-size: 9px; }
    .data-table-row { font-size: var(--text-xs); padding: 10px var(--space-sm); }
    .glass-card { padding: 14px; border-radius: 10px; }
    .glass-card-sm { padding: 10px; }
    .toast-container { top: 10px; right: 10px; left: 10px; }
    .toast { font-size: var(--text-xs); padding: 10px 14px; }
    .form-actions { flex-direction: column; }
    .form-actions .btn-primary,
    .form-actions .btn-secondary { width: 100%; }
    .form-actions-end { flex-direction: column; }
    .form-actions-end .btn-primary,
    .form-actions-end .btn-secondary { width: 100%; }
}

/* Desktop: restore sidebar */
@media (min-width: 1024px) {
    .main-topbar { padding: 14px 36px; }
    .main-content { padding: 0 36px 64px; }
    .page-title { padding: 32px 36px 0; }
}

/* ══════════════════════════════════════════════════
   RECOUVREMENT MODULE
   ══════════════════════════════════════════════════ */

/* Phase badges */
.phase-badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 8px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.phase-amiable { color: var(--primary); background: var(--primary-dim); border: 1px solid var(--primary-soft); }
.phase-precontentieux { color: var(--amber); background: var(--amber-dim); border: 1px solid var(--amber-soft); }
.phase-contentieux { color: var(--red); background: var(--red-dim); border: 1px solid var(--red-soft); }
.phase-execution { color: #991b1b; background: rgba(153,27,27,0.06); border: 1px solid rgba(153,27,27,0.15); }

/* Resultat badges */
.resultat-attente { color: var(--text-secondary); background: var(--bg-warm); border: 1px solid var(--border); }
.resultat-positif { color: var(--emerald); background: var(--emerald-dim); border: 1px solid var(--emerald-soft); }
.resultat-negatif { color: var(--red); background: var(--red-dim); border: 1px solid var(--red-soft); }
.resultat-neutre { color: var(--amber); background: var(--amber-dim); border: 1px solid var(--amber-soft); }
.resultat-procedure { color: var(--violet); background: var(--violet-dim); border: 1px solid var(--violet-soft); }

/* Ventilation bars */
.bar-ventilation { display: flex; height: 8px; border-radius: 8px; overflow: hidden; background: var(--bg-warm); }
.bar-segment { height: 100%; cursor: pointer; transition: opacity 0.2s; min-width: 2px; }
.bar-segment:hover { opacity: 0.8; }
.bar-segment-amiable { background: var(--primary); }
.bar-segment-precontentieux { background: var(--amber); }
.bar-segment-contentieux { background: var(--red); }
.bar-segment-execution { background: #991b1b; }
.bar-segment-vert { background: var(--emerald); }
.bar-segment-jaune { background: var(--amber); }
.bar-segment-orange { background: #ea580c; }
.bar-segment-rouge { background: var(--red); }
.bar-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.bar-legend-item { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--text-secondary); }
.bar-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Timeline */
.timeline { display: flex; flex-direction: column; gap: 0; position: relative; }
.timeline-item { display: flex; gap: 16px; position: relative; padding-bottom: 24px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item:last-child .timeline-line { display: none; }
.timeline-marker { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; width: 40px; }
.timeline-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid var(--border); background: var(--surface); color: var(--text-secondary); flex-shrink: 0; z-index: 1; }
.timeline-icon svg { width: 18px; height: 18px; }
.timeline-line { width: 2px; flex: 1; background: var(--border); margin-top: 4px; }
.timeline-card { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; border-left: 3px solid var(--border); }
.timeline-card-amiable { border-left-color: var(--primary); }
.timeline-card-amiable .timeline-icon { border-color: var(--primary-soft); color: var(--primary); }
.timeline-card-precontentieux { border-left-color: var(--amber); }
.timeline-card-precontentieux .timeline-icon { border-color: var(--amber-soft); color: var(--amber); }
.timeline-card-contentieux { border-left-color: var(--red); }
.timeline-card-contentieux .timeline-icon { border-color: var(--red-soft); color: var(--red); }
.timeline-card-execution { border-left-color: #991b1b; }
.timeline-card-execution .timeline-icon { border-color: rgba(153,27,27,0.3); color: #991b1b; }
.timeline-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.timeline-type { font-weight: 600; font-size: var(--text-sm); }
.timeline-date { font-size: var(--text-xs); color: var(--text-dim); }
.timeline-desc { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.5; margin-bottom: 10px; }
.timeline-meta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; font-size: var(--text-xs); color: var(--text-dim); }
.timeline-amount { font-family: var(--font-mono); font-weight: 600; color: var(--red); }
.timeline-actions { display: flex; gap: 6px; margin-left: auto; }

/* Prochaine action encadré */
.action-prochaine { border: 1px dashed var(--border-strong); border-radius: 8px; padding: 10px 14px; margin-top: 10px; font-size: var(--text-xs); color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.action-prochaine.en-retard { border-color: var(--red); background: var(--red-dim); color: var(--red); }

/* Pièce jointe */
.piece-jointe { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--primary); text-decoration: none; }
.piece-jointe:hover { text-decoration: underline; }

/* Alerte cards */
.alerte-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-radius: 8px; font-size: var(--text-sm); }
.alerte-item a { color: inherit; text-decoration: none; }
.alerte-item a:hover { text-decoration: underline; }
.alerte-danger { background: var(--red-dim); color: var(--red); border: 1px solid var(--red-soft); }
.alerte-warning { background: var(--amber-dim); color: var(--amber); border: 1px solid var(--amber-soft); }
.alerte-info { background: var(--blue-dim); color: var(--blue); border: 1px solid var(--blue-soft); }

/* Lot pills */
.lot-pill { display: inline-flex; padding: 2px 8px; border-radius: 6px; font-size: 10px; font-weight: 600; background: var(--bg-warm); color: var(--text-secondary); border: 1px solid var(--border); }

/* Section form */
.form-section { margin-bottom: 24px; }
.form-section-title { font-size: var(--text-sm); font-weight: 700; color: var(--text); margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }

/* Empty state */
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 24px; text-align: center; color: var(--text-dim); }
.empty-state svg { width: 48px; height: 48px; color: var(--emerald); }
.empty-state-text { font-size: var(--text-base); font-weight: 600; color: var(--text-secondary); }

/* Responsive recouvrement */
@media (max-width: 767px) {
    .timeline-item { flex-direction: column; gap: 8px; }
    .timeline-marker { flex-direction: row; width: auto; gap: 8px; }
    .timeline-line { display: none; }
    .timeline-card { border-left-width: 3px; }
    .timeline-header { flex-direction: column; align-items: flex-start; }
    .timeline-actions { margin-left: 0; }
    .bar-legend { gap: 8px; }
}
