/* ═══════════════════════════════════════════════════════
   Xpert-iA Command Center — Dashboard Stylesheet
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ── Tokens ── */
:root {
    /* Surfaces */
    --surface-0: #F0EDFA;
    --surface-1: #FFFFFF;
    --surface-2: #F8F7FC;
    --surface-raised: #FFFFFF;

    /* Sidebar */
    --sidebar-bg: #0D0620;
    --sidebar-hover: rgba(124, 58, 237, 0.12);
    --sidebar-active: rgba(124, 58, 237, 0.22);
    --sidebar-text: rgba(255,255,255,0.75);
    --sidebar-text-active: #FFFFFF;
    --sidebar-w: 252px;
    --sidebar-w-collapsed: 68px;
    --sidebar-border: rgba(255,255,255,0.04);

    /* Brand */
    --accent: #7C3AED;
    --accent-hover: #6D28D9;
    --accent-muted: rgba(124, 58, 237, 0.08);
    --accent-glow: rgba(124, 58, 237, 0.15);

    /* Text */
    --text-primary: #1A1235;
    --text-secondary: #6B6585;
    --text-tertiary: #9B95AD;
    --text-inverse: #FFFFFF;

    /* Status */
    --success: #10B981;
    --success-bg: #ECFDF5;
    --success-text: #065F46;
    --error: #EF4444;
    --error-bg: #FEF2F2;
    --error-text: #991B1B;
    --warning: #F59E0B;
    --warning-bg: #FFFBEB;
    --warning-text: #92400E;

    /* Borders & Shadows */
    --border: rgba(0,0,0,0.06);
    --border-strong: rgba(0,0,0,0.10);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);

    /* Radius */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Motion */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration: 0.2s;
}

/* ── Dark Theme ── */
[data-theme="dark"] {
    --surface-0: #09060F;
    --surface-1: #13101C;
    --surface-2: #1A1525;
    --surface-raised: #1A1525;
    --sidebar-bg: #06030C;
    --text-primary: #EDE9F6;
    --text-secondary: #9B93B0;
    --text-tertiary: #6B6380;
    --accent-muted: rgba(124, 58, 237, 0.15);
    --accent-glow: rgba(124, 58, 237, 0.25);
    --border: rgba(255,255,255,0.06);
    --border-strong: rgba(255,255,255,0.10);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.4);
    --success-bg: rgba(16,185,129,0.1);
    --success-text: #6EE7B7;
    --error-bg: rgba(239,68,68,0.1);
    --error-text: #FCA5A5;
    --warning-bg: rgba(245,158,11,0.1);
    --warning-text: #FCD34D;
}

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

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--surface-0);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; transition: color var(--duration) var(--ease); }
a:hover { color: var(--accent-hover); }
a.btn:hover { color: inherit; }
a.btn-primary:hover { color: white; }
a.btn-ghost:hover { color: var(--accent); }

/* ══════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════ */

.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width 0.25s var(--ease);
    border-right: 1px solid var(--sidebar-border);
}

.sidebar.collapsed { width: var(--sidebar-w-collapsed); }

/* Sidebar Header */
.sb-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
}

.sb-logo {
    height: 36px;
    width: auto;
    border-radius: 8px;
    object-fit: contain;
    transition: height 0.2s var(--ease);
}

.sidebar.collapsed .sb-logo {
    height: 28px;
}

/* Collapse toggle */
.sb-collapse {
    position: absolute;
    right: -13px;
    top: 26px;
    width: 26px; height: 26px;
    background: var(--accent);
    border: 3px solid var(--surface-0);
    border-radius: 50%;
    color: white;
    font-size: 0.65rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    z-index: 110;
    transition: all 0.2s var(--ease);
    box-shadow: 0 2px 8px rgba(124,58,237,0.3);
}
.sb-collapse:hover { transform: scale(1.15); box-shadow: 0 4px 12px rgba(124,58,237,0.4); }
.sidebar.collapsed .sb-collapse { transform: rotate(180deg); }
.sidebar.collapsed .sb-collapse:hover { transform: rotate(180deg) scale(1.15); }

/* Sidebar Nav */
.sb-nav { flex: 1; padding: 8px 10px; overflow-y: auto; }

.sb-section {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255,255,255,0.7);
    padding: 20px 14px 6px;
    white-space: nowrap;
    transition: opacity 0.15s var(--ease);
}
.sidebar.collapsed .sb-section { opacity: 0; height: 12px; padding: 6px 0; }

.sb-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s var(--ease);
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    white-space: nowrap;
    position: relative;
}

.sb-link:hover {
    background: var(--sidebar-hover);
    color: rgba(255,255,255,0.85);
    text-decoration: none;
}

.sb-link.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
}

.sb-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.sb-link .icon {
    width: 20px;
    height: 20px;
    text-align: center;
    font-size: 1.05rem;
    flex-shrink: 0;
    transition: transform 0.15s var(--ease);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sb-link .icon svg {
    display: block;
}

.sb-link:hover .icon { transform: scale(1.1); }

.sb-link .label {
    opacity: 1;
    transition: opacity 0.15s var(--ease);
}

.sidebar.collapsed .sb-link .label { opacity: 0; width: 0; overflow: hidden; }
.sidebar.collapsed .sb-link { justify-content: center; padding: 10px; }

/* Sidebar Footer */
.sb-footer {
    padding: 12px 10px;
    border-top: 1px solid var(--sidebar-border);
}

.sb-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: background 0.15s var(--ease);
}

.sb-user:hover { background: var(--sidebar-hover); }

.sb-avatar {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), #A78BFA);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    color: white;
    flex-shrink: 0;
}

