/* =====================================================================
 * Starlink Reseller — Design system premium v2 (iOS 26 Liquid Glass)
 * Glassmorphism raffiné + neumorphism + dark mode + animations spring
 * ===================================================================== */

:root {
    /* Palette claire */
    --bg: #F5F6FB;
    --bg-soft: #ECEEF8;
    --surface: rgba(255, 255, 255, 0.72);
    --surface-solid: #FFFFFF;
    --surface-2: #F8F9FE;
    --surface-3: #FBFCFF;
    --border: rgba(20, 30, 60, 0.07);
    --border-strong: rgba(20, 30, 60, 0.13);
    --text: #0F1B3A;
    --text-soft: #5A6285;
    --text-mute: #8A92AE;

    /* Accents — palette iOS 26 inspirée */
    --primary: #5B6CFF;
    --primary-2: #8B5BFF;
    --primary-soft: rgba(91, 108, 255, 0.12);
    --primary-grad: linear-gradient(135deg, #5B6CFF 0%, #8B5BFF 100%);
    --primary-grad-soft: linear-gradient(135deg, rgba(91, 108, 255, 0.14), rgba(139, 91, 255, 0.14));

    --success: #1FAF74;
    --success-soft: rgba(31, 175, 116, 0.14);
    --warning: #F4A019;
    --warning-soft: rgba(244, 160, 25, 0.14);
    --danger: #E64A4A;
    --danger-soft: rgba(230, 74, 74, 0.14);
    --info: #29B6F6;
    --info-soft: rgba(41, 182, 246, 0.14);
    --whatsapp: #25D366;

    /* Ombres iOS naturelles */
    --shadow-sm: 0 2px 6px rgba(20, 30, 60, 0.04), 0 1px 2px rgba(20, 30, 60, 0.04);
    --shadow: 0 8px 24px rgba(20, 30, 60, 0.07), 0 2px 6px rgba(20, 30, 60, 0.04);
    --shadow-lg: 0 18px 50px rgba(20, 30, 60, 0.12), 0 6px 16px rgba(20, 30, 60, 0.06);
    --shadow-xl: 0 30px 80px rgba(20, 30, 60, 0.18), 0 10px 30px rgba(20, 30, 60, 0.08);
    --shadow-glow: 0 14px 40px rgba(91, 108, 255, 0.28);
    --shadow-inset: inset 0 1px 0 rgba(255,255,255,0.6), inset 0 -1px 0 rgba(0,0,0,0.04);

    --radius: 18px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --radius-pill: 999px;

    /* Easing — spring iOS */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-ios: cubic-bezier(0.32, 0.72, 0.0, 1.0);
    --ease-spring: cubic-bezier(0.5, 1.5, 0.5, 1);
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.27, 1.55);

    --sidebar-w: 260px;
    --sidebar-w-collapsed: 76px;
    --tabbar-h: 70px;

    --blur-glass: 32px;
}

[data-theme="dark"] {
    --bg: #0A0D1A;
    --bg-soft: #11142B;
    --surface: rgba(22, 26, 50, 0.72);
    --surface-solid: #181C32;
    --surface-2: #1E2240;
    --surface-3: #232850;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #F2F4FA;
    --text-soft: #B5BBD8;
    --text-mute: #7E85A6;

    --primary-soft: rgba(139, 132, 255, 0.18);
    --success-soft: rgba(31, 175, 116, 0.22);
    --warning-soft: rgba(244, 160, 25, 0.22);
    --danger-soft: rgba(230, 74, 74, 0.22);
    --info-soft: rgba(41, 182, 246, 0.22);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow: 0 12px 36px rgba(0, 0, 0, 0.32);
    --shadow-lg: 0 22px 60px rgba(0, 0, 0, 0.45);
    --shadow-xl: 0 30px 80px rgba(0, 0, 0, 0.55);
    --shadow-inset: inset 0 1px 0 rgba(255,255,255,0.06), inset 0 -1px 0 rgba(0,0,0,0.2);
}

/* ---------------------------------------------------------------------
 * Reset et base
 * ------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
    background:
        radial-gradient(1100px 600px at -8% -10%, rgba(91, 108, 255, 0.13), transparent 50%),
        radial-gradient(900px 500px at 110% 10%, rgba(139, 91, 255, 0.13), transparent 50%),
        radial-gradient(800px 500px at 50% 110%, rgba(41, 182, 246, 0.08), transparent 60%),
        var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    transition: background 0.4s var(--ease);
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }
img, svg { display: block; max-width: 100%; }

h1, h2, h3, h4 { margin: 0 0 0.5rem; font-weight: 700; letter-spacing: -0.02em; }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.5rem; color: var(--text-soft); }
small { color: var(--text-mute); }

::selection { background: var(--primary-soft); color: var(--primary); }

/* ---------------------------------------------------------------------
 * Animation utility — view transition style
 * ------------------------------------------------------------------- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn {
    from { opacity: 0; transform: translateX(24px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes pop {
    0% { transform: scale(0.85); opacity: 0; }
    60% { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); }
}
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 var(--primary-soft); }
    50% { box-shadow: 0 0 0 8px transparent; }
}
@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.fade-up { animation: fadeUp 0.5s var(--ease-ios) both; }
.fade-up-delay-1 { animation-delay: 0.05s; }
.fade-up-delay-2 { animation-delay: 0.1s; }
.fade-up-delay-3 { animation-delay: 0.15s; }
.fade-up-delay-4 { animation-delay: 0.2s; }
.fade-in { animation: fadeIn 0.35s var(--ease) both; }

/* Page transition — fade contenu lors du chargement */
.main > .content {
    animation: fadeUp 0.45s var(--ease-ios) both;
}

/* ---------------------------------------------------------------------
 * Layout (sidebar + topbar + tabbar mobile)
 * ------------------------------------------------------------------- */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
    transition: grid-template-columns 0.35s var(--ease-ios);
}
.app-shell.sidebar-collapsed {
    grid-template-columns: var(--sidebar-w-collapsed) 1fr;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 14px;
    background: var(--surface);
    backdrop-filter: saturate(180%) blur(var(--blur-glass));
    -webkit-backdrop-filter: saturate(180%) blur(var(--blur-glass));
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 10;
    overflow: hidden;
    transition: padding 0.3s var(--ease-ios);
}

.brand {
    display: flex; align-items: center; gap: 12px;
    padding: 6px 10px 22px;
}
.brand-icon {
    width: 40px; height: 40px;
    border-radius: 13px;
    background: var(--primary-grad);
    display: grid; place-items: center;
    box-shadow: var(--shadow-glow), var(--shadow-inset);
    color: white;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}
.brand-icon::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.3), transparent 40%);
    pointer-events: none;
}
.brand-text { transition: opacity 0.25s var(--ease-ios); min-width: 0; }
.brand-name { font-weight: 700; letter-spacing: -0.02em; font-size: 1.05rem; white-space: nowrap; }
.brand-sub  { font-size: 0.72rem; color: var(--text-mute); white-space: nowrap; }
.sidebar-collapsed .brand-text { opacity: 0; pointer-events: none; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px;
    border-radius: 14px;
    color: var(--text-soft);
    font-size: 0.93rem; font-weight: 500;
    transition: all 0.25s var(--ease-ios);
    position: relative;
    white-space: nowrap;
    overflow: hidden;
}
.nav a:hover {
    background: var(--bg-soft);
    color: var(--text);
    transform: translateX(2px);
}
.nav a.active {
    background: var(--primary-grad);
    color: white;
    box-shadow: var(--shadow-glow), var(--shadow-inset);
}
.nav a.active::before {
    content: '';
    position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 18px; border-radius: 0 3px 3px 0;
    background: rgba(255,255,255,0.7);
}
.nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-section { margin: 14px 10px 6px; font-size: 0.7rem; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.1em; }
.nav-label { transition: opacity 0.25s var(--ease-ios); }
.sidebar-collapsed .nav-section,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .nav .badge { opacity: 0; pointer-events: none; }
.sidebar-collapsed .nav a { justify-content: center; padding: 11px 8px; }

.sidebar-toggle {
    position: absolute; right: -12px; top: 78px;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--surface-solid);
    border: 1px solid var(--border-strong);
    display: grid; place-items: center;
    z-index: 15;
    color: var(--text-soft);
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}
.sidebar-toggle:hover { color: var(--primary); transform: scale(1.1); }
.sidebar-toggle svg { width: 14px; height: 14px; transition: transform 0.3s var(--ease-ios); }
.sidebar-collapsed .sidebar-toggle svg { transform: rotate(180deg); }

.sidebar-foot { margin-top: auto; padding-top: 14px; }
.sidebar-collapsed .sidebar-foot .card { padding: 8px; }
.sidebar-collapsed .sidebar-foot .card > div:nth-child(2),
.sidebar-collapsed .sidebar-foot .card > form { display: none; }

.main {
    min-width: 0;
    display: flex; flex-direction: column;
    min-height: 100vh;
}

.topbar {
    position: sticky; top: 0;
    z-index: 8;
    padding: 14px 28px;
    display: flex; align-items: center; gap: 14px;
    background: var(--surface);
    backdrop-filter: saturate(180%) blur(var(--blur-glass));
    -webkit-backdrop-filter: saturate(180%) blur(var(--blur-glass));
    border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 1.25rem; margin: 0; }
.topbar .topbar-greet { font-size: 0.78rem; color: var(--text-mute); margin-top: 2px; }
.topbar-grow { flex: 1; }

.icon-btn {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: var(--surface-2);
    display: grid; place-items: center;
    transition: all 0.25s var(--ease-ios);
    color: var(--text-soft);
    position: relative;
    border: 1px solid var(--border);
}
.icon-btn:hover {
    background: var(--bg-soft);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    color: var(--primary);
}
.icon-btn:active { transform: translateY(0) scale(0.94); }
.icon-btn .dot {
    position: absolute; top: 8px; right: 8px;
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--danger);
    box-shadow: 0 0 0 3px var(--surface);
}
.badge-pill {
    position: absolute; top: 4px; right: 4px;
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 999px;
    background: var(--danger);
    color: white; font-size: 0.65rem; font-weight: 700;
    display: grid; place-items: center;
    box-shadow: 0 0 0 2px var(--surface);
    animation: pop 0.4s var(--ease-bounce);
}

