/* ── Reset & variables ─────────────────────────────────────────────────── */

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

/* ── Donker thema (standaard) ──────────────────────────────────────────── */
:root, [data-theme="dark"] {
  --bg:           #111b21;
  --bg-dark:      #0a1419;
  --bg-panel:     #1f2c34;
  --bg-hover:     #2a3942;
  --bg-active:    #2a3942;
  --border:       #2a3942;
  --accent:       #25D366;
  --accent-dark:  #1ebe5a;
  --text:         #e9edef;
  --text-sub:     #8696a0;
  --text-muted:   #526168;
  --out-bubble:   #005c4b;
  --in-bubble:    #1f2c34;
  --danger:       #ef4444;
  --radius:       8px;
  --sidebar-w:    340px;
}

/* ── Licht thema ───────────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg:           #f0f2f5;
  --bg-dark:      #e9edef;
  --bg-panel:     #ffffff;
  --bg-hover:     #f0f2f5;
  --bg-active:    #e9edef;
  --border:       #d1d7db;
  --accent:       #25D366;
  --accent-dark:  #1ebe5a;
  --text:         #111b21;
  --text-sub:     #54656f;
  --text-muted:   #8696a0;
  --out-bubble:   #d9fdd3;
  --in-bubble:    #ffffff;
  --danger:       #dc2626;
  --radius:       8px;
  --sidebar-w:    340px;
}

/* Systeem-thema: volg OS-voorkeur */
@media (prefers-color-scheme: light) {
  [data-theme="system"] {
    --bg:           #f0f2f5;
    --bg-dark:      #e9edef;
    --bg-panel:     #ffffff;
    --bg-hover:     #f0f2f5;
    --bg-active:    #e9edef;
    --border:       #d1d7db;
    --accent:       #25D366;
    --accent-dark:  #1ebe5a;
    --text:         #111b21;
    --text-sub:     #54656f;
    --text-muted:   #8696a0;
    --out-bubble:   #d9fdd3;
    --in-bubble:    #ffffff;
    --danger:       #dc2626;
  }
}

/* ── Accounts screen ───────────────────────────────────────────────────── */

#screen-accounts {
  display: flex; justify-content: center;
  background: var(--bg-dark); overflow-y: auto;
}

#accounts-page { width: 100%; max-width: 800px; }

#accounts-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--border);
  background: var(--bg-dark); position: sticky; top: 0; z-index: 10;
}

.accounts-logo { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; }
.accounts-logo svg { width: 28px; height: 28px; }

#accounts-agent-info { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-sub); }
#accounts-actions { display: flex; gap: 6px; }

/* ── Hoofdtabbalk ──────────────────────────────────────────────────────── */
#main-tab-bar {
  display: flex; border-bottom: 1px solid var(--border);
  background: var(--bg-dark); position: sticky; top: 61px; z-index: 9;
}
.main-tab {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 24px; font-size: 14px; font-weight: 500;
  color: var(--text-sub); background: none; border: none;
  border-bottom: 3px solid transparent; cursor: pointer;
  transition: color .15s, border-color .15s; white-space: nowrap;
}
.main-tab svg { width: 16px; height: 16px; flex-shrink: 0; }
.main-tab:hover { color: var(--text); }
.main-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.acc-badge {
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 1;
  min-width: 16px; height: 16px; padding: 2px 4px;
  border-radius: 8px; text-align: center;
}

.main-tab-panel { padding: 0; }
.main-tab-panel.hidden { display: none; }

#accounts-content { padding: 36px 24px; }
#accounts-content h2 { font-size: 22px; font-weight: 600; margin-bottom: 6px; }
#accounts-subtitle { color: var(--text-sub); font-size: 14px; margin-bottom: 28px; }

#cb-tab-content { padding: 24px; max-width: 800px; }
#rep-tab-content { padding: 24px; max-width: 1000px; }

#accounts-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px;
}

.account-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 16px;
  cursor: pointer; transition: background .15s, border-color .15s;
}
.account-card:hover { background: var(--bg-hover); border-color: var(--accent); }

.account-card-icon {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--accent); color: #111;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
  position: relative;
}
.card-unread-badge {
  position: absolute; top: -4px; right: -4px;
  background: #e53e3e; color: #fff;
  font-size: 10px; font-weight: 700; line-height: 1;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; border: 2px solid var(--bg-main);
  pointer-events: none;
}

.account-card-info { flex: 1; min-width: 0; }
.account-card-name { font-size: 14px; font-weight: 600; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-card-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-sub); }

.account-card-arrow { width: 18px; height: 18px; color: var(--text-muted); flex-shrink: 0; }

#no-accounts-msg { text-align: center; color: var(--text-sub); padding: 60px 20px; font-size: 14px; line-height: 1.8; }

.personal-badge {
  display: inline-block; font-size: 10px; font-weight: 600; letter-spacing: .4px;
  background: var(--accent); color: #111; border-radius: 4px;
  padding: 1px 6px; margin-left: 6px; vertical-align: middle; text-transform: uppercase;
}
.account-card-add { border-style: dashed; opacity: .8; }
.account-card-add:hover { opacity: 1; }
.account-card-add .add-icon { background: transparent; border: 2px dashed var(--accent); color: var(--accent); font-size: 22px; }

/* ── Account badge in sidebar ──────────────────────────────────────────── */

#account-badge {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 20px; padding: 5px 12px; cursor: pointer;
  transition: background .15s; min-width: 0; max-width: 160px;
}
#account-badge:hover { background: var(--bg-hover); }
#account-badge-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
#account-badge span { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Admin: accounts section ───────────────────────────────────────────── */

.section-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title-row h3 { margin-bottom: 0; }
.btn-primary.small { padding: 6px 12px; font-size: 12px; }

.account-admin-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 8px; background: var(--bg);
  flex-wrap: wrap;
}
.account-admin-info { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.account-admin-icon {
  width: 36px; height: 36px; border-radius: 50%; background: var(--accent);
  color: #111; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.account-admin-name { font-size: 13px; font-weight: 600; }
.account-admin-meta { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-sub); margin-top: 2px; }
.account-admin-agents { flex: 1; font-size: 12px; color: var(--text-sub); }
.account-admin-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.agent-list-label { font-size: 12px; }

.accounts-cell { max-width: 200px; font-size: 12px; color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.agent-checkbox {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 13px;
}
.agent-checkbox:last-child { border-bottom: none; }
.agent-checkbox input { width: 16px; height: 16px; accent-color: var(--accent); }

.empty-msg { color: var(--text-sub); font-size: 13px; padding: 12px 0; }
.empty-msg.error { color: var(--danger); }

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

button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ── Screens ───────────────────────────────────────────────────────────── */

.screen { height: 100vh; }
.hidden { display: none !important; }

/* ── Login ─────────────────────────────────────────────────────────────── */

#screen-login {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--bg-dark);
}
#login-logos { width: 100%; max-width: 480px; }

.auth-card {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 40px 36px; width: 360px;
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
}

.auth-logo { text-align: center; margin-bottom: 16px; }
.auth-logo svg { width: 52px; height: 52px; }

.auth-card h1 { text-align: center; font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.auth-subtitle { text-align: center; color: var(--text-sub); margin-bottom: 28px; font-size: 13px; }
.auth-version { text-align: center; color: var(--text-muted); font-size: 11px; margin-top: 20px; }
.remember-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-sub); cursor: pointer; margin-bottom: 12px; }
.remember-label input { cursor: pointer; }

