/* ══════════════════════════════════════════════
   AI Agency Dashboard — Wope-geïnspireerd design
   Deep navy · Inter · Purple accenten · Premium
   ══════════════════════════════════════════════ */

/* ── DONKER thema (Wope dark navy) ── */
:root {
    --bg:           #0B0A12;
    --panel:        #13111F;
    --panel-2:      #1C1A2E;
    --border:       rgba(124,92,252,.14);
    --text:         rgba(255,255,255,.92);
    --muted:        rgba(255,255,255,.40);
    --brand:        #7C5CFC;
    --brand-2:      #6441e0;
    --accent:       #7C5CFC;
    --accent-glow:  rgba(124,92,252,.22);
    --green:        #34D399;
    --orange:       #FBBF24;
    --red:          #F87171;
    --success:      #34D399;
    --warning:      #FBBF24;
    --danger:       #F87171;
    --goud-glow:    rgba(124,92,252,.2);
    --schaduw:      0 4px 24px rgba(0,0,0,.55);
    --goud-grad:    linear-gradient(135deg, #7C5CFC, #a78bfa);
    --sidebar-bg:   #0B0A12;
    --hover:        rgba(124,92,252,.08);
    --shadow-card:  0 1px 3px rgba(0,0,0,.4);
    --shadow-panel: 0 2px 8px rgba(0,0,0,.35);
}

/* ── LICHT thema (clean white) ── */
[data-theme="light"] {
    --bg:           #FFFFFF;
    --panel:        #FAFAFA;
    --panel-2:      #F4F3FF;
    --border:       rgba(124,92,252,.12);
    --text:         #1A1633;
    --muted:        #8B88A8;
    --brand:        #7C5CFC;
    --brand-2:      #6441e0;
    --accent:       #7C5CFC;
    --accent-glow:  rgba(124,92,252,.15);
    --green:        #059669;
    --orange:       #D97706;
    --red:          #DC2626;
    --success:      #059669;
    --warning:      #D97706;
    --danger:       #DC2626;
    --goud-glow:    rgba(124,92,252,.12);
    --schaduw:      0 1px 4px rgba(124,92,252,.08);
    --goud-grad:    linear-gradient(135deg, #7C5CFC, #a78bfa);
    --sidebar-bg:   #FAFAFA;
    --hover:        rgba(124,92,252,.06);
    --shadow-card:  0 1px 3px rgba(124,92,252,.06);
    --shadow-panel: none;
}

/* ── Reset ── */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
    font-feature-settings: 'cv11', 'ss01', 'ss03';
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 12px; font-weight: 600; letter-spacing: -.02em; color: var(--text); }
h1 { font-size: 30px; font-weight: 700; letter-spacing: -.025em; line-height: 1.2; }
h2 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
h3 { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-weight: 600; opacity: .7; }

/* ══════════════════════════════════════════════
   SIDEBAR — Wope-stijl
   ══════════════════════════════════════════════ */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 232px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding: 16px 10px 10px;
    display: flex; flex-direction: column;
    overflow: hidden;
}

/* Brand blok — Wope stijl */
.brand {
    display: flex; align-items: center; gap: 9px;
    font-size: 14px; font-weight: 700; letter-spacing: -.02em; color: var(--text);
    flex-shrink: 0;
    padding: 6px 8px 16px;
    margin-bottom: 4px;
}
.brand strong { font-weight: 700; letter-spacing: -.02em; }
.brand-dot {
    width: 22px; height: 22px; border-radius: 6px;
    background: linear-gradient(135deg, #7C5CFC, #a78bfa);
    border: none;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 800; color: #fff;
    flex-shrink: 0;
    box-shadow: 0 0 12px rgba(124,92,252,.45);
}
.brand-dot::after { content: "A"; }

/* Nav scrollt, footer blijft vast */
.sidebar nav {
    display: flex; flex-direction: column;
    flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden;
    padding-right: 2px;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.08) transparent;
}
.sidebar nav::-webkit-scrollbar { width: 3px; }
.sidebar nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 4px; }
.sidebar nav::-webkit-scrollbar-track { background: transparent; }

/* Sectie-labels — Wope stijl */
.sidebar nav .nav-section {
    font-size: 10px; text-transform: uppercase; letter-spacing: .1em;
    color: var(--muted); opacity: .5; font-weight: 600;
    padding: 12px 10px 3px; display: block;
    pointer-events: none;
}
.sidebar nav .nav-section:first-child { padding-top: 2px; }