/* Search trigger dans la topbar */
.topbar-search {
    flex: 1; max-width: 380px;
    display: flex; align-items: center; gap: 10px;
    padding: 9px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-mute);
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.25s var(--ease-ios);
}
.topbar-search:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--surface-solid);
}
.topbar-search kbd {
    padding: 2px 7px;
    background: var(--bg-soft);
    border-radius: 6px;
    font-size: 0.72rem;
    color: var(--text-soft);
    font-family: inherit;
    margin-left: auto;
    border: 1px solid var(--border);
}

.content {
    padding: 28px;
    flex: 1;
    max-width: 1480px;
    width: 100%;
}

/* ---------------------------------------------------------------------
 * Cards
 * ------------------------------------------------------------------- */
.card {
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s var(--ease-ios), box-shadow 0.3s var(--ease-ios), border-color 0.2s;
}
.card:hover { box-shadow: var(--shadow); }
.card-lg { padding: 22px; border-radius: var(--radius-lg); }
.card-glass {
    background: var(--surface);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
    gap: 12px;
}
.card-title { font-size: 0.78rem; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.card-subtitle { color: var(--text-soft); font-size: 0.9rem; }

/* KPI cards — Liquid Glass */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.kpi {
    position: relative;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all 0.4s var(--ease-ios);
    isolation: isolate;
}
.kpi::before {
    content: '';
    position: absolute; inset: 0;
    background: var(--primary-grad-soft);
    opacity: 0;
    transition: opacity 0.4s var(--ease);
    z-index: -1;
}
.kpi:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--border-strong);
}
.kpi:hover::before { opacity: 1; }

.kpi-icon {
    width: 46px; height: 46px;
    border-radius: 14px;
    display: grid; place-items: center;
    background: var(--primary-soft);
    color: var(--primary);
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
}
.kpi-icon::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.3), transparent 50%);
}
.kpi-icon.success { background: var(--success-soft); color: var(--success); }
.kpi-icon.warning { background: var(--warning-soft); color: var(--warning); }
.kpi-icon.danger  { background: var(--danger-soft);  color: var(--danger); }
.kpi-icon.info    { background: var(--info-soft);    color: var(--info); }
.kpi-icon.primary { background: var(--primary-soft); color: var(--primary); }

.kpi-label { font-size: 0.78rem; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; margin-bottom: 4px; }
.kpi-value {
    font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.kpi-evolution {
    display: inline-flex; align-items: center; gap: 4px;
    margin-top: 6px;
    font-size: 0.82rem; font-weight: 600;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
}
.kpi-evolution.up   { color: var(--success); background: var(--success-soft); }
.kpi-evolution.down { color: var(--danger);  background: var(--danger-soft); }
.kpi-evolution.flat { color: var(--text-mute); background: var(--bg-soft); }

/* ---------------------------------------------------------------------
 * Boutons — micro-interactions iOS
 * ------------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 0.9rem;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    transition: all 0.25s var(--ease-ios);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}
.btn::after {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 50%), rgba(255,255,255,0.4) 0%, transparent 60%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: scale(0.96); }
.btn:active::after { opacity: 1; transition-duration: 0s; }
.btn svg { width: 16px; height: 16px; }

.btn-primary {
    background: var(--primary-grad);
    color: white;
    border-color: transparent;
    box-shadow: 0 8px 24px rgba(91, 108, 255, 0.32), var(--shadow-inset);
}
.btn-primary:hover { box-shadow: 0 12px 32px rgba(91, 108, 255, 0.42), var(--shadow-inset); }
.btn-success { background: var(--success); color: white; border-color: transparent; box-shadow: 0 6px 16px rgba(31, 175, 116, 0.3); }
.btn-warning { background: var(--warning); color: white; border-color: transparent; box-shadow: 0 6px 16px rgba(244, 160, 25, 0.3); }
.btn-danger  { background: var(--danger);  color: white; border-color: transparent; box-shadow: 0 6px 16px rgba(230, 74, 74, 0.3); }
.btn-ghost   { background: transparent; border-color: var(--border-strong); }
.btn-sm      { padding: 6px 12px; font-size: 0.82rem; }
.btn-lg      { padding: 14px 26px; font-size: 1rem; }
.btn-icon    { padding: 9px; border-radius: 12px; }

.btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------------
 * Forms
 * ------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 0.85rem; font-weight: 600; color: var(--text-soft); }
.field .hint { font-size: 0.78rem; color: var(--text-mute); }
.input, .select, .textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text);
    font-size: 0.95rem;
    transition: all 0.2s var(--ease);
    outline: none;
    font-family: inherit;
}
.input:focus, .select:focus, .textarea:focus {
    border-color: var(--primary);
    background: var(--surface-solid);
    box-shadow: 0 0 0 4px var(--primary-soft);
}
.textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.form-actions {
    display: flex; gap: 10px; justify-content: flex-end;
    margin-top: 18px; padding-top: 18px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

/* Toggle iOS */
.toggle { position: relative; display: inline-block; width: 50px; height: 30px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider {
    position: absolute; inset: 0;
    background: var(--bg-soft); border-radius: 999px;
    transition: 0.3s var(--ease-ios);
    cursor: pointer;
}
.toggle .slider::before {
    content: '';
    position: absolute; left: 3px; top: 3px;
    width: 24px; height: 24px; border-radius: 50%;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: 0.3s var(--ease-spring);
}
.toggle input:checked + .slider { background: var(--success); }
.toggle input:checked + .slider::before { transform: translateX(20px); }

/* ---------------------------------------------------------------------
 * Tables (style iOS list)
 * ------------------------------------------------------------------- */
.table-wrap {
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}
.table th {
    text-align: left;
    padding: 14px 18px;
    font-size: 0.72rem;
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}
.table td {
    padding: 14px 18px;
    border-top: 1px solid var(--border);
    vertical-align: middle;
}
.table tbody tr { transition: background 0.2s; }
.table tbody tr:hover { background: var(--surface-2); }
.table td.actions { text-align: right; white-space: nowrap; }

/* Pour mobile : transformation en cartes */
/* Note : la transformation des tableaux en cartes sur mobile est gérée
 * par le bloc @media (max-width: 900px) plus bas (approche flex aboutie). */

/* ---------------------------------------------------------------------
 * Badges, chips, avatars
 * ------------------------------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.76rem;
    font-weight: 600;
    background: var(--bg-soft);
    color: var(--text-soft);
}
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger  { background: var(--danger-soft);  color: var(--danger); }
.badge.info    { background: var(--info-soft);    color: var(--info); }
.badge.primary { background: var(--primary-soft); color: var(--primary); }
.badge .dot-status { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    display: grid; place-items: center;
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-inset);
    position: relative;
    overflow: hidden;
}
.avatar::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.25), transparent 50%);
}
.avatar-sm { width: 32px; height: 32px; font-size: 0.78rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.2rem; }

.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell .meta-name { font-weight: 600; color: var(--text); }
.user-cell .meta-sub { font-size: 0.78rem; color: var(--text-mute); }

/* ---------------------------------------------------------------------
 * Toasts (notifications éphémères)
 * ------------------------------------------------------------------- */
.toast-wrap, .flash-wrap {
    position: fixed;
    top: 16px; right: 16px;
    display: flex; flex-direction: column; gap: 10px;
    z-index: 999;
    max-width: 380px;
    pointer-events: none;
}
.toast, .flash {
    background: var(--surface-solid);
    border: 1px solid var(--border-strong);
    padding: 14px 18px 14px 14px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    display: flex; align-items: flex-start; gap: 12px;
    animation: slideIn 0.45s var(--ease-spring);
    border-left: 4px solid var(--info);
    pointer-events: auto;
    min-width: 260px;
}
.toast.success, .flash.success { border-left-color: var(--success); }
.toast.error,   .flash.error   { border-left-color: var(--danger); }
.toast.warning, .flash.warning { border-left-color: var(--warning); }
.toast .toast-icon, .flash > svg, .flash > i {
    width: 22px; height: 22px;
    border-radius: 50%;
    display: grid; place-items: center;
    flex-shrink: 0;
    color: var(--info);
}
.toast.success .toast-icon, .flash.success > i { color: var(--success); }
.toast.error .toast-icon,   .flash.error > i   { color: var(--danger); }
.toast.warning .toast-icon, .flash.warning > i { color: var(--warning); }
.toast p, .flash p { margin: 0; color: var(--text); font-size: 0.9rem; line-height: 1.4; }
.toast.fade-out { animation: fadeUp 0.3s var(--ease) reverse forwards; }

/* ---------------------------------------------------------------------
 * Auth / login screen
 * ------------------------------------------------------------------- */
.auth-shell {
    min-height: 100vh;
    display: grid; place-items: center;
    padding: 24px;
    background:
        radial-gradient(800px 600px at 80% 20%, rgba(139, 91, 255, 0.2), transparent 60%),
        radial-gradient(700px 500px at 20% 80%, rgba(91, 108, 255, 0.2), transparent 60%),
        var(--bg);
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    backdrop-filter: saturate(180%) blur(28px);
    -webkit-backdrop-filter: saturate(180%) blur(28px);
    border: 1px solid var(--border-strong);
    border-radius: 28px;
    padding: 36px 30px;
    box-shadow: var(--shadow-xl), var(--shadow-inset);
    animation: fadeUp 0.5s var(--ease-spring);
}
.auth-card h1 { font-size: 1.6rem; }
.auth-card .brand-icon { margin: 0 auto 20px; width: 64px; height: 64px; border-radius: 18px; }

/* ---------------------------------------------------------------------
 * Search and filters
 * ------------------------------------------------------------------- */
.search-bar {
    position: relative;
    flex: 1;
    max-width: 380px;
}
.search-bar input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text);
    outline: none;
    transition: all 0.2s;
}
.search-bar input:focus {
    border-color: var(--primary);
    background: var(--surface-solid);
    box-shadow: 0 0 0 4px var(--primary-soft);
}
.search-bar svg {
    position: absolute;
    left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--text-mute);
    width: 18px; height: 18px;
}