/* ── Forms ─────────────────────────────────────────────────────────────── */

.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-sub); text-transform: uppercase; letter-spacing: .4px; }

.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 120px; margin-bottom: 0; }

input[type="text"], input[type="password"], input[type="search"], input[type="url"], input[type="tel"], input[type="email"], input[type="number"], select, textarea {
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); padding: 10px 12px; font-size: 14px; outline: none;
  transition: border-color .15s; width: 100%; box-sizing: border-box;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }

.form-error { color: var(--danger); font-size: 12px; margin-top: 6px; padding: 8px 10px;
  background: rgba(239,68,68,.1); border-radius: 6px; border: 1px solid rgba(239,68,68,.25); }

/* ── Buttons ───────────────────────────────────────────────────────────── */

.btn-primary {
  padding: 10px 18px; background: var(--accent); color: #111;
  border: none; border-radius: 6px; font-size: 14px; font-weight: 600;
  transition: background .15s; white-space: nowrap;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary.full-width { width: 100%; }

.btn-secondary {
  padding: 10px 18px; background: transparent; color: var(--text-sub);
  border: 1px solid var(--border); border-radius: 6px; font-size: 14px;
  transition: background .15s, color .15s;
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text); }

.btn-danger {
  padding: 10px 18px; background: transparent; color: var(--danger);
  border: 1px solid rgba(239,68,68,.4); border-radius: 6px; font-size: 14px;
  transition: background .15s;
}
.btn-danger:hover { background: rgba(239,68,68,.1); }
.btn-danger.small, .btn-ghost.small { padding: 5px 10px; font-size: 12px; }

.btn-ghost {
  padding: 8px 14px; background: transparent; color: var(--text-sub);
  border: 1px solid var(--border); border-radius: 6px; font-size: 13px;
  transition: background .15s;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; background: transparent; border: none;
  border-radius: 6px; color: var(--text-sub); transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

/* ── QR screen ─────────────────────────────────────────────────────────── */

#screen-qr {
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-dark);
}

.qr-card {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 32px 40px 40px; width: 480px; text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
}

/* Methode-tabs */
.qr-method-tabs {
  display: flex; gap: 4px; background: var(--bg-hover);
  border-radius: 8px; padding: 4px; margin-bottom: 24px;
}
.qr-method-tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 12px; border: none; border-radius: 6px; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--text-sub);
  background: transparent; transition: all .15s;
}
.qr-method-tab.active {
  background: var(--bg-panel); color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}

/* Pairing code wizard */
.pairing-wizard { text-align: left; }
.pairing-intro { font-size: 13px; color: var(--text-sub); line-height: 1.6; margin-bottom: 16px; }
.pairing-hint  { font-size: 12px; color: var(--text-sub); margin-top: 4px; display: block; }
.pairing-steps { font-size: 13px; color: var(--text-sub); line-height: 1.8; padding-left: 18px; margin-bottom: 20px; }
.pairing-steps strong { color: var(--text); }
.pairing-code  {
  font-size: 32px; font-weight: 700; letter-spacing: 8px; text-align: center;
  color: var(--accent); background: var(--bg-hover); border-radius: 10px;
  padding: 20px 10px; margin: 0 0 16px; font-family: monospace;
}
.btn-link { background: none; border: none; color: var(--accent); cursor: pointer; font-size: inherit; padding: 0; text-decoration: underline; }

.qr-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 28px;
  justify-content: center;
}
.qr-header #qr-logout-btn { margin-left: auto; }
#qr-status-text { font-weight: 500; }

#qr-image-wrap img { width: 240px; height: 240px; border-radius: 8px; background: white; padding: 8px; }
#qr-image-wrap p { margin-top: 16px; color: var(--text-sub); font-size: 13px; line-height: 1.6; }

#qr-waiting, #qr-agent-wait {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 40px 0; color: var(--text-sub);
}

/* ── Spinner ───────────────────────────────────────────────────────────── */

.spinner {
  width: 32px; height: 32px; border: 3px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite;
}
.spinner.small { width: 18px; height: 18px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Status dot ────────────────────────────────────────────────────────── */

.status-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.status-dot.ready    { background: var(--accent); }
.status-dot.qr       { background: #facc15; }
.status-dot.connecting, .status-dot.initializing { background: #fb923c; animation: pulse 1.2s ease-in-out infinite; }
.status-dot.disconnected { background: var(--danger); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ── Main portal layout ────────────────────────────────────────────────── */

#screen-main {
  display: flex; height: 100vh; overflow: hidden;
}

/* ── Sidebar ───────────────────────────────────────────────────────────── */

#sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: var(--bg-dark); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}

#sidebar-top {
  display: flex; flex-wrap: wrap; align-items: center;
  padding: 8px 10px 0; border-bottom: 1px solid var(--border);
  gap: 0 4px;
}
#account-badge    { order: 1; flex: 1; min-width: 0; }
#sidebar-actions  { order: 2; flex-shrink: 0; }
#portal-tab-bar   { order: 3; width: 100%; padding-bottom: 2px; }

#agent-info { display: flex; align-items: center; gap: 10px; min-width: 0; }

#agent-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #111; flex-shrink: 0;
}

#agent-name-role { display: flex; flex-direction: column; min-width: 0; }
#agent-display-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#agent-display-role { font-size: 11px; color: var(--text-sub); }

#sidebar-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.portal-agent-label { font-size: 11px; font-weight: 600; color: var(--text-sub); white-space: nowrap; padding: 0 6px 0 2px; margin-right: 2px; border-right: 1px solid var(--border); line-height: 1; }
#sidebar-actions .icon-btn { width: 28px; height: 28px; }
#sidebar-actions .icon-btn svg { width: 16px; height: 16px; }

/* ── Account switcher strip ─────────────────────────────────────────────── */

#account-switcher {
  display: flex; gap: 4px; padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
}
#account-switcher:empty { display: none; }
#account-switcher::-webkit-scrollbar { display: none; }