/* Nav links — Wope stijl */
.sidebar nav a {
    color: var(--muted);
    padding: 6px 9px;
    border-radius: 6px;
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    transition: background .1s ease, color .1s ease;
    line-height: 1.4;
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 2px;
}
.sidebar nav a:hover {
    background: var(--hover);
    color: var(--text);
    text-decoration: none;
}
.sidebar nav a .nav-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px;
    font-size: 13px;
    flex-shrink: 0;
    opacity: .6;
}
.sidebar nav a:hover .nav-icon { opacity: .9; }
.sidebar nav a.active .nav-icon { opacity: 1; filter: none; }

/* ── ACTIVE STATE — Wope paars ── */
.sidebar nav a.active {
    background: rgba(124,92,252,.12) !important;
    color: #a78bfa !important;
    font-weight: 600;
    border-left: 2px solid #7C5CFC;
    padding-left: 7px;
}
[data-theme="light"] .sidebar nav a.active {
    background: rgba(124,92,252,.09) !important;
    color: #7C5CFC !important;
    border-left: 2px solid #7C5CFC;
}
[data-theme="light"] .sidebar nav a {
    color: #6B6889;
}
[data-theme="light"] .sidebar nav a:hover {
    color: #1A1633;
}

/* Personal Willem link */
.sidebar-section-link {
    margin-top: 4px;
    padding-top: 5px !important;
    border-top: 1px solid var(--border);
    color: var(--muted) !important;
    font-size: 11px !important;
    opacity: .7;
}
.sidebar-section-link:hover { opacity: 1 !important; }

/* Sidebar footer */
.sidebar-footer {
    font-size: 10px; color: var(--muted);
    margin-top: 4px; padding-top: 8px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-footer .user { display: block; margin-bottom: 3px; opacity: .45; font-size: 9px; word-break: break-all; }
.sidebar-footer .logout { color: var(--muted); font-size: 10px; }
.sidebar-footer .user-pic { width: 22px; height: 22px; border-radius: 50%; vertical-align: middle; margin-right: 7px; }

/* Sidebar Personal stijl */
.sidebar-personal .brand-dot { background: linear-gradient(135deg, #34D399, #059669); box-shadow: 0 0 12px rgba(52,211,153,.5); }

/* ══════════════════════════════════════════════
   CONTENT
   ══════════════════════════════════════════════ */
.content { margin-left: 234px; padding: 56px 64px 80px; max-width: 1180px; }
.page-header { margin-bottom: 32px; }
.page-header h1 { margin-bottom: 4px; }

/* ══════════════════════════════════════════════
   STAT CARDS — Notion ademruimte
   ══════════════════════════════════════════════ */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 32px;
}
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 22px 24px;
    box-shadow: var(--shadow-card);
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.card:hover {
    background: var(--panel-2);
    border-color: rgba(124,92,252,.28);
    box-shadow: 0 0 0 1px rgba(124,92,252,.08), 0 4px 16px rgba(0,0,0,.3);
}
.card .label {
    color: var(--muted);
    font-size: 12px;
    text-transform: none;
    letter-spacing: 0;
    margin-bottom: 12px;
    font-weight: 500;
}
.card .value {
    font-size: 30px;
    font-weight: 600;
    letter-spacing: -.03em;
    line-height: 1.1;
    color: var(--text);
}
.card .sub {
    color: var(--muted);
    font-size: 12.5px;
    margin-top: 8px;
}

/* ══════════════════════════════════════════════
   PANELS — Notion luchtig
   ══════════════════════════════════════════════ */
.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px 28px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-panel);
}
.panel h2 { margin-bottom: 18px; }

/* ══════════════════════════════════════════════
   TABLES — Wope-stijl strakke rijen
   ══════════════════════════════════════════════ */
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 9px 13px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
th {
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10.5px;
    letter-spacing: .06em;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(124,92,252,.04); }
[data-theme="light"] tr:hover td { background: rgba(124,92,252,.04); }

/* ══════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════ */
.btn {
    display: inline-block;
    padding: 7px 16px;
    border-radius: 7px;
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    box-shadow: 0 0 14px rgba(124,92,252,.35);
    transition: opacity .12s ease, box-shadow .12s ease;
    letter-spacing: -.01em;
}
.btn:hover { opacity: .88; text-decoration: none; box-shadow: 0 0 20px rgba(124,92,252,.5); }
.btn-secondary {
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--text);
    box-shadow: none;
}
.btn-secondary:hover { border-color: rgba(124,92,252,.3); background: var(--panel); box-shadow: none; }
.btn-danger { background: rgba(248,113,113,.15); color: var(--red); border: 1px solid rgba(248,113,113,.2); box-shadow: none; }
.btn-danger:hover { background: rgba(248,113,113,.22); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-xs { padding: 3px 9px; font-size: 11px; border-radius: 5px; }

/* ══════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════ */
form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
form label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
form input, form textarea, form select {
    width: 100%;
    padding: 9px 12px;
    border-radius: 7px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 13.5px;
    font-family: inherit;
    transition: border-color .14s, box-shadow .14s;
}
form textarea { min-height: 80px; resize: vertical; }
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: rgba(124,92,252,.55);
    box-shadow: 0 0 0 3px rgba(124,92,252,.12);
}
form .full { grid-column: 1 / -1; }
form .actions { display: flex; gap: 10px; margin-top: 16px; }