.filters {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
    margin: 18px 0;
}
.filter-chip {
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    background: var(--surface-solid);
    border: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-soft);
    font-weight: 500;
    transition: all 0.25s var(--ease-ios);
}
.filter-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}
.filter-chip.active {
    background: var(--primary-grad);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-glow);
}

/* ---------------------------------------------------------------------
 * Tab bar mobile
 * ------------------------------------------------------------------- */
.tabbar {
    display: none;
    position: fixed; left: 0; right: 0; bottom: 0;
    height: var(--tabbar-h);
    background: var(--surface);
    backdrop-filter: saturate(180%) blur(28px);
    -webkit-backdrop-filter: saturate(180%) blur(28px);
    border-top: 1px solid var(--border);
    padding: 8px env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    z-index: 20;
}
.tabbar a {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px;
    font-size: 0.7rem;
    color: var(--text-mute);
    font-weight: 500;
    transition: color 0.25s var(--ease-ios);
    position: relative;
}
.tabbar a.active { color: var(--primary); }
.tabbar a.active svg { animation: pop 0.45s var(--ease-bounce); }
.tabbar a svg { width: 22px; height: 22px; transition: transform 0.25s; }

/* ---------------------------------------------------------------------
 * Tab bar : bouton "Plus"
 * ------------------------------------------------------------------- */
.tabbar-btn {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px;
    font-size: 0.7rem;
    color: var(--text-mute);
    font-weight: 500;
    transition: color 0.25s var(--ease-ios);
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.tabbar-btn:hover { color: var(--primary); }
.tabbar-btn svg { width: 22px; height: 22px; }

/* ---------------------------------------------------------------------
 * Bottom sheet (mobile menu "Plus")
 * ------------------------------------------------------------------- */
.sheet-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    display: none;
    opacity: 0;
    transition: opacity 0.25s var(--ease-ios);
}
.sheet-overlay.show { display: flex; align-items: flex-end; opacity: 1; }
.sheet {
    width: 100%;
    background: var(--surface-solid);
    border-top-left-radius: 28px;
    border-top-right-radius: 28px;
    padding: 12px 16px 30px;
    box-shadow: var(--shadow-xl);
    transform: translateY(100%);
    transition: transform 0.35s var(--ease-spring);
    max-height: 85vh;
    overflow-y: auto;
}
.sheet-overlay.show .sheet { transform: translateY(0); }
.sheet-handle {
    width: 40px; height: 4px;
    background: var(--border-strong);
    border-radius: 999px;
    margin: 0 auto 14px;
}
.sheet-header {
    display: flex; align-items: center; justify-content: space-between;
    padding-bottom: 12px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.sheet-header h3 { margin: 0; }
.sheet-body { display: flex; flex-direction: column; gap: 2px; }
.sheet-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px;
    border-radius: 14px;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 500;
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-family: inherit;
    transition: background 0.2s;
}
.sheet-item:hover { background: var(--surface-2); }
.sheet-item.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}
.sheet-item .icon-wrap {
    width: 38px; height: 38px;
    border-radius: 11px;
    flex-shrink: 0;
}

/* ---------------------------------------------------------------------
 * Lists & timeline
 * ------------------------------------------------------------------- */
.list { display: flex; flex-direction: column; gap: 1px; }
.list-item {
    display: flex; align-items: center; gap: 14px;
    padding: 14px;
    border-radius: 14px;
    transition: background 0.2s, transform 0.2s var(--ease-ios);
}
.list-item:hover { background: var(--surface-2); transform: translateX(2px); }
.list-item .icon-wrap {
    width: 40px; height: 40px;
    border-radius: 12px;
    display: grid; place-items: center;
    flex-shrink: 0;
}
.list-item .meta { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; color: var(--text); font-size: 0.94rem; }
.list-item .sub { font-size: 0.82rem; color: var(--text-mute); margin-top: 2px; }
.list-item .right { text-align: right; flex-shrink: 0; }

/* ---------------------------------------------------------------------
 * Page header
 * ------------------------------------------------------------------- */
.page-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 22px;
    gap: 12px;
    flex-wrap: wrap;
    animation: fadeUp 0.4s var(--ease-ios) both;
}
.page-head h1 { margin: 0; font-size: 1.6rem; }
.page-head .sub { color: var(--text-mute); font-size: 0.92rem; }

/* ---------------------------------------------------------------------
 * Section grids
 * ------------------------------------------------------------------- */
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 22px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.gap-md { gap: 18px; }
.section { margin-top: 22px; }

@media (max-width: 1024px) {
    .grid-2 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr 1fr; }
}

/* ---------------------------------------------------------------------
 * MOBILE RESPONSIVE — refonte complète
 * ------------------------------------------------------------------- */

/* Tablette (≤ 1024px) — sidebar plus étroite si possible */
@media (max-width: 1024px) {
    :root { --sidebar-w: 220px; }
    .content { padding: 22px; }
}