.acc-sw-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px; border-radius: 16px; border: none;
  background: var(--bg-panel); color: var(--text); cursor: pointer;
  font-size: 11px; white-space: nowrap; flex-shrink: 0;
  position: relative; transition: background .15s;
}
.acc-sw-btn:hover { background: var(--bg-hover); }
.acc-sw-btn.active { background: var(--bg-hover); outline: 2px solid var(--acc-color, var(--accent)); }

.acc-sw-avatar {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--acc-color, var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; color: #111; flex-shrink: 0;
}

.acc-sw-name { max-width: 80px; overflow: hidden; text-overflow: ellipsis; }

.acc-sw-badge {
  background: var(--danger); color: #fff; font-size: 9px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
}

.acc-color-input { width: 18px; height: 18px; border: none; padding: 0; cursor: pointer; border-radius: 50%; }
.color-pick-label { cursor: pointer; display: inline-flex; align-items: center; margin-left: 6px; }

#search-wrap { padding: 10px 12px; border-bottom: 1px solid var(--border); }
#chat-search {
  width: 100%; background: var(--bg-panel); border-color: transparent;
  padding: 8px 12px; border-radius: 20px; font-size: 13px;
}
#chat-search:focus { border-color: var(--accent); }

#wa-status-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; background: rgba(239,68,68,.08);
  border-bottom: 1px solid rgba(239,68,68,.2);
  font-size: 12px; color: var(--danger);
}

#chat-list { flex: 1; overflow-y: auto; }
#chat-list::-webkit-scrollbar { width: 4px; }
#chat-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── Chat items ────────────────────────────────────────────────────────── */

.chat-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,.03);
  transition: background .1s;
}
.chat-item:hover  { background: var(--bg-hover); }
.chat-item.active { background: var(--bg-active); }

.chat-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--bg-panel); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--text-sub); flex-shrink: 0;
}

.chat-info { flex: 1; min-width: 0; }
.chat-meta { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 3px; }
.chat-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-time { font-size: 11px; color: var(--text-muted); flex-shrink: 0; margin-left: 6px; }

.chat-preview-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.chat-preview { font-size: 12px; color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }

.unread-badge {
  background: var(--accent); color: #111; font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px; flex-shrink: 0;
}

/* ── Chat area ─────────────────────────────────────────────────────────── */

#chat-area {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg);
}

#no-chat-selected {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px; color: var(--text-muted);
}
#no-chat-selected svg { width: 48px; height: 48px; }
#no-chat-selected p { font-size: 15px; }

#chat-view { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

#chat-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; background: var(--bg-dark); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#chat-header-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--bg-panel); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--text-sub); flex-shrink: 0;
}

#chat-header-info { display: flex; flex-direction: column; }
#chat-header-name { font-size: 15px; font-weight: 600; }
#chat-header-sub  { font-size: 12px; color: var(--text-sub); }

#messages-container {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%232a3942' fill-opacity='0.15'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
#messages-container::-webkit-scrollbar { width: 4px; }
#messages-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

#messages-list { display: flex; flex-direction: column; gap: 2px; margin-top: auto; }

.loading-msgs { display: flex; justify-content: center; padding: 40px; }
.error-msg { text-align: center; color: var(--danger); padding: 20px; font-size: 13px; }

/* ── Messages ──────────────────────────────────────────────────────────── */

.msg-wrap { display: flex; margin: 1px 0; }
.msg-wrap.out { justify-content: flex-end; }
.msg-wrap.in  { justify-content: flex-start; }

.msg-bubble {
  max-width: 65%; padding: 7px 10px 4px;
  border-radius: 8px; font-size: 13.5px; line-height: 1.45;
  position: relative; word-break: break-word;
}
.msg-wrap.out .msg-bubble { background: var(--out-bubble); border-bottom-right-radius: 2px; }
.msg-wrap.in  .msg-bubble { background: var(--in-bubble);  border-bottom-left-radius: 2px; }

.msg-sender { font-size: 12px; font-weight: 600; color: var(--accent); margin-bottom: 2px; }
.msg-body   { white-space: pre-wrap; }
.msg-media  { font-style: normal; }
.msg-caption { font-size: 13px; margin-top: 5px; white-space: pre-wrap; }

.msg-img {
  display: block; max-width: 280px; max-height: 300px;
  border-radius: 6px; object-fit: cover; transition: opacity .2s;
}
.msg-img[alt*="Laden"] { min-width: 120px; min-height: 80px; background: var(--bg-hover); }
.msg-img:hover { opacity: .9; }

.msg-video {
  display: block; max-width: 280px; max-height: 220px;
  border-radius: 6px; background: #000;
}

audio { display: block; width: 240px; margin: 2px 0; }

.msg-doc {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 6px;
  background: rgba(255,255,255,.08); color: var(--text);
  text-decoration: none; font-size: 13px;
  border: 1px solid var(--border); transition: background .15s;
}
.msg-doc:hover { background: rgba(255,255,255,.14); }

.msg-footer { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 3px; }
.msg-time   { font-size: 10px; color: var(--text-muted); }
.msg-agent  { font-size: 10px; color: var(--text-muted); font-style: italic; }
.msg-ack    { display: inline-flex; align-items: center; flex-shrink: 0; }

/* ── Bijlage preview ────────────────────────────────────────────────────── */

#attachment-preview {
  display: flex; align-items: center;
  padding: 6px 16px 0;
  background: var(--bg-dark);
}
#attachment-preview.hidden { display: none; }
#attachment-preview-inner {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-panel); border-radius: 8px;
  padding: 6px 10px; font-size: 13px; max-width: 100%;
}
#attachment-name { font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
#attachment-size { color: var(--text-sub); font-size: 11px; white-space: nowrap; }
#attachment-remove {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 14px; padding: 0 2px; line-height: 1;
}
#attachment-remove:hover { color: var(--danger, #e74c3c); }

/* ── Message input ─────────────────────────────────────────────────────── */

#message-input-area {
  display: flex; align-items: flex-end; gap: 10px;
  padding: 12px 16px; background: var(--bg-dark); border-top: 1px solid var(--border);
  flex-shrink: 0;
}

#attach-btn {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-sub); transition: color .15s, background .15s;
  margin-bottom: 2px;
}
#attach-btn:hover { color: var(--accent); background: var(--bg-panel); }

#message-input {
  flex: 1; background: var(--bg-panel); border-radius: 20px; border-color: transparent;
  padding: 10px 16px; font-size: 14px; resize: none; max-height: 120px;
  line-height: 1.4; overflow-y: auto;
}
#message-input:focus { border-color: var(--accent); }

#send-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent); border: none;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .15s;
}
#send-btn:hover { background: var(--accent-dark); }
#send-btn svg { width: 18px; height: 18px; color: #111; }

