/* ============================================
   DIGITEYES CRM — Dark Luxury Theme
   ============================================ */

:root {
    --bg-dark: #08080d;
    --bg-surface: #111118;
    --bg-card: #181822;
    --bg-card-hover: #1e1e2c;
    --bg-input: #14141e;
    --border: #2a2a3a;
    --border-light: #222233;
    --gold: #c9a96e;
    --gold-dim: #a08550;
    --gold-bright: #e0c78a;
    --text: #e8e8ec;
    --text-muted: #8888a0;
    --text-dim: #555568;
    --white: #ffffff;
    --red: #ef4444;
    --green: #22c55e;
    --blue: #6366f1;
    --purple: #8b5cf6;
    --amber: #f59e0b;
    --cyan: #06b6d4;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --sidebar-w: 220px;
    --topbar-h: 60px;
    --filters-h: 50px;
    --detail-w: 480px;
    --transition: 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ---- Sidebar ---- */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition);
}
.sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-w))); }

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}
.logo-icon {
    width: 36px; height: 36px;
    background: var(--gold);
    color: var(--bg-dark);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 18px;
}
.logo-text {
    font-weight: 600;
    font-size: 15px;
    line-height: 1.2;
}
.logo-text small {
    font-weight: 400;
    font-size: 11px;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.nav-links {
    list-style: none;
    padding: 12px 8px;
    flex: 1;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    margin-bottom: 2px;
}
.nav-item:hover {
    background: var(--bg-card);
    color: var(--text);
}
.nav-item.active {
    background: var(--bg-card);
    color: var(--gold);
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 20px;
    background: var(--gold);
    border-radius: 0 3px 3px 0;
}
.nav-item svg { flex-shrink: 0; }
.badge {
    background: var(--red);
    color: white;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: auto;
    font-weight: 600;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.btn-sync {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    transition: all var(--transition);
}
.btn-sync:hover { border-color: var(--gold); color: var(--gold); }
.btn-sync.syncing svg { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.auth-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-dim);
}
.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
}
.status-dot.online { background: var(--green); }
.status-dot.offline { background: var(--red); }

/* ---- Main Content ---- */
.main-content {
    margin-left: var(--sidebar-w);
    height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition);
}
.sidebar.collapsed ~ .main-content { margin-left: 0; }

/* ---- Top Bar ---- */
.topbar {
    height: var(--topbar-h);
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
    flex-shrink: 0;
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.topbar-center { flex: 1; max-width: 480px; }
.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.view-title {
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
}
.search-box:focus-within { border-color: var(--gold-dim); }
.search-box svg { color: var(--text-dim); flex-shrink: 0; }
.search-box input {
    background: none;
    border: none;
    color: var(--text);
    font-size: 13px;
    width: 100%;
    outline: none;
}
.search-box input::placeholder { color: var(--text-dim); }

/* ---- Buttons ---- */
.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}
.btn-icon:hover { background: var(--bg-card); color: var(--text); }

.btn-primary {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--gold);
    color: var(--bg-dark);
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}
.btn-primary:hover { background: var(--gold-bright); }
.btn-primary.btn-sm { padding: 5px 10px; font-size: 12px; }

.btn-ghost {
    padding: 8px 14px;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: var(--radius);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
}
.btn-ghost:hover { border-color: var(--text-dim); color: var(--text); }
.btn-ghost.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-ghost.danger:hover { border-color: var(--red); color: var(--red); }

.btn-text {
    background: none;
    border: none;
    color: var(--gold);
    cursor: pointer;
    font-size: 12px;
    padding: 4px;
    transition: color var(--transition);
}
.btn-text:hover { color: var(--gold-bright); }
.btn-text.btn-sm { font-size: 11px; }

/* ---- Filters Bar ---- */
.filters-bar {
    padding: 8px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-surface);
    flex-shrink: 0;
}
.filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
}
.filter-group label {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.filter-group select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 4px 8px;
    border-radius: var(--radius);
    font-size: 12px;
    outline: none;
    cursor: pointer;
}
.filter-group select:focus { border-color: var(--gold-dim); }