/* Tablette compacte / phablette (≤ 900px) — bascule en mobile */
@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar, .sidebar-toggle { display: none; }
    .tabbar { display: flex; }
    .topbar-search { display: none; }

    .content {
        padding: 14px 14px calc(var(--tabbar-h) + 40px);
        max-width: 100%;
    }

    .topbar {
        padding: 10px 14px;
        gap: 10px;
    }
    .topbar > div:first-child { min-width: 0; flex: 1; overflow: hidden; }
    .topbar h1 {
        font-size: 1rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .topbar-greet {
        font-size: 0.7rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .topbar-grow { display: none; }
    .icon-btn { width: 38px; height: 38px; flex-shrink: 0; }

    h1 { font-size: 1.4rem; }
    h2 { font-size: 1.15rem; }
    h3 { font-size: 1rem; }

    /* PAGE HEAD : titre puis boutons en bas, alignés à droite */
    .page-head {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        margin-bottom: 12px;
    }
    .page-head > div:first-child h1 { font-size: 1.35rem; margin-bottom: 1px; }
    .page-head .sub {
        font-size: 0.82rem;
        line-height: 1.35;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .page-head .btn-group {
        display: flex;
        gap: 6px;
        flex-wrap: wrap;
    }
    .page-head .btn-group .btn { flex: 1; justify-content: center; min-width: 0; padding: 9px 12px; font-size: 0.85rem; }
    .page-head .btn-group .btn.btn-ghost { flex: 0 0 auto; }
    .page-head > a.btn,
    .page-head > form { align-self: stretch; }
    .page-head > a.btn { justify-content: center; padding: 9px 14px; }
    .page-head > form .btn { width: 100%; justify-content: center; }
    /* Sur très petit (<400px), les boutons secondaires deviennent icon-only */
    @media (max-width: 400px) {
        .page-head .btn-group .btn.btn-ghost { padding: 9px; }
        .page-head .btn-group .btn.btn-ghost span:not(.badge) { display: none; }
    }

    /* KPI GRID — layout horizontal compact sur mobile */
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .kpi {
        padding: 12px;
        border-radius: 16px;
        display: grid;
        grid-template-columns: 38px 1fr;
        gap: 10px;
        align-items: center;
    }
    .kpi-icon {
        width: 38px; height: 38px;
        margin-bottom: 0;
        border-radius: 11px;
        grid-row: span 3;
        align-self: center;
    }
    .kpi-icon svg { width: 16px; height: 16px; }
    .kpi-label {
        font-size: 0.62rem;
        letter-spacing: 0.05em;
        margin-bottom: 1px;
        grid-column: 2;
    }
    .kpi-value {
        font-size: 1.05rem;
        letter-spacing: -0.01em;
        word-break: break-word;
        grid-column: 2;
        line-height: 1.1;
    }
    .kpi-evolution {
        margin-top: 4px;
        font-size: 0.68rem;
        padding: 1px 6px;
        grid-column: 2;
        justify-self: start;
    }
    .kpi-evolution svg { width: 10px; height: 10px; }

    /* GRIDS */
    .grid-2, .grid-3 { grid-template-columns: 1fr; gap: 14px; }
    .field-grid { grid-template-columns: 1fr; gap: 10px; }
    .section { margin-top: 16px; }

    /* FILTERS — scroll horizontal au lieu de wrap */
    .filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 4px 14px 8px;
        margin: 10px -14px 14px;
        scrollbar-width: none;
        scroll-snap-type: x proximity;
    }
    .filters::-webkit-scrollbar { display: none; }
    .filter-chip {
        flex-shrink: 0;
        padding: 6px 12px;
        font-size: 0.82rem;
        scroll-snap-align: start;
    }
    /* Ajoute un padding fantôme pour bien voir le dernier chip */
    .filters::after {
        content: '';
        flex: 0 0 8px;
    }

    /* CARDS sur mobile : padding plus serré */
    .card { padding: 14px; border-radius: 16px; }
    .card-lg { padding: 16px; border-radius: 20px; }
    .card-header { margin-bottom: 10px; }

    /* TABLES → CARTES compactes mobiles (approche flex) */
    .table thead { display: none; }
    .table, .table tbody { display: block; width: 100%; }
    .table tr {
        display: flex;
        flex-direction: column;
        gap: 0;
        margin-bottom: 8px;
        background: var(--surface-solid);
        border-radius: 14px;
        border: 1px solid var(--border);
        padding: 10px 12px;
        box-shadow: var(--shadow-sm);
    }
    .table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        padding: 5px 0;
        border-top: 1px solid var(--border);
        border-bottom: none;
        font-size: 0.85rem;
        text-align: right;
        line-height: 1.3;
    }
    .table td::before {
        content: attr(data-label);
        font-size: 0.66rem;
        font-weight: 600;
        color: var(--text-mute);
        text-transform: uppercase;
        letter-spacing: 0.04em;
        flex-shrink: 0;
        text-align: left;
    }
    /* Première colonne (souvent l'avatar + nom) : header de la carte */
    .table td:first-child {
        border-top: none;
        font-weight: 700;
        font-size: 0.95rem;
        padding: 0 0 8px;
        margin-bottom: 2px;
        border-bottom: 1px solid var(--border);
        justify-content: flex-start;
        text-align: left;
    }
    .table td:first-child::before { display: none; }
    .table td:first-child .user-cell { flex: 1; }

    /* Actions row : alignée à droite, séparée */
    .table td.actions {
        justify-content: flex-end;
        gap: 6px;
        padding-top: 8px;
        margin-top: 2px;
        border-top: 1px dashed var(--border);
    }
    .table td.actions::before { display: none; }
    .table td.actions .icon-btn { width: 34px; height: 34px; }

    .table-wrap {
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
        overflow: visible;
    }

    /* LIST ITEMS — denses sur mobile */
    .list-item {
        gap: 10px;
        padding: 10px 8px;
    }
    .list-item .icon-wrap { width: 34px; height: 34px; border-radius: 10px; }
    .list-item .icon-wrap svg { width: 15px; height: 15px; }
    .list-item .title { font-size: 0.88rem; line-height: 1.3; }
    .list-item .sub { font-size: 0.76rem; line-height: 1.35; margin-top: 1px; }
    .list-item .right {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-shrink: 0;
    }
    /* Quand le .right contient surtout des badges, on les empile verticalement */
    .list-item .right.right-stack {
        flex-direction: column;
        align-items: flex-end;
        gap: 3px;
    }
    .list-item .right .badge {
        font-size: 0.68rem;
        padding: 2px 7px;
    }
    .list-item .right .icon-btn { width: 32px; height: 32px; }

    /* CHARTS plus courts sur mobile */
    .chart-wrap { height: 260px; }
    .chart-wrap.small { height: 180px; }

    /* FORM ACTIONS sticky en bas si possible */
    .form-actions { gap: 8px; }
    .form-actions .btn { flex: 1; justify-content: center; }

    /* CALENDRIER — bascule en mode liste verticale */
    .calendar {
        display: flex !important;
        flex-direction: column;
        grid-template-columns: none;
        gap: 6px;
        padding: 8px;
    }
    .calendar-events-wrap {
        display: flex;
        flex-direction: column;
        gap: 4px;
        min-width: 0;
        overflow: hidden;
    }
    .calendar-head { display: none; }
    .calendar-cell {
        display: grid !important;
        grid-template-columns: 56px 1fr;
        min-height: 0 !important;
        gap: 10px;
        padding: 12px 14px;
        align-items: start;
        overflow: visible !important;
    }
    .calendar-cell.out { display: none !important; }
    .calendar-day {
        font-size: 1.1rem;
        font-weight: 700;
        text-align: center;
        margin: 0;
        line-height: 1.2;
    }
    .calendar-day::after {
        content: attr(data-day-name);
        display: block;
        font-size: 0.7rem;
        color: var(--text-mute);
        font-weight: 500;
        text-transform: uppercase;
        margin-top: 2px;
    }
    .calendar-cell.today .calendar-day { color: var(--primary); }
    .calendar-events-wrap {
        display: flex;
        flex-direction: column;
        gap: 4px;
        min-width: 0;
    }
    .calendar-event {
        display: none; /* on cache les bulles count, on affiche les détails directement */
    }
    .calendar-details {
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: 3px;
    }
    .cal-pop {
        font-size: 0.78rem;
        padding: 6px 10px;
        background: var(--bg-soft);
        border-radius: 10px;
    }
    .calendar-cell:not(.has-events) {
        display: none !important;
    }
    .cal-pop {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    /* SIDEBAR FOOT user card sur mobile — n'apparaît plus puisque la sidebar est cachée */

    /* CLIENT HEADER fiche */
    .client-header {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
        padding: 16px;
        gap: 12px;
    }
    .client-header h1 { font-size: 1.3rem; }
    .contact-actions { width: 100%; }
    .contact-actions a { flex: 1; justify-content: center; }

    /* TICKETS thread sur mobile */
    .ticket-thread { gap: 10px; }
    .ticket-msg { padding: 12px; border-radius: 12px; }

    /* COMMUNICATIONS bulk list */
    .bulk-row {
        padding: 10px 12px;
        gap: 10px;
    }
    .bulk-row .text-right { font-size: 0.78rem; }
    .bulk-row .text-danger { font-size: 0.88rem; }

    /* AUTH card */
    .auth-card { padding: 28px 22px; border-radius: 24px; }
    .auth-card h1 { font-size: 1.4rem; }

    /* FLASH/TOAST plus compact */
    .flash-wrap, .toast-wrap {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    .flash, .toast {
        padding: 10px 12px;
        border-radius: 12px;
        min-width: 0;
    }
    .flash p, .toast p { font-size: 0.85rem; }

    /* CMDK adapté */
    .cmdk-overlay.show { padding-top: 8vh; padding-left: 12px; padding-right: 12px; }
    .cmdk { border-radius: 18px; }
    .cmdk-input-wrap { padding: 14px 16px; }
    .cmdk-input { font-size: 0.95rem; }
    .cmdk-result { padding: 10px; gap: 10px; }
    .cmdk-result-icon { width: 32px; height: 32px; }
    .cmdk-result-sub { font-size: 0.72rem; }
    .cmdk-footer { padding: 8px 14px; flex-wrap: wrap; gap: 8px; font-size: 0.7rem; }
}

/* Petits smartphones (≤ 400px) — encore plus dense */
@media (max-width: 400px) {
    .content { padding: 12px 10px calc(var(--tabbar-h) + 40px); }
    .kpi { padding: 12px; }
    .kpi-value { font-size: 1.05rem; }
    .kpi-icon { width: 32px; height: 32px; }
    .topbar { padding: 9px 10px; gap: 6px; }
    .topbar h1 { font-size: 0.95rem !important; }
    .topbar-greet { display: none !important; }
    .icon-btn { width: 36px; height: 36px; }
    .tabbar { height: 64px; }
    .tabbar a { font-size: 0.65rem; gap: 1px; }
    .tabbar a svg { width: 20px; height: 20px; }
    .page-head { margin-bottom: 14px; }
    .page-head h1 { font-size: 1.25rem; }
    .filter-chip { padding: 6px 10px; font-size: 0.78rem; }
    .btn { padding: 9px 14px; font-size: 0.85rem; }
    .btn-sm { padding: 5px 10px; font-size: 0.78rem; }
    /* Stats de carte client : 3 colonnes trop serrées sous 400px → 1 colonne */
    .client-card-stats { grid-template-columns: 1fr; gap: 4px; }
}

/* Skeleton loader */
.skel {
    background: linear-gradient(90deg, var(--bg-soft) 0%, var(--surface-2) 50%, var(--bg-soft) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.2s ease-in-out infinite;
    border-radius: 10px;
    height: 14px;
}

/* ---------------------------------------------------------------------
 * Détails fiche client
 * ------------------------------------------------------------------- */
.client-header {
    display: flex; align-items: center; gap: 16px;
    padding: 22px;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
}
.client-header .meta { flex: 1; min-width: 0; }
.client-header h1 { font-size: 1.5rem; margin-bottom: 4px; }

.contact-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.contact-actions a {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    font-size: 0.85rem;
    color: var(--text-soft);
    border: 1px solid var(--border);
    transition: all 0.25s var(--ease-ios);
}
.contact-actions a:hover {
    color: var(--primary);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.contact-actions a.whatsapp { color: var(--whatsapp); border-color: rgba(37, 211, 102, 0.3); }
.contact-actions a.whatsapp:hover { background: rgba(37, 211, 102, 0.08); border-color: var(--whatsapp); }

.phone-list { display: flex; flex-wrap: wrap; gap: 6px; }
.phone-tag {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: var(--radius-pill);
    background: var(--bg-soft); font-size: 0.82rem;
    color: var(--text-soft);
}

.phone-row {
    display: grid; grid-template-columns: 2fr 1fr auto; gap: 8px;
    align-items: center; margin-bottom: 8px;
}

/* ---------------------------------------------------------------------
 * Notification dropdown
 * ------------------------------------------------------------------- */
.notif-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px; max-height: 480px;
    overflow-y: auto;
    background: var(--surface-solid);
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    padding: 8px;
    display: none;
    z-index: 50;
}
.notif-dropdown.show { display: block; animation: slideDown 0.3s var(--ease-spring); }
.notif-dropdown .list-item { padding: 12px; }
.notif-dropdown .list-item:not(:last-child) { border-bottom: 1px solid var(--border); border-radius: 0; }

/* ---------------------------------------------------------------------
 * Stats charts
 * ------------------------------------------------------------------- */
.chart-card { position: relative; }
.chart-wrap { position: relative; height: 320px; }
.chart-wrap.small { height: 220px; }

/* ---------------------------------------------------------------------
 * Empty state
 * ------------------------------------------------------------------- */
.empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-mute);
}
.empty svg { width: 56px; height: 56px; margin: 0 auto 12px; color: var(--text-mute); opacity: 0.5; }
.empty h3 { color: var(--text-soft); }

/* ---------------------------------------------------------------------
 * Receipt / facture (print friendly)
 * ------------------------------------------------------------------- */
.receipt-wrap {
    max-width: 760px; margin: 30px auto;
    background: white; color: #111;
    border-radius: 14px; padding: 40px;
    box-shadow: var(--shadow-xl);
}
.receipt-wrap h1 { color: #111; font-size: 1.6rem; margin-bottom: 4px; }
.receipt-wrap table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.receipt-wrap th, .receipt-wrap td { padding: 10px 12px; border-bottom: 1px solid #eee; text-align: left; }
.receipt-wrap .total { font-weight: 700; font-size: 1.1rem; }
@media print {
    body { background: white; }
    .receipt-wrap { box-shadow: none; margin: 0; padding: 20px; }
    .no-print { display: none !important; }
}

/* ---------------------------------------------------------------------
 * Command palette (Ctrl/Cmd+K)
 * ------------------------------------------------------------------- */
.cmdk-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    display: none;
    animation: fadeIn 0.2s var(--ease);
}
.cmdk-overlay.show { display: grid; place-items: flex-start center; padding-top: 12vh; }
.cmdk {
    width: 100%; max-width: 580px;
    background: var(--surface-solid);
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: slideDown 0.3s var(--ease-spring);
}
.cmdk-input-wrap {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}
.cmdk-input-wrap svg { color: var(--text-mute); width: 20px; height: 20px; }
.cmdk-input {
    flex: 1;
    border: none; background: none;
    color: var(--text);
    font-size: 1rem;
    outline: none;
    font-family: inherit;
}
.cmdk-results {
    max-height: 60vh; overflow-y: auto;
    padding: 8px;
}
.cmdk-empty {
    text-align: center; padding: 40px;
    color: var(--text-mute);
}
.cmdk-result {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s;
}
.cmdk-result:hover, .cmdk-result.active {
    background: var(--primary-soft);
}
.cmdk-result-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--bg-soft);
    display: grid; place-items: center;
    color: var(--text-soft);
    flex-shrink: 0;
}
.cmdk-result.active .cmdk-result-icon {
    background: var(--primary);
    color: white;
}
.cmdk-result-meta { flex: 1; min-width: 0; }
.cmdk-result-title { font-weight: 600; color: var(--text); font-size: 0.95rem; }
.cmdk-result-sub { font-size: 0.78rem; color: var(--text-mute); }
.cmdk-result-type {
    font-size: 0.7rem;
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 8px;
    background: var(--bg-soft);
    border-radius: 999px;
}
.cmdk-footer {
    padding: 8px 18px;
    border-top: 1px solid var(--border);
    display: flex; gap: 14px;
    color: var(--text-mute);
    font-size: 0.75rem;
}
.cmdk-footer kbd {
    padding: 1px 6px;
    background: var(--bg-soft);
    border-radius: 4px;
    font-family: inherit;
    border: 1px solid var(--border);
}