/* ── Callback badge ────────────────────────────────────────────────────── */

#callback-btn { position: relative; }
.callback-badge {
  position: absolute; top: 2px; right: 2px;
  background: var(--danger); color: #fff;
  font-size: 9px; font-weight: 700; line-height: 1;
  min-width: 14px; height: 14px; padding: 2px 3px;
  border-radius: 7px; text-align: center;
  pointer-events: none;
}

/* ── Callback scherm ────────────────────────────────────────────────────── */

#screen-callback {
  display: flex; justify-content: center;
  background: var(--bg-dark); overflow-y: auto;
}
#callback-panel { width: 100%; max-width: 800px; padding: 32px 24px; }
#callback-header { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
#callback-header h2 { font-size: 20px; font-weight: 600; }

.callback-section {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
}
.callback-section h3 { font-size: 15px; font-weight: 600; margin-bottom: 16px; }

.form-row.wrap { flex-wrap: wrap; }
.cb-filter-sel { font-size: 13px; background: var(--bg-hover); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 4px 8px; cursor: pointer; }

/* Callback list items */
.cb-item {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px;
}
.cb-item.cb-status-afgehandeld { opacity: 0.55; }
.cb-item.urgentie-item-hoog   { background: rgba(251,146,60,.08); border-left: 3px solid #f97316; }
.cb-item.urgentie-item-urgent { background: rgba(239,68,68,.10);  border-left: 3px solid #ef4444; }
.cb-item-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cb-date { font-size: 11px; color: var(--text-muted); margin-left: auto; }
.cb-delete-btn { margin-left: 6px; width: 24px; height: 24px; color: var(--text-sub); }
.cb-delete-btn:hover { color: var(--danger); }
.cb-delete-btn svg { width: 14px; height: 14px; }

.cb-status-badge {
  font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 10px; text-transform: uppercase; letter-spacing: .4px;
}
.cb-status-badge.open                  { background: #2d4a1e; color: #7ee55a; }
.cb-status-badge.in_behandeling        { background: #2d3a4a; color: #60aaff; }
.cb-status-badge.herinnering_verzonden { background: #3d2e10; color: #f59e0b; }
.cb-status-badge.afgehandeld           { background: #2a2a2a; color: var(--text-muted); }

.cb-item-body { margin-bottom: 12px; }
.cb-name-phone { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.cb-name-phone strong { font-size: 15px; }
.cb-phone { color: var(--accent); font-size: 13px; text-decoration: none; }
.cb-phone:hover { text-decoration: underline; }
.cb-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--text-sub); margin-bottom: 6px; }
.cb-company { background: var(--bg-hover); border-radius: 4px; padding: 1px 6px; }
.cb-opmerking { font-size: 13px; color: var(--text-sub); background: var(--bg-hover); border-radius: 6px; padding: 8px 10px; }

/* Notitieveld */
.cb-notes-wrap { margin: 10px 0 6px; }
.cb-notes-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; display: block; margin-bottom: 4px; }
.cb-notes-input {
  width: 100%; background: var(--bg-hover); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 13px;
  padding: 7px 10px; resize: vertical; font-family: inherit;
  transition: border-color .15s;
}
.cb-notes-input:focus { outline: none; border-color: var(--accent); }

.cb-item-footer { display: flex; align-items: center; gap: 10px; }
.cb-status-label { font-size: 12px; color: var(--text-muted); }
.cb-status-sel {
  font-size: 12px; background: var(--bg-hover); border: 1px solid var(--border);
  color: var(--text); border-radius: 6px; padding: 4px 8px; cursor: pointer;
}

/* Bedrijven in admin */
.company-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.company-row:last-child { border-bottom: none; }
.company-name { font-size: 14px; }

/* ── Admin panel ───────────────────────────────────────────────────────── */

#screen-admin {
  display: flex; justify-content: center;
  background: var(--bg-dark); overflow-y: auto;
}

#admin-panel {
  width: 100%; max-width: 760px; padding: 32px 24px;
}

#admin-header {
  display: flex; align-items: center; gap: 14px; margin-bottom: 32px;
}
#admin-header h2 { font-size: 20px; font-weight: 600; }

.admin-section {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
}
.admin-section h3 { font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text-sub); margin-bottom: 16px; }

#admin-wa-status { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 13px; }

#agents-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 0; }
#agents-table th { text-align: left; padding: 8px 10px; color: var(--text-sub); font-weight: 600;
  font-size: 11px; text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--border); }
#agents-table td { padding: 10px 10px; border-bottom: 1px solid rgba(255,255,255,.04); }
#agents-table tr:last-child td { border-bottom: none; }
.agent-actions { display: flex; gap: 6px; }

/* ── Modal ─────────────────────────────────────────────────────────────── */

#modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
  backdrop-filter: blur(4px);
}

#modal {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius); width: 360px; overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 0; }
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-body { padding: 18px 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 18px; }

/* ── Settings sectie-stijlen (gebruikt in #settings-main-body) ─────────── */

.settings-body { flex: 1; overflow-y: auto; padding: 8px 0; }

.settings-section { padding: 14px 18px 10px; border-bottom: 1px solid var(--border); }
.settings-section:last-child { border-bottom: none; }
.settings-section-title {
  font-size: 11px; font-weight: 700; letter-spacing: .6px;
  text-transform: uppercase; color: var(--text-sub); margin-bottom: 12px;
}

.settings-empty { font-size: 13px; color: var(--text-sub); margin: 0 0 6px; }

/* Thema-knoppen */
.theme-label { font-size: 12px; color: var(--text-sub); margin-bottom: 8px; }
.theme-btns { display: flex; gap: 8px; }
.theme-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 14px; font-size: 11px; font-weight: 500;
  color: var(--text-sub); background: var(--bg-hover);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: border-color .15s, color .15s;
}
.theme-btn svg { width: 18px; height: 18px; }
.theme-btn:hover { color: var(--text); border-color: var(--text-sub); }
.theme-btn.active { color: var(--accent); border-color: var(--accent); background: var(--bg-active); }

.settings-account-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; background: var(--bg-panel); border-radius: 8px; padding: 10px 12px;
}
.settings-acc-name { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.settings-acc-status { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-sub); }

.settings-notif-row {
  padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.05);
}
.settings-notif-row:last-child { border-bottom: none; }
.settings-notif-name { font-size: 13px; font-weight: 500; margin-bottom: 8px; }
.settings-toggles { display: flex; gap: 16px; }

.toggle-wrap {
  display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none;
}
.toggle-wrap input[type=checkbox] { display: none; }
.toggle-track {
  width: 34px; height: 20px; border-radius: 10px;
  background: var(--border); position: relative; transition: background .2s; flex-shrink: 0;
}
.toggle-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; transition: transform .2s;
}
.toggle-wrap input:checked + .toggle-track { background: var(--accent); }
.toggle-wrap input:checked + .toggle-track .toggle-thumb { transform: translateX(14px); }
.toggle-lbl { font-size: 12px; color: var(--text-sub); }

