/* ============================================================
   PORTAIL CLIENT — ChatDirect
   Design Vitby.ai — Clean, airy, teal accent
   Light-first with dark toggle
   ============================================================ */

:root {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-hover: #f8fafc;
    --border: #e5e7eb;
    --text: #1a1a2e;
    --text-dim: #6b7280;
    --text-muted: #9ca3af;
    --indigo: #0d9488;
    --indigo-hover: #14b8a6;
    --indigo-subtle: rgba(13,148,136,0.06);
    --accent: #0d9488;
    --green: #22c55e;
    --red: #ef4444;
    --yellow: #eab308;
    --radius: 12px;
    --radius-sm: 8px;
    --s-xs: 4px;
    --s-sm: 8px;
    --s-md: 16px;
    --s-lg: 24px;
    --s-xl: 32px;
    --header-bg: #fafbfc;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
}

[data-theme="light"] {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-hover: #f8fafc;
    --border: #e5e7eb;
    --text: #1a1a2e;
    --text-dim: #6b7280;
    --text-muted: #9ca3af;
    --indigo-subtle: rgba(13,148,136,0.06);
    --header-bg: #fafbfc;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
}

[data-theme="dark"] {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface-hover: #22252f;
    --border: rgba(255,255,255,0.08);
    --text: #e5e7eb;
    --text-dim: #9ca3af;
    --text-muted: #6b7280;
    --indigo: #14b8a6;
    --indigo-hover: #2dd4bf;
    --indigo-subtle: rgba(20,184,166,0.08);
    --accent: #14b8a6;
    --header-bg: #141720;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
}

/* --- Midnight Blue Theme --- */
[data-theme="midnight"] {
    --bg: #0c1222;
    --surface: #131c31;
    --surface-hover: #1e2d4d;
    --border: rgba(59,130,246,0.12);
    --text: #e2e8f0;
    --text-dim: #94a3b8;
    --text-muted: #64748b;
    --indigo: #3b82f6;
    --indigo-hover: #2563eb;
    --indigo-subtle: rgba(59,130,246,0.08);
    --accent: #3b82f6;
    --green: #22c55e;
    --red: #ef4444;
    --yellow: #eab308;
    --header-bg: rgba(12,18,34,0.92);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
}

/* --- Forest Green Theme --- */
[data-theme="forest"] {
    --bg: #0b1610;
    --surface: #122118;
    --surface-hover: #1f3828;
    --border: rgba(34,197,94,0.12);
    --text: #dcfce7;
    --text-dim: #86efac;
    --text-muted: #6b9080;
    --indigo: #22c55e;
    --indigo-hover: #16a34a;
    --indigo-subtle: rgba(34,197,94,0.08);
    --accent: #22c55e;
    --green: #4ade80;
    --red: #ef4444;
    --yellow: #eab308;
    --header-bg: rgba(11,22,16,0.92);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
}

/* --- Warm Sunset Theme --- */
[data-theme="sunset"] {
    --bg: #18110c;
    --surface: #231812;
    --surface-hover: #3a271d;
    --border: rgba(245,158,11,0.12);
    --text: #fef3c7;
    --text-dim: #d4a574;
    --text-muted: #92714d;
    --indigo: #f59e0b;
    --indigo-hover: #d97706;
    --indigo-subtle: rgba(245,158,11,0.08);
    --accent: #f59e0b;
    --green: #22c55e;
    --red: #ef4444;
    --yellow: #fbbf24;
    --header-bg: rgba(24,17,12,0.92);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
}

/* --- Ocean Cyan Theme --- */
[data-theme="ocean"] {
    --bg: #0b1628;
    --surface: #101e38;
    --surface-hover: #1c3256;
    --border: rgba(6,182,212,0.12);
    --text: #ecfeff;
    --text-dim: #67e8f9;
    --text-muted: #5b8a95;
    --indigo: #06b6d4;
    --indigo-hover: #0891b2;
    --indigo-subtle: rgba(6,182,212,0.08);
    --accent: #06b6d4;
    --green: #22c55e;
    --red: #ef4444;
    --yellow: #eab308;
    --header-bg: rgba(11,22,40,0.92);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--indigo); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--indigo-hover); }