.sb-user-info { overflow: hidden; }
.sb-user-info .name { font-size: 0.82rem; font-weight: 600; color: rgba(255,255,255,0.85); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-info .role { font-size: 0.7rem; color: rgba(255,255,255,0.35); font-family: 'JetBrains Mono', monospace; }
.sidebar.collapsed .sb-user-info { display: none; }

/* ══════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════ */

.main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    transition: margin-left 0.25s var(--ease);
    padding: 28px 36px 60px;
}

.sidebar.collapsed ~ .main { margin-left: var(--sidebar-w-collapsed); }

/* Page Title */
.page-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.page-title h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.page-title .meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* ── Stats Strip ── */
.stats-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    margin-bottom: 32px;
}

.stat {
    background: linear-gradient(135deg, var(--surface-raised) 0%, rgba(124,58,237,0.04) 100%);
    border: 1px solid rgba(124,58,237,0.12);
    border-radius: var(--radius);
    padding: 20px 22px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all var(--duration) var(--ease);
    position: relative;
    overflow: hidden;
}

.stat::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 20px rgba(124,58,237,0.15), 0 0 0 1px rgba(124,58,237,0.1);
    transform: translateY(-1px);
}

.stat:hover::before { opacity: 1; }

.stat-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.stat-icon.purple { background: linear-gradient(135deg, rgba(124,58,237,0.15), rgba(124,58,237,0.08)); color: #a78bfa; }
.stat-icon.green { background: linear-gradient(135deg, rgba(34,197,94,0.15), rgba(34,197,94,0.08)); color: #4ade80; }
.stat-icon.amber { background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(245,158,11,0.08)); color: #fbbf24; }

.stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    background: linear-gradient(135deg, var(--text-primary) 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 2px;
}

/* ══════════════════════════════════════
   ROBOT CARDS
   ══════════════════════════════════════ */

.robots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 18px;
    margin-bottom: 32px;
}

.robot-card {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all 0.25s var(--ease);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.robot-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), #A78BFA);
    opacity: 0;
    transition: opacity 0.25s var(--ease);
}

.robot-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--accent-glow);
    transform: translateY(-2px);
}

.robot-card:hover::before { opacity: 1; }

.robot-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.robot-identity {
    display: flex;
    align-items: center;
    gap: 12px;
}

.robot-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    background: var(--accent-muted);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
}

.robot-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.robot-version {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.robot-card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 18px;
    padding: 14px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
}

.robot-stat-item {
    display: flex;
    flex-direction: column;
}

.robot-stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.robot-stat-label {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.robot-card-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

/* Legacy robots — grayed out */
.robot-card--legacy {
    opacity: 0.55;
    cursor: default;
    position: relative;
}

.robot-card--legacy:hover {
    transform: none;
    box-shadow: var(--shadow);
    border-color: var(--border);
}

.robot-card--legacy::before { display: none; }

.robot-card--legacy .robot-icon { filter: grayscale(0.5); }

.robot-legacy-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    background: var(--surface-2);
    padding: 3px 8px;
    border-radius: 4px;
}
.robot-new-badge {    position: absolute;    top: 12px;    left: 12px;    font-family: 'JetBrains Mono', monospace;    font-size: 0.6rem;    font-weight: 700;    text-transform: uppercase;    letter-spacing: 0.08em;    color: #fff;    background: linear-gradient(135deg, #10b981, #059669);    padding: 3px 10px;    border-radius: 4px;    z-index: 2;    animation: pulse-new 2s ease-in-out infinite;}@keyframes pulse-new {    0%, 100% { opacity: 1; }    50% { opacity: 0.7; }}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 0.82rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s var(--ease);
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 12px rgba(124,58,237,0.25); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-strong);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-muted); }

.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-xs { padding: 4px 10px; font-size: 0.72rem; }
.btn-danger { color: var(--error); border-color: var(--error-bg); background: var(--error-bg); }
.btn-danger:hover { background: var(--error); color: white; }

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.badge-active { background: var(--success-bg); color: var(--success-text); }
.badge-cancelled { background: var(--error-bg); color: var(--error-text); }
.badge-version { background: var(--accent-muted); color: var(--accent); }

/* ── Cards ── */
.card {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 12px;
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.card-head h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; }

th {
    text-align: left;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border-strong);
}

td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

td strong { color: var(--text-primary); font-weight: 600; }

tr { transition: background 0.1s var(--ease); }
tr:hover td { background: var(--surface-2); }

/* ── Search ── */
.search-input {
    padding: 9px 14px;
    padding-left: 36px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    color: var(--text-primary);
    background: var(--surface-1);
    width: 280px;
    transition: all var(--duration) var(--ease);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239B95AD' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ── Alerts ── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid;
}

.alert-success { background: var(--success-bg); color: var(--success-text); border-color: rgba(16,185,129,0.15); }
.alert-error { background: var(--error-bg); color: var(--error-text); border-color: rgba(239,68,68,0.15); }
.alert-warning { background: var(--warning-bg); color: var(--warning-text); border-color: rgba(245,158,11,0.15); }

/* ── Forms ── */
.form-group { margin-bottom: 10px; }
.form-group label { display: block; font-weight: 600; font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.04em; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 9px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-family: inherit; font-size: 0.88rem; color: var(--text-primary); background: var(--surface-1); transition: all var(--duration) var(--ease); }
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Login ── */
.login-wrapper { max-width: 420px; margin: 80px auto; }
.login-card { background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-lg); }
.login-header { background: var(--sidebar-bg); padding: 28px 32px; text-align: center; }
.login-header img { height: 36px; border-radius: 8px; margin-bottom: 8px; }
.login-header h1 { color: white; font-size: 1.1rem; font-weight: 600; }
.login-header p { color: rgba(255,255,255,0.4); font-size: 0.78rem; font-family: 'JetBrains Mono', monospace; margin-top: 2px; }
.login-body { padding: 28px 32px; }
.login-body .btn { width: 100%; justify-content: center; padding: 11px; }