/* ---------------------------------------------------------------------
 * Confetti canvas (overlay full-screen, no interaction)
 * ------------------------------------------------------------------- */
.confetti-canvas {
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 9999;
}

/* ---------------------------------------------------------------------
 * DASHBOARD PREMIUM
 * ------------------------------------------------------------------- */

/* Particles flottantes en background du dashboard */
.dashboard-particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: -1;
}
.dashboard-particles span {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(91,108,255,0.4) 0%, rgba(91,108,255,0) 70%);
    filter: blur(40px);
    animation: float-particle 20s ease-in-out infinite;
}
.dashboard-particles span:nth-child(1) { width: 300px; height: 300px; top: 10%; left: -5%; animation-delay: 0s; }
.dashboard-particles span:nth-child(2) { width: 220px; height: 220px; top: 60%; right: -3%; animation-delay: 4s; background: radial-gradient(circle, rgba(139,91,255,0.35), transparent 70%); }
.dashboard-particles span:nth-child(3) { width: 280px; height: 280px; top: 90%; left: 20%; animation-delay: 8s; background: radial-gradient(circle, rgba(31,175,116,0.3), transparent 70%); }
.dashboard-particles span:nth-child(4) { width: 180px; height: 180px; top: 40%; right: 30%; animation-delay: 12s; background: radial-gradient(circle, rgba(244,160,25,0.25), transparent 70%); }
.dashboard-particles span:nth-child(5) { width: 240px; height: 240px; top: 80%; right: -2%; animation-delay: 6s; background: radial-gradient(circle, rgba(41,182,246,0.3), transparent 70%); }
.dashboard-particles span:nth-child(6) { width: 200px; height: 200px; top: 30%; left: 50%; animation-delay: 14s; background: radial-gradient(circle, rgba(230,74,74,0.22), transparent 70%); }
.dashboard-particles span:nth-child(7) { width: 320px; height: 320px; top: 100%; left: 70%; animation-delay: 10s; background: radial-gradient(circle, rgba(91,108,255,0.32), transparent 70%); }

@keyframes float-particle {
    0%, 100% { transform: translateY(0) translateX(0) scale(1); }
    25%      { transform: translateY(-30px) translateX(20px) scale(1.05); }
    50%      { transform: translateY(20px) translateX(-15px) scale(0.95); }
    75%      { transform: translateY(-10px) translateX(-25px) scale(1.02); }
}

/* Hero greeting (premium) */
.hero-greeting {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 24px 28px;
    margin-bottom: 16px;
    background: var(--surface);
    backdrop-filter: saturate(180%) blur(28px);
    -webkit-backdrop-filter: saturate(180%) blur(28px);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
.hero-greeting::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0.6;
}
.hero-greeting-text { flex: 1; min-width: 0; }
.hero-greeting-time {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 0.78rem;
    color: var(--text-mute);
    margin-bottom: 6px;
}
.live-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 0 var(--success);
    animation: pulse-live 2s ease-in-out infinite;
}
@keyframes pulse-live {
    0%, 100% { box-shadow: 0 0 0 0 rgba(31, 175, 116, 0.6); }
    50%      { box-shadow: 0 0 0 8px rgba(31, 175, 116, 0); }
}
.hero-greeting h1 {
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--text) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}
.hero-greeting-sub { color: var(--text-soft); font-size: 0.95rem; margin: 0; max-width: 480px; }
.hero-greeting-actions { display: flex; gap: 10px; flex-shrink: 0; }

@media (max-width: 720px) {
    .hero-greeting {
        flex-direction: column;
        align-items: stretch;
        padding: 18px;
        gap: 12px;
    }
    .hero-greeting h1 { font-size: 1.4rem; }
    .hero-greeting-actions { width: 100%; }
    .hero-greeting-actions .btn { flex: 1; justify-content: center; }
}

/* KPI Premium avec glow + sparkline */
.kpi-premium {
    --accent: var(--primary);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s var(--ease-ios), box-shadow 0.3s var(--ease-ios);
    transform-style: preserve-3d;
    padding-bottom: 36px; /* place pour sparkline */
}
.kpi-premium::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: var(--accent);
    border-radius: 4px 0 0 4px;
    opacity: 0.85;
    transition: width 0.3s var(--ease-ios);
}
.kpi-premium:hover::after { width: 6px; }
.kpi-premium:hover {
    box-shadow: 0 18px 48px rgba(20, 30, 60, 0.14), 0 0 0 1px var(--accent);
}
.kpi-glow {
    position: absolute;
    width: 200px; height: 200px;
    background: var(--accent);
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0;
    top: -50px; right: -50px;
    transition: opacity 0.4s var(--ease);
    pointer-events: none;
}
.kpi-premium:hover .kpi-glow { opacity: 0.18; }
.kpi-sparkline {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
    opacity: 0.85;
}

/* Mini KPIs row */
.mini-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin: 16px 0;
    padding: 14px;
    background: var(--surface);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.mini-kpi {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    transition: background 0.2s;
}
.mini-kpi:hover { background: var(--surface-2); }
.mini-kpi svg { width: 22px; height: 22px; flex-shrink: 0; }
.mini-kpi-value {
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.1;
}
.mini-kpi-label {
    font-size: 0.72rem;
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 1px;
}

/* Action board */
.action-board {
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.action-board::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--warning), var(--primary), var(--danger));
    background-size: 200% 100%;
    animation: shimmer-bar 4s linear infinite;
}
@keyframes shimmer-bar {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}
.action-board-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
}
.action-board-header h3 { margin: 0; }
.action-board-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 10px;
}
.action-item {
    display: flex; align-items: center; gap: 12px;
    padding: 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text);
    transition: all 0.25s var(--ease-ios);
    position: relative;
    overflow: hidden;
    animation: fadeUp 0.45s var(--ease-spring) both;
}
.action-item::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--primary);
    transition: width 0.3s var(--ease-ios);
}
.action-item--danger::before  { background: var(--danger); }
.action-item--warning::before { background: var(--warning); }
.action-item--info::before    { background: var(--info); }
.action-item--success::before { background: var(--success); }
.action-item:hover {
    background: var(--surface-solid);
    transform: translateX(3px);
    box-shadow: var(--shadow-sm);
}
.action-item:hover::before { width: 6px; }
.action-item-icon {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary);
    display: grid; place-items: center;
    flex-shrink: 0;
}
.action-item--danger  .action-item-icon { background: var(--danger-soft); color: var(--danger); }
.action-item--warning .action-item-icon { background: var(--warning-soft); color: var(--warning); }
.action-item--info    .action-item-icon { background: var(--info-soft); color: var(--info); }
.action-item--success .action-item-icon { background: var(--success-soft); color: var(--success); }
.action-item-content { flex: 1; min-width: 0; }
.action-item-title { font-weight: 600; font-size: 0.95rem; }
.action-item-detail { font-size: 0.8rem; color: var(--text-mute); margin-top: 2px; }
.action-item-cta {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    flex-shrink: 0;
}
.action-item--danger  .action-item-cta { color: var(--danger); }
.action-item--warning .action-item-cta { color: var(--warning); }

@media (max-width: 480px) {
    .action-item-cta span { display: none; }
    .action-board-grid { gap: 8px; }
    .action-item { padding: 12px; }
}

/* Heatmap */
.heatmap {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin: 12px 0;
}
.heatmap-cell {
    aspect-ratio: 1;
    border-radius: 4px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    transition: transform 0.2s var(--ease-ios);
    animation: fadeIn 0.5s var(--ease-ios) both;
    cursor: default;
}
.heatmap-cell:hover { transform: scale(1.2); z-index: 5; }
.heatmap-cell.intensity-0 { background: var(--bg-soft); border-color: var(--border); }
.heatmap-cell.intensity-1 { background: rgba(91, 108, 255, 0.25); border-color: rgba(91, 108, 255, 0.3); }
.heatmap-cell.intensity-2 { background: rgba(91, 108, 255, 0.45); border-color: rgba(91, 108, 255, 0.5); }
.heatmap-cell.intensity-3 { background: rgba(91, 108, 255, 0.7); border-color: rgba(91, 108, 255, 0.75); }
.heatmap-cell.intensity-4 { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 8px var(--primary-soft); }
.heatmap-legend {
    display: flex; align-items: center; gap: 4px;
    font-size: 0.72rem;
    margin-top: 8px;
    flex-wrap: wrap;
}
.heatmap-legend .heatmap-cell {
    width: 14px; height: 14px;
    aspect-ratio: unset;
    cursor: default;
}
.heatmap-tooltip {
    position: fixed;
    background: var(--surface-solid);
    color: var(--text);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.78rem;
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-lg);
    transform: translate(-50%, -100%);
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
}

/* Rank badge sur top clients */
.rank-badge {
    width: 28px; height: 28px;
    display: grid; place-items: center;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* ---------------------------------------------------------------------
 * STATS PREMIUM
 * ------------------------------------------------------------------- */
.stats-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 26px 28px;
    background: var(--surface);
    backdrop-filter: saturate(180%) blur(28px);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}