/* ============================================================
   LOGIN
   ============================================================ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--s-md);
    background: var(--bg);
}
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px var(--s-xl);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-md);
}
.login-logo {
    text-align: center;
    margin-bottom: var(--s-lg);
}
.logo-mark {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #0d9488, #14b8a6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--s-md);
}
.login-logo h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
}
.login-logo p {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-top: 4px;
}
.login-footer {
    text-align: center;
    margin-top: var(--s-lg);
    font-size: 0.75rem;
    color: var(--text-muted);
}
.theme-toggle {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 0.75rem;
    margin-bottom: var(--s-xs);
    transition: color 0.15s;
}
.theme-toggle:hover { color: var(--text); }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 240px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 100;
}
.sidebar-logo {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}
.sidebar-logo-mark {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--indigo), var(--indigo-hover, var(--indigo)));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sidebar-logo-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-nav {
    flex: 1;
    padding: 8px 0;
    overflow-y: auto;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    transition: color 0.15s, background 0.15s;
    border-left: 2px solid transparent;
}
.nav-link:hover {
    color: var(--text);
    background: var(--bg);
}
.nav-link.active {
    color: var(--accent, var(--indigo));
    border-left-color: var(--accent, var(--indigo));
    font-weight: 600;
}
.nav-link svg {
    width: 17px;
    height: 17px;
    opacity: 0.6;
    flex-shrink: 0;
}
.nav-link.active svg {
    opacity: 1;
}
.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 16px;
}
.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}
.sidebar-footer .nav-link {
    padding: 6px 0;
    border-left: none;
}
.sidebar-footer .nav-link:hover {
    background: none;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    margin-left: 240px;
    min-height: 100vh;
}
.topbar {
    height: 52px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-breadcrumb {
    flex: 1;
    font-size: 0.82rem;
    color: var(--text-dim);
}
.topbar-breadcrumb strong {
    color: var(--text);
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}
.topbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-dim);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
    font-size: 0.85rem;
}
.topbar-btn:hover {
    background: var(--bg);
    color: var(--text);
}
.topbar-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px;
    min-width: 150px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 200;
}
.topbar-dropdown.open {
    display: block;
}
.topbar-dropdown-item {
    display: block;
    width: 100%;
    padding: 7px 12px;
    font-size: 0.82rem;
    color: var(--text);
    text-decoration: none;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 4px;
    text-align: left;
    font-family: inherit;
    transition: background 0.15s;
}
.topbar-dropdown-item:hover {
    background: var(--bg);
}
.topbar-dropdown-item.active {
    color: var(--accent, var(--indigo));
    font-weight: 600;
}
.content-area {
    padding: 24px;
    max-width: 1140px;
}
.nav-burger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text);
    padding: 4px;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
}

/* ============================================================
   CARDS & BENTO
   ============================================================ */
.bento {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--s-md);
    margin-bottom: var(--s-lg);
}
.bento-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: box-shadow 0.2s;
}
.bento-card:hover {
    box-shadow: var(--shadow-sm);
}
.bento-label {
    font-size: 0.72rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
    margin-bottom: 6px;
}
.bento-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}
.bento-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: var(--s-lg);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--s-md);
}
.card-header h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.82rem;
}
th {
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
    background: transparent;
    border-top: none;
}
tr:hover td {
    background: var(--indigo-subtle);
}

/* ============================================================
   FORMS & BUTTONS
   ============================================================ */
.form-group {
    margin-bottom: var(--s-md);
}
.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-dim);
}
.form-group input, .form-group select {
    width: 100%;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px rgba(13,148,136,0.12);
}