/* ---- Views ---- */
.views-container {
    flex: 1;
    overflow: hidden;
    position: relative;
}
.view {
    display: none;
    height: 100%;
    overflow: auto;
}
.view.active { display: block; }

/* ---- Kanban ---- */
.kanban-board {
    display: flex;
    gap: 12px;
    padding: 20px;
    height: 100%;
    overflow-x: auto;
}
.kanban-column {
    min-width: 240px;
    max-width: 280px;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.column-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
}
.column-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.column-header h3 {
    font-size: 13px;
    font-weight: 600;
    flex: 1;
}
.column-count {
    background: var(--bg-card);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    color: var(--text-dim);
}
.column-cards {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
    min-height: 100px;
}

/* Kanban Card */
.kanban-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 8px;
    cursor: grab;
    transition: all var(--transition);
}
.kanban-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border);
}
.kanban-card.sortable-ghost {
    opacity: 0.4;
    border-color: var(--gold);
}
.kanban-card.sortable-chosen {
    border-color: var(--gold);
    box-shadow: 0 8px 32px rgba(201,169,110,0.15);
}
.card-agency {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 4px;
}
.card-contact {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.card-date {
    font-size: 11px;
    color: var(--text-dim);
}
.card-date.overdue { color: var(--red); font-weight: 500; }
.card-date.today { color: var(--amber); font-weight: 500; }
.card-stars {
    font-size: 11px;
    color: var(--gold);
}
.card-type {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-dark);
    color: var(--text-dim);
}
.card-type.prioritaire { color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
.card-type.principale { color: var(--amber); border: 1px solid rgba(245,158,11,0.3); }
.card-type.secondaire { color: var(--text-dim); border: 1px solid var(--border); }

/* ---- Table ---- */
.table-wrapper {
    padding: 20px;
    overflow: auto;
    height: 100%;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}
.data-table th:hover { color: var(--text-muted); }
.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    vertical-align: middle;
}
.data-table tr:hover td { background: var(--bg-card); }
.data-table tr { cursor: pointer; }

.status-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}
.status-pill.recherche { background: rgba(99,102,241,0.15); color: var(--blue); }
.status-pill.contacte { background: rgba(245,158,11,0.15); color: var(--amber); }
.status-pill.relance { background: rgba(139,92,246,0.15); color: var(--purple); }
.status-pill.rdv { background: rgba(6,182,212,0.15); color: var(--cyan); }
.status-pill.proposition { background: rgba(201,169,110,0.15); color: var(--gold); }
.status-pill.gagne { background: rgba(34,197,94,0.15); color: var(--green); }
.status-pill.perdu { background: rgba(239,68,68,0.15); color: var(--red); }

/* ---- Dashboard ---- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    padding: 20px;
    max-width: 1200px;
}
.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px;
    grid-column: span 1;
}
.kpi-card.accent {
    border-color: var(--gold-dim);
    background: linear-gradient(135deg, var(--bg-card), rgba(201,169,110,0.08));
}
.kpi-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 8px;
}
.kpi-value {
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}
.kpi-card.accent .kpi-value { color: var(--gold); }

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px;
    grid-column: span 2;
    height: 280px;
    position: relative;
}
.chart-card.wide { grid-column: span 2; }
.chart-card h3 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-muted);
}
.chart-card canvas {
    max-height: 220px !important;
    width: 100% !important;
}

/* ---- Timeline ---- */
.timeline-container {
    padding: 24px 28px;
    max-width: 860px;
}
.timeline-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dim);
}

/* Day group */
.tl-stream { display: flex; flex-direction: column; gap: 28px; }
.tl-day-group {}
.tl-day-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.tl-day-label {
    font-family: 'Playfair Display', serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.3px;
}
.tl-day-rel {
    font-size: 11px;
    color: var(--gold);
    background: rgba(201,169,110,0.12);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}