/* ══════════════════════════════════════════════
   STATUS PILLS
   ══════════════════════════════════════════════ */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 500; }
.pill-actief, .pill-active, .pill-paid    { background: rgba(52,211,153,.1); color: var(--green); }
.pill-pauze, .pill-trialing, .pill-open   { background: rgba(251,146,60,.1);  color: var(--orange); }
.pill-opgezegd, .pill-canceled, .pill-void { background: rgba(248,113,113,.1); color: var(--red); }
.pill-draft, .pill-past_due               { background: rgba(139,145,160,.1); color: var(--muted); }

/* ══════════════════════════════════════════════
   FLASH MESSAGES
   ══════════════════════════════════════════════ */
.flash { padding: 11px 15px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.flash-success { background: rgba(52,211,153,.08); border: 1px solid rgba(52,211,153,.2); color: var(--green); }
.flash-error   { background: rgba(248,113,113,.08); border: 1px solid rgba(248,113,113,.2); color: var(--red); }
.flash-danger  { background: rgba(248,113,113,.08); border: 1px solid rgba(248,113,113,.2); color: var(--red); }

/* ══════════════════════════════════════════════
   LOGIN
   ══════════════════════════════════════════════ */
.login-wrap { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 20px; }
.login-box {
    width: 100%; max-width: 360px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 36px;
    box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 0 1px rgba(124,92,252,.12), 0 0 60px rgba(124,92,252,.08);
}
.login-box h1 {
    text-align: center; margin-bottom: 24px;
    background: linear-gradient(135deg, #fff 30%, #a78bfa);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.google-btn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; padding: 10px 14px; border-radius: 8px;
    background: #fff; color: #1f1f1f; border: 1px solid #e0e0e0;
    font-size: 14px; font-weight: 500; text-decoration: none; margin-bottom: 18px;
    transition: background .12s;
}
.google-btn:hover { background: #f8f8f8; text-decoration: none; }
.divider {
    display: flex; align-items: center; gap: 10px; margin: 14px 0 18px;
    color: var(--muted); font-size: 12px;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ══════════════════════════════════════════════
   PAGE HEADER
   ══════════════════════════════════════════════ */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.page-header .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Search bar */
.searchbar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.searchbar input, .searchbar select { max-width: 260px; }

/* Progress bar */
.progress { background: var(--panel-2); border-radius: 999px; height: 4px; overflow: hidden; width: 100%; max-width: 150px; }
.progress > div { height: 100%; background: var(--accent); border-radius: 999px; }
.progress.warn > div { background: var(--orange); }
.progress.over > div { background: var(--red); }

/* Detail grid */
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 1000px) { .detail-grid { grid-template-columns: 1fr; } }

/* Key-value pairs */
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 7px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* Empty state */
.empty { color: var(--muted); padding: 28px; text-align: center; font-style: italic; font-size: 13px; }

/* Status dots */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-ok        { background: var(--green);  box-shadow: 0 0 6px rgba(52,211,153,.5); }
.dot-down      { background: var(--red);    box-shadow: 0 0 6px rgba(248,113,113,.5); }
.dot-scheduled { background: var(--orange); }

/* Code */
code {
    background: var(--panel-2); padding: 2px 6px; border-radius: 4px;
    font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--text);
}

/* ══════════════════════════════════════════════
   NICHE TABS (Skills / Command Center)
   ══════════════════════════════════════════════ */
.niche-tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.niche-tab {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 13px; border-radius: 7px;
    background: var(--panel); border: 1px solid var(--border);
    color: var(--muted); font-size: 13px; font-weight: 500; text-decoration: none;
    transition: background .1s, color .1s;
}
.niche-tab:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.niche-tab.active { background: var(--panel-2); color: var(--text); font-weight: 600; border-color: rgba(255,255,255,.1); }
[data-theme="light"] .niche-tab.active { border-color: rgba(0,0,0,.1); }
.niche-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

/* ══════════════════════════════════════════════
   AGENT CHAT
   ══════════════════════════════════════════════ */
.chat-balk { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; }
.chat-balk select {
    flex: 1; padding: 7px 10px; border-radius: 7px;
    background: var(--bg); border: 1px solid var(--border); color: var(--text); font-size: 13px;
}
.chat-balk .btn { white-space: nowrap; }
.chat-venster {
    overflow-y: auto; display: flex; flex-direction: column; gap: 0;
    padding: 8px 0 16px; min-height: 240px; max-height: 64vh;
    margin-bottom: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
.chat-bubble {
    max-width: 100%; padding: 13px 16px; border-radius: 0;
    border-bottom: 1px solid var(--border);
}
.chat-bubble:last-child { border-bottom: none; }
.chat-user      { background: rgba(124,58,237,.055); }
.chat-assistant { background: transparent; }
.chat-rol {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
    font-weight: 700; opacity: .5; margin-bottom: 8px;
    display: flex; align-items: center; gap: 6px;
}
.chat-rol::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; display: inline-block; }
.chat-user .chat-rol      { color: #7c3aed; }
.chat-assistant .chat-rol { color: #22d3ee; }
.chat-tekst { font-size: 14px; line-height: 1.65; color: var(--text); word-wrap: break-word; }
.chat-tekst p { margin: 0 0 12px; }
.chat-tekst p:last-child { margin-bottom: 0; }
.chat-tekst h1, .chat-tekst h2, .chat-tekst h3 { margin: 18px 0 8px; line-height: 1.3; font-weight: 700; }
.chat-tekst h1 { font-size: 18px; }
.chat-tekst h2 { font-size: 16px; }
.chat-tekst h3 { font-size: 14px; }
.chat-tekst ul, .chat-tekst ol { margin: 0 0 12px; padding-left: 22px; }
.chat-tekst li { margin: 3px 0; }
.chat-tekst a { color: #22d3ee; text-decoration: underline; text-underline-offset: 2px; }
.chat-tekst strong { font-weight: 700; }
.chat-tekst code {
    font-family: "SF Mono", Menlo, Monaco, Consolas, "Courier New", monospace;
    font-size: 12.5px; background: rgba(124,58,237,.1); padding: 1px 5px; border-radius: 4px; color: #c4b5fd;
}
.chat-tekst pre {
    background: #0a0b16; border: 1px solid var(--border); border-radius: 8px;
    padding: 12px 14px; margin: 10px 0; overflow-x: auto;
    font-family: "SF Mono", Menlo, Monaco, Consolas, "Courier New", monospace;
    font-size: 12.5px; line-height: 1.55;
}
.chat-tekst pre code { background: transparent; padding: 0; color: #e6edf3; }
.chat-tekst blockquote { border-left: 3px solid #7c3aed; padding-left: 12px; margin: 10px 0; color: var(--muted); font-style: italic; }
.chat-tekst table { border-collapse: collapse; margin: 10px 0; font-size: 13px; width: 100%; }
.chat-tekst th, .chat-tekst td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.chat-tekst th { background: var(--panel-2); font-weight: 600; }
.chat-tekst hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.chat-form { display: flex; gap: 8px; }
.chat-form input, .chat-form textarea { flex: 1; }
.chat-form textarea {
    font-family: inherit; padding: 11px;
    border: 1px solid var(--border); border-radius: 7px;
    background: var(--bg); color: var(--text); resize: vertical; min-height: 58px;
}

/* ══════════════════════════════════════════════
   AGENT REGISTER GRID
   ══════════════════════════════════════════════ */
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-top: 8px; }
.agent-kaart { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.agent-kaart-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; margin-bottom: 6px; }
.agent-kaart-meta { margin-bottom: 6px; }
.agent-kaart-desc { font-size: 12px; color: var(--muted); line-height: 1.45; }

/* ══════════════════════════════════════════════
   CANVAS LEGEND
   ══════════════════════════════════════════════ */
.canvas-legend {
    display: flex; gap: 16px; flex-wrap: wrap;
    padding: 10px 16px; border-top: 1px solid var(--border);
    font-size: 12px; color: var(--text); align-items: center;
}
.canvas-legend .dot { margin-right: 4px; }

/* ══════════════════════════════════════════════
   MOBILE
   ══════════════════════════════════════════════ */
.mobile-topbar { display: none; }
.menu-toggle   { display: none; }
.nav-overlay   { display: none; }

@media (max-width: 860px) {
    .sidebar { transform: translateX(-100%); transition: transform .25s ease; z-index: 200; width: 230px; }
    body.nav-open .sidebar { transform: translateX(0); }
    .nav-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 150; }
    body.nav-open .nav-overlay { display: block; }
    .mobile-topbar {
        display: flex; align-items: center; gap: 12px;
        position: fixed; top: 0; left: 0; right: 0; height: 52px; z-index: 100;
        background: var(--panel); border-bottom: 1px solid var(--border); padding: 0 14px;
    }
    .menu-toggle { display: block; background: none; border: none; color: var(--text); font-size: 22px; cursor: pointer; padding: 2px 8px; line-height: 1; }
    .mobile-brand { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
    .content { margin-left: 0; padding: 68px 14px 32px; max-width: 100%; }
    .cards { grid-template-columns: 1fr 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .agent-grid { grid-template-columns: 1fr; }
    form .row { grid-template-columns: 1fr; }
    .panel { padding: 14px; overflow-x: auto; }
    table { font-size: 12px; }
    th, td { padding: 7px 8px; }
    .page-header { flex-wrap: wrap; gap: 8px; }
    .page-header .actions { flex-wrap: wrap; }
    h1 { font-size: 20px; }
    .searchbar { flex-wrap: wrap; }
    .searchbar input, .searchbar select { max-width: 100%; }
    #agents-canvas { height: 300px !important; }
    .chat-venster { max-height: 50vh; }
    .kv { grid-template-columns: 1fr; gap: 2px 0; }
    .kv dt { margin-top: 8px; }
}

@media (max-width: 540px) {
    .cards { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
    .content { padding: 64px 10px 28px; }
    .panel { padding: 12px; }
    .niche-tab { padding: 6px 11px; font-size: 12px; }
}

/* ══════════════════════════════════════════════
   JARVIS SPRAAK-ASSISTENT
   ══════════════════════════════════════════════ */
#jarvis-knop {
    position: fixed; right: 18px; bottom: 18px; z-index: 300;
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--panel); color: var(--muted); border: 1px solid var(--border); cursor: pointer;
    font-size: 13px; font-weight: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    display: flex; align-items: center; justify-content: center;
    transition: background .12s ease, color .12s ease, border-color .12s ease;
    opacity: .55;
}
#jarvis-knop:hover { background: var(--panel-2); color: var(--text); border-color: var(--text); opacity: 1; }
.jarvis-puls { display: none; }
@keyframes jarvisPuls {
    0%   { transform: scale(1);   opacity: .7; }
    100% { transform: scale(1.7); opacity: 0;  }
}
#jarvis-paneel {
    position: fixed; right: 22px; bottom: 88px; z-index: 300;
    width: 355px; max-width: calc(100vw - 32px); height: 470px; max-height: 70vh;
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 14px; box-shadow: 0 12px 44px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.04);
    display: none; flex-direction: column; overflow: hidden;
}
#jarvis-paneel.open { display: flex; }
.jarvis-kop { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--border); }
.jarvis-kop strong { font-size: 14px; }
#jarvis-status { font-size: 11px; color: var(--muted); flex: 1; }
.jarvis-sluit { background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; line-height: 1; }
#jarvis-gesprek { flex: 1; overflow-y: auto; padding: 13px; display: flex; flex-direction: column; gap: 10px; }
.jarvis-bubble { max-width: 84%; padding: 8px 12px; border-radius: 10px; font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.jarvis-mens { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 3px; }
.jarvis-bot  { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--border); border-bottom-left-radius: 3px; }
#jarvis-input-wrap { padding: 10px 13px; border-top: 1px solid var(--border); display: flex; gap: 7px; }
#jarvis-invoer {
    flex: 1; background: var(--bg); border: 1px solid var(--border);
    color: var(--text); border-radius: 7px; padding: 8px 11px;
    font-size: 13px; font-family: inherit; resize: none; height: 36px;
}
#jarvis-invoer:focus { outline: none; border-color: rgba(124,58,237,.4); }
#jarvis-stuur {
    background: var(--goud-grad); color: #1c1606; border: none;
    border-radius: 7px; padding: 0 14px; font-size: 13px; font-weight: 600; cursor: pointer;
}

/* ══════════════════════════════════════════════
   DESIGN-LESSEN — Animations, polish, completion rings
   Bron: /Users/willem/systeem/design_lessen.md
   Doel: Duolingo/Phantom/Revolut niveau van feel
   ══════════════════════════════════════════════ */

/* ── Keyframes ── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes softBounce {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.06); }
    100% { transform: scale(1); }
}
@keyframes successPulse {
    0%   { box-shadow: 0 0 0 0 rgba(77,171,154,.45); }
    70%  { box-shadow: 0 0 0 14px rgba(77,171,154,0); }
    100% { box-shadow: 0 0 0 0 rgba(77,171,154,0); }
}
@keyframes ringFillSpin {
    from { stroke-dashoffset: var(--ring-empty); }
    to   { stroke-dashoffset: var(--ring-target); }
}
@keyframes sparkleRotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes typewriterCursor {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0; }
}

/* ── Globale page-load entrance ── */
.content { animation: fadeInUp .35s ease both; }
.page-header h1 { animation: fadeInUp .4s ease both; }

/* Stagger panels in als ze net laden */
.cards .card { animation: fadeInUp .4s ease both; }
.cards .card:nth-child(1) { animation-delay: .04s; }
.cards .card:nth-child(2) { animation-delay: .09s; }
.cards .card:nth-child(3) { animation-delay: .14s; }
.cards .card:nth-child(4) { animation-delay: .19s; }
.cards .card:nth-child(5) { animation-delay: .24s; }
.detail-grid > .panel { animation: fadeInUp .45s ease both; animation-delay: .25s; }
.detail-grid > .panel:nth-child(2) { animation-delay: .32s; }

/* ── Stat-card polish: tactiel hover ── */
.card {
    transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.card:hover { transform: translateY(-2px); }
.card .value { transition: color .15s ease; }
.card:hover .value { color: var(--accent); }

/* ── Trend-badge (mastery i.p.v. badge-theater) ── */
.trend-pill {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 11.5px; font-weight: 500; padding: 2px 8px;
    border-radius: 999px; margin-top: 6px;
    line-height: 1.3;
}
.trend-up    { background: rgba(77,171,154,.13); color: var(--success); }
.trend-down  { background: rgba(224,62,62,.13);  color: var(--danger); }
.trend-flat  { background: var(--panel-2);       color: var(--muted); }
.trend-pill::before { content: ""; }
.trend-up::before   { content: "↗"; font-weight: 700; }
.trend-down::before { content: "↘"; font-weight: 700; }
.trend-flat::before { content: "→"; font-weight: 700; }

/* ══════════════════════════════════════════════
   COMPLETION RINGS — Apple Watch closure principle
   ══════════════════════════════════════════════ */
.rings-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
    animation: fadeInUp .5s ease both;
}
.ring-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 22px;
    display: flex; align-items: center; gap: 16px;
    transition: transform .18s ease, border-color .18s ease;
}
.ring-card:hover { transform: translateY(-2px); }
.ring-svg {
    width: 64px; height: 64px; flex-shrink: 0;
    transform: rotate(-90deg);
    filter: drop-shadow(0 1px 3px rgba(0,0,0,.12));
}
.ring-bg   { fill: none; stroke: var(--border); stroke-width: 8; }
.ring-fill {
    fill: none; stroke-width: 8; stroke-linecap: round;
    stroke-dasharray: 175.93;  /* 2*pi*r met r=28 */
    transition: stroke-dashoffset 1.4s cubic-bezier(.22, 1, .36, 1);
    animation: fadeIn .4s ease both;
}
.ring-fill-1 { stroke: var(--success); }
.ring-fill-2 { stroke: var(--accent); }
.ring-fill-3 { stroke: var(--warning); }
.ring-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ring-label {
    font-size: 12px; color: var(--muted); font-weight: 500;
    text-transform: none; letter-spacing: 0;
}
.ring-value {
    font-size: 22px; font-weight: 600; letter-spacing: -.02em;
    color: var(--text); line-height: 1.1;
}
.ring-value .ring-goal { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 2px; }
.ring-pct {
    font-size: 11px; color: var(--muted); margin-top: 3px;
}
.ring-card.is-complete .ring-fill { animation: softBounce .8s ease .8s; }
.ring-card.is-complete .ring-value { color: var(--success); }