[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select,
[data-theme="midnight"] .form-group input,
[data-theme="midnight"] .form-group select,
[data-theme="forest"] .form-group input,
[data-theme="forest"] .form-group select,
[data-theme="sunset"] .form-group input,
[data-theme="sunset"] .form-group select,
[data-theme="ocean"] .form-group input,
[data-theme="ocean"] .form-group select {
    background: var(--bg);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: var(--surface);
    color: var(--text);
    transition: all 0.15s;
    white-space: nowrap;
}
.btn:hover {
    background: var(--surface-hover);
    border-color: var(--text-dim);
}
.btn-primary {
    background: var(--indigo);
    color: #fff;
    border-color: transparent;
    font-weight: 600;
}
.btn-primary:hover {
    background: var(--indigo-hover);
    color: #fff;
    border-color: transparent;
}
.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
}
.btn-ghost:hover {
    background: var(--surface-hover);
    color: var(--text);
    border-color: var(--text-muted);
}
.btn-full {
    width: 100%;
    padding: 10px;
    justify-content: center;
}
.btn-sm {
    font-size: 0.75rem;
    padding: 4px 10px;
}
.btn-danger {
    background: var(--red);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.82rem;
    font-family: inherit;
    transition: opacity 0.15s;
}
.btn-danger:hover { opacity: 0.9; }

/* Alerts */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: var(--s-md);
    display: flex;
    align-items: center;
    gap: 8px;
}
.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}
.alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

[data-theme="dark"] .alert-error,
[data-theme="midnight"] .alert-error,
[data-theme="forest"] .alert-error,
[data-theme="sunset"] .alert-error,
[data-theme="ocean"] .alert-error {
    background: rgba(239,68,68,0.1);
    border-color: rgba(239,68,68,0.2);
    color: #fca5a5;
}
[data-theme="dark"] .alert-success,
[data-theme="midnight"] .alert-success,
[data-theme="forest"] .alert-success,
[data-theme="sunset"] .alert-success,
[data-theme="ocean"] .alert-success {
    background: rgba(34,197,94,0.1);
    border-color: rgba(34,197,94,0.2);
    color: #86efac;
}

/* Dropdown open state */
.portal-lang-dropdown.open {
    display: block !important;
}

/* Live chat badge */
.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    background: #ef4444;
    border-radius: 10px;
    margin-left: auto;
}

.empty {
    text-align: center;
    padding: var(--s-xl) var(--s-md);
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 20px;
    background: rgba(13,148,136,0.08);
    color: var(--indigo);
    letter-spacing: 0.01em;
}

[data-theme="dark"] .badge,
[data-theme="midnight"] .badge,
[data-theme="forest"] .badge,
[data-theme="sunset"] .badge,
[data-theme="ocean"] .badge {
    background: rgba(20,184,166,0.12);
}

/* ============================================================
   MESSAGES (conversation view)
   ============================================================ */
.message {
    margin-bottom: var(--s-sm);
    padding: 10px var(--s-md);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    line-height: 1.65;
}
.message-user {
    background: rgba(13,148,136,0.06);
    border: 1px solid rgba(13,148,136,0.12);
}
.message-bot {
    background: var(--surface-hover);
    border: 1px solid var(--border);
}

[data-theme="dark"] .message-user,
[data-theme="midnight"] .message-user,
[data-theme="forest"] .message-user,
[data-theme="sunset"] .message-user,
[data-theme="ocean"] .message-user {
    background: rgba(20,184,166,0.08);
    border-color: rgba(20,184,166,0.15);
}

.message-role {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    margin-bottom: 3px;
}
.message-time {
    font-size: 0.68rem;
    color: var(--text-muted);
    float: right;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: var(--s-lg);
    color: var(--text);
}

/* ============================================================
   DASHBOARD GRIDS
   ============================================================ */
.dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-lg);
    margin-bottom: var(--s-lg);
}
.dash-secondary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: var(--s-lg);
}

/* ============================================================
   TABS
   ============================================================ */