/* ── Empty ── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-tertiary); }
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.5; }

/* ── Activity Chart ── */
.chart-wrap { padding: 4px 0; }
.bar-chart { display: flex; align-items: flex-end; gap: 2px; height: 100px; }
.bar {
    flex: 1;
    min-width: 4px;
    border-radius: 2px 2px 0 0;
    background: var(--accent);
    opacity: 0.5;
    transition: all 0.2s var(--ease);
    position: relative;
    cursor: pointer;
}
.bar:hover { opacity: 1; }
.bar .tip { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--text-primary); color: var(--surface-0); padding: 4px 8px; border-radius: 4px; font-family: 'JetBrains Mono', monospace; font-size: 0.65rem; white-space: nowrap; display: none; pointer-events: none; z-index: 10; }
.bar:hover .tip { display: block; }

/* ── Utility ── */
.text-muted { color: var(--text-tertiary); }
.text-sm { font-size: 0.8rem; }
.text-mono { font-family: 'JetBrains Mono', monospace; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 10px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar { width: var(--sidebar-w-collapsed); }
    .sidebar .label, .sidebar .sb-section, .sb-wordmark, .sb-user-info { display: none !important; }
    .sb-link { justify-content: center; padding: 10px; }
    .main { margin-left: var(--sidebar-w-collapsed); padding: 20px; }
    .robots-grid { grid-template-columns: 1fr; }
    .stats-strip { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
}

/* ── Animations ── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-in { animation: fadeUp 0.4s var(--ease) both; }
.animate-in:nth-child(1) { animation-delay: 0.05s; }
.animate-in:nth-child(2) { animation-delay: 0.1s; }
.animate-in:nth-child(3) { animation-delay: 0.15s; }
.animate-in:nth-child(4) { animation-delay: 0.2s; }
.animate-in:nth-child(5) { animation-delay: 0.25s; }
.animate-in:nth-child(6) { animation-delay: 0.3s; }

/* btn-outline (used in various places) */
.btn-outline {
    background: transparent;
    color: var(--accent);
    border-color: var(--accent);
}
.btn-outline:hover {
    background: var(--accent-muted);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

/* Checkbox labels always nowrap */
label:has(input[type="checkbox"]) { white-space: nowrap; }
input[type="checkbox"] + label, label > input[type="checkbox"] { white-space: nowrap; }

/* ═══ Sidebar User Menu (restored) ═══ */
.sb-user-row {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
}
.sb-user-row .sb-user { flex: 1; cursor: pointer; }
.sb-menu-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.35);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.15s;
    display: flex;
    align-items: center;
}
.sb-menu-btn:hover { background: var(--sidebar-hover); color: rgba(255,255,255,0.7); }
.sb-user-menu {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--sidebar-bg, #0D0620);
    border: 1px solid var(--sidebar-border);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 6px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
    z-index: 50;
}
.sb-user-menu.open { display: block; }
.sb-user-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    color: rgba(255,255,255,0.7);
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.12s;
}
.sb-user-menu-item:hover { background: var(--sidebar-hover); color: #fff; }
.sb-user-menu-logout { color: #EF4444; }
.sb-user-menu-logout:hover { background: rgba(239,68,68,0.1); color: #EF4444; }
.sb-user-menu form { margin: 0; }
.sidebar.collapsed .sb-menu-btn { display: none; }
.sidebar.collapsed .sb-user-menu { display: none !important; }

/* ═══ Integrations (restored) ═══ */
.integration-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.integration-card { background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; transition: border-color 0.15s; }
.integration-card:hover { border-color: var(--accent); }
.integration-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.integration-icon { font-size:1.4rem; width:32px; height:32px; display:flex; align-items:center; justify-content:center; background:var(--surface-2); border-radius:8px; flex-shrink:0; }
.integration-name { font-weight: 600; font-size: 0.88rem; flex: 1; }
.integration-desc { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.5; margin-bottom: 12px; }
.integration-actions { display: flex; gap: 6px; }

/* Integration Modal */
.integration-modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.5); backdrop-filter:blur(4px); z-index:100; display:flex; align-items:center; justify-content:center; padding:20px; }
.integration-modal { background:var(--surface-raised,#1A1525); border:1px solid var(--border); width:min(500px,95%); max-height:calc(100vh - 40px); border-radius:var(--radius,12px); overflow:hidden; display:flex; flex-direction:column; box-shadow:0 20px 60px rgba(0,0,0,0.4); }
.integration-modal-header { padding:14px 18px; border-bottom:1px solid var(--border); display:flex; justify-content:space-between; align-items:center; }
.integration-modal-title { display:flex; align-items:center; gap:10px; font-weight:700; font-size:0.95rem; }
.integration-modal-close { background:none; border:1px solid var(--border); border-radius:50%; width:28px; height:28px; cursor:pointer; font-size:1rem; color:var(--text-secondary); display:flex; align-items:center; justify-content:center; }
.integration-modal-close:hover { background:var(--surface-2); color:var(--text-primary); }
.integration-modal-body { padding:14px 18px; overflow-y:auto; flex:1; }
.integration-modal-body .form-group { margin-bottom:14px; }
.integration-modal-footer { padding:12px 18px; border-top:1px solid var(--border); display:flex; align-items:center; gap:12px; }
.integration-modal-message { font-size:0.8rem; font-weight:500; }
.integration-modal-message.success { color:var(--success,#10B981); }
.integration-modal-message.error { color:var(--error,#EF4444); }

.input-full { width:100%; padding:7px 12px; border:1px solid var(--border-strong); border-radius:var(--radius-sm); font-family:inherit; font-size:0.88rem; color:var(--text-primary); background:var(--surface-1); }
.input-full:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-glow); }

.toggle-switch { position:relative; display:inline-block; width:36px; height:20px; }
.toggle-switch input { opacity:0; width:0; height:0; }
.toggle-slider { position:absolute; cursor:pointer; inset:0; background:var(--border-strong); border-radius:20px; transition:0.2s; }
.toggle-slider:before { content:''; position:absolute; height:14px; width:14px; left:3px; bottom:3px; background:#fff; border-radius:50%; transition:0.2s; }
.toggle-switch input:checked + .toggle-slider { background:var(--accent); }
.toggle-switch input:checked + .toggle-slider:before { transform:translateX(16px); }

/* ═══ Invoice Table ═══ */
.inv-table { width:100%; border-collapse:collapse; font-size:0.82rem; }
.inv-table th { text-align:left; font-size:0.72rem; font-weight:600; color:var(--text-secondary); padding:10px 14px; border-bottom:1px solid var(--border); text-transform:uppercase; letter-spacing:0.04em; }
.inv-table td { padding:10px 14px; border-bottom:1px solid var(--border); vertical-align:middle; }
.inv-table tbody tr:last-child td { border-bottom:none; }
.inv-table tbody tr:hover { background:var(--surface-2,rgba(124,58,237,.03)); }
.inv-amount { font-weight:700; font-variant-numeric:tabular-nums; }

/* ═══ Sidebar Badges ═══ */
.sb-link { position: relative; }
.sb-badge {
    margin-left: auto;
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 6px;
    border-radius: 10px;
    background: rgba(124,92,252,0.2);
    color: #A78BFA;
    white-space: nowrap;
    flex-shrink: 0;
}
.sidebar.collapsed .sb-badge { display: none; }

/* ═══ Dossiers Table ═══ */
.doss-bar { display:flex; align-items:center; gap:12px; margin-bottom:14px; flex-wrap:wrap; }
.doss-bar .search { flex:1; min-width:180px; padding:7px 12px; border:1px solid var(--border-strong); border-radius:var(--radius-sm); font-family:inherit; font-size:0.88rem; color:var(--text-primary); background:var(--surface-1); }
.doss-bar .search:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-glow); }
.doss-actions { display:flex; gap:6px; }
.doss-mass { display:flex; gap:6px; align-items:center; }
.doss-table { width:100%; border-collapse:collapse; font-size:0.82rem; }
.doss-table th { text-align:left; font-size:0.68rem; font-weight:600; color:var(--text-secondary); padding:8px 6px; border-bottom:1px solid var(--border); text-transform:uppercase; letter-spacing:0.04em; }
.doss-table td { padding:6px; border-bottom:1px solid var(--border); vertical-align:middle; }
.doss-table tbody tr:last-child td { border-bottom:none; }
.doss-table tbody tr:hover { background:var(--surface-2,rgba(124,58,237,.03)); }
.doss-table input.cell-edit { width:100%; padding:4px 6px; border:1px solid transparent; border-radius:4px; background:transparent; color:var(--text-primary); font-size:0.82rem; font-family:inherit; transition:all 0.15s; }
.doss-table input.cell-edit:hover { border-color:var(--border); }
.doss-table input.cell-edit:focus { outline:none; border-color:var(--accent); background:var(--surface-1); box-shadow:0 0 0 2px var(--accent-glow); }
.doss-table .cell-mono { font-family:'JetBrains Mono',monospace; font-size:0.78rem; }
.doss-table .cb { width:16px; height:16px; cursor:pointer; accent-color:var(--accent); }
.cell-warn { color:var(--warning,#F59E0B); }
.cell-warn-icon { margin-right:2px; }

/* ═══ Badges ═══ */
.badge { font-size:0.65rem; font-weight:600; padding:2px 8px; border-radius:12px; text-transform:uppercase; letter-spacing:0.04em; display:inline-block; }
.badge-active { background:rgba(16,185,129,0.1); color:var(--success,#10B981); }
.badge-muted { background:var(--surface-2,rgba(255,255,255,0.05)); color:var(--text-tertiary); }
.badge-cancelled { background:rgba(239,68,68,0.1); color:var(--error,#EF4444); }
.badge-success { background:rgba(16,185,129,0.1); color:var(--success,#10B981); }
.badge-version { background:rgba(124,92,252,0.1); color:var(--accent,#7C5CFC); }

/* ═══ Coming Soon ═══ */
.coming-soon-card { background:var(--surface-raised); border:1px solid var(--border); border-radius:var(--radius); padding:28px 24px; text-align:center; }
.coming-soon-badge { display:inline-block; font-size:0.72rem; font-weight:700; padding:4px 12px; background:rgba(124,92,252,0.12); color:var(--accent,#7C5CFC); border-radius:20px; margin-bottom:14px; }
.coming-soon-desc { font-size:0.88rem; color:var(--text-secondary); line-height:1.7; max-width:560px; margin:0 auto 18px; }
.coming-soon-footer { margin-top:16px; }
.coming-soon-notify { font-size:0.82rem; color:var(--text-tertiary); }
.coming-soon-notify .btn { margin-top:10px; }
.coming-soon-tabs-preview { margin-top:18px; }
.coming-soon-tabs-label { font-size:0.75rem; font-weight:600; color:var(--text-secondary); margin-bottom:8px; }
.coming-soon-tabs-list { display:flex; flex-wrap:wrap; gap:8px; justify-content:center; }
.coming-soon-tab { font-size:0.78rem; padding:5px 14px; background:var(--surface-2); border:1px solid var(--border); border-radius:20px; color:var(--text-secondary); }

/* ═══ Integrations Tabs ═══ */
.integrations-tabs { display:flex; gap:0; margin-bottom:20px; border-bottom:2px solid var(--border,#2E2E52); }
.integrations-tab { padding:10px 18px; background:none; border:none; color:var(--text-muted,#8B8BA3); font-size:0.88rem; font-weight:600; cursor:pointer; border-bottom:3px solid transparent; margin-bottom:-2px; transition:all 0.2s; white-space:nowrap; }
.integrations-tab:hover { color:var(--text-primary,#fff); }
.integrations-tab.active { color:var(--accent,#7C5CFC); border-bottom-color:var(--accent,#7C5CFC); }

/* ═══ Utility ═══ */
.text-muted { color:var(--text-secondary); }
.text-sm { font-size:0.82rem; }
.text-mono { font-family:'JetBrains Mono',monospace; }

/* ═══ Dashboard stats strip ═══ */
.stats-strip { display:grid; grid-template-columns:repeat(auto-fit,minmax(140px,1fr)); gap:12px; margin-bottom:18px; }
.stat { background:var(--surface-raised); border:1px solid var(--border); border-radius:var(--radius-sm); padding:12px 14px; display:flex; align-items:center; gap:10px; }
.stat-icon { font-size:1.2rem; width:36px; height:36px; display:flex; align-items:center; justify-content:center; background:var(--surface-2); border-radius:8px; flex-shrink:0; }
.stat-label { font-size:0.7rem; color:var(--text-secondary); text-transform:uppercase; letter-spacing:0.04em; font-weight:600; }
.stat-value { font-size:1.15rem; font-weight:700; color:var(--text-primary); font-variant-numeric:tabular-nums; }
.stat-green .stat-value { color:var(--success,#10B981); }
.stat-amber .stat-value { color:var(--warning,#F59E0B); }


/* ═══ Empty State ═══ */
.empty-state { text-align:center; padding:40px 20px; color:var(--text-tertiary); }
.empty-icon { font-size:2.5rem; margin-bottom:12px; opacity:0.5; }

/* ═══ Buttons missing styles ═══ */
.btn-xs { padding:3px 8px; font-size:0.72rem; }
.btn-del { background:none; border:1px solid var(--error,#EF4444); color:var(--error); border-radius:var(--radius-sm); padding:4px 8px; font-size:0.72rem; cursor:pointer; font-family:inherit; }
.btn-del:hover { background:rgba(239,68,68,0.08); }
.btn-mass-danger { background:var(--error,#EF4444); color:#fff; border:none; border-radius:var(--radius-sm); padding:6px 12px; font-size:0.78rem; font-weight:600; cursor:pointer; font-family:inherit; }
.btn-mass-danger:hover { opacity:0.9; }

/* ═══ Selector Panel (Dossiers) ═══ */
.selector-panel { background:var(--surface-raised); border:1px solid var(--border); border-radius:var(--radius); padding:14px 18px; margin-bottom:14px; }
.selector-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.selector-criteria { display:flex; flex-direction:column; gap:6px; }
.selector-criterion { display:flex; gap:8px; align-items:center; }
.selector-field, .selector-op, .selector-value { padding:6px 10px; border:1px solid var(--border-strong); border-radius:var(--radius-sm); font-family:inherit; font-size:0.82rem; color:var(--text-primary); background:var(--surface-1); }
.selector-field { width:160px; }
.selector-op { width:120px; }
.selector-value { flex:1; }
.selector-remove-btn { background:none; border:none; color:var(--text-tertiary); cursor:pointer; font-size:0.85rem; padding:4px; }
.selector-remove-btn:hover { color:var(--error); }
.selector-actions { display:flex; justify-content:space-between; align-items:center; margin-top:10px; }
.selector-actions-right { display:flex; gap:6px; }
.selector-result-count { font-size:0.78rem; color:var(--text-secondary); }
.selector-validate-btn { }
.selector-preview { margin-top:10px; border-top:1px solid var(--border); padding-top:10px; }
.selector-preview-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:6px; }
.selector-preview-label { font-size:0.75rem; font-weight:600; color:var(--text-secondary); text-transform:uppercase; }
.selector-preview-list { max-height:200px; overflow-y:auto; }
.selector-preview-item { display:flex; align-items:center; gap:8px; padding:4px 0; font-size:0.82rem; }
.selector-preview-name { font-weight:600; flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.selector-preview-meta { font-size:0.72rem; color:var(--text-secondary); font-family:'JetBrains Mono',monospace; white-space:nowrap; }
.selector-exclude-btn { background:none; border:none; cursor:pointer; font-size:0.75rem; padding:2px 4px; opacity:0.5; transition:opacity 0.15s; }
.selector-exclude-btn:hover { opacity:1; }
.selector-preview-more { padding:6px 12px; font-size:0.75rem; color:var(--text-secondary); text-align:center; font-style:italic; }

/* ═══ Client context bar ═══ */
.client-context-bar { display:flex; align-items:center; gap:10px; background:var(--surface-1); border:1px solid var(--accent); border-radius:var(--radius-sm); padding:8px 14px; margin-bottom:14px; }
.client-context-icon { font-size:1.1rem; }
.client-context-info { flex:1; }
.client-context-name { font-weight:600; font-size:0.85rem; }
.client-context-siret { font-size:0.72rem; color:var(--text-secondary); font-family:'JetBrains Mono',monospace; }

/* ═══ Segmentation ═══ */
.seg-stats-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(120px,1fr)); gap:10px; margin-bottom:16px; }
.seg-stat-card { background:var(--surface-raised); border:1px solid var(--border); border-radius:var(--radius-sm); padding:12px; text-align:center; }
.seg-stat-num { font-size:1.3rem; font-weight:800; color:var(--text-primary); font-variant-numeric:tabular-nums; }
.seg-stat-label { font-size:0.65rem; color:var(--text-secondary); text-transform:uppercase; letter-spacing:0.04em; margin-top:2px; }
.seg-breakdown { margin-bottom:16px; }
.seg-breakdown h3 { font-size:0.92rem; font-weight:700; margin-bottom:8px; }
.seg-breakdown-list { display:flex; flex-direction:column; gap:4px; }
.seg-breakdown-item { display:flex; justify-content:space-between; padding:6px 10px; background:var(--surface-1); border-radius:var(--radius-sm); font-size:0.82rem; }
.seg-breakdown-count { font-weight:700; font-variant-numeric:tabular-nums; color:var(--accent); }

/* ═══ Message Viewer ═══ */
.message-viewer-content { padding:16px; font-size:0.85rem; line-height:1.7; color:var(--text-primary); }

/* ═══ Modal ═══ */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.5); backdrop-filter:blur(4px); z-index:100; display:flex; align-items:center; justify-content:center; padding:20px; }
.modal-card { background:var(--surface-raised); border:1px solid var(--border); border-radius:var(--radius); width:min(500px,95%); max-height:calc(100vh - 40px); overflow:auto; padding:20px; }
.modal-footer { display:flex; justify-content:flex-end; gap:8px; margin-top:16px; padding-top:12px; border-top:1px solid var(--border); }

/* ═══ Onboarding ═══ */
.ob-wrapper { max-width:640px; margin:0 auto; padding:20px 0; }
.ob-progress { display:flex; align-items:center; justify-content:center; gap:0; margin-bottom:28px; }
.ob-pip { display:flex; flex-direction:column; align-items:center; gap:4px; min-width:60px; }
.ob-pip-dot { width:32px; height:32px; border-radius:50%; background:var(--surface-2); border:2px solid var(--border); display:flex; align-items:center; justify-content:center; font-size:0.78rem; font-weight:700; color:var(--text-tertiary); transition:all 0.2s; }
.ob-pip.active .ob-pip-dot { background:var(--accent); border-color:var(--accent); color:#fff; }
.ob-pip.done .ob-pip-dot { background:var(--success,#10B981); border-color:var(--success,#10B981); color:#fff; }
.ob-pip-text { font-size:0.68rem; font-weight:600; color:var(--text-tertiary); text-transform:uppercase; letter-spacing:0.04em; }
.ob-pip.active .ob-pip-text { color:var(--accent); }
.ob-pip.done .ob-pip-text { color:var(--success,#10B981); }
.ob-pip-line { flex:1; height:2px; background:var(--border); max-width:60px; margin:0 4px; margin-bottom:18px; }
.ob-pip-line.done { background:var(--success,#10B981); }

.ob-fade { animation:obFadeIn 0.3s ease; }
@keyframes obFadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

.ob-hero { text-align:center; margin-bottom:24px; }
.ob-hero h2 { font-size:1.3rem; font-weight:700; margin-bottom:6px; color:var(--text-primary); }
.ob-hero p { font-size:0.88rem; color:var(--text-secondary); max-width:480px; margin:0 auto; line-height:1.6; }

.ob-card { background:var(--surface-raised); border:1px solid var(--border); border-radius:var(--radius); padding:20px 24px; margin-bottom:16px; transition:border-color 0.15s; }
.ob-card:hover { border-color:var(--accent-glow,rgba(124,92,252,0.3)); }
.ob-card-icon { width:40px; height:40px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:1.3rem; }
.ob-card-icon.api { background:rgba(124,92,252,0.1); }
.ob-card-icon.file { background:rgba(16,185,129,0.1); }
.ob-card-title { font-weight:700; font-size:0.92rem; color:var(--text-primary); margin-bottom:2px; }
.ob-card-desc { font-size:0.78rem; color:var(--text-secondary); }

.ob-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.ob-field { display:flex; flex-direction:column; gap:4px; }
.ob-field.span-2 { grid-column:span 2; }
.ob-field label { font-size:0.78rem; font-weight:600; color:var(--text-secondary); }
.ob-field .req { color:var(--error,#EF4444); }
.ob-field input, .ob-field select { padding:8px 12px; border:1px solid var(--border-strong); border-radius:var(--radius-sm); font-family:inherit; font-size:0.88rem; color:var(--text-primary); background:var(--surface-1); transition:all 0.15s; }
.ob-field input:focus, .ob-field select:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-glow); }

.ob-footer { display:flex; justify-content:space-between; align-items:center; margin-top:20px; padding-top:16px; }

.ob-connectors { display:grid; grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); gap:8px; margin-top:12px; }
.ob-ctr { display:flex; flex-direction:column; align-items:center; gap:6px; padding:14px 10px; background:var(--surface-1); border:1px solid var(--border); border-radius:var(--radius-sm); text-decoration:none; color:var(--text-primary); font-size:0.78rem; font-weight:500; transition:all 0.15s; text-align:center; }
.ob-ctr:hover { border-color:var(--accent); background:var(--accent-muted); }
.ob-ctr img { height:28px; width:auto; object-fit:contain; }

.robot-description { font-size:0.82rem; color:var(--text-secondary); line-height:1.5; margin-bottom:14px; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; flex-shrink:0; }

/* ── Log console (page exécution robot_job.html.twig) ── */
.log-console {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.78rem;
    line-height: 1.65;
    background: #0D0620;
    color: #C4B5FD;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    max-height: 60vh;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    margin-top: 8px;
    border: 1px solid rgba(255,255,255,0.06);
}
.log-console::-webkit-scrollbar { width: 8px; }
.log-console::-webkit-scrollbar-track { background: rgba(255,255,255,0.03); }
.log-console::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }
.log-console::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

.log-console .log-time { color: #6B6380; }
.log-console .log-success { color: #6EE7B7; font-weight: 600; }
.log-console .log-error { color: #FCA5A5; font-weight: 600; }
.log-console .log-info { color: #93C5FD; }

/* ═══ Zebra striping dossiers ═══ */
.doss-table tbody tr:nth-child(odd) { background: rgba(124,92,252,0.04); }
.doss-table tbody tr:nth-child(even) { background: transparent; }
.doss-table tbody tr:hover { background: rgba(124,92,252,0.08) !important; }

/* ═══ Files Page ═══ */
.files-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; flex-wrap:wrap; gap:12px; }
.files-title-group { display:flex; align-items:center; gap:12px; }
.files-icon { font-size:1.8rem; }
.files-title { font-size:1.3rem; font-weight:700; color:var(--text-primary); }
.files-subtitle { font-size:0.82rem; color:var(--text-secondary); }
.files-toolbar { display:flex; align-items:center; gap:10px; }
.files-view-toggle { display:flex; border:1px solid var(--border); border-radius:var(--radius-sm); overflow:hidden; }
.files-view-toggle button { background:none; border:none; padding:6px 10px; cursor:pointer; color:var(--text-tertiary); transition:all 0.15s; display:flex; align-items:center; }
.files-view-toggle button:hover { color:var(--text-primary); }
.files-view-toggle button.active { background:var(--accent); color:#fff; }
.files-open-btn { display:inline-flex; align-items:center; gap:6px; font-size:0.82rem; color:var(--accent); text-decoration:none; padding:6px 12px; border:1px solid var(--border); border-radius:var(--radius-sm); transition:all 0.15s; }
.files-open-btn:hover { border-color:var(--accent); background:var(--accent-muted); }

.files-breadcrumb { display:flex; align-items:center; gap:6px; font-size:0.82rem; margin-bottom:14px; padding:8px 12px; background:var(--surface-1); border-radius:var(--radius-sm); flex-wrap:wrap; }
.files-breadcrumb a { color:var(--accent); text-decoration:none; font-weight:500; }
.files-breadcrumb a:hover { text-decoration:underline; }
.files-breadcrumb .sep { color:var(--text-tertiary); }

.files-loading { text-align:center; padding:40px; color:var(--text-secondary); font-size:0.88rem; }
.files-empty { display:flex; flex-direction:column; align-items:center; padding:40px 20px; text-align:center; }

.files-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:12px; }
.file-card { background:var(--surface-raised); border:1px solid var(--border); border-radius:var(--radius); padding:16px 12px; text-align:center; cursor:pointer; transition:all 0.15s; position:relative; }
.file-card:hover { border-color:var(--accent); box-shadow:0 2px 12px rgba(124,92,252,0.08); }
.fc-actions { position:absolute; top:8px; right:8px; display:flex; gap:4px; opacity:0; transition:opacity 0.15s; }
.file-card:hover .fc-actions { opacity:1; }
.fc-actions a, .fc-actions button { background:var(--surface-2); border:1px solid var(--border); border-radius:4px; padding:4px; cursor:pointer; color:var(--text-secondary); display:flex; align-items:center; text-decoration:none; }
.fc-actions a:hover, .fc-actions button:hover { color:var(--accent); border-color:var(--accent); }
.fc-actions .btn-danger:hover { color:var(--error); border-color:var(--error); }
.fc-icon { font-size:2rem; margin-bottom:8px; }
.fc-name { font-size:0.78rem; font-weight:600; color:var(--text-primary); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.fc-meta { font-size:0.68rem; color:var(--text-tertiary); margin-top:2px; }

.files-list { width:100%; border-collapse:collapse; font-size:0.82rem; }
.files-list td { padding:8px 10px; border-bottom:1px solid var(--border); vertical-align:middle; }
.files-list tr:last-child td { border-bottom:none; }
.files-list tr:hover { background:var(--surface-2,rgba(124,58,237,.03)); }
.fl-icon { width:32px; font-size:1.1rem; text-align:center; }
.fl-name { font-weight:600; }
.fl-actions { display:flex; gap:8px; align-items:center; }
.fl-actions a, .fl-actions button { display:inline-flex; align-items:center; gap:4px; font-size:0.72rem; color:var(--text-secondary); text-decoration:none; background:none; border:none; cursor:pointer; padding:2px 4px; border-radius:4px; font-family:inherit; }
.fl-actions a:hover { color:var(--accent); }
.fl-actions .btn-danger { color:var(--text-tertiary); }
.fl-actions .btn-danger:hover { color:var(--error); }

/* PDF viewer modal */
.pdf-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.7); backdrop-filter:blur(4px); z-index:200; display:flex; align-items:center; justify-content:center; padding:20px; }
.pdf-modal { background:var(--surface-raised); border:1px solid var(--border); border-radius:var(--radius); width:min(900px,95vw); height:min(85vh,calc(100vh - 40px)); display:flex; flex-direction:column; overflow:hidden; box-shadow:0 20px 60px rgba(0,0,0,0.5); }
.pdf-header { display:flex; align-items:center; justify-content:space-between; padding:10px 16px; border-bottom:1px solid var(--border); }
.pdf-title { font-weight:600; font-size:0.88rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex:1; }
.pdf-close { background:none; border:1px solid var(--border); border-radius:50%; width:28px; height:28px; font-size:1.1rem; cursor:pointer; color:var(--text-secondary); display:flex; align-items:center; justify-content:center; }
.pdf-close:hover { background:var(--surface-2); color:var(--text-primary); }
.pdf-frame { flex:1; border:none; width:100%; }

/* ── Feedback / Support modal ── */
.feedback-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(124,58,237,0.35), 0 2px 6px rgba(0,0,0,0.1);
    transition: transform 0.15s var(--ease-spring), box-shadow 0.15s var(--ease);
    z-index: 900;
}
.feedback-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 32px rgba(124,58,237,0.45), 0 4px 10px rgba(0,0,0,0.15);
    background: var(--accent-hover);
}

.feedback-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    backdrop-filter: blur(3px);
}
.feedback-overlay.open { display: flex; }

.feedback-modal {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: feedback-pop 0.2s var(--ease-spring);
}
@keyframes feedback-pop { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.feedback-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
}
.feedback-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}
.feedback-close {
    background: none;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-tertiary);
    padding: 0 4px;
}
.feedback-close:hover { color: var(--text-primary); }

.feedback-body {
    padding: 18px 22px;
    overflow-y: auto;
    flex: 1;
}
.feedback-field { margin-bottom: 16px; }
.feedback-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.feedback-field textarea,
.feedback-field input[type="file"] {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.88rem;
    background: var(--surface-2);
    color: var(--text-primary);
    resize: vertical;
}
.feedback-field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

.feedback-type {
    display: flex;
    gap: 8px;
}
.feedback-type label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary);
    background: var(--surface-2);
    margin: 0;
    transition: all 0.12s;
    flex: 1;
    justify-content: center;
}
.feedback-type label:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-muted);
    color: var(--accent);
    font-weight: 600;
}
.feedback-type input[type="radio"] {
    margin: 0;
    accent-color: var(--accent);
}

.feedback-hint {
    font-size: 0.72rem;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.feedback-preview {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.feedback-preview img {
    max-width: 100%;
    max-height: 180px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    display: block;
}
.feedback-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.feedback-preview-remove:hover { background: var(--error); }
.feedback-preview > div { position: relative; }

.feedback-status {
    font-size: 0.8rem;
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    display: none;
}
.feedback-status.success {
    display: block;
    background: var(--success-bg);
    color: var(--success-text);
}
.feedback-status.error {
    display: block;
    background: var(--error-bg);
    color: var(--error-text);
}

.feedback-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 22px;
    border-top: 1px solid var(--border);
}

/* ══════════════════════════════════════
   ADMIN — Tableaux, filtres, composants partagés
   ══════════════════════════════════════ */

/* Search / filter bar */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    align-items: center;
    flex-wrap: wrap;
}
.search-bar input[type="text"],
.search-bar input[type="search"],
.search-bar select {
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    background: var(--surface-raised);
    color: var(--text-primary);
}
.search-bar input[type="text"] { flex: 1; min-width: 220px; }
.search-bar input:focus,
.search-bar select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

/* Tables style dossiers/admin */
.doss-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.doss-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    white-space: nowrap;
}
.doss-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    color: var(--text-primary);
}
.doss-table tbody tr:hover td { background: var(--accent-muted); }
.doss-table tbody tr:last-child td { border-bottom: none; }

/* Generic table (no doss prefix) */
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}
table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}
table tbody tr:hover td { background: var(--accent-muted); }

/* Page title (si pas déjà définie ailleurs, est override-compatible) */
.page-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.page-title h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* Card wrapper */
.card {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.12s var(--ease);
    text-decoration: none;
    line-height: 1.2;
}
.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-xs { padding: 4px 8px; font-size: 0.72rem; }
.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: white; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text-secondary); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text-primary); }
.btn-outline { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-outline:hover { background: var(--accent-muted); }

/* Expand toggle button (+ / −) */
.btn-expand {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 24px;
    height: 24px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.12s;
}
.btn-expand:hover {
    background: var(--accent-muted);
    border-color: var(--accent);
    color: var(--accent);
}

/* Key-value detail row (expanded in tables) */
.sub-detail {
    margin-top: 8px;
    padding: 12px 14px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.sub-kv {
    display: flex;
    gap: 12px;
    padding: 4px 0;
    font-size: 0.82rem;
    line-height: 1.6;
}
.sub-kv + .sub-kv { border-top: 1px solid var(--border); }
.sub-key {
    min-width: 110px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    padding-top: 2px;
    flex-shrink: 0;
}
.sub-val {
    color: var(--text-primary);
    word-break: break-word;
    flex: 1;
}
.sub-val a { color: var(--accent); }

/* Compact input */
.input-sm {
    padding: 5px 9px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.8rem;
    background: var(--surface-raised);
    color: var(--text-primary);
}
.input-sm:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-muted);
}

/* Lead tags (status/type chips) */
.lead-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--surface-2);
    color: var(--text-secondary);
    text-transform: capitalize;
    line-height: 1.5;
}
.lead-tag.new { background: var(--accent-muted); color: var(--accent); }
.lead-tag.seen { background: var(--warning-bg); color: var(--warning-text); }
.lead-tag.resolved { background: var(--success-bg); color: var(--success-text); }

/* Badges généraux */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.5;
}
.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-cancelled { background: var(--error-bg); color: var(--error-text); }
.badge-version { background: var(--accent-muted); color: var(--accent); }
.badge-active { background: var(--success-bg); color: var(--success-text); }
.badge-ok { background: var(--success-bg); color: var(--success-text); }
.badge-ko { background: var(--error-bg); color: var(--error-text); }
.badge-muted { background: var(--surface-2); color: var(--text-tertiary); border: 1px solid var(--border); }

/* Text utilities */
.text-muted { color: var(--text-tertiary); }
.text-sm { font-size: 0.82rem; }
.text-mono { font-family: 'JetBrains Mono', monospace; }

/* Alerts */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 12px;
    border-left: 3px solid;
}
.alert-success { background: var(--success-bg); color: var(--success-text); border-color: var(--success); }
.alert-error { background: var(--error-bg); color: var(--error-text); border-color: var(--error); }
.alert-warning { background: var(--warning-bg); color: var(--warning-text); border-color: var(--warning); }

/* Stat cards (monitoring + dashboards) */
.stat-card {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}
.stat-card .stat-value,
.stat-value { font-size: 1.35rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.stat-card .stat-label,
.stat-label { font-size: 0.72rem; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }

/* Two columns layout helper */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* Documentation button — light purple pill */
.btn-doc {
    display: inline-flex; align-items: center; gap: 4px;
    background: #EDE9FE; color: #7C5CFC; border: 1px solid #DDD6FE;
    border-radius: 20px; padding: 6px 14px; font-size: 0.78rem;
    font-weight: 600; cursor: pointer; text-decoration: none;
    transition: all 0.2s ease;
}
.btn-doc:hover { background: #DDD6FE; color: #5A3AD8; }

/* Account tabs (settings page) */
.account-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}
.account-tabs button {
    padding: 10px 20px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-tertiary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all 0.15s;
}
.account-tabs button:hover { color: var(--text-secondary); }
.account-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