/* ══════════════════════════════════════════════
   INSTA-LEADS — gefaseerde reveal (variable reward)
   ══════════════════════════════════════════════ */
.lead-reveal { display: none; }
.lead-reveal.is-open { display: block; }
.lead-reveal.is-open > * { animation: fadeInUp .42s ease both; }
.lead-reveal.is-open > *:nth-child(1) { animation-delay: .05s; }
.lead-reveal.is-open > *:nth-child(2) { animation-delay: .22s; }
.lead-reveal.is-open > *:nth-child(3) { animation-delay: .42s; }
.lead-reveal.is-open > *:nth-child(4) { animation-delay: .66s; }
.lead-reveal.is-open > *:nth-child(5) { animation-delay: .88s; }
.lead-reveal.is-open > *:nth-child(6) { animation-delay: 1.10s; }

.lead-card-trigger {
    cursor: pointer; user-select: none;
    transition: background .14s ease;
}
.lead-card-trigger:hover { background: var(--panel-2); }
.lead-card-trigger .reveal-hint {
    font-size: 11px; color: var(--muted);
    display: inline-flex; align-items: center; gap: 4px;
    margin-left: 8px;
}
.lead-card-trigger .reveal-hint::before {
    content: "▶"; font-size: 9px; transition: transform .2s ease;
}
.lead-card-trigger.is-open .reveal-hint::before {
    transform: rotate(90deg);
}