.tabs, .config-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.tab {
    padding: 10px 18px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
    font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active {
    color: var(--accent, var(--indigo));
    border-bottom-color: var(--accent, var(--indigo));
    font-weight: 600;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   FORM ENHANCEMENTS
   ============================================================ */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.85rem;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
    resize: vertical;
    min-height: 80px;
}

[data-theme="dark"] .form-group textarea,
[data-theme="midnight"] .form-group textarea,
[data-theme="forest"] .form-group textarea,
[data-theme="sunset"] .form-group textarea,
[data-theme="ocean"] .form-group textarea {
    background: var(--bg);
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px rgba(13,148,136,0.12);
}
.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0.5rem;
}
.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--indigo);
    cursor: pointer;
}
.checkbox-group label {
    font-size: 0.85rem;
    margin-bottom: 0;
    color: var(--text);
    cursor: pointer;
}
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
input[type="color"] {
    width: 50px;
    height: 36px;
    padding: 2px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--surface);
}

/* ============================================================
   CONFIG SECTIONS
   ============================================================ */
.config-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 1.5rem;
}
.config-section h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

/* ============================================================
   COLOR ROWS (bot-config)
   ============================================================ */
.color-row {
    display: flex;
    align-items: center;
    gap: var(--s-sm);
}
.color-row input[type="color"] {
    flex-shrink: 0;
}
.color-row .color-hex {
    font-size: 0.78rem;
    color: var(--text-dim);
    font-family: 'SF Mono', 'Fira Code', monospace;
    min-width: 70px;
}

/* ============================================================
   HORAIRE GRID (bot-config)
   ============================================================ */
.horaire-grid {
    width: 100%;
    border-collapse: collapse;
}
.horaire-grid th,
.horaire-grid td {
    padding: 0.5rem 0.6rem;
    font-size: 0.82rem;
    border-bottom: 1px solid var(--border);
}
.horaire-grid th {
    text-align: left;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
    font-weight: 600;
}
.horaire-grid input[type="time"] {
    padding: 6px 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 0.82rem;
    transition: border-color 0.15s;
}

[data-theme="dark"] .horaire-grid input[type="time"],
[data-theme="midnight"] .horaire-grid input[type="time"],
[data-theme="forest"] .horaire-grid input[type="time"],
[data-theme="sunset"] .horaire-grid input[type="time"],
[data-theme="ocean"] .horaire-grid input[type="time"] {
    background: var(--bg);
}

.horaire-grid input[type="time"]:focus {
    outline: none;
    border-color: var(--indigo);
}
.horaire-grid input[type="checkbox"] {
    width: auto;
    accent-color: var(--indigo);
}
.horaire-jour-label {
    text-transform: capitalize;
    font-weight: 500;
}

/* ============================================================
   MODEL GROUP (bot-config)
   ============================================================ */
.model-group {
    transition: opacity 0.2s;
}

/* ============================================================
   PIPELINE
   ============================================================ */
.pipeline-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--s-md);
    align-items: flex-start;
}
.pipeline-col {
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-height: 200px;
}

[data-theme="dark"] .pipeline-col,
[data-theme="midnight"] .pipeline-col,
[data-theme="forest"] .pipeline-col,
[data-theme="sunset"] .pipeline-col,
[data-theme="ocean"] .pipeline-col {
    background: var(--bg);
}

.pipeline-col-header {
    padding: var(--s-md);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.pipeline-col-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
}
.pipeline-count {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
}
.pipeline-col-body {
    padding: var(--s-sm);
    display: flex;
    flex-direction: column;
    gap: var(--s-sm);
    transition: background 0.2s;
    border: 2px solid transparent;
    min-height: 100px;
}
.pipeline-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    transition: all 0.15s;
}
.pipeline-card:hover {
    border-color: var(--indigo);
    box-shadow: 0 2px 8px rgba(13,148,136,0.08);
}
.pipeline-card-name {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 2px;
    color: var(--text);
}
.pipeline-card-email {
    font-size: 0.75rem;
    color: var(--text-dim);
    word-break: break-all;
}
.pipeline-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.72rem;
    color: var(--text-muted);
}
.pipeline-card-actions {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    flex-wrap: wrap;
}
.pipeline-move-btn {
    padding: 3px 8px;
    font-size: 0.68rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-dim);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}