.stats-hero::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary-2), transparent);
    opacity: 0.6;
}
.stats-hero h1 {
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--text) 0%, var(--primary-2) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}
.stats-hero p { font-size: 0.95rem; }

.stats-hero-period { text-align: right; flex-shrink: 0; }
.period-pills {
    display: inline-flex;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 4px;
    gap: 2px;
}
.period-pill {
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-soft);
    transition: all 0.25s var(--ease-ios);
}
.period-pill:hover { color: var(--primary); }
.period-pill.active {
    background: var(--primary-grad);
    color: white;
    box-shadow: var(--shadow-glow);
}

/* Insights row */
.insights-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}
.insight-card {
    display: flex; align-items: center; gap: 14px;
    padding: 18px;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s var(--ease-ios);
    animation: fadeUp 0.5s var(--ease-spring) both;
    position: relative;
    overflow: hidden;
}
.insight-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, currentColor 0%, transparent 50%);
    opacity: 0.05;
    pointer-events: none;
}
.insight-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}
.insight-card.insight--primary { color: var(--primary); }
.insight-card.insight--success { color: var(--success); }
.insight-card.insight--warning { color: var(--warning); }
.insight-card.insight--danger  { color: var(--danger); }
.insight-card.insight--info    { color: var(--info); }
.insight-icon {
    width: 48px; height: 48px;
    border-radius: 14px;
    background: currentColor;
    display: grid; place-items: center;
    flex-shrink: 0;
}
.insight-icon svg { width: 22px; height: 22px; color: white !important; }
.insight-content { flex: 1; min-width: 0; }
.insight-title { font-size: 0.78rem; color: var(--text-mute); font-weight: 600; }
.insight-value {
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 2px;
    line-height: 1.1;
    color: currentColor;
}
.insight-detail { font-size: 0.78rem; color: var(--text-mute); margin-top: 3px; }

/* Forecast */
.forecast-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.forecast-card {
    padding: 16px;
    background: var(--surface-2);
    border-radius: 14px;
    border: 1px solid var(--border);
    animation: fadeUp 0.5s var(--ease-spring) both;
    transition: all 0.3s var(--ease-ios);
}
.forecast-card:hover {
    background: var(--surface-solid);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    border-color: var(--primary);
}
.forecast-label {
    font-size: 0.75rem;
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}
.forecast-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin: 6px 0 10px;
}
.forecast-bar {
    height: 6px;
    background: var(--bg-soft);
    border-radius: 999px;
    overflow: hidden;
}
.forecast-bar-fill {
    height: 100%;
    background: var(--primary-grad);
    border-radius: 999px;
    transition: width 0.8s var(--ease-ios);
}

/* Trésorerie row */
.treso-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.treso-item {
    display: flex; align-items: center; gap: 12px;
    padding: 14px;
    background: var(--surface-2);
    border-radius: 14px;
    border: 1px solid var(--border);
    transition: all 0.2s;
}
.treso-item:hover { background: var(--surface-solid); }
.treso-item--solde {
    grid-column: 1 / -1;
    background: var(--primary-soft);
    border-color: var(--primary);
}
.treso-icon {
    width: 40px; height: 40px;
    border-radius: 12px;
    display: grid; place-items: center;
    flex-shrink: 0;
}

@media (max-width: 720px) {
    .stats-hero { flex-direction: column; align-items: stretch; padding: 20px; gap: 14px; }
    .stats-hero h1 { font-size: 1.4rem; }
    .stats-hero-period { text-align: left; }
    .period-pill { padding: 6px 12px; font-size: 0.8rem; }
    .insights-row { gap: 10px; }
    .insight-card { padding: 14px; }
    .insight-value { font-size: 1.05rem; }
    .forecast-row { grid-template-columns: 1fr; }
    .treso-row { grid-template-columns: 1fr; }
}

/* Wallet mini card (dashboard) */
.wallet-mini-card {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #1FAF74 0%, #5B6CFF 100%);
    border-radius: var(--radius-lg);
    color: white;
    margin-bottom: 16px;
    transition: all 0.3s var(--ease-ios);
    box-shadow: 0 10px 30px rgba(31, 175, 116, 0.28);
    position: relative;
    overflow: hidden;
}
.wallet-mini-card::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(400px 150px at 100% 0%, rgba(255,255,255,0.18), transparent 60%);
    pointer-events: none;
}
.wallet-mini-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(31, 175, 116, 0.38);
}
.wallet-mini-card.low {
    background: linear-gradient(135deg, #E64A4A 0%, #F4A019 100%);
    box-shadow: 0 10px 30px rgba(230, 74, 74, 0.32);
}
.wallet-mini-card.low:hover { box-shadow: 0 14px 36px rgba(230, 74, 74, 0.42); }
.wallet-mini-icon {
    width: 52px; height: 52px;
    border-radius: 16px;
    background: rgba(255,255,255,0.22);
    backdrop-filter: blur(10px);
    display: grid; place-items: center;
    flex-shrink: 0;
    position: relative;
}
.wallet-mini-icon svg { width: 26px; height: 26px; color: white; }
@media (max-width: 720px) {
    .wallet-mini-card { padding: 14px; gap: 10px; }
    .wallet-mini-icon { width: 44px; height: 44px; }
    .wallet-mini-icon svg { width: 22px; height: 22px; }
}

/* ---------------------------------------------------------------------
 * FOND DE ROULEMENT — wallet
 * ------------------------------------------------------------------- */
.wallet-hero {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 22px;
    align-items: center;
    padding: 26px 28px;
    background: linear-gradient(135deg, #1FAF74 0%, #5B6CFF 100%);
    color: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 18px 50px rgba(31, 175, 116, 0.28);
    position: relative;
    overflow: hidden;
    margin-bottom: 14px;
}
.wallet-hero.low {
    background: linear-gradient(135deg, #E64A4A 0%, #F4A019 100%);
    box-shadow: 0 18px 50px rgba(230, 74, 74, 0.32);
}
.wallet-hero::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(500px 200px at 100% 0%, rgba(255,255,255,0.18), transparent 60%);
    pointer-events: none;
}
.wallet-hero-main {
    display: flex; align-items: center; gap: 18px;
    position: relative;
}
.wallet-hero-icon {
    width: 72px; height: 72px;
    border-radius: 22px;
    background: rgba(255,255,255,0.22);
    backdrop-filter: blur(10px);
    display: grid; place-items: center;
    flex-shrink: 0;
}
.wallet-hero-icon svg { width: 36px; height: 36px; color: white; }
.wallet-hero-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.9;
}
.wallet-hero-value {
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}
.wallet-alert {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 8px;
    padding: 6px 12px;
    background: rgba(255,255,255,0.2);
    border-radius: 999px;
    font-size: 0.82rem;
    backdrop-filter: blur(10px);
}
.wallet-alert svg { width: 14px; height: 14px; }

.wallet-hero-flux {
    display: flex; flex-direction: column;
    gap: 10px;
    padding-left: 22px;
    border-left: 1px solid rgba(255,255,255,0.25);
    position: relative;
}
.wallet-flux-item .text-mute { color: rgba(255,255,255,0.85) !important; }
.wallet-flux-item .fw-700 { font-size: 1.4rem; color: white !important; }

@media (max-width: 720px) {
    .wallet-hero {
        grid-template-columns: 1fr;
        padding: 20px;
        gap: 16px;
    }
    .wallet-hero-main { gap: 14px; }
    .wallet-hero-icon { width: 56px; height: 56px; border-radius: 16px; }
    .wallet-hero-icon svg { width: 28px; height: 28px; }
    .wallet-hero-value { font-size: 1.8rem; }
    .wallet-hero-flux {
        flex-direction: row;
        padding-left: 0;
        padding-top: 14px;
        border-left: none;
        border-top: 1px solid rgba(255,255,255,0.25);
        justify-content: space-around;
    }
    .wallet-flux-item .fw-700 { font-size: 1.1rem; }
}

/* ---------------------------------------------------------------------
 * LISTE CLIENTS — grille de cards + contrôles
 * ------------------------------------------------------------------- */
.client-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    align-items: center;
}
.client-controls .search-bar { flex: 1; max-width: 360px; }

.view-toggle {
    display: inline-flex;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 3px;
    gap: 2px;
}
.view-btn {
    display: grid; place-items: center;
    width: 38px; height: 34px;
    border-radius: 999px;
    color: var(--text-soft);
    transition: all 0.2s var(--ease-ios);
}
.view-btn:hover { color: var(--primary); }
.view-btn.active {
    background: var(--primary-grad);
    color: white;
    box-shadow: var(--shadow-sm);
}
.view-btn svg { width: 16px; height: 16px; }

.client-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.client-card {
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 16px;
    box-shadow: var(--shadow-sm);
    color: var(--text);
    transition: all 0.25s var(--ease-ios);
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
}
.client-card::before {
    content: '';
    position: absolute; left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--success);
    opacity: 0;
    transition: opacity 0.2s;
}
.client-card.has-debt::before {
    opacity: 1;
    background: var(--danger);
}
.client-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: var(--primary);
}
.client-card-top {
    display: flex; align-items: center; gap: 12px;
    position: relative;
    padding-right: 60px; /* place pour le badge statut */
}
.client-card-meta { flex: 1; min-width: 0; }
.client-card-name {
    font-weight: 700; font-size: 1.02rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.client-card-sub {
    color: var(--text-mute); font-size: 0.82rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-top: 2px;
}
.client-card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 12px;
    background: var(--surface-2);
    border-radius: 12px;
}
.client-card-footer {
    display: flex; flex-wrap: wrap; gap: 6px;
    align-items: center;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}
.client-card-footer .text-mute { display: inline-flex; align-items: center; gap: 4px; }

@media (max-width: 720px) {
    .client-grid { grid-template-columns: 1fr; gap: 10px; }
    .client-card { padding: 14px; }
    .client-controls { gap: 6px; }
    .client-controls .search-bar { max-width: 100%; }
}

/* ---------------------------------------------------------------------
 * FICHE CLIENT premium — hero, score, tabs, quick actions
 * ------------------------------------------------------------------- */