/* Sparkle voor analysed-status (anticipation cue) */
.pill.pill-actief.has-sparkle::after {
    content: "✨"; margin-left: 4px;
    display: inline-block;
    animation: softBounce 1.6s ease infinite;
}

/* ══════════════════════════════════════════════
   MICRO-FEEDBACK — Toast + button success-state
   ══════════════════════════════════════════════ */
.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: var(--text); color: var(--bg);
    padding: 10px 18px; border-radius: 8px;
    font-size: 13px; font-weight: 500;
    box-shadow: 0 10px 30px rgba(0,0,0,.18);
    animation: fadeInUp .25s ease both;
    z-index: 9999;
}
.toast.is-success { box-shadow: 0 10px 30px rgba(77,171,154,.3); }
.toast.is-success::before { content: "✓ "; color: var(--success); font-weight: 700; }
.toast.is-error::before   { content: "⚠ "; color: var(--danger); font-weight: 700; }

.btn.is-success {
    background: var(--success) !important;
    border-color: var(--success) !important;
    color: #fff !important;
    animation: successPulse 1s ease;
}

/* Shimmer skeleton voor laden */
.skeleton {
    background: linear-gradient(90deg, var(--panel), var(--panel-2), var(--panel));
    background-size: 200% 100%;
    animation: shimmer 1.6s ease infinite;
    border-radius: 6px;
}