.pipeline-move-btn:hover {
    background: var(--surface-hover);
    color: var(--text);
}

/* Drag and drop */
.pipeline-card[draggable="true"] { cursor: grab; transition: opacity 0.2s, transform 0.2s; }
.pipeline-card[draggable="true"]:active { cursor: grabbing; }
.pipeline-card.dragging { opacity: 0.4; transform: scale(0.95); }
.pipeline-col-body.drag-over {
    background: rgba(13,148,136,0.06);
    border: 2px dashed var(--indigo);
    border-radius: var(--radius-sm);
}

[data-theme="dark"] .pipeline-col-body.drag-over,
[data-theme="midnight"] .pipeline-col-body.drag-over,
[data-theme="forest"] .pipeline-col-body.drag-over,
[data-theme="sunset"] .pipeline-col-body.drag-over,
[data-theme="ocean"] .pipeline-col-body.drag-over {
    background: rgba(20,184,166,0.08);
}

/* Score dots */
.score-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 3px;
}

/* ============================================================
   CRM DASHBOARD
   ============================================================ */
.crm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-lg);
    margin-bottom: var(--s-lg);
}
.crm-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--s-sm);
    margin-bottom: var(--s-lg);
}
.crm-metric {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--s-md);
    text-align: center;
    transition: box-shadow 0.2s;
}
.crm-metric:hover { box-shadow: var(--shadow-sm); }
.crm-metric-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--indigo);
}
.crm-metric-label {
    font-size: 0.72rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
    font-weight: 500;
}

/* Funnel */
.funnel-bar {
    display: flex;
    align-items: center;
    gap: var(--s-sm);
    margin-bottom: var(--s-sm);
}
.funnel-label {
    width: 100px;
    font-size: 0.82rem;
    font-weight: 500;
    text-align: right;
    flex-shrink: 0;
    color: var(--text);
}
.funnel-track {
    flex: 1;
    height: 32px;
    background: var(--surface-hover);
    border-radius: 6px;
    overflow: hidden;
}

[data-theme="dark"] .funnel-track,
[data-theme="midnight"] .funnel-track,
[data-theme="forest"] .funnel-track,
[data-theme="sunset"] .funnel-track,
[data-theme="ocean"] .funnel-track {
    background: var(--bg);
}

.funnel-fill {
    height: 100%;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    transition: width 0.5s;
    min-width: 30px;
}
.funnel-pct {
    font-size: 0.72rem;
    color: var(--text-dim);
    width: 50px;
    text-align: left;
    flex-shrink: 0;
}

/* Hot leads */
.hot-lead-row {
    display: flex;
    align-items: center;
    gap: var(--s-sm);
    padding: 8px var(--s-md);
    border-bottom: 1px solid var(--border);
    font-size: 0.82rem;
    transition: background 0.15s;
}
.hot-lead-row:last-child { border-bottom: none; }
.hot-lead-row:hover { background: var(--indigo-subtle); }
.hot-lead-name {
    font-weight: 600;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
}
.hot-lead-email {
    color: var(--text-dim);
    font-size: 0.75rem;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Score badge */
.score-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 20px;
    min-width: 28px;
    text-align: center;
}
.score-badge-sm {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    background: #10b981;
}
.score-high { background: #dcfce7; color: #166534; }

[data-theme="dark"] .score-high,
[data-theme="midnight"] .score-high,
[data-theme="forest"] .score-high,
[data-theme="sunset"] .score-high,
[data-theme="ocean"] .score-high { background: rgba(34,197,94,0.15); color: #86efac; }

/* Source table */
.source-table {
    width: 100%;
    font-size: 0.82rem;
}
.source-table th {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-dim);
    letter-spacing: 0.05em;
    padding: var(--s-xs) var(--s-sm);
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-weight: 600;
}
.source-table td {
    padding: var(--s-xs) var(--s-sm);
    border-bottom: 1px solid var(--border);
}

/* ============================================================
   LEADS
   ============================================================ */
.leads-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--s-sm);
    margin-bottom: var(--s-lg);
}
.leads-stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--s-md);
    text-align: center;
    transition: box-shadow 0.2s;
}
.leads-stat-card:hover { box-shadow: var(--shadow-sm); }
.leads-stat-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
}
.leads-stat-label {
    font-size: 0.72rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
    font-weight: 500;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 20px;
}
.status-badge-lg {
    display: inline-block;
    padding: 3px 14px;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 20px;
}
.status-form {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ============================================================
   LEAD DETAIL
   ============================================================ */
.lead-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-lg);
}
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-md);
    font-size: 0.88rem;
}
.info-label {
    color: var(--text-dim);
    font-size: 0.72rem;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 28px;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}