.tl-day-count {
    font-size: 11px;
    color: var(--text-dim);
    margin-left: auto;
}
.tl-day-items { display: flex; flex-direction: column; gap: 0; }

/* Card */
.tl-card {
    display: flex;
    gap: 14px;
    padding: 0;
    min-height: 64px;
}
.tl-card-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 36px;
    flex-shrink: 0;
}
.tl-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}
.tl-icon--email       { background: rgba(99,102,241,0.15); }
.tl-icon--linkedin    { background: rgba(0,119,181,0.18); }
.tl-icon--linkedin-visit { background: rgba(0,119,181,0.10); }
.tl-icon--rdv         { background: rgba(6,182,212,0.15); }
.tl-icon--enrich      { background: rgba(139,92,246,0.15); }
.tl-icon--data        { background: rgba(34,197,94,0.15); }
.tl-icon--planning    { background: rgba(245,158,11,0.15); }
.tl-icon--note        { background: rgba(136,136,160,0.12); }

.tl-rail {
    width: 2px;
    flex: 1;
    background: var(--border-light);
    min-height: 12px;
}
.tl-card:last-child .tl-rail { background: transparent; }

.tl-card-body {
    flex: 1;
    padding: 6px 0 18px 0;
    min-width: 0;
}
.tl-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.tl-tag {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
}
.tl-tag--email       { color: #a5b4fc; background: rgba(99,102,241,0.18); }
.tl-tag--linkedin    { color: #7ec8e3; background: rgba(0,119,181,0.18); }
.tl-tag--linkedin-visit { color: #7ec8e3; background: rgba(0,119,181,0.10); }
.tl-tag--rdv         { color: #67e8f9; background: rgba(6,182,212,0.18); }
.tl-tag--enrich      { color: #c4b5fd; background: rgba(139,92,246,0.18); }
.tl-tag--data        { color: #86efac; background: rgba(34,197,94,0.18); }
.tl-tag--planning    { color: #fcd34d; background: rgba(245,158,11,0.18); }
.tl-tag--note        { color: var(--text-muted); background: rgba(136,136,160,0.12); }

.tl-agency-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--gold);
}
.tl-contact-name {
    font-size: 12px;
    color: var(--text-muted);
}
.tl-contact-name::before { content: '/'; margin-right: 6px; color: var(--text-dim); }
.tl-card-detail {
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.5;
}
.tl-card-result {
    font-size: 12px;
    color: var(--gold-dim);
    margin-top: 5px;
    padding: 5px 10px;
    background: rgba(201,169,110,0.06);
    border-left: 2px solid var(--gold-dim);
    border-radius: 0 4px 4px 0;
}

/* ---- Base Agences ---- */
.base-container { padding: 24px 28px; }
.base-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}
.base-stats {
    display: flex;
    gap: 16px;
    align-items: center;
}
.base-stat {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}
.base-stat.active { color: var(--text); }
.base-stat-num { font-weight: 700; color: var(--gold); font-size: 18px; }
.base-stat-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.base-stat-dot.green { background: var(--green); }
.base-stat-dot.red { background: var(--red); opacity: 0.6; }
.base-search {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 14px;
    color: var(--text);
    font-size: 13px;
    width: 240px;
    outline: none;
}
.base-search:focus { border-color: var(--gold-dim); }
.base-search::placeholder { color: var(--text-dim); }
.base-filters {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.base-filter-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 7px 10px;
    color: var(--text);
    font-size: 12px;
    outline: none;
    cursor: pointer;
}
.base-filter-select:focus { border-color: var(--gold-dim); }

.base-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}
.base-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    position: relative;
    transition: border-color var(--transition), transform var(--transition);
}
.base-card:hover { border-color: var(--border); transform: translateY(-1px); }
.base-card--active { border-left: 3px solid var(--green); }
.base-card--inactive { border-left: 3px solid rgba(239,68,68,0.35); opacity: 0.75; }
.base-card--inactive:hover { opacity: 1; }

.base-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.base-indicator {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.base-indicator.green { background: var(--green); box-shadow: 0 0 6px rgba(34,197,94,0.4); }
.base-indicator.red { background: var(--red); opacity: 0.5; }
.base-card-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.base-card-stars {
    font-size: 12px;
    flex-shrink: 0;
}
.base-card-ville {
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 8px;
}
.base-card-sectors {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}
.base-sector-tag {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 7px;
    border-radius: 3px;
    color: var(--gold);
    background: rgba(201,169,110,0.12);
}
.base-card-clients {
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 10px;
}
.base-card-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    color: var(--text-dim);
}
.base-card-source {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 3px;
}
.base-card-collab { }
.base-card-link {
    color: var(--gold-dim);
    text-decoration: none;
    margin-left: auto;
}
.base-card-link:hover { color: var(--gold); text-decoration: underline; }
.base-card-badge {
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--green);
    background: rgba(34,197,94,0.12);
    padding: 3px 8px;
    border-radius: 4px;
}

/* ---- Reminders ---- */
.reminders-container {
    padding: 20px 24px;
    max-width: 800px;
}
.reminders-section { margin-bottom: 24px; }
.reminders-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}
.reminders-title.overdue { color: var(--red); }
.reminders-title.today { color: var(--amber); }
.reminders-title.upcoming { color: var(--text-muted); }