.admin-section-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px;
}
.admin-section-header h3 { margin-bottom: 0; }

/* ── Login logo's ───────────────────────────────────────────────────────── */

.login-logos-wrap {
  display: flex; align-items: center; justify-content: center;
  flex-wrap: nowrap; gap: 28px; margin-bottom: 28px;
}
.login-logo-img {
  height: 70px; max-width: 160px; object-fit: contain;
  opacity: .95; transition: opacity .2s, transform .2s;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.4));
}
.login-logo-img:hover { opacity: 1; transform: scale(1.05); }

/* ── Logo-beheer in admin ───────────────────────────────────────────────── */

.logo-item {
  position: relative; display: inline-block;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 6px; background: var(--bg-panel);
}
.logo-thumb {
  display: block; height: 48px; max-width: 100px;
  object-fit: contain; border-radius: 4px;
}
.logo-del-btn {
  position: absolute; top: -6px; right: -6px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #e74c3c; color: #fff; border: none;
  font-size: 10px; cursor: pointer; line-height: 18px; text-align: center;
  padding: 0;
}
.logo-del-btn:hover { background: #c0392b; }

/* ── Portal tabbladen (sidebar-top) ────────────────────────────────────── */

#portal-tab-bar {
  display: flex; gap: 2px; flex-shrink: 0;
}

.portal-tab {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: none; background: transparent;
  color: var(--text-sub); border-radius: 8px;
  transition: background .15s, color .15s;
}
.portal-tab svg { width: 18px; height: 18px; }
.portal-tab:hover { background: var(--bg-hover); color: var(--text); }
.portal-tab.active { background: var(--bg-hover); color: var(--accent); }
.portal-tab .callback-badge {
  position: absolute; top: 2px; right: 2px;
}

/* ── Portal sidebar panels ─────────────────────────────────────────────── */

#portal-panel-wa {
  display: flex; flex-direction: column; flex: 1; overflow: hidden;
}
#portal-panel-cb {
  display: flex; flex-direction: column; flex: 1; overflow: hidden;
}
#portal-panel-settings {
  display: flex; flex-direction: column; flex: 1; overflow: hidden;
}
#portal-panel-rep {
  display: flex; flex-direction: column; flex: 1; overflow: hidden;
}
#portal-panel-rep .rep-sidebar-filters {
  padding: 8px 10px; border-bottom: 1px solid var(--border); flex-shrink: 0;
  display: flex; flex-direction: column; gap: 6px;
}
#portal-panel-rep .rep-sidebar-filters select {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 12px; padding: 5px 8px;
}
#rep-sidebar-list { flex: 1; overflow-y: auto; }
#rep-sidebar-list::-webkit-scrollbar { width: 4px; }
#rep-sidebar-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

#portal-panel-cb.hidden, #portal-panel-wa.hidden, #portal-panel-settings.hidden,
#portal-panel-rep.hidden { display: none !important; }

/* rep-main: full height flex column */
#rep-main {
  display: flex; flex-direction: column; flex: 1; overflow: hidden;
  background: var(--bg);
}
#rep-detail-area { flex: 1; overflow-y: auto; }

#cb-sidebar-toolbar {
  padding: 10px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}

#cb-sidebar-list { flex: 1; overflow-y: auto; }
#cb-sidebar-list::-webkit-scrollbar { width: 4px; }
#cb-sidebar-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.cb-sidebar-empty { padding: 16px; font-size: 13px; color: var(--text-sub); }

.cb-sidebar-item {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 16px; cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,.03);
  transition: background .1s;
}
.cb-sidebar-item:hover  { background: var(--bg-hover); }
.cb-sidebar-item.active { background: var(--bg-active); border-left: 3px solid var(--accent); }

/* Urgentie achtergrondkleuren */
.cb-sidebar-item.urgentie-hoog   { background: rgba(251,146,60,.12); border-left: 3px solid #f97316; }
.cb-sidebar-item.urgentie-urgent { background: rgba(239,68,68,.14);  border-left: 3px solid #ef4444; }
.cb-sidebar-item.urgentie-hoog:hover   { background: rgba(251,146,60,.2); }
.cb-sidebar-item.urgentie-urgent:hover { background: rgba(239,68,68,.22); }
.cb-sidebar-item.urgentie-hoog.active   { background: rgba(251,146,60,.25); border-left: 3px solid #f97316; }
.cb-sidebar-item.urgentie-urgent.active { background: rgba(239,68,68,.28);  border-left: 3px solid #ef4444; }

/* Urgentie badge */
.cb-urgentie-badge {
  font-size: 10px; font-weight: 700; padding: 2px 6px;
  border-radius: 8px; text-transform: uppercase; letter-spacing: .3px;
}
.cb-urgentie-badge.hoog   { background: rgba(251,146,60,.2); color: #f97316; }
.cb-urgentie-badge.urgent { background: rgba(239,68,68,.2);  color: #ef4444; }

.cb-sidebar-item-header {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.cb-sidebar-item-date { font-size: 11px; color: var(--text-muted); }
.cb-sidebar-item-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-sidebar-item-meta { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-sub); }

/* ── Portal: hoofd WA / Terugbel / Instellingen panelen ───────────────── */

#wa-main {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
}
#cb-main {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
}
#settings-main {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg);
}
#wa-main.hidden, #cb-main.hidden, #settings-main.hidden { display: none !important; }

/* ── Instellingen hoofdgebied ──────────────────────────────────────────── */

#settings-main-header {
  display: flex; align-items: center;
  padding: 16px 24px; border-bottom: 1px solid var(--border);
  background: var(--bg-dark); flex-shrink: 0;
}
#settings-main-header h2 { font-size: 16px; font-weight: 600; }

#settings-main-body {
  flex: 1; overflow-y: auto; padding: 8px 0; max-width: 600px; width: 100%;
}
#settings-main-body::-webkit-scrollbar { width: 4px; }
#settings-main-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── Terugbelverzoeken: hoofdgebied ────────────────────────────────────── */

#cb-main-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  background: var(--bg-dark); flex-shrink: 0;
}
#cb-main-toolbar h2 { font-size: 16px; font-weight: 600; }
.cb-toolbar-actions { display: flex; gap: 8px; }

/* btn-primary met icoon */
.btn-primary.small { display: inline-flex; align-items: center; gap: 6px; }
.btn-primary.small svg { width: 14px; height: 14px; flex-shrink: 0; }

#cb-main-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