/* ══════════════════════════════════════════════
   FLASH MESSAGES — upgrade naar polished
   ══════════════════════════════════════════════ */
.flash { animation: fadeInUp .3s ease both; }

/* ══════════════════════════════════════════════
   LOGIN — premium first-impression
   ══════════════════════════════════════════════ */
.login-wrap { animation: fadeIn .6s ease both; }
.login-box {
    animation: fadeInUp .55s cubic-bezier(.22, 1, .36, 1) both;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0,0,0,.18);
}
.login-box h1 {
    color: var(--text) !important;
    background: none !important;
    -webkit-background-clip: initial !important;
    background-clip: initial !important;
}
.login-hero {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; margin-bottom: 18px;
    font-size: 14px; color: var(--muted);
}
.login-hero-dot {
    width: 22px; height: 22px; border-radius: 6px;
    background: var(--panel-2); border: 1px solid var(--border);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 12px; color: var(--text);
}

/* ══════════════════════════════════════════════
   PERSONAL WILLEM — eigen card-grid systeem
   .os-* classes voor /personal/* templates
   ══════════════════════════════════════════════ */

/* Sidebar variant — Personal subdomein */
.sidebar-personal .brand strong { color: var(--text); }
.sidebar-personal .brand-dot { background: rgba(77,171,154,.15); color: var(--success); }
.sidebar-personal .brand-dot::after { content: "P"; }
.sidebar-personal nav a.active { background: var(--hover); }
.back-to-agency {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--muted); font-size: 12px;
    padding: 4px 8px; margin: -2px 0 12px;
    border-radius: 4px; opacity: .65;
    transition: opacity .15s ease;
}
.back-to-agency:hover { opacity: 1; color: var(--text); text-decoration: none; background: var(--hover); }