.timeline-item {
    position: relative;
    margin-bottom: 18px;
}
.timeline-dot {
    position: absolute;
    left: -24px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--surface);
}
.timeline-dot.capture { background: var(--indigo); border-color: var(--indigo); }
.timeline-dot.relance { background: #f59e0b; border-color: #f59e0b; }
.timeline-dot.status_change { background: #8b5cf6; border-color: #8b5cf6; }
.timeline-dot.note { background: #06b6d4; border-color: #06b6d4; }
.timeline-dot.assign { background: #ec4899; border-color: #ec4899; }
.timeline-dot.message { background: #10b981; border-color: #10b981; }
.timeline-dot.tag { background: #a855f7; border-color: #a855f7; }
.timeline-dot.reminder_done { background: #22c55e; border-color: #22c55e; }
.timeline-date {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.timeline-text {
    font-size: 0.85rem;
    margin-top: 2px;
    word-break: break-word;
    color: var(--text);
}

/* ============================================================
   RELANCE CONFIG
   ============================================================ */
.relance-step-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: var(--s-md);
    transition: opacity 0.2s;
}
.relance-step-header {
    display: flex;
    align-items: center;
    gap: var(--s-sm);
    margin-bottom: var(--s-md);
}
.relance-step-num {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    background: var(--indigo);
}
.relance-step-title {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text);
}
.relance-step {
    display: flex;
    align-items: flex-start;
    gap: var(--s-sm);
}
.relance-num {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
}
.relance-row {
    margin-bottom: var(--s-sm);
}

/* Variables help */
.vars-help {
    background: var(--indigo-subtle);
    border: 1px solid rgba(13,148,136,0.15);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: var(--s-lg);
}
.vars-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}
.var-tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.75rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--indigo);
}

/* ============================================================
   CALENDAR
   ============================================================ */
.cal-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.cal-table th {
    padding: 8px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.cal-cell {
    padding: 4px;
    vertical-align: top;
    min-height: 90px;
    height: 90px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}
.cal-cell:hover { background: var(--indigo-subtle); }
.cal-cell.today { background: rgba(13,148,136,0.06); }
.cal-cell.empty { background: var(--surface-hover); cursor: default; }
.cal-cell.empty:hover { background: var(--surface-hover); }

[data-theme="dark"] .cal-cell.today,
[data-theme="midnight"] .cal-cell.today,
[data-theme="forest"] .cal-cell.today,
[data-theme="sunset"] .cal-cell.today,
[data-theme="ocean"] .cal-cell.today { background: rgba(20,184,166,0.08); }
[data-theme="dark"] .cal-cell.empty,
[data-theme="midnight"] .cal-cell.empty,
[data-theme="forest"] .cal-cell.empty,
[data-theme="sunset"] .cal-cell.empty,
[data-theme="ocean"] .cal-cell.empty { background: var(--bg); }
[data-theme="dark"] .cal-cell.empty:hover,
[data-theme="midnight"] .cal-cell.empty:hover,
[data-theme="forest"] .cal-cell.empty:hover,
[data-theme="sunset"] .cal-cell.empty:hover,
[data-theme="ocean"] .cal-cell.empty:hover { background: var(--bg); }

.cal-day {
    font-size: 0.78rem;
    margin-bottom: 4px;
    color: var(--text-dim);
}
.cal-day.today {
    font-weight: 700;
    color: var(--indigo);
}
.cal-rem {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.65rem;
    padding: 2px 4px;
    margin-bottom: 2px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.15s;
}
.cal-rem:hover { opacity: 0.8; }
.cal-rem.done { text-decoration: line-through; opacity: 0.5; }
.cal-rem .cal-check {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1.5px solid currentColor;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    flex-shrink: 0;
    cursor: pointer;
    background: none;
    color: inherit;
}
.cal-rem-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.cal-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 200;
    backdrop-filter: blur(2px);
}
.cal-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    width: 90%;
    max-width: 400px;
    z-index: 201;
    box-shadow: 0 16px 48px rgba(0,0,0,0.15);
    display: none;
}

[data-theme="dark"] .cal-modal-overlay,
[data-theme="midnight"] .cal-modal-overlay,
[data-theme="forest"] .cal-modal-overlay,
[data-theme="sunset"] .cal-modal-overlay,
[data-theme="ocean"] .cal-modal-overlay {
    background: rgba(0,0,0,0.5);
}
[data-theme="dark"] .cal-modal,
[data-theme="midnight"] .cal-modal,
[data-theme="forest"] .cal-modal,
[data-theme="sunset"] .cal-modal,
[data-theme="ocean"] .cal-modal {
    box-shadow: 0 16px 48px rgba(0,0,0,0.4);
}

/* ============================================================
   HELP / DOCS
   ============================================================ */
.help-section {
    margin-bottom: var(--s-lg);
}
.help-content {
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text);
}
.help-content h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: var(--s-md) 0 var(--s-sm);
    color: var(--text);
}

