:root {
    --primary: #1e4962;
    --accent: #ff6f00;
    --accent-hover: #e06300;
    --bg: #f4f6f9;
    --text: #1e2d3d;
    --text-sub: #6a8a9a;
    --text-muted: #9ab5c7;
    --border: #e2e8ef;
    --white: #ffffff;
    --danger: #e05555;
    --success: #34a853;
    --sidebar-w: 260px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--text);
}

/* ── Auth overlay ── */
#auth-overlay {
    position: fixed; inset: 0; background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
}
#auth-overlay .auth-box {
    background: var(--white); border-radius: 12px; padding: 40px 48px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.10); text-align: center; max-width: 360px;
}
#auth-overlay h2 { color: var(--primary); font-size: 18px; margin-bottom: 8px; }
#auth-overlay p { color: var(--text-sub); font-size: 14px; margin-bottom: 16px; }
#auth-overlay .spinner {
    width: 32px; height: 32px; border: 3px solid var(--border);
    border-top-color: var(--accent); border-radius: 50%;
    animation: spin 0.75s linear infinite; margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Buttons ── */
.btn-primary {
    padding: 8px 18px; background: var(--accent); color: white;
    border: none; border-radius: 8px; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: background 0.15s;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary.btn-lg { padding: 12px 28px; font-size: 15px; }

.btn-secondary {
    padding: 8px 18px; background: var(--white); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
    font-weight: 500; cursor: pointer; transition: border-color 0.15s;
}
.btn-secondary:hover { border-color: var(--primary); }

.btn-danger-sm {
    padding: 5px 12px; background: transparent; color: var(--danger);
    border: 1px solid var(--danger); border-radius: 6px; font-size: 12px;
    font-weight: 500; cursor: pointer; margin-left: auto;
}
.btn-danger-sm:hover { background: #fdecea; }

.btn-header {
    padding: 5px 14px; border-radius: 20px;
    border: 2px solid rgba(255,255,255,0.4); background: transparent;
    color: white; font-size: 13px; font-weight: 600; cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.btn-header:hover { border-color: white; background: rgba(255,255,255,0.1); }
.btn-feedback { display: inline-flex; align-items: center; gap: 6px; }
.btn-feedback svg { display: block; }

/* ── Header ── */
header {
    background: var(--primary); color: white;
    padding: 0 20px; display: flex; align-items: center;
    gap: 10px; height: 48px; flex-shrink: 0;
}
.btn-hamburger {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; margin-left: -6px; padding: 0;
    background: transparent; border: none; color: #fff;
    border-radius: 8px; cursor: pointer; flex-shrink: 0;
    transition: background 0.15s;
}
.btn-hamburger:hover { background: rgba(255,255,255,0.14); }
.btn-hamburger:active { background: rgba(255,255,255,0.22); }
.logo { width: 28px; height: 28px; flex-shrink: 0; }
.logo img { width: 28px; height: 28px; object-fit: contain; }
.header-title { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.header-title h1 { font-size: 15px; font-weight: 700; letter-spacing: 0.2px; }
.header-title p { font-size: 12px; color: var(--text-muted); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-name { font-size: 13px; opacity: 0.9; }

.session-indicator {
    margin-left: 24px; display: flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,0.1); padding: 4px 12px; border-radius: 16px;
    font-size: 12px;
}
.session-indicator .session-project { opacity: 0.7; }

/* ── Main layout ── */
#app { display: flex; flex-direction: column; height: 100vh; }
.main { flex: 1; display: flex; overflow: hidden; position: relative; }

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-w); background: var(--white);
    border-right: 1px solid var(--border); display: flex;
    flex-direction: column; flex-shrink: 0;
    transition: width 0.22s ease; overflow: hidden;
}
.sidebar.collapsed { width: 0; border-right: none; }

.sidebar-header {
    padding: 16px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    min-width: var(--sidebar-w);
}
.sidebar-header h2 {
    font-size: 13px; font-weight: 600; color: #4a6a80;
    text-transform: uppercase; letter-spacing: 0.6px;
}

/* Global Base Tools card in sidebar */
.base-tools-btn {
    display: flex; align-items: center; gap: 11px;
    width: calc(100% - 24px); margin: 12px;
    padding: 10px 12px; text-align: left;
    background: linear-gradient(135deg, #fff7f0 0%, #fdeede 100%);
    border: 1px solid #f6d9bd; border-radius: 10px;
    cursor: pointer; transition: all 0.16s ease;
}
.base-tools-btn:hover {
    border-color: var(--accent);
    box-shadow: 0 3px 10px rgba(255,111,0,0.13);
    transform: translateY(-1px);
}
.base-tools-icon {
    font-size: 19px; line-height: 1;
    width: 34px; height: 34px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--white); border-radius: 8px;
    box-shadow: 0 1px 3px rgba(30,73,98,0.10);
}
.base-tools-text { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.base-tools-title {
    font-size: 13px; font-weight: 600; color: var(--primary);
    letter-spacing: 0.2px;
}
.base-tools-sub {
    font-size: 11px; color: var(--text-sub);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.base-tools-arrow {
    width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0;
    transition: transform 0.16s ease;
}
.base-tools-btn:hover .base-tools-arrow { transform: translateX(2px); color: var(--accent); }

.sidebar-search { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.sidebar-search input {
    width: 100%; padding: 6px 10px 6px 30px;
    border: 1px solid var(--border); border-radius: 6px;
    font-size: 12.5px; color: var(--primary); background: var(--bg);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%238aa0b0' stroke-width='2.5'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: 9px center;
    outline: none; transition: border-color 0.15s;
}
.sidebar-search input:focus { border-color: var(--accent); }

.chat-list { flex: 1; overflow-y: auto; padding: 8px; }
.chat-list-empty { padding: 24px 16px; text-align: center; font-size: 13px; color: #aabbcc; }

.chat-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 8px; cursor: pointer;
    transition: background 0.12s;
}
.chat-item:hover { background: #f0f5f9; }
.chat-item.active { background: #fff3ea; }
.chat-item.active .chat-item-title { color: var(--accent); }
.chat-item-icon {
    width: 32px; height: 32px; border-radius: 50%;
    background: #e8f0f7; display: flex; align-items: center;
    justify-content: center; flex-shrink: 0; font-size: 13px;
}
.chat-item.active .chat-item-icon { background: #fde8d4; }
.chat-item-body { flex: 1; min-width: 0; }
.chat-item-title {
    font-size: 13px; font-weight: 500; color: #2c3e50;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-item-meta { font-size: 11px; color: #9ab0c0; margin-top: 2px; }

/* ── Toggle sidebar ── */
.btn-toggle-sidebar {
    position: absolute; top: 50%; transform: translateY(-50%);
    left: var(--sidebar-w); z-index: 10;
    width: 20px; height: 36px; background: var(--white);
    border: 1px solid var(--border); border-left: none;
    border-radius: 0 6px 6px 0; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #8aa0b0; transition: left 0.22s ease, background 0.15s, color 0.15s;
    box-shadow: 2px 0 6px rgba(0,0,0,0.06);
}
.btn-toggle-sidebar:hover { background: var(--bg); color: var(--primary); }
.btn-toggle-sidebar svg { width: 12px; height: 12px; transition: transform 0.22s ease; }
.btn-toggle-sidebar.collapsed { left: 0; }
.btn-toggle-sidebar.collapsed svg { transform: rotate(180deg); }

/* ── Delegated auth ── */
.delegated-auth-status {
    margin: 12px 0; padding: 14px 16px; border-radius: 8px;
    display: flex; align-items: center; gap: 12px; justify-content: space-between;
    font-size: 13px;
}
.delegated-auth-status.pending { background: #fef3e2; border: 1px solid #f5d89a; }
.delegated-auth-status.loading { background: #e8f3fb; border: 1px solid #b8d8ea; }
.delegated-auth-status.success { background: #e6f9ed; border: 1px solid #a8e6c1; }
.delegated-auth-status.error { background: #fde8e8; border: 1px solid #f5b0b0; }
.delegated-info { display: flex; flex-direction: column; gap: 4px; }
.login-hint { font-size: 11.5px; color: var(--text-sub); }
.config-badge { font-size: 10.5px; padding: 1px 6px; background: #e6f9ed; color: #2a8a52; border-radius: 8px; margin-left: 6px; }
.btn-sm { padding: 6px 14px; font-size: 12.5px; }
.session-delegated { font-size: 11.5px; color: var(--accent); margin-left: 8px; }

/* ── Chat area ── */
.chat-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }

.view-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; overflow-y: auto; }

.chat-area-header {
    padding: 12px 24px; background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
}
.chat-area-header h2 { font-size: 15px; font-weight: 600; color: var(--text); }
.badge {
    font-size: 11.5px; padding: 2px 8px;
    background: #e8f3fb; color: #3a7aaa;
    border-radius: 12px; font-weight: 500;
}
.model-select {
    margin-left: auto;
    font-size: 12px; padding: 4px 8px;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--white); color: var(--text); cursor: pointer;
}
.model-select:hover { border-color: #3a7aaa; }
.model-select:focus { outline: none; border-color: #3a7aaa; }

.agentuur-bar {
    display: flex; gap: 8px; flex-wrap: wrap;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg, #f7f9fb);
}
.agentuur-metric {
    display: inline-flex; align-items: baseline; gap: 6px;
    font-size: 12px;
    padding: 3px 10px;
    border: 1px solid var(--border); border-radius: 999px;
    background: var(--white);
}
.agentuur-label { color: var(--muted, #6b7785); }
.agentuur-value { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

.uren-badge {
    display: inline-block;
    font-size: 11px; font-weight: 600;
    padding: 2px 8px; border-radius: 999px;
    background: #eef4f9; color: #2c5a78;
    border: 1px solid var(--border);
    font-variant-numeric: tabular-nums;
}
.customer-header-bar .uren-badge { margin-left: 10px; vertical-align: middle; font-size: 12px; }
.project-card-uren { margin-top: 6px; }

#chat-container {
    flex: 1; overflow-y: auto; padding: 24px 24px 100px;
    display: flex; flex-direction: column; gap: 20px;
}

/* ── Messages ── */
.message { display: flex; gap: 12px; align-items: flex-start; animation: fadeIn 0.18s ease; max-width: 100%; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.message.user { flex-direction: row-reverse; }
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.message.user .avatar { background: var(--accent); color: white; }
.message.assistant .avatar { background: #e8f0f7; color: var(--primary); }

.bubble-wrapper { max-width: 78%; min-width: 0; }
.message.user .bubble-wrapper { text-align: right; }
.msg-time { font-size: 10.5px; color: var(--text-muted); margin-top: 4px; display: inline-block; }
.msg-sender { font-size: 11px; color: var(--text-sub); font-weight: 600; display: block; margin-bottom: 2px; }

.bubble {
    padding: 14px 18px; border-radius: 14px;
    font-size: 14px; line-height: 1.7;
    word-wrap: break-word; overflow-wrap: break-word;
}
.message.user .bubble { background: var(--accent); color: white; border-bottom-right-radius: 3px; }
.message.assistant .bubble {
    background: var(--white); color: var(--text);
    border-bottom-left-radius: 3px; box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

/* ── Markdown content inside bubbles ── */
.bubble .md-content h1 { font-size: 1.4em; font-weight: 700; margin: 16px 0 8px; padding-bottom: 6px; border-bottom: 2px solid var(--border); }
.bubble .md-content h2 { font-size: 1.2em; font-weight: 700; margin: 14px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.bubble .md-content h3 { font-size: 1.05em; font-weight: 700; margin: 12px 0 4px; }
.bubble .md-content h4, .bubble .md-content h5, .bubble .md-content h6 { font-size: 1em; font-weight: 600; margin: 10px 0 4px; }
.bubble .md-content p { margin: 6px 0; }
.bubble .md-content ul, .bubble .md-content ol { padding-left: 22px; margin: 6px 0; }
.bubble .md-content li { margin: 3px 0; }
.bubble .md-content blockquote {
    border-left: 3px solid var(--accent); padding: 4px 12px; margin: 8px 0;
    background: #fdf8f3; color: #5a4a3a; border-radius: 0 6px 6px 0;
}
.bubble .md-content hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.bubble .md-content a { color: var(--accent); text-decoration: underline; }
.bubble .md-content a:hover { color: var(--accent-hover); }
.bubble .md-content img { max-width: 100%; border-radius: 8px; margin: 8px 0; }
.bubble .md-content strong { font-weight: 600; }

/* Inline code */
.bubble code {
    background: #f0f4f8; padding: 2px 6px; border-radius: 4px; font-size: 0.88em;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}
/* Code blocks */
.bubble pre {
    position: relative;
    background: #1e2d3d; color: #e8f0f7; padding: 14px 16px; border-radius: 10px;
    overflow-x: auto; margin: 10px 0; font-size: 13px; line-height: 1.5;
}
.bubble pre code {
    background: none; color: inherit; padding: 0; font-size: inherit;
}
.btn-copy {
    position: absolute; top: 8px; right: 8px;
    padding: 3px 10px; background: rgba(255,255,255,0.12); color: #aac;
    border: 1px solid rgba(255,255,255,0.15); border-radius: 5px;
    font-size: 11px; cursor: pointer; transition: all 0.15s;
}
.btn-copy:hover { background: rgba(255,255,255,0.22); color: #fff; }

/* Tables */
.bubble table {
    width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px;
    border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.bubble thead { background: var(--primary); color: white; }
.bubble th {
    padding: 9px 12px; text-align: left; font-weight: 600; font-size: 12.5px;
    letter-spacing: 0.2px;
}
.bubble td { padding: 8px 12px; border-top: 1px solid var(--border); }
.bubble tbody tr:nth-child(even) { background: #f8fafb; }
.bubble tbody tr:hover { background: #f0f5f9; }

/* ── Tool chips ── */
.tool-chips {
    display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px;
}
.tool-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; background: #f0f5fa;
    border: 1px solid #dde8f0; border-radius: 16px;
    font-size: 12px; color: #3a6078; transition: all 0.15s;
}
.tool-chip.running { border-color: var(--accent); background: #fff8f2; }
.tool-chip.done { opacity: 0.7; }
.tool-chip.done .tool-spinner { color: var(--success); font-size: 11px; }
.tool-chip-label { white-space: nowrap; }
.tool-spinner { width: 14px; height: 14px; display: flex; align-items: center; justify-content: center; }
.spinner-dot {
    width: 10px; height: 10px; border: 2px solid #dde8f0;
    border-top-color: var(--accent); border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

/* Typing indicator */
.typing-indicator { display: flex; gap: 4px; padding: 10px 14px; align-items: center; }
.typing-indicator span {
    width: 7px; height: 7px; background: #c0d0dc; border-radius: 50%;
    animation: bounce 1.2s ease infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }

/* ── Input area ── */
#input-area {
    position: absolute; bottom: 24px; left: 0; right: 0;
    padding: 0 24px; pointer-events: none; display: flex; justify-content: center;
}
.input-box {
    pointer-events: auto; width: 100%; max-width: 760px;
    display: flex; align-items: flex-end; gap: 8px;
    background: var(--white); border: 1px solid var(--border);
    border-radius: 14px; padding: 8px 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.input-box textarea {
    flex: 1; border: none; outline: none; resize: none;
    font-size: 14px; line-height: 1.5; max-height: 120px;
    font-family: inherit; color: var(--text);
}
.input-box textarea::placeholder { color: #aabbcc; }
.btn-send {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--accent); border: none; color: white;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0; transition: background 0.15s;
}
.btn-send:hover { background: var(--accent-hover); }
.btn-send:disabled { background: #dde8f0; cursor: not-allowed; }
.btn-send svg { width: 18px; height: 18px; }

/* Paperclip / attach button */
.btn-attach {
    width: 36px; height: 36px; border-radius: 50%;
    background: transparent; border: none; color: var(--muted, #6b7c8c);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0; transition: background 0.15s, color 0.15s;
}
.btn-attach:hover { background: #eef3f7; color: var(--accent); }
.btn-attach svg { width: 19px; height: 19px; }

/* Attachment chips */
.attachment-chips {
    pointer-events: auto; width: 100%; max-width: 760px;
    display: flex; flex-wrap: wrap; gap: 6px; margin: 0 auto 8px;
}
.attachment-chips:empty { display: none; }
.attachment-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: #eef3f7; border: 1px solid var(--border);
    border-radius: 8px; padding: 4px 8px; font-size: 12.5px; color: var(--text);
    max-width: 220px;
}
.attachment-chip .chip-name {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.attachment-chip .chip-remove {
    border: none; background: transparent; color: var(--muted, #6b7c8c);
    cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px;
}
.attachment-chip .chip-remove:hover { color: #c0392b; }

/* Drag & drop hint */
#input-area.dragging .input-box { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
.drop-hint {
    pointer-events: none; display: none; margin: 6px auto 0; text-align: center;
    font-size: 12px; color: var(--accent); font-weight: 500;
}
.drop-hint.visible { display: block; }

/* ── Welcome ── */
.welcome {
    text-align: center; color: #8aa0b0; margin: auto;
    padding: 40px 20px; max-width: 480px; width: 100%;
}
.welcome .welcome-icon {
    width: 56px; height: 56px; background: #fff3ea; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px; font-size: 24px;
}
.welcome h2 { font-size: 20px; color: var(--text); margin-bottom: 8px; font-weight: 700; }
.welcome p { font-size: 14px; margin-bottom: 24px; line-height: 1.6; }

/* ── Session form ── */
.session-form {
    max-width: 480px; width: 100%; margin: 40px auto; padding: 32px;
    background: var(--white); border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.session-form h2 { font-size: 18px; color: var(--primary); margin-bottom: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-sub); margin-bottom: 6px; }
.form-group input, .form-group select {
    width: 100%; padding: 8px 12px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 14px; color: var(--text);
    outline: none; transition: border-color 0.15s;
}
.form-group textarea {
    width: 100%; padding: 8px 12px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 14px; color: var(--text);
    outline: none; transition: border-color 0.15s; resize: vertical;
    font-family: inherit; line-height: 1.5;
}
.form-group textarea:focus { border-color: var(--accent); }
.form-group input:focus, .form-group select:focus { border-color: var(--accent); }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

.search-results {
    max-height: 200px; overflow-y: auto; border: 1px solid var(--border);
    border-radius: 8px; margin-top: 4px; display: none;
}
.search-results.visible { display: block; }
.search-result-item {
    padding: 8px 12px; cursor: pointer; font-size: 13px;
    border-bottom: 1px solid var(--border); transition: background 0.1s;
}
.search-result-item:hover { background: #f0f5f9; }
.search-result-item:last-child { border-bottom: none; }
.search-result-id { font-size: 11px; color: var(--text-muted); }


/* ── Customer sidebar ── */
.klant-group { margin-bottom: 2px; }
.klant-group.selected > .klant-header { background: #fff3ea; color: var(--accent); }
.klant-header {
    display: flex; align-items: center; gap: 6px;
    padding: 9px 12px; cursor: pointer; border-radius: 8px;
    font-size: 13px; font-weight: 500; color: #2c3e50;
    transition: background 0.12s;
}
.klant-header:hover { background: #f0f5f9; }
.klant-expand { font-size: 9px; color: #8aa0b0; width: 12px; text-align: center; flex-shrink: 0; }
.klant-naam { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.klant-count {
    font-size: 11px; background: var(--accent); color: white;
    border-radius: 10px; padding: 1px 7px; font-weight: 600; flex-shrink: 0;
}
.klant-sessions { padding-left: 18px; max-height: 46vh; overflow-y: auto; }
.klant-sessions::-webkit-scrollbar { width: 7px; }
.klant-sessions::-webkit-scrollbar-thumb { background: #d3dde5; border-radius: 4px; }
.klant-sessions::-webkit-scrollbar-thumb:hover { background: #b9c8d3; }
.klant-sessions-empty { padding: 6px 12px; font-size: 12px; color: #aab; font-style: italic; }
.klant-group-divider { height: 1px; background: var(--border); margin: 8px 12px; }

.session-item {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 10px; border-radius: 6px; cursor: pointer;
    font-size: 12.5px; transition: background 0.12s;
}
.session-item:hover { background: #f0f5f9; }
.session-item.active { background: #fde8d4; }
.session-icon { flex-shrink: 0; font-size: 10px; }
.session-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #3a5a6a; }
.session-time { font-size: 11px; color: #9ab0c0; flex-shrink: 0; }
.session-collab {
    font-size: 10.5px; color: #5a7383; background: #eef3f7;
    border-radius: 8px; padding: 0 5px; flex-shrink: 0; white-space: nowrap;
}

/* ── Customer detail view ── */
.customer-detail {
    max-width: 680px; width: 100%; margin: 0 auto; padding: 32px 24px;
}
.customer-header-bar {
    margin-bottom: 24px; padding-bottom: 16px; border-bottom: 2px solid var(--border);
}
.customer-header-bar h2 { font-size: 22px; color: var(--primary); font-weight: 700; }

.customer-login {
    margin-bottom: 20px; padding: 14px 16px; border-radius: 8px;
    display: flex; align-items: center; gap: 12px; justify-content: space-between;
    font-size: 13px;
}
.customer-login.pending { background: #fef3e2; border: 1px solid #f5d89a; }
.customer-login.loading { background: #e8f3fb; border: 1px solid #b8d8ea; }
.customer-login.success { background: #e6f9ed; border: 1px solid #a8e6c1; }
.customer-login.error { background: #fde8e8; border: 1px solid #f5b0b0; }

.customer-section { margin-bottom: 28px; }
.customer-section h3 { font-size: 14px; font-weight: 700; color: #4a6a80; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.section-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.section-header h3 { margin-bottom: 0; }
.btn-refresh { background: none; border: none; cursor: pointer; font-size: 16px; line-height: 1; color: #7a93a6; padding: 2px 4px; border-radius: 6px; transition: color 0.15s, background 0.15s; }
.btn-refresh:hover { color: #2f6fb0; background: #eef3f8; }
.btn-refresh:disabled { cursor: default; opacity: 0.6; }
.btn-refresh.spinning { animation: refresh-spin 0.7s linear infinite; }
@keyframes refresh-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.section-hint { font-size: 12px; color: #9ab0c0; margin-bottom: 12px; }

/* Login-required overlay for customer content */
.customer-locked {
    text-align: center; padding: 48px 24px; color: #8aa0b0;
}
.customer-locked .lock-icon { font-size: 48px; margin-bottom: 16px; }
.customer-locked p { font-size: 14px; margin-bottom: 8px; line-height: 1.5; }
.customer-locked .lock-hint { font-size: 12px; color: var(--text-muted); }

.project-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}
.project-card {
    background: var(--white); border: 1px solid var(--border); border-radius: 10px;
    padding: 14px 16px; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s;
}
.project-card:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(255,111,0,0.1); }
.project-card-icon { font-size: 20px; margin-bottom: 6px; }
.project-card-name { font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.project-card-id { font-size: 11px; color: var(--text-muted); }

.customer-quick { background: #f8fafb; padding: 16px; border-radius: 10px; border: 1px solid var(--border); }
.quick-row { display: flex; align-items: flex-end; gap: 12px; }
.quick-row .btn-primary { white-space: nowrap; height: 38px; }

.customer-session-list { display: flex; flex-direction: column; gap: 4px; max-height: 52vh; overflow-y: auto; padding-right: 2px; }
.customer-session-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; background: var(--white); border: 1px solid var(--border);
    border-radius: 8px; font-size: 13px;
}
.customer-session-item.ended { opacity: 0.6; }
.cs-title { flex: 1; font-weight: 500; color: var(--text); }
.cs-sm { font-size: 11px; color: var(--text-muted); background: #f0f4f8; padding: 2px 6px; border-radius: 4px; }
.cs-time { font-size: 11.5px; color: #9ab0c0; }
.cs-people { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.cs-creator { font-size: 11.5px; color: #4a6a80; white-space: nowrap; }
.cs-participants { font-size: 11.5px; color: #6a8090; background: #eef3f7; padding: 2px 7px; border-radius: 8px; white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.btn-open-session {
    padding: 4px 12px; background: var(--accent); color: white;
    border: none; border-radius: 6px; font-size: 12px; font-weight: 600;
    cursor: pointer; transition: background 0.15s;
}
.btn-open-session:hover { background: var(--accent-hover); }

.loading-text { padding: 16px; font-size: 13px; color: #9ab0c0; text-align: center; }

/* ── Highlight.js theme overrides (dark) ── */
.hljs { background: transparent !important; }

/* Archive button in session list */
.btn-archive {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 4px;
    opacity: 0.4;
    transition: opacity 0.2s;
    margin-left: auto;
}
.btn-archive:hover { opacity: 1; }
.session-item { position: relative; }
.session-item .btn-archive { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }

/* Archive folder in sidebar */
.archive-folder { margin-top: 4px; }
.archive-header {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px 6px 24px;
    cursor: pointer; font-size: 12px; color: var(--text-sub);
    transition: background 0.15s;
}
.archive-header:hover { background: var(--bg); }
.archive-expand { font-size: 9px; width: 12px; }
.archive-icon { font-size: 13px; }
.archive-label { flex: 1; font-weight: 500; }
.archive-count {
    background: var(--border); color: var(--text-sub);
    font-size: 10px; padding: 1px 6px; border-radius: 8px;
}
.archive-sessions { padding-left: 8px; }
.session-item.archived { opacity: 0.65; }
.session-item.archived:hover { opacity: 1; }
.btn-unarchive {
    background: none; border: none; cursor: pointer;
    font-size: 12px; padding: 2px 4px; opacity: 0.4;
    transition: opacity 0.2s; position: absolute;
    right: 6px; top: 50%; transform: translateY(-50%);
}
.btn-unarchive:hover { opacity: 1; }

/* Sidebar locked state */
.klant-sessions-locked {
    padding: 10px 16px;
    font-size: 12px;
    color: var(--text-sub);
    display: flex;
    align-items: center;
    gap: 6px;
}
.lock-icon-small { font-size: 14px; }

/* ═══════════════════════════════════════════════════════════════════════
   Tool blocks — VS Code–style collapsible tool execution blocks
   ═══════════════════════════════════════════════════════════════════════ */

.tool-block {
    margin: 8px 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    font-size: 13px;
    background: var(--surface);
    transition: box-shadow 0.2s;
}
.tool-block:hover {
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.tool-block-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}
.tool-block-header:hover {
    background: rgba(0,0,0,0.03);
}

.tool-block-icon { font-size: 14px; flex-shrink: 0; }
.tool-block-name {
    font-weight: 600;
    color: var(--primary);
    flex-shrink: 0;
}
.tool-block-detail {
    flex: 1;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
    color: var(--text-sub);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.tool-block-status {
    flex-shrink: 0;
    font-size: 12px;
    width: 20px;
    text-align: center;
}
.tool-block-status.done {
    color: #27ae60;
    font-weight: 700;
}
.tool-block-status.running {
    display: flex;
    align-items: center;
    justify-content: center;
}
.tool-block-time {
    font-size: 11px;
    color: var(--text-sub);
    flex-shrink: 0;
    min-width: 30px;
    text-align: right;
}
.tool-block-chevron {
    font-size: 10px;
    color: var(--text-sub);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}
.tool-block.expanded .tool-block-chevron {
    transform: rotate(90deg);
}

.tool-block-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    border-top: 0 solid var(--border);
}
.tool-block.expanded .tool-block-body {
    max-height: 600px;
    overflow-y: auto;
    border-top-width: 1px;
}

.tool-block-input {
    background: #1e1e2e;
    padding: 0;
}
.tool-block-input pre {
    margin: 0;
    padding: 10px 12px;
}
.tool-block-input code {
    font-size: 12px;
    color: #cdd6f4;
    white-space: pre-wrap;
    word-break: break-all;
}

.tool-block-output {
    border-top: 1px solid rgba(255,255,255,0.06);
    background: #181825;
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
}
.tool-block-output pre {
    margin: 0;
    padding: 10px 12px;
}
.tool-block-output code {
    font-size: 11px;
    color: #a6adc8;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Spinner animation */
.spinner-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border: 2px solid var(--primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: tool-spin 0.8s linear infinite;
}
@keyframes tool-spin {
    to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════════════════
   Thinking blocks — reasoning indicator
   ═══════════════════════════════════════════════════════════════════════ */

.thinking-block {
    margin: 8px 0;
    border: 1px solid #d5c8e8;
    border-radius: 8px;
    overflow: hidden;
    font-size: 13px;
}

.thinking-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #f5f0fa;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}
.thinking-header:hover {
    background: #ede4f5;
}

.thinking-icon { font-size: 14px; }
.thinking-label {
    flex: 1;
    font-weight: 500;
    color: #7c3aed;
    font-size: 12px;
}
.thinking-status {
    font-size: 12px;
    color: #7c3aed;
    width: 20px;
    text-align: center;
}
.thinking-status .spinner-dot {
    border-color: #7c3aed;
    border-top-color: transparent;
    width: 6px;
    height: 6px;
}
.thinking-chevron {
    font-size: 10px;
    color: #a78bfa;
    transition: transform 0.2s ease;
}
.thinking-block.expanded .thinking-chevron {
    transform: rotate(90deg);
}

.thinking-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0 12px;
    font-size: 12px;
    font-style: italic;
    color: #6b7280;
    background: #faf8fc;
    white-space: pre-wrap;
    line-height: 1.5;
}
.thinking-block.expanded .thinking-body {
    max-height: 400px;
    overflow-y: auto;
    padding: 10px 12px;
}

/* ═══════════════════════════════════════════════════════════════════════
   Message animations
   ═══════════════════════════════════════════════════════════════════════ */

.message {
    animation: msg-slide-in 0.25s ease-out;
}
@keyframes msg-slide-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tool-block {
    animation: tool-appear 0.2s ease-out;
}
@keyframes tool-appear {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pulse on tool completion */
.tool-block-status.done {
    animation: tool-done-pulse 0.4s ease;
}
@keyframes tool-done-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); color: #2ecc71; }
    100% { transform: scale(1); }
}


/* ═══════════════════════════════════════════════════
   FILE BROWSER PANEL
   ═══════════════════════════════════════════════════ */

.file-browser-panel {
    position: fixed;
    top: 0;
    right: -70vw;
    width: 70vw;
    height: 100vh;
    background: #1e1e1e;
    border-left: 2px solid #333;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    box-shadow: -4px 0 20px rgba(0,0,0,0.5);
}
.file-browser-panel.open { right: 0; }

.fb-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #252526;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}
.fb-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #e0e0e0;
}
.fb-icon { font-size: 18px; }
.fb-actions { display: flex; gap: 6px; }

.fb-btn {
    background: #333;
    border: 1px solid #555;
    color: #ccc;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}
.fb-btn:hover { background: #444; color: #fff; }
.fb-btn:disabled { opacity: 0.4; cursor: default; }
.fb-btn-save { background: #0e639c; border-color: #1177bb; color: #fff; }
.fb-btn-save:hover { background: #1177bb; }
.fb-btn-close { background: transparent; border: none; font-size: 18px; }

.fb-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.fb-tree-pane {
    width: 260px;
    min-width: 200px;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.fb-tree-header {
    padding: 8px 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
    background: #252526;
    border-bottom: 1px solid #333;
}
.fb-tree {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.fb-folder { margin: 0; }
.fb-folder-header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px 3px 12px;
    cursor: pointer;
    color: #ccc;
    font-size: 13px;
    user-select: none;
}
.fb-folder-header:hover { background: #2a2d2e; }
.fb-folder-icon { font-size: 10px; width: 14px; text-align: center; color: #888; }
.fb-folder-name { color: #ccc; }
.fb-folder-children { padding-left: 12px; }
.fb-folder-children.collapsed { display: none; }

.fb-file {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px 3px 16px;
    cursor: pointer;
    font-size: 13px;
    color: #bbb;
    user-select: none;
}
.fb-file:hover { background: #2a2d2e; }
.fb-file.active { background: #37373d; color: #fff; }
.fb-file-icon { font-size: 12px; width: 16px; text-align: center; flex-shrink: 0; }
.fb-file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-file-size { font-size: 11px; color: #666; flex-shrink: 0; }
.fb-badge {
    font-size: 9px;
    background: #333;
    color: #888;
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 4px;
    flex-shrink: 0;
}

.fb-editor-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.fb-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #252526;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}
.fb-file-path {
    font-size: 13px;
    color: #888;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fb-editor-actions { flex-shrink: 0; }

.fb-editor {
    flex: 1;
    width: 100%;
    background: #1e1e1e;
    color: #d4d4d4;
    border: none;
    padding: 12px 16px;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: none;
    outline: none;
    tab-size: 4;
}
.fb-editor:disabled { color: #555; }

.fb-loading, .fb-error, .fb-empty {
    padding: 16px;
    color: #888;
    font-size: 13px;
    text-align: center;
}
.fb-error { color: #f48771; }

/* Per-customer Base Tools button in klant header */
.klant-files-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 3px 5px;
    margin-left: auto;
    border-radius: 6px;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
    flex-shrink: 0;
}
.klant-header:hover .klant-files-btn { opacity: 0.65; }
.klant-files-btn:hover { opacity: 1 !important; background: rgba(255,111,0,0.12); }


/* ── Modal overlay ───────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(30, 73, 98, 0.35);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: modalFadeIn 0.2s ease;
}
@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-12px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-box {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0;
    min-width: 440px;
    max-width: 520px;
    box-shadow: 0 20px 60px rgba(30, 73, 98, 0.18), 0 4px 16px rgba(0,0,0,0.08);
    animation: modalSlideIn 0.25s ease;
    overflow: hidden;
}
.modal-box h2 {
    margin: 0;
    padding: 22px 28px 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.2px;
}
.modal-box .modal-subtitle {
    padding: 4px 28px 0;
    font-size: 13px;
    color: var(--text-sub);
    margin: 0;
}
.modal-box .modal-body {
    padding: 18px 28px 4px;
}
.modal-box .form-group {
    margin-bottom: 16px;
}
.modal-box .form-group label {
    display: block;
    font-size: 12px;
    color: var(--text-sub);
    margin-bottom: 5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.modal-box .form-group input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 13.5px;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.modal-box .form-group input::placeholder {
    color: var(--text-muted);
}
.modal-box .form-group input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 111, 0, 0.12);
}
.modal-box .form-group .field-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
}
.ac-suggest {
    position: relative;
    margin-top: 4px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--white);
    max-height: 220px;
    overflow-y: auto;
    box-shadow: 0 6px 18px rgba(0,0,0,.10);
    z-index: 5;
}
.ac-suggest-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}
.ac-suggest-item:last-child { border-bottom: none; }
.ac-suggest-item:hover { background: #eef4f9; }
.ac-suggest-item.muted { color: var(--text-muted); cursor: default; }
.ac-suggest-item.muted:hover { background: transparent; }
.ac-suggest-name { font-weight: 600; font-size: 13px; }
.ac-suggest-meta { font-size: 11px; color: var(--text-muted); }
.modal-box .form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 16px 28px 22px;
    background: var(--bg);
    border-top: 1px solid var(--border);
    margin-top: 8px;
}
.modal-box .form-error {
    color: var(--danger);
    font-size: 12px;
    padding: 8px 12px;
    background: rgba(224, 85, 85, 0.08);
    border-radius: 6px;
    margin: 0 28px;
}
.modal-box .form-actions .btn-secondary {
    padding: 9px 20px;
    font-size: 13px;
}
.modal-box .form-actions .btn-primary {
    padding: 9px 24px;
    font-size: 13px;
    font-weight: 600;
}

/* Add client button in sidebar */
.btn-add-client {
    background: var(--accent);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(255, 111, 0, 0.35);
    transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
}
.btn-add-client svg {
    width: 16px;
    height: 16px;
    stroke: #fff;
}
.btn-add-client:hover {
    background: var(--accent-hover);
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 2px 6px rgba(255, 111, 0, 0.45);
}
.btn-add-client:active { transform: translateY(0) scale(0.98); }

/* Session info (i) icon + tooltip */
.session-info {
    cursor: help;
    font-size: 12px;
    opacity: 0.6;
    margin-left: 4px;
    transition: opacity 0.15s;
}
.session-info:hover { opacity: 1; }

/* Stop agent button in chat header */
.btn-stop-agent {
    width: 36px; height: 36px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: #fdecea; color: #c0392b; border: 1px solid #f5c6c0;
    cursor: pointer; flex-shrink: 0; transition: background 0.15s;
}
.btn-stop-agent svg { width: 15px; height: 15px; }
.btn-stop-agent:hover { background: #f9d9d4; }

/* Toast notifications */
#toast-container {
    position: fixed; top: 18px; right: 18px; z-index: 9999;
    display: flex; flex-direction: column; gap: 10px; max-width: 360px;
}
.toast {
    display: flex; align-items: flex-start; gap: 10px;
    background: var(--white, #fff); color: var(--text, #1a2733);
    border: 1px solid var(--border, #dde8f0); border-left: 4px solid #6b7c8c;
    border-radius: 10px; padding: 11px 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.14);
    font-size: 13.5px; line-height: 1.4;
    opacity: 0; transform: translateX(16px); transition: opacity 0.2s, transform 0.2s;
}
.toast.toast-in { opacity: 1; transform: translateX(0); }
.toast.toast-out { opacity: 0; transform: translateX(16px); }
.toast-icon {
    width: 18px; height: 18px; flex-shrink: 0; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: #fff; margin-top: 1px;
}
.toast-msg { flex: 1; word-break: break-word; }
.toast-close {
    border: none; background: transparent; color: var(--muted, #6b7c8c);
    cursor: pointer; font-size: 18px; line-height: 1; padding: 0 2px; flex-shrink: 0;
}
.toast-close:hover { color: var(--text, #1a2733); }
.toast-success { border-left-color: #2e9e5b; }
.toast-success .toast-icon { background: #2e9e5b; }
.toast-error { border-left-color: #c0392b; }
.toast-error .toast-icon { background: #c0392b; }
.toast-info { border-left-color: var(--accent, #2563eb); }
.toast-info .toast-icon { background: var(--accent, #2563eb); }
.toast-warning { border-left-color: #d99100; }
.toast-warning .toast-icon { background: #d99100; }

/* Accessibility: visible focus states for keyboard navigation */
button:focus-visible, a:focus-visible, textarea:focus-visible,
input:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--accent, #2563eb);
    outline-offset: 2px;
}

/* FileBrowser modal */
.fb-box {
    min-width: 760px; max-width: 920px; width: 90vw;
    height: 78vh; max-height: 720px;
    display: flex; flex-direction: column;
}
.fb-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 24px 14px; border-bottom: 1px solid var(--border);
}
.fb-header h2 { margin: 0; padding: 0; }
.fb-close {
    border: none; background: transparent; color: var(--text-sub);
    font-size: 24px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.fb-close:hover { color: var(--text); }
.fb-body { flex: 1; display: flex; min-height: 0; }
.fb-sidebar {
    width: 280px; flex-shrink: 0; border-right: 1px solid var(--border);
    display: flex; flex-direction: column; min-height: 0; background: var(--bg);
}
.fb-sidebar-actions {
    display: flex; gap: 6px; padding: 12px; border-bottom: 1px solid var(--border);
}
.fb-sidebar-actions .btn-secondary { flex: 1; padding: 7px 10px; font-size: 12.5px; }
.fb-refresh {
    border: 1px solid var(--border); background: var(--white); border-radius: 8px;
    cursor: pointer; width: 34px; flex-shrink: 0; font-size: 15px; color: var(--text-sub);
}
.fb-refresh:hover { color: var(--accent); border-color: var(--accent); }
.fb-filelist { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.fb-file {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--text);
}
.fb-file:hover { background: var(--white); }
.fb-file.active { background: var(--white); box-shadow: inset 3px 0 0 var(--accent); }
.fb-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-file-size { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.fb-empty, .fb-filelist .fb-empty {
    padding: 16px; font-size: 12.5px; color: var(--text-muted); text-align: center; cursor: default;
}
.fb-editor { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.fb-editor-empty {
    flex: 1; display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 13.5px; padding: 24px; text-align: center;
}
.fb-editor-pane { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.fb-editor-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; border-bottom: 1px solid var(--border); gap: 12px;
}
.fb-current-path {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 12.5px; color: var(--text-sub);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fb-delete {
    border: none; background: transparent; cursor: pointer; font-size: 15px;
    padding: 2px 6px; border-radius: 6px; opacity: 0.75;
}
.fb-delete:hover { background: rgba(224, 85, 85, 0.12); opacity: 1; }
.fb-textarea {
    flex: 1; border: none; outline: none; resize: none; padding: 16px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 13px; line-height: 1.55; color: var(--text); background: var(--white);
}
.fb-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 24px; border-top: 1px solid var(--border); background: var(--bg);
}
.fb-status { font-size: 12.5px; color: var(--text-sub); }
.fb-footer-actions { display: flex; gap: 10px; }
.fb-footer-actions .btn-secondary,
.fb-footer-actions .btn-primary { padding: 9px 22px; font-size: 13px; }

@media (max-width: 820px) {
    .fb-box { min-width: 0; width: 96vw; height: 88vh; }
    .fb-sidebar { width: 200px; }
}

/* Queue badge */
.queue-badge {
    display: inline-flex;
    align-items: center;
    background: #fff3ea;
    color: var(--accent);
    border: 1px solid #ffd9b8;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 6px;
}

/* Collaborator typing indicator bar */
.collab-typing-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 16px;
    font-size: 12px;
    color: var(--text-secondary, #888);
    font-style: italic;
}
.collab-typing-bar .ct-dots {
    display: inline-flex;
    gap: 3px;
}
.collab-typing-bar .ct-dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    animation: ctBlink 1.2s infinite ease-in-out;
}
.collab-typing-bar .ct-dots span:nth-child(2) { animation-delay: 0.2s; }
.collab-typing-bar .ct-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ctBlink {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

/* Customer session list actions */
.customer-session-item .cs-action {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 13px;
    opacity: 0.55;
    padding: 2px 4px;
    border-radius: 4px;
    transition: opacity 0.15s, background 0.15s;
}
.customer-session-item .cs-action:hover { opacity: 1; background: var(--bg, #f3f3f3); }
.customer-session-item.archived { opacity: 0.7; }
.cs-archive-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary, #999);
    letter-spacing: 0.5px;
    margin: 12px 0 4px;
}

/* Download links in chat */
.download-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white !important;
    text-decoration: none !important;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    margin: 4px 0;
    transition: transform 0.1s, box-shadow 0.15s;
    box-shadow: 0 2px 6px rgba(255, 111, 0, 0.2);
}
.download-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 111, 0, 0.35);
}

/* ── Mobile sidebar backdrop ── */
#sidebar-backdrop {
    display: none;
    position: absolute; inset: 0; z-index: 40;
    background: rgba(15, 30, 40, 0.45);
    backdrop-filter: blur(1px);
}
#sidebar-backdrop.visible { display: block; }

/* ── Responsive / mobile ── */
@media (max-width: 820px) {
    header { padding: 0 12px; gap: 8px; }
    .header-title p { display: none; }
    .session-indicator { display: none !important; }
    .user-name { display: none; }

    .sidebar {
        position: absolute; top: 0; left: 0; height: 100%;
        width: min(86vw, 320px); z-index: 50;
        box-shadow: 2px 0 18px rgba(0,0,0,0.22);
        transform: translateX(0);
        transition: transform 0.24s ease;
    }
    .sidebar.collapsed {
        width: min(86vw, 320px);
        transform: translateX(-100%);
        border-right: 1px solid var(--border);
    }
    .sidebar-header { min-width: 0; }

    .klant-sessions { max-height: none; }
    .customer-detail { padding: 16px 14px; }
    .customer-session-list { max-height: none; }
    .session-form { margin: 16px auto; padding: 20px; }
}

@media (max-width: 520px) {
    .header-title h1 { font-size: 14px; }
    .chat-area-header { padding: 8px 12px; }
    .customer-session-item { flex-wrap: wrap; }
    .cs-people { flex-basis: 100%; order: 5; }
    .btn-open-session { order: 4; }
}