.reminder-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all var(--transition);
}
.reminder-card:hover { border-color: var(--border); background: var(--bg-card-hover); }
.reminder-card.overdue { border-left: 3px solid var(--red); }
.reminder-card.today { border-left: 3px solid var(--amber); }
.reminder-agency {
    font-weight: 600;
    font-size: 13px;
    min-width: 140px;
}
.reminder-action {
    flex: 1;
    font-size: 13px;
    color: var(--text-muted);
}
.reminder-date {
    font-size: 12px;
    color: var(--text-dim);
    white-space: nowrap;
}

/* ---- Detail Panel ---- */
.detail-panel {
    position: fixed;
    top: 0; right: 0;
    width: var(--detail-w);
    height: 100vh;
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 200;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 32px rgba(0,0,0,0.3);
}
.detail-panel.open { transform: translateX(0); }

.detail-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}
.detail-title-group { flex: 1; }
.detail-title-group h2 {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    font-weight: 600;
}
.detail-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    background: rgba(201,169,110,0.15);
    color: var(--gold);
    margin-top: 4px;
}
.detail-actions-top {
    display: flex;
    gap: 6px;
}

.detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}
.detail-section {
    margin-bottom: 24px;
}
.detail-section h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.detail-field {
    font-size: 12px;
}
.detail-field .label {
    color: var(--text-dim);
    display: block;
    margin-bottom: 2px;
}
.detail-field .value {
    color: var(--text);
}
.detail-field .value a {
    color: var(--gold);
    text-decoration: none;
}
.detail-field .value a:hover { text-decoration: underline; }

/* Detail contacts */
.contact-card {
    padding: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    margin-bottom: 8px;
}
.contact-name { font-weight: 600; font-size: 13px; }
.contact-role { font-size: 12px; color: var(--text-muted); }
.contact-info { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.contact-info a { color: var(--gold); text-decoration: none; }

/* Notes */
.notes-area {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 10px;
}
.note-item {
    padding: 8px 10px;
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--text-muted);
    border-left: 2px solid var(--gold-dim);
}
.notes-input {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.notes-input textarea {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 8px;
    font-size: 12px;
    font-family: inherit;
    resize: vertical;
    outline: none;
}
.notes-input textarea:focus { border-color: var(--gold-dim); }

/* Detail timeline */
.detail-timeline .tl-item {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    font-size: 12px;
}
.tl-item .tl-date {
    color: var(--text-dim);
    white-space: nowrap;
    min-width: 65px;
}
.tl-item .tl-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--gold);
    flex-shrink: 0;
    margin-top: 4px;
}
.tl-item .tl-text { color: var(--text-muted); }

/* ---- Overlay ---- */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.overlay.visible { opacity: 1; pointer-events: auto; }