/* ── Grid + cards ── */
.os-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
    animation: fadeInUp .45s ease both;
}
.os-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px 20px;
    display: flex; flex-direction: column; gap: 10px;
    min-height: 160px;
    transition: transform .18s ease, border-color .18s ease, background .18s ease;
    animation: fadeInUp .4s ease both;
}
.os-card:hover { transform: translateY(-2px); }
.os-card h3 {
    margin: 0; font-size: 16px; font-weight: 600; color: var(--text);
    letter-spacing: -.01em;
}
.os-card-head {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
    color: var(--muted); font-weight: 600;
}
.os-card-id { display: inline-flex; align-items: center; }
.os-streak {
    font-size: 10px; font-weight: 600; color: var(--success);
    display: inline-flex; align-items: center; gap: 3px;
}
.os-key {
    border-color: rgba(124,92,252,.35);
    background: linear-gradient(180deg, rgba(124,92,252,.05), transparent 60%), var(--panel);
}

/* ── Capture (vang-op) input ── */
.os-capture {
    display: flex; gap: 8px;
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 10px; padding: 8px 8px 8px 14px;
    transition: border-color .15s ease;
}
.os-capture:focus-within { border-color: var(--accent); }
.os-capture input {
    flex: 1; background: transparent; border: none;
    color: var(--text); font-size: 14px; outline: none;
    font-family: inherit;
}
.os-capture input::placeholder { color: var(--muted); }
.os-capture button {
    background: var(--text); color: var(--bg);
    border: none; padding: 8px 14px; border-radius: 6px;
    font-size: 13px; font-weight: 500; cursor: pointer;
    transition: opacity .12s ease;
}
.os-capture button:hover { opacity: .82; }

/* ── Tasks ── */
.os-task {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 6px;
    transition: border-color .12s ease;
}
.os-task:hover { border-color: var(--muted); }
.os-task-titel {
    font-size: 13.5px; color: var(--text); font-weight: 500;
    line-height: 1.4; margin-bottom: 4px;
}
.os-task-meta {
    display: flex; gap: 6px; flex-wrap: wrap;
    font-size: 11px; color: var(--muted);
}