#cb-welcome-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  color: var(--text-muted);
}
#cb-welcome-state svg { width: 48px; height: 48px; opacity: .5; }
#cb-welcome-state p { font-size: 15px; text-align: center; line-height: 1.7; }

/* cb-form-panel is now a top-level fixed modal */
.cb-form-modal {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.45);
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; padding: 24px;
}
.cb-form-card {
  width: 100%; max-width: 600px; margin: 40px 0;
  background: var(--panel-bg, var(--bg)); border-radius: 12px; padding: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
}
.cb-panel-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px;
}
.cb-panel-header h3 { font-size: 16px; font-weight: 600; }

#cb-detail-panel { flex: 1; overflow-y: auto; padding: 20px; }

.cb-detail-card {
  max-width: 640px; background: var(--bg-panel);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
}
.cb-detail-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 14px; border-bottom: 1px solid var(--border);
}

/* ── 2FA login scherm ───────────────────────────────────────────────────── */

.twofa-header { text-align: center; margin-bottom: 20px; }
.twofa-icon { font-size: 36px; margin-bottom: 8px; }
.twofa-header h2 { font-size: 18px; font-weight: 600; margin-bottom: 6px; }

.twofa-remember {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-sub); cursor: pointer;
  margin-top: 4px;
}
.twofa-remember input { cursor: pointer; }

#twofa-code {
  font-size: 22px; letter-spacing: 6px; text-align: center; font-weight: 600;
}

/* ── Toast notificaties ──────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg-chat, #fff);
  border: 1px solid var(--border);
  border-left: 4px solid #25d366;
  border-radius: 10px;
  padding: 12px 14px;
  min-width: 280px;
  max-width: 340px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  pointer-events: all;
  cursor: pointer;
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.toast-show {
  opacity: 1;
  transform: translateX(0);
}
.toast.toast-hide {
  opacity: 0;
  transform: translateX(30px);
}
.toast-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: #25d36620;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #25d366;
}
.toast-icon svg { width: 14px; height: 14px; }
.toast-content { flex: 1; min-width: 0; }
.toast-title { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.toast-body  { font-size: 12px; color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--text-sub);
  opacity: 0.5;
  line-height: 1;
}
.toast-close:hover { opacity: 1; }
.toast-close svg { width: 14px; height: 14px; display: block; }

/* ── Reparaties module ─────────────────────────────────────────────────── */

/* Toolbar */
#rep-main-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
  flex-shrink: 0;
}
#rep-main-toolbar h2 { font-size: 16px; font-weight: 700; color: var(--text); }