.client-hero {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 24px;
    align-items: center;
    padding: 26px 28px;
    background: var(--primary-grad);
    color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glow);
    position: relative;
    overflow: hidden;
    margin-bottom: 14px;
}
.client-hero::before {
    content: '';
    position: absolute; inset: 0;
    background:
        radial-gradient(600px 200px at 100% 0%, rgba(255,255,255,0.18), transparent 60%),
        radial-gradient(400px 200px at 0% 100%, rgba(255,255,255,0.08), transparent 60%);
    pointer-events: none;
}
.client-hero-main {
    display: flex; align-items: center; gap: 18px;
    position: relative;
    min-width: 0;
}
.client-hero-main .avatar {
    background: rgba(255,255,255,0.25) !important;
    backdrop-filter: blur(8px);
    border: 2px solid rgba(255,255,255,0.4);
    width: 72px; height: 72px;
    font-size: 1.5rem;
}
.client-hero-meta { flex: 1; min-width: 0; }
.client-hero h1 {
    color: white;
    font-size: 1.7rem;
    margin-bottom: 6px;
}
.client-hero-sub {
    display: flex; gap: 14px; flex-wrap: wrap;
    color: rgba(255,255,255,0.85);
    font-size: 0.85rem;
}
.client-hero-sub span {
    display: inline-flex; align-items: center; gap: 5px;
}
.client-hero-sub svg { width: 14px; height: 14px; }
.client-hero-badges {
    display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap;
}
.client-hero-badges .badge {
    background: rgba(255,255,255,0.22) !important;
    color: white !important;
    backdrop-filter: blur(8px);
}

/* Score circulaire */
.client-score {
    display: flex; flex-direction: column;
    align-items: center; gap: 6px;
    position: relative;
}
.score-circle {
    position: relative;
    width: 80px; height: 80px;
}
.score-circle svg { width: 100%; height: 100%; transition: stroke-dasharray 1s var(--ease-ios); }
.score-value {
    position: absolute; inset: 0;
    display: grid; place-items: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}
.score-label { text-align: center; }
.score-title { font-weight: 700; font-size: 0.95rem; }
.score-sub { font-size: 0.72rem; opacity: 0.85; }

/* Quick actions bar */
.client-quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
    margin-bottom: 8px;
}
.quick-btn {
    display: flex; align-items: center; justify-content: center;
    gap: 6px;
    padding: 12px 10px;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s var(--ease-ios);
    box-shadow: var(--shadow-sm);
}
.quick-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.quick-btn.primary {
    background: var(--primary-grad);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-glow);
}
.quick-btn.primary:hover { color: white; }
.quick-btn.whatsapp { color: var(--whatsapp); border-color: rgba(37, 211, 102, 0.3); }
.quick-btn.whatsapp:hover { background: rgba(37, 211, 102, 0.08); border-color: var(--whatsapp); color: var(--whatsapp); }
.quick-btn svg { width: 16px; height: 16px; }

/* Tabs bar */
.tabs-bar {
    display: flex;
    gap: 4px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 4px;
    margin: 16px 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs-bar::-webkit-scrollbar { display: none; }
.tab-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 16px;
    border-radius: 10px;
    color: var(--text-soft);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.25s var(--ease-ios);
    white-space: nowrap;
    position: relative;
    flex-shrink: 0;
}
.tab-btn:hover { color: var(--text); background: var(--surface-solid); }
.tab-btn.active {
    background: var(--primary-grad);
    color: white;
    box-shadow: 0 4px 12px rgba(91, 108, 255, 0.32);
}
.tab-btn svg { width: 16px; height: 16px; }
.tab-badge {
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0 6px;
    border-radius: 999px;
    min-width: 18px;
    height: 18px;
    display: inline-grid;
    place-items: center;
}
.tab-btn.active .tab-badge { background: rgba(255,255,255,0.3); }

/* Panneaux */
.tab-panel { display: none; animation: fadeUp 0.35s var(--ease-ios) both; }
.tab-panel.active { display: block; }

/* Info-list (clé/valeur) */
.info-list {
    display: flex; flex-direction: column;
    gap: 0;
    margin: 0;
}
.info-list > div {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.info-list > div:last-child { border-bottom: none; }
.info-list dt { font-size: 0.78rem; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.info-list dd { margin: 0; font-weight: 500; }

@media (max-width: 720px) {
    .client-hero {
        grid-template-columns: 1fr;
        padding: 20px;
        gap: 18px;
        text-align: left;
    }
    .client-hero-main { gap: 14px; flex-direction: column; align-items: flex-start; text-align: left; }
    .client-hero-main .avatar { width: 60px; height: 60px; font-size: 1.2rem; }
    .client-hero h1 { font-size: 1.4rem; }
    .client-hero-sub { gap: 8px; font-size: 0.78rem; }
    .client-score {
        flex-direction: row;
        align-self: stretch;
        justify-content: flex-start;
        gap: 14px;
        background: rgba(255,255,255,0.15);
        padding: 10px 14px;
        border-radius: 12px;
        backdrop-filter: blur(8px);
    }
    .score-circle { width: 64px; height: 64px; }
    .score-value { font-size: 1.2rem; }
    .score-label { text-align: left; }

    .client-quick-actions {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }
    .quick-btn {
        padding: 10px 6px;
        flex-direction: column;
        gap: 4px;
        font-size: 0.7rem;
        line-height: 1.1;
    }
    .quick-btn svg { width: 18px; height: 18px; }

    .tabs-bar { margin: 12px -14px; padding: 4px 8px; border-radius: 0; border-left: none; border-right: none; }
    .tab-btn { padding: 7px 12px; font-size: 0.82rem; }
    .tab-btn span { display: inline; }

    .info-list > div { grid-template-columns: 1fr; gap: 2px; padding: 8px 0; }
}

/* ---------------------------------------------------------------------
 * NOUVEAU MODULE PAIEMENT — type tabs, echeance picker, recap, actions
 * ------------------------------------------------------------------- */
.payment-type-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.payment-tab {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--surface-solid);
    border: 2px solid var(--border);
    border-radius: 16px;
    color: var(--text);
    transition: all 0.25s var(--ease-ios);
}
.payment-tab:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.payment-tab.active {
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: var(--shadow-glow);
}
.payment-tab-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: grid; place-items: center;
    flex-shrink: 0;
}
.payment-tab-title { font-weight: 700; font-size: 1rem; }
.payment-tab-sub { font-size: 0.78rem; color: var(--text-mute); }

.client-pill {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    background: var(--primary-soft);
    border: 1px solid var(--primary);
    border-radius: 14px;
    margin-bottom: 14px;
}

.echeance-picker {
    display: flex; flex-direction: column;
    gap: 8px;
    max-height: 460px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 8px;
}
.echeance-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--surface-2);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s var(--ease-ios);
}
.echeance-row:hover {
    background: var(--surface-solid);
    border-color: var(--border-strong);
}
.echeance-row.selected {
    background: var(--primary-soft);
    border-color: var(--primary);
}
.echeance-row.preselected {
    border-color: var(--success);
}
.echeance-row input[type=checkbox] {
    width: 20px; height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}
.echeance-meta { flex: 1; min-width: 0; }
.echeance-title { font-weight: 600; font-size: 0.95rem; }
.echeance-sub {
    font-size: 0.78rem; color: var(--text-mute);
    margin-top: 2px;
    display: flex; align-items: center; gap: 4px;
    flex-wrap: wrap;
}
.echeance-amount { text-align: right; flex-shrink: 0; }
.echeance-amount .fw-700 { font-size: 1rem; }

.echeance-summary {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px;
    margin-top: 10px;
    background: var(--success-soft);
    border-radius: 12px;
    border: 1px solid var(--success);
}
.echeance-summary .fw-700 { font-size: 1.3rem; }

/* Method bars (paiements stats) */
.method-bars {
    display: flex; flex-direction: column;
    gap: 10px;
}
.method-bar {
    display: grid;
    grid-template-columns: 130px 1fr 120px;
    align-items: center;
    gap: 12px;
}
.method-bar-label { display: flex; flex-direction: column; gap: 1px; }
.method-bar-track {
    height: 10px;
    background: var(--bg-soft);
    border-radius: 999px;
    overflow: hidden;
}
.method-bar-fill {
    height: 100%;
    background: var(--primary-grad);
    border-radius: 999px;
    transition: width 0.6s var(--ease-ios);
}
.method-bar-value { text-align: right; font-size: 0.9rem; }
@media (max-width: 720px) {
    .method-bar { grid-template-columns: 1fr; gap: 4px; }
    .method-bar-value { text-align: left; }
}

/* RECAP page */
.recap-hero {
    display: flex; align-items: center; gap: 18px;
    padding: 22px 26px;
    background: var(--primary-grad);
    border-radius: 24px;
    color: white;
    box-shadow: var(--shadow-glow);
    position: relative;
    overflow: hidden;
}
.recap-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent 60%);
}
.recap-hero-icon {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    display: grid; place-items: center;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}
.recap-hero-icon svg { width: 30px; height: 30px; color: white; }
.recap-hero .text-mute { color: rgba(255,255,255,0.85) !important; }

.action-stack {
    display: flex; flex-direction: column;
    gap: 8px;
}
.action-btn {
    display: flex; align-items: center; gap: 12px;
    padding: 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text);
    transition: all 0.2s var(--ease-ios);
}
.action-btn:hover {
    background: var(--surface-solid);
    border-color: var(--primary);
    transform: translateX(2px);
}
.action-btn-icon {
    width: 40px; height: 40px;
    border-radius: 11px;
    background: var(--primary-soft);
    color: var(--primary);
    display: grid; place-items: center;
    flex-shrink: 0;
}
.action-btn-title { font-weight: 600; }
.action-btn-sub { font-size: 0.78rem; color: var(--text-mute); margin-top: 1px; }
.action-btn.whatsapp .action-btn-icon {
    background: rgba(37, 211, 102, 0.14);
    color: var(--whatsapp);
}
.action-btn.whatsapp:hover { border-color: var(--whatsapp); }