/* ── Pills ── */
.os-pill {
    display: inline-flex; align-items: center;
    padding: 1px 8px; border-radius: 999px;
    font-size: 10.5px; font-weight: 500;
    background: var(--panel-2); color: var(--muted);
    border: 1px solid var(--border);
}
.os-pill-key {
    background: rgba(124,92,252,.14); color: var(--accent);
    border-color: rgba(124,92,252,.3);
}

/* ── Alle taken-link ── */
.os-card a {
    color: var(--muted); font-size: 12px;
    text-decoration: none;
    transition: color .12s ease;
}
.os-card a:hover { color: var(--text); }

/* ── Stat-blokken binnen card (DAILY SCORE / STREAK rij) ── */
.os-card > div[style*="justify-content: space-between"] {
    padding: 6px 0;
    border-top: 1px solid var(--border);
}
.os-card > div[style*="justify-content: space-between"]:first-of-type {
    border-top: none;
}

/* ── Habits grid (groene blokken op home) ── */
.habits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin-top: 12px;
}
.habit-tile {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    cursor: pointer;
    transition: transform .15s ease, border-color .15s ease;
}
.habit-tile:hover { transform: translateY(-1px); border-color: var(--success); }
.habit-tile.is-done {
    background: rgba(77,171,154,.1);
    border-color: rgba(77,171,154,.4);
}

/* ── PERSONAL — utility classes voor consistente templates ── */
.os-section-label {
    font-size: 11px; color: var(--muted); font-weight: 600;
    text-transform: uppercase; letter-spacing: .08em;
    margin-bottom: 8px; display: block;
}
.os-form-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.os-form-row.three  { grid-template-columns: 1fr 1fr 1fr; }
.os-form-row.split  { grid-template-columns: 2fr 1fr 130px; }
@media (max-width: 720px) {
    .os-form-row, .os-form-row.three, .os-form-row.split { grid-template-columns: 1fr; }
}
.os-form-group label {
    display: block; font-size: 11.5px; color: var(--muted);
    margin-bottom: 4px; font-weight: 500;
}
.os-status-strip {
    display: flex; gap: 16px; flex-wrap: wrap;
    padding: 12px 16px; background: var(--panel); border: 1px solid var(--border);
    border-radius: 10px; margin-bottom: 18px; font-size: 13px;
}
.os-status-strip .ok   { color: var(--success); }
.os-status-strip .off  { color: var(--muted); }

/* ── KANBAN — cleaner kolommen ── */
.os-kanban {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}
.os-kanban-col {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 10px; padding: 14px;
    display: flex; flex-direction: column; gap: 8px;
}
.os-kanban-col h4 {
    margin: 0 0 4px; font-size: 13px; font-weight: 600;
    color: var(--text); letter-spacing: -.01em;
    display: flex; justify-content: space-between;
}
.os-kanban-col h4 .count {
    color: var(--muted); font-weight: 500; font-size: 12px;
}
.os-task-actions {
    display: inline-flex; gap: 4px; margin-left: auto;
}
.os-task-actions button {
    background: transparent; border: 1px solid var(--border); cursor: pointer;
    width: 24px; height: 24px; border-radius: 5px;
    font-size: 11px; color: var(--muted);
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.os-task-actions button:hover { background: var(--panel-2); color: var(--text); }
.os-task-actions .act-done:hover { color: var(--success); border-color: var(--success); }
.os-task-actions .act-key:hover  { color: var(--accent); border-color: var(--accent); }
.os-task-actions .act-cal:hover  { color: var(--accent); border-color: var(--accent); }
.os-task-actions .act-del:hover  { color: var(--danger); border-color: var(--danger); }
.os-task-move {
    display: inline-flex; gap: 3px; margin-top: 6px;
}
.os-task-move button {
    background: var(--panel-2); border: 1px solid var(--border);
    color: var(--muted); cursor: pointer;
    width: 22px; height: 18px; border-radius: 4px;
    font-size: 10px; font-weight: 600;
    transition: background .12s ease, color .12s ease;
}
.os-task-move button:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.os-task.done { opacity: .55; }
.os-pill-done { background: rgba(77,171,154,.15); color: var(--success); border-color: rgba(77,171,154,.3); }

/* Tabel-helper voor /personal */
.os-table { width: 100%; font-size: 13px; }
.os-table th {
    text-align: left; padding: 8px 10px; color: var(--muted);
    font-weight: 500; font-size: 11.5px; text-transform: uppercase;
    letter-spacing: .06em; border-bottom: 1px solid var(--border);
}
.os-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); }
.os-table tr:last-child td { border-bottom: none; }
.os-table .num { text-align: right; font-variant-numeric: tabular-nums; }