/* ============================================================
   PDF PRINT
   ============================================================ */
.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.header-right {
    text-align: right;
    font-size: 0.72rem;
    color: var(--text-dim);
}
.metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.metric {
    text-align: center;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--indigo);
}
.metric-label {
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.footer {
    margin-top: 40px;
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

@media print {
    .no-print { display: none !important; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .pipeline-grid { grid-template-columns: repeat(2, 1fr); }
    .crm-metrics { grid-template-columns: repeat(2, 1fr); }
    .crm-grid { grid-template-columns: 1fr; }
    .metrics { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 200;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay.open {
        display: block;
    }
    .main-content {
        margin-left: 0;
    }
    .content-area {
        padding: var(--s-md);
    }
    .nav-burger {
        display: block;
    }
    .bento { grid-template-columns: repeat(2, 1fr); gap: var(--s-sm); }
    .bento-value { font-size: 1.5rem; }
    .dash-grid { grid-template-columns: 1fr; }
    .lead-grid { grid-template-columns: 1fr; }
    .info-grid { grid-template-columns: 1fr; }
    table { min-width: 500px; }
    .form-row { grid-template-columns: 1fr; }
    .tabs, .config-tabs { gap: 0; }
    .tab { padding: 8px 12px; font-size: 0.78rem; }
    .leads-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .bento { grid-template-columns: 1fr 1fr; }
    .card { padding: var(--s-md); }
    .pipeline-grid { grid-template-columns: 1fr; }
    .leads-stats { grid-template-columns: 1fr 1fr; }
    .login-card { padding: 24px 20px; }
}

/* ============================================================
   SELECTION & SCROLLBAR
   ============================================================ */
::selection {
    background: rgba(13,148,136,0.2);
    color: var(--text);
}

[data-theme="dark"] ::selection,
[data-theme="midnight"] ::selection,
[data-theme="forest"] ::selection,
[data-theme="sunset"] ::selection,
[data-theme="ocean"] ::selection {
    background: rgba(20,184,166,0.3);
}

/* Subtle 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);
}