/* ---- Modal ---- */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.modal.open { opacity: 1; pointer-events: auto; }
.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 640px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
}
.modal-form { padding: 20px; }
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}
.form-group label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    margin-bottom: 4px;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--gold-dim); }
.form-group.full { grid-column: span 2; }

.checkbox-row {
    display: flex;
    gap: 16px;
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: var(--gold);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
    margin-top: 12px;
}

/* ---- Toast ---- */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 400;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 13px;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease;
    max-width: 320px;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--gold); }
@keyframes slideIn {
    from { transform: translateX(100px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ---- Table Toolbar & Toggle ---- */
.table-toolbar {
    padding: 12px 20px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}
.toggle-group {
    display: flex;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.toggle-btn {
    padding: 6px 16px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}
.toggle-btn:hover { color: var(--text-muted); }
.toggle-btn.active {
    background: var(--gold);
    color: var(--bg-dark);
    font-weight: 600;
}

/* ---- Actions View ---- */
.actions-container {
    padding: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.actions-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}
.actions-columns {
    display: flex;
    gap: 12px;
    flex: 1;
    overflow-x: auto;
}
.actions-column {
    flex: 1;
    min-width: 280px;
    max-width: 400px;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.actions-column-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
}
.actions-column-header h3 {
    font-size: 13px;
    font-weight: 600;
    flex: 1;
}
.actions-list {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
    min-height: 100px;
}

/* ---- Action Cards (expandable) ---- */
.action-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 0;
    margin-bottom: 8px;
    transition: all var(--transition);
    overflow: hidden;
}
.action-card:hover {
    border-color: var(--border);
}
.action-card.expanded {
    border-color: var(--gold-dim);
    background: var(--bg-surface);
}

/* Card header — always visible, clickable */
.action-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
}
.action-card-header:hover { background: rgba(255,255,255,0.02); }
.action-card-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.action-card-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.action-expand-icon {
    font-size: 10px;
    color: var(--text-dim);
    width: 14px;
    text-align: center;
}

.action-type-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}
.action-type-badge.email { background: rgba(99,102,241,0.15); color: var(--blue); }
.action-type-badge.linkedin { background: rgba(0,119,181,0.15); color: #0077b5; }
.action-type-badge.comment { background: rgba(139,92,246,0.15); color: var(--purple); }
.action-type-badge.call { background: rgba(6,182,212,0.15); color: var(--cyan); }
.action-type-badge.other { background: rgba(136,136,160,0.15); color: var(--text-muted); }

.action-card-agency {
    font-weight: 600;
    font-size: 12px;
    color: var(--gold);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.action-card-contact-inline {
    font-size: 11px;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.action-date {
    font-size: 11px;
    color: var(--text-dim);
    white-space: nowrap;
}

/* Subject line */
.action-card-subject {
    font-size: 13px;
    font-weight: 500;
    padding: 0 12px 6px;
    cursor: pointer;
}

/* Preview (collapsed) */
.action-card-preview {
    font-size: 12px;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    padding: 0 12px 8px;
    line-height: 1.4;
    cursor: pointer;
}

/* Expanded content area */
.action-card-expanded {
    padding: 0 12px 8px;
    border-top: 1px solid var(--border-light);
    margin-top: 4px;
}

/* Full content display */
.action-card-content-full {
    margin-top: 10px;
}
.action-card-content-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 6px;
    font-weight: 600;
}
.action-card-content-body {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
}

/* Internal notes */
.action-card-notes {
    margin-top: 10px;
}
.action-card-notes-body {
    font-size: 12px;
    color: var(--text-muted);
    border-left: 2px solid var(--gold-dim);
    padding-left: 12px;
    line-height: 1.5;
}
.action-card-done-date {
    margin-top: 8px;
    font-size: 11px;
    color: var(--green);
    font-weight: 500;
}

/* LinkedIn post/profile embed */
.action-linkedin-post {
    background: rgba(0,119,181,0.06);
    border: 1px solid rgba(0,119,181,0.2);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-top: 10px;
    margin-bottom: 4px;
}
.action-linkedin-post-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #0077b5;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.action-linkedin-post-link {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    word-break: break-all;
    margin-bottom: 8px;
    text-decoration: none;
}
.action-linkedin-post-link:hover {
    color: #0077b5;
    text-decoration: underline;
}

/* Toolbar — always visible at bottom of card */
.action-card-toolbar {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    border-top: 1px solid var(--border-light);
    background: rgba(0,0,0,0.15);
}

.action-btn {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: none;
    color: var(--text-dim);
    font-size: 11px;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 4px;
}
.action-btn:hover { border-color: var(--text-muted); color: var(--text); background: rgba(255,255,255,0.03); }
.action-btn.approve { color: var(--green); border-color: rgba(34,197,94,0.3); font-weight: 600; }
.action-btn.approve:hover { background: rgba(34,197,94,0.12); }
.action-btn.done { color: var(--blue); border-color: rgba(99,102,241,0.3); font-weight: 600; }
.action-btn.done:hover { background: rgba(99,102,241,0.12); }

.btn-xs {
    padding: 2px 8px;
    font-size: 10px;
    border: 1px solid rgba(0,119,181,0.3);
    color: #0077b5;
    background: none;
    border-radius: 4px;
    cursor: pointer;
}
.btn-xs:hover { background: rgba(0,119,181,0.1); }

/* Action content preview modal */
.action-preview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 350;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.action-preview-overlay.open { opacity: 1; pointer-events: auto; }
.action-preview-content {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
    padding: 24px;
}
.action-preview-content h3 {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    margin-bottom: 4px;
}
.action-preview-meta {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.action-preview-body {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 16px;
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-wrap;
    color: var(--text);
    margin-bottom: 16px;
}
.action-preview-notes {
    font-size: 12px;
    color: var(--text-muted);
    border-left: 2px solid var(--gold-dim);
    padding-left: 12px;
    margin-bottom: 16px;
}
.action-preview-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.action-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.action-preview-header h3 {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
}
.action-preview-text {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 16px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text);
    margin-top: 8px;
}
.actions-empty {
    color: var(--text-dim);
    font-size: 13px;
    padding: 16px;
    text-align: center;
}

/* ---- Contact Detail Modal ---- */
.contact-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 350;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    background: rgba(0,0,0,0.6);
}
.contact-modal.open { opacity: 1; pointer-events: auto; }
.contact-modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}
.contact-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.contact-modal-header h3 {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
}
.contact-modal-body {
    padding: 20px;
}
.contact-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}
.contact-detail-field {
    font-size: 13px;
}
.contact-detail-field .label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    margin-bottom: 3px;
}
.contact-detail-field .value {
    color: var(--text);
    word-break: break-word;
}
.contact-detail-field .value a {
    color: var(--gold);
    text-decoration: none;
}
.contact-detail-field .value a:hover { text-decoration: underline; }
.contact-detail-field.full { grid-column: span 2; }

.contact-linkedin-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}
.contact-linkedin-section h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #0077b5;
    margin-bottom: 10px;
}
.li-action-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: 6px;
    font-size: 12px;
}
.li-action-item .li-status {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
}
.li-action-item .li-status.fait { background: rgba(34,197,94,0.15); color: var(--green); }
.li-action-item .li-status.afaire { background: rgba(245,158,11,0.15); color: var(--amber); }

.contact-history-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}
.contact-history-section h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 10px;
}

/* ---- Clickable contact cards ---- */
.contact-card.clickable {
    cursor: pointer;
    transition: all var(--transition);
}
.contact-card.clickable:hover {
    border-color: var(--gold-dim);
    background: var(--bg-card-hover);
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .detail-panel { width: 100%; }
    .form-row { grid-template-columns: 1fr; }
    .form-group.full { grid-column: span 1; }
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
    .chart-card, .chart-card.wide { grid-column: span 2; }
    .contact-modal-content { width: 95%; }
    .contact-detail-grid { grid-template-columns: 1fr; }
    .contact-detail-field.full { grid-column: span 1; }
}