@media (max-width: 720px) {
    .payment-type-tabs { gap: 8px; }
    .payment-tab { padding: 12px; }
    .payment-tab-icon { width: 38px; height: 38px; }
    .echeance-picker { max-height: 360px; padding: 6px; }
    .echeance-row { padding: 10px 12px; gap: 10px; }
    .echeance-amount .fw-700 { font-size: 0.92rem; }
    .recap-hero { padding: 18px; gap: 14px; border-radius: 20px; }
    .recap-hero-icon { width: 52px; height: 52px; }
    .recap-hero > div:nth-child(2) > div:nth-child(3) { font-size: 1.6rem !important; }
}

/* ---------------------------------------------------------------------
 * Sélecteur type d'abonnement Starlink (Mini / Standard / Autre)
 * ------------------------------------------------------------------- */
.type-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}
.type-card {
    position: relative;
    display: flex; align-items: center; gap: 12px;
    padding: 16px;
    background: var(--surface-2);
    border: 2px solid var(--border);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.25s var(--ease-ios);
    overflow: hidden;
}
.type-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.type-card input[type=radio] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.type-card-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary);
    display: grid; place-items: center;
    flex-shrink: 0;
}
.type-card-body { flex: 1; min-width: 0; }
.type-card-title { font-weight: 700; font-size: 1rem; }
.type-card-price { font-size: 0.85rem; color: var(--text-mute); margin-top: 2px; }
.type-card-check {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border-strong);
    display: grid; place-items: center;
    transition: all 0.25s var(--ease-ios);
    color: transparent;
    flex-shrink: 0;
}
.type-card-check svg { width: 12px; height: 12px; }
.type-card.active {
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: var(--shadow-glow);
}
.type-card.active .type-card-check {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}
.type-card.active .type-card-icon {
    background: var(--primary);
    color: white;
}

/* ---------------------------------------------------------------------
 * Total box (récap calcul abonnement)
 * ------------------------------------------------------------------- */
.total-box {
    background: var(--primary-soft);
    border: 1px solid var(--primary);
    border-radius: 18px;
    padding: 18px;
    margin: 6px 0 18px;
    display: grid;
    grid-template-columns: 1.4fr auto;
    gap: 18px;
    align-items: center;
    background-image: linear-gradient(135deg, var(--primary-soft) 0%, rgba(139, 91, 255, 0.08) 100%);
}
.total-box-detail {
    display: flex; flex-direction: column; gap: 4px;
    font-size: 0.88rem;
}
.total-box-detail > div {
    display: flex; justify-content: space-between; gap: 14px;
}
.total-box-detail strong { color: var(--text); }
.total-box-final {
    text-align: right;
    padding-left: 14px;
    border-left: 1px solid var(--primary);
}
.total-box-value {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.02em;
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
    .total-box { grid-template-columns: 1fr; gap: 14px; }
    .total-box-final {
        border-left: none;
        border-top: 1px solid var(--primary);
        padding-left: 0;
        padding-top: 12px;
        text-align: center;
    }
    .total-box-value { font-size: 1.4rem; }
}

/* ---------------------------------------------------------------------
 * Liste des emails Starlink (sur fiche client)
 * ------------------------------------------------------------------- */
.email-row {
    display: grid;
    grid-template-columns: 2fr 1fr auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}
@media (max-width: 600px) {
    .email-row { grid-template-columns: 1fr auto; }
    .email-row .email-label { grid-column: 1 / -1; }
}

/* Ticket items — badges en flow */
.ticket-badges {
    display: flex; align-items: center; gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}

/* ---------------------------------------------------------------------
 * Ticket thread (messages)
 * ------------------------------------------------------------------- */
.ticket-thread { display: flex; flex-direction: column; gap: 12px; }
.ticket-msg {
    padding: 14px;
    background: var(--surface-2);
    border-radius: 14px;
    border-left: 3px solid var(--primary);
    animation: fadeUp 0.35s var(--ease-ios) both;
}
.ticket-msg--client { border-left-color: var(--success); background: var(--success-soft); }
.ticket-msg--systeme { border-left-color: var(--text-mute); background: var(--bg-soft); font-style: italic; opacity: 0.85; }
.ticket-msg-head {
    display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.ticket-msg-body { color: var(--text); line-height: 1.55; white-space: pre-wrap; }

/* ---------------------------------------------------------------------
 * Calendar
 * ------------------------------------------------------------------- */
.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px;
    box-shadow: var(--shadow-sm);
}
.calendar-head {
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 8px 0;
}
.calendar-cell {
    min-height: 100px;
    padding: 8px;
    border-radius: 12px;
    background: var(--surface-2);
    border: 1px solid transparent;
    transition: all 0.2s var(--ease-ios);
    position: relative;
    overflow: hidden;
}
.calendar-cell:hover { border-color: var(--primary); transform: scale(1.02); }
.calendar-cell.out { opacity: 0.4; }
.calendar-cell.today {
    background: var(--primary-soft);
    border-color: var(--primary);
}
.calendar-day {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 6px;
}
.calendar-cell.today .calendar-day { color: var(--primary); }
.calendar-event {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    margin-bottom: 4px;
    margin-right: 4px;
}
.calendar-event svg { width: 11px; height: 11px; }
.calendar-event.echeance { background: var(--primary-soft); color: var(--primary); }
.calendar-event.ticket { background: var(--warning-soft); color: var(--warning); }

.calendar-details {
    margin-top: 4px;
    font-size: 0.72rem;
    display: flex; flex-direction: column; gap: 2px;
}
.cal-pop {
    display: flex; align-items: center; gap: 4px;
    padding: 3px 6px;
    border-radius: 6px;
    color: var(--text-soft);
    background: var(--surface-solid);
    border: 1px solid var(--border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.15s;
}
.cal-pop:hover { background: var(--surface-3); color: var(--text); }

/* Calendar mobile : règles gérées dans le @media 900px plus bas */

/* ---------------------------------------------------------------------
 * Activity timeline
 * ------------------------------------------------------------------- */
.activity-timeline {
    display: flex; flex-direction: column; gap: 8px;
}
.activity-row {
    display: flex; align-items: center; gap: 14px;
    padding: 12px;
    border-radius: 14px;
    transition: background 0.2s;
    animation: fadeUp 0.3s var(--ease-ios) both;
}
.activity-row:hover { background: var(--surface-2); }
.activity-icon {
    width: 38px; height: 38px;
    border-radius: 11px;
    display: grid; place-items: center;
    flex-shrink: 0;
}
.activity-meta { flex: 1; min-width: 0; }
.activity-time { font-size: 0.78rem; flex-shrink: 0; }

/* ---------------------------------------------------------------------
 * Bulk list (sélection clients pour communications)
 * ------------------------------------------------------------------- */
.bulk-list {
    max-height: 460px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
}
.bulk-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}
.bulk-row:last-child { border-bottom: none; }
.bulk-row:hover { background: var(--surface-2); }
.bulk-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); }

/* ---------------------------------------------------------------------
 * Swipe-to-action (mobile)
 * ------------------------------------------------------------------- */
.swipe-row {
    position: relative;
    overflow: hidden;
    border-radius: 14px;
}
.swipe-content {
    transition: transform 0.3s var(--ease-spring);
    background: var(--surface-solid);
}
.swipe-actions {
    position: absolute; right: 0; top: 0; bottom: 0;
    display: flex;
}
.swipe-actions button {
    width: 80px;
    display: grid; place-items: center;
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
}
.swipe-actions .swipe-delete { background: var(--danger); }
.swipe-actions .swipe-action { background: var(--primary); }

/* utilitaires */
.text-mute { color: var(--text-mute); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-soft { color: var(--text-soft); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-700 { font-weight: 700; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 6px; } .gap-2 { gap: 10px; } .gap-3 { gap: 16px; }
.w-full { width: 100%; }
.hidden { display: none; }
.no-wrap { white-space: nowrap; }

/* =====================================================================
 * COUCHE PREMIUM v3 — finitions raffinées
 * États vides, focus accessibles, scrollbar, halo de connexion, boutons.
 * Construit uniquement sur les variables existantes (clair + sombre).
 * ===================================================================== */

/* --- États vides : badge d'icône premium + hiérarchie nette --- */
.empty { padding: 46px 24px; animation: fadeUp 0.5s var(--ease-ios) both; }
.empty svg {
    width: 26px; height: 26px;
    padding: 19px;
    box-sizing: content-box;
    margin: 0 auto 18px;
    color: var(--primary);
    background:
        radial-gradient(130% 130% at 50% 0%, var(--primary-soft), transparent 72%),
        var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: 50%;
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    opacity: 1;
    animation: emptyFloat 5.5s var(--ease-ios) infinite;
}
.empty h3 { color: var(--text); font-size: 1.06rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 5px; }
.empty p { color: var(--text-mute); font-size: 0.9rem; line-height: 1.5; max-width: 360px; margin: 0 auto; }
.empty .btn, .empty .empty-cta { margin-top: 18px; }
.empty .empty-cta { display: inline-flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
@keyframes emptyFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* --- Boutons primaires : reflet & halo premium au survol --- */
.btn-primary {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.16), transparent 42%), var(--primary-grad);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 36px rgba(91, 108, 255, 0.40), var(--shadow-inset);
}

/* --- Scrollbar premium, discrète, cohérente avec le thème --- */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 999px;
    border: 3px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-mute); background-clip: content-box; }

/* --- Focus visible : anneau accessible (éléments cliquables sans focus actuel) --- */
a:focus-visible, button:focus-visible, [role="button"]:focus-visible,
.btn:focus-visible, .filter-chip:focus-visible, .tab-btn:focus-visible, .icon-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-soft), 0 0 0 1px var(--primary);
}

/* --- Carte de connexion : liseré dégradé lumineux --- */
.auth-card { position: relative; }
.auth-card::before {
    content: "";
    position: absolute; inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(140deg, var(--primary) 0%, var(--primary-2) 35%, transparent 70%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
            mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    opacity: 0.55; pointer-events: none;
}
.brand-icon { animation: brandPulse 4s var(--ease-ios) infinite; }
@keyframes brandPulse {
    0%, 100% { box-shadow: var(--shadow-glow), var(--shadow-inset); }
    50% { box-shadow: 0 18px 50px rgba(91, 108, 255, 0.45), var(--shadow-inset); }
}

/* --- Rendu de police plus net --- */
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }

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