/* Legenda */
#rep-legenda {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 18px 10px;
  border-bottom: 1px solid var(--border);
}
.rep-leg-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-sub);
}
.rep-leg-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.rep-leg-dot.standkachel { background: #9ca3af; }
.rep-leg-dot.radiateur   { background: #60a5fa; }
.rep-leg-dot.kookplaat   { background: #f87171; }
.rep-leg-dot.branderkop  { background: #4ade80; }
.rep-leg-dot.waterboiler { background: #c084fc; }
.rep-leg-dot.koelkast    { background: #fb923c; }
.rep-leg-dot.overig      { background: var(--border); }

/* Detail area */
#rep-detail-area {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}
#rep-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--text-muted);
  font-size: 14px;
  padding: 60px 20px;
  text-align: center;
}
#rep-welcome svg { opacity: .3; }

/* Sidebar items */
.rep-sidebar-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
  border-left: 3px solid transparent;
}
.rep-sidebar-item:hover   { background: var(--bg-hover); }
.rep-sidebar-item.active  { background: var(--bg-active); }
.rep-sidebar-item-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
  flex-wrap: wrap;
}
.rep-sidebar-klant {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.rep-sidebar-date {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: auto;
}
.rep-sidebar-meta {
  font-size: 12px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Status badges — klasse is "rep-status-badge binnenkomst" etc. */
.rep-status-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 20px;
  flex-shrink: 0;
}
.rep-status-badge.binnenkomst    { background: rgba(107,114,128,.18); color: #9ca3af; }
.rep-status-badge.in_behandeling { background: rgba(59,130,246,.18);  color: #60a5fa; }
.rep-status-badge.gereed         { background: rgba(34,197,94,.18);   color: #4ade80; }
.rep-status-badge.opgehaald      { background: rgba(16,185,129,.18);  color: #34d399; }
.rep-status-badge.gefactueerd    { background: rgba(168,85,247,.18);  color: #c084fc; }

/* Type-kleuren sidebar border — klasse is "type-standkachel" etc. */
.rep-sidebar-item.type-standkachel { border-left-color: #9ca3af; }
.rep-sidebar-item.type-radiateur   { border-left-color: #60a5fa; }
.rep-sidebar-item.type-kookplaat   { border-left-color: #f87171; }
.rep-sidebar-item.type-branderkop  { border-left-color: #4ade80; }
.rep-sidebar-item.type-waterboiler { border-left-color: #c084fc; }
.rep-sidebar-item.type-koelkast    { border-left-color: #fb923c; }
.rep-sidebar-item.type-overig      { border-left-color: var(--border); }

/* Detail card */
.rep-detail-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 700px;
}
.rep-dc-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}
.rep-dc-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg-dark);
  color: var(--text-sub);
  flex-shrink: 0;
}
.rep-dc-klant { flex: 1; }
.rep-dc-naam {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}
.rep-dc-werkbon {
  font-size: 13px;
  color: var(--text-sub);
  margin-top: 2px;
}
.rep-dc-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 10px 14px;
  background: var(--bg-dark);
  border-radius: var(--radius);
  font-size: 12px;
}
.rep-dc-meta-item { display: flex; flex-direction: column; gap: 2px; }
.rep-dc-meta-label { color: var(--text-muted); font-size: 11px; }
.rep-dc-meta-val { color: var(--text); font-weight: 600; }
.rep-dc-block { display: flex; flex-direction: column; gap: 6px; }
.rep-dc-label { font-size: 12px; font-weight: 600; color: var(--text-sub); }
.rep-dc-klacht {
  font-size: 13px;
  color: var(--text);
  background: var(--bg-dark);
  border-radius: 6px;
  padding: 10px 12px;
}
.rep-notities-input,
.rep-status-sel,
.rep-akkoord-sel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  padding: 7px 10px;
  width: 100%;
}
.rep-notities-input:focus,
.rep-status-sel:focus,
.rep-akkoord-sel:focus { outline: none; border-color: var(--accent); }
.rep-notities-input { resize: vertical; min-height: 72px; }
.rep-dc-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.rep-dc-footer .rep-dc-label { min-width: auto; }
.rep-dc-footer .rep-status-sel,
.rep-dc-footer .rep-akkoord-sel { width: auto; flex: 1; min-width: 140px; }

/* Form overlay */
#rep-form-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#rep-form-overlay.hidden { display: none; }
.rep-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.rep-form-card {
  background: var(--bg-panel);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.rep-form-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.rep-form-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.rep-form-row label {
  font-size: 12px;
  color: var(--text-sub);
  font-weight: 600;
}
.rep-form-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.rep-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

/* Reparaties op accounts-scherm */
.rep-acc-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  margin-bottom: 8px;
  background: var(--bg-panel);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.rep-acc-item-left { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.rep-acc-item-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.rep-acc-klant { font-size: 14px; font-weight: 600; color: var(--text); }
.rep-acc-meta { font-size: 12px; color: var(--text-sub); }
.rep-acc-klacht { font-size: 12px; color: var(--text-sub); font-style: italic; }
.rep-acc-notities { font-size: 12px; color: var(--text-sub); max-width: 260px; text-align: right; }

/* Akkoord type badge — klasse is "rep-akkoord-badge akkoord" etc. */
.rep-akkoord-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 20px;
  flex-shrink: 0;
}
.rep-akkoord-badge.akkoord      { background: rgba(34,197,94,.18);   color: #4ade80; }
.rep-akkoord-badge.niet_akkoord { background: rgba(239,68,68,.14);   color: #f87171; }
.rep-akkoord-badge.onbekend     { background: rgba(107,114,128,.18); color: #9ca3af; }
.rep-akkoord-badge.nvt          { background: rgba(107,114,128,.12); color: var(--text-muted); }

/* ── Teamchat ──────────────────────────────────────────────────────────── */

/* Sidebar toolbar */
#ic-sidebar-toolbar { padding: 10px 12px; border-bottom: 1px solid var(--border); }

/* Chat list in sidebar */
#ic-chat-list { overflow-y: auto; flex: 1; }

.ic-sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.ic-sidebar-item:hover  { background: var(--hover-bg); }
.ic-sidebar-item.active { background: var(--active-bg); }

/* Avatar klein (sidebar) */
.ic-avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  position: relative;
}
.ic-avatar-sm.group { border-radius: 10px; background: var(--accent2, #7478e7); }

/* Online dot */
.ic-online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--sidebar-bg, var(--bg));
}

.ic-item-info    { flex: 1; min-width: 0; }
.ic-item-name    { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ic-last-msg     { font-size: 12px; color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.ic-last-msg.muted { color: var(--text-muted); }
.ic-group-tag    { font-size: 10px; background: rgba(116,120,231,.2); color: #7478e7; border-radius: 4px; padding: 1px 5px; vertical-align: middle; margin-left: 4px; }
.ic-unread-badge { background: var(--accent); color: #fff; border-radius: 50%; min-width: 18px; height: 18px; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 3px; }

/* Hoofd chat gebied */
#ic-main {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
#ic-no-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-sub);
  gap: 12px;
}
#ic-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Header */
#ic-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}
.ic-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
}
.ic-avatar.group { border-radius: 12px; background: #7478e7; }

#ic-header-info { display: flex; flex-direction: column; }
#ic-header-name { font-size: 15px; font-weight: 600; }
#ic-header-sub  { font-size: 12px; color: var(--text-sub); }

/* ── Avatar upload (instellingen & groep modal) ── */
.avatar-upload-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
}
.avatar-preview-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent, #9AFF47);
  color: var(--bg, #1a1a1a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  flex-shrink: 0;
  border: 2px solid var(--border);
  overflow: hidden;
}
.avatar-upload-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.avatar-upload-label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
/* Agent-rij in modal met mini-avatar */
.ic-agent-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 8px;
  cursor: pointer;
}
.ic-agent-check:hover { background: var(--hover-bg); }
.ic-agent-mini-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent2, #7478e7);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

/* Berichten */
#ic-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ic-no-msgs { text-align: center; color: var(--text-muted); font-size: 13px; margin: auto; }

.ic-msg        { display: flex; flex-direction: column; max-width: 70%; }
.ic-msg.me     { align-self: flex-end; align-items: flex-end; }
.ic-msg:not(.me) { align-self: flex-start; align-items: flex-start; }

.ic-msg-author { font-size: 11px; color: var(--text-sub); margin-bottom: 2px; padding-left: 4px; }
.ic-msg-bubble {
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
  background: var(--msg-in-bg, rgba(0,0,0,.07));
  color: var(--text);
}
.ic-msg.me .ic-msg-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ic-msg:not(.me) .ic-msg-bubble { border-bottom-left-radius: 4px; }
.ic-msg-time { font-size: 10px; color: var(--text-muted); margin-top: 2px; padding: 0 4px; }

/* Typing indicator */
#ic-typing-bar, #acc-ic-typing-bar {
  min-height: 22px;
  padding: 0 16px 2px;
}
.ic-typing-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-sub);
  font-style: italic;
}
.ic-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.ic-typing-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: ic-bounce 1.2s infinite ease-in-out;
}
.ic-typing-dots span:nth-child(1) { animation-delay: 0s; }
.ic-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.ic-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ic-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%            { transform: translateY(-4px); opacity: 1; }
}

/* Input balk */
#ic-input-bar {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}
#ic-input {
  flex: 1;
  padding: 8px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--input-bg, var(--bg));
  color: var(--text);
  font-size: 14px;
  outline: none;
}
#ic-input:focus { border-color: var(--accent); }
#ic-send-btn { border-radius: 50%; width: 36px; height: 36px; padding: 0; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 300; display: flex; align-items: center; justify-content: center; }
.modal-card    { background: var(--bg); border-radius: 12px; width: 100%; padding: 0; overflow: hidden; box-shadow: 0 8px 40px rgba(0,0,0,.3); }
.ic-agent-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
.ic-agent-check:hover { background: var(--hover-bg); }
.ic-agent-check input { width: 16px; height: 16px; }

/* Callback agent-selectie checkboxlijst */
.cb-agents-checklist {
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 160px;
  overflow-y: auto;
  background: var(--input-bg, var(--bg));
}
.cb-agent-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.cb-agent-check:last-child { border-bottom: none; }
.cb-agent-check:hover { background: var(--hover-bg); }
.cb-agent-check input { width: 15px; height: 15px; cursor: pointer; }

/* Read receipts */
.ic-receipt { display: inline-flex; align-items: center; margin-left: 4px; vertical-align: middle; }
.ic-msg-time { display: flex; align-items: center; }

/* ── Accounts-screen chat layout ──────────────────────────────────────── */
#acc-chat-layout {
  display: flex;
  height: calc(100vh - 130px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 0 16px 16px;
}
#acc-ic-sidebar {
  width: 280px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#acc-ic-sidebar-toolbar { padding: 10px 12px; border-bottom: 1px solid var(--border); }
#acc-ic-chat-list { flex: 1; overflow-y: auto; }

#acc-ic-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#acc-ic-no-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-sub);
  gap: 12px;
}
#acc-ic-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
#acc-ic-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
#acc-ic-header-info { display: flex; flex-direction: column; }
#acc-ic-header-name { font-size: 15px; font-weight: 600; }
#acc-ic-header-sub  { font-size: 12px; color: var(--text-sub); }
#acc-ic-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#acc-ic-input-bar {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
#acc-ic-input {
  flex: 1;
  padding: 8px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--input-bg, var(--bg));
  color: var(--text);
  font-size: 14px;
  outline: none;
}
#acc-ic-input:focus { border-color: var(--accent); }
#acc-ic-send-btn { border-radius: 50%; width: 36px; height: 36px; padding: 0; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ── Nieuw WA gesprek modal ───────────────────────────────────────────── */
#search-wrap { display: flex; align-items: center; gap: 4px; }
#search-wrap #chat-search { flex: 1; }
#new-chat-btn { flex-shrink: 0; }

.wa-contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s;
}
.wa-contact-item:hover    { background: var(--hover-bg); }
.wa-contact-item.selected { background: var(--active-bg); }
.wa-contact-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.wa-contact-name   { font-size: 13px; font-weight: 600; }
.wa-contact-number { font-size: 12px; color: var(--text-sub); }

/* ── Back-knop (alleen zichtbaar op mobiel) ──────────────────────────── */
.mobile-back-btn {
  display: none;
  align-items: center; justify-content: center;
  width: 34px; height: 34px;
  background: transparent; border: none;
  border-radius: 6px; color: var(--text-sub);
  cursor: pointer; flex-shrink: 0;
  transition: background .15s, color .15s;
  margin-right: 4px;
}
.mobile-back-btn:hover { background: var(--bg-hover); color: var(--text); }
.mobile-back-btn svg { width: 20px; height: 20px; }

/* ── Responsive: Tablet (≤900px) ─────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 280px; }

  #accounts-topbar   { padding: 14px 16px; }
  #accounts-content  { padding: 24px 16px; }
  #cb-tab-content    { padding: 16px; }
  #rep-tab-content   { padding: 16px; }
  #admin-panel       { padding: 24px 16px; }

  /* Tab bar scrollable */
  #main-tab-bar { overflow-x: auto; scrollbar-width: none; }
  #main-tab-bar::-webkit-scrollbar { display: none; }
  .main-tab { padding: 12px 16px; font-size: 13px; }

  /* Accounts chat sidebar narrower */
  #acc-ic-sidebar { width: 220px; }

  /* Auth & QR kaarten */
  .auth-card { width: 340px; }
  .qr-card   { width: 420px; padding: 24px 28px 32px; }
}

/* ── Responsive: Mobiel (≤640px) ─────────────────────────────────────── */
@media (max-width: 640px) {

  /* Auth */
  .auth-card { width: calc(100vw - 32px); padding: 28px 20px; }
  .qr-card   { width: calc(100vw - 32px); padding: 20px; }
  .login-logos-wrap { gap: 14px; margin-bottom: 18px; }
  .login-logo-img   { height: 50px; max-width: 110px; }
  #qr-image-wrap img { width: 200px; height: 200px; }

  /* ── Portal layout: sidebar als full-screen drawer ─────────────────── */
  #screen-main { position: relative; overflow: hidden; }

  #sidebar {
    position: absolute; inset: 0;
    width: 100%; min-width: 100%;
    z-index: 10;
    transform: translateX(0);
    transition: transform .25s ease;
  }

  /* Als een chat open is schuift de sidebar weg */
  #screen-main.mobile-chat-open #sidebar {
    transform: translateX(-100%);
    pointer-events: none;
  }

  #chat-area { width: 100%; }

  /* Back-knop zichtbaar maken in chat headers */
  .mobile-back-btn { display: flex; }

  /* ── Accounts screen ────────────────────────────────────────────────── */
  #accounts-topbar  { padding: 10px 12px; }
  #accounts-content { padding: 16px 12px; }
  #accounts-content h2 { font-size: 18px; }
  #accounts-subtitle   { margin-bottom: 18px; }
  #accounts-agent-info { display: none; }

  #main-tab-bar { overflow-x: auto; scrollbar-width: none; }
  #main-tab-bar::-webkit-scrollbar { display: none; }
  .main-tab { padding: 10px 12px; font-size: 12px; gap: 5px; }

  #accounts-grid { grid-template-columns: 1fr; gap: 8px; }
  .account-card  { padding: 12px 12px; }

  #cb-tab-content  { padding: 10px; }
  #rep-tab-content { padding: 10px; }
  #admin-panel     { padding: 16px 10px; }

  /* Agents tabel horizontaal scrollbaar */
  #agents-table { display: block; overflow-x: auto; white-space: nowrap; }

  /* Modals vol-breedte */
  #modal      { width: calc(100vw - 20px); }
  .modal-card { max-width: calc(100vw - 20px); }

  /* Berichten */
  .msg-bubble { max-width: 85%; }
  .ic-msg     { max-width: 85%; }
  #message-input-area { padding: 8px 10px; }

  /* Toast */
  #toast-container { top: 8px; right: 8px; left: 8px; }
  .toast { min-width: 0; max-width: 100%; }

  /* Reparaties form */
  .rep-form-2col { grid-template-columns: 1fr; }
  .rep-form-card { padding: 16px; max-height: 95vh; }

  /* Callback items */
  .cb-item         { padding: 10px 10px; }
  .cb-item-footer  { flex-wrap: wrap; gap: 6px; }
  .cb-name-phone   { flex-wrap: wrap; gap: 6px; }

  /* Sidebar portal label verbergen */
  .portal-agent-label { display: none; }
  #sidebar-top { padding: 6px 8px 0; }

  /* ── Accounts-screen teamchat: sidebar als drawer ──────────────────── */
  #acc-chat-layout {
    position: relative;
    margin: 0 8px 8px;
    height: calc(100vh - 115px);
  }
  #acc-ic-sidebar {
    position: absolute; inset: 0;
    width: 100%;
    z-index: 5;
    background: var(--bg-dark);
    transform: translateX(0);
    transition: transform .25s ease;
  }
  #acc-chat-layout.mobile-chat-open #acc-ic-sidebar {
    transform: translateX(-100%);
    pointer-events: none;
  }
  #acc-ic-main { width: 100%; }

  /* Form rows stapelen op mobiel */
  .form-row { flex-direction: column; }
  .form-row .form-group { min-width: unset; }

  /* Rep detail kaart vol-breedte */
  .rep-detail-card { padding: 12px; }
  .rep-dc-meta-row { gap: 8px; padding: 8px 10px; }
}
