/* ── Fonts ── */
@font-face {
    font-family: 'Noka';
    src: url('fonts/noka-medium.woff2') format('woff2'),
         url('fonts/noka-medium.woff') format('woff');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

/* ── Variables ── */
:root {
    --blue: #0D2957;
    --blue-light: #1a3a6e;
    --gold: #EFC981;
    --gold-dark: #d4aa5c;
    --cream: #F2E4CE;
    --cream-light: #f8f1e6;
    --dark: #1A2129;
    --dark-soft: #2a3140;
    --white: #ffffff;
    --gray-100: #f5f5f5;
    --gray-200: #e8e8e8;
    --gray-300: #d1d1d1;
    --gray-500: #888;
    --gray-700: #555;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow: 0 2px 12px rgba(13,41,87,0.08);
    --shadow-lg: 0 8px 32px rgba(13,41,87,0.12);
    --sidebar-w: 260px;
    --transition: 0.2s ease;
    --font-main: 'Noka', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    font-family: var(--font-body);
    background: var(--cream-light);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* ── Auth Overlay ── */
/* ── Auth Overlay ── */
.auth-overlay {
    position: fixed; inset: 0; z-index: 10000;
    display: flex; align-items: center; justify-content: center;
    background: var(--blue);
    background-image: url('/assets/wood-texture.jpg');
    background-size: cover;
    background-blend-mode: overlay;
}
.auth-overlay::before {
    content: '';
    position: absolute; inset: 0;
    background: rgba(13,41,87,0.88);
}
.auth-modal {
    position: relative;
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 3rem 2.5rem;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-lg);
}
.auth-logo img { height: 56px; margin-bottom: 1.5rem; }
.auth-modal h2 { font-family: var(--font-main); color: var(--blue); font-size: 1.5rem; margin-bottom: 0.25rem; }
.auth-subtitle { color: var(--gray-500); font-size: 0.9rem; margin-bottom: 1.5rem; }
.auth-input-wrap { margin-bottom: 1rem; }
.auth-input-wrap input {
    width: 100%; padding: 0.85rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: border-color var(--transition);
    outline: none;
}
.auth-input-wrap input:focus { border-color: var(--gold); }
.auth-btn {
    width: 100%; padding: 0.85rem;
    background: var(--blue);
    color: var(--white);
    border: none; border-radius: var(--radius-sm);
    font-size: 1rem; font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
}
.auth-btn:hover { background: var(--blue-light); }
.auth-error { color: #c0392b; font-size: 0.85rem; margin-top: 0.75rem; }

/* ── App Layout ── */
.app { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--blue);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}
.sidebar-header {
    padding: 1.5rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}
.sidebar-logo { height: 40px; margin-bottom: 0.5rem; }
.sidebar-badge {
    display: inline-block;
    background: rgba(239,201,129,0.15);
    color: var(--gold);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
}
.sidebar-nav { flex: 1; padding: 0.75rem 0; }
.nav-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
    border-left: 3px solid transparent;
}
.nav-item:hover { color: var(--white); background: rgba(255,255,255,0.05); }
.nav-item.active {
    color: var(--gold);
    background: rgba(239,201,129,0.08);
    border-left-color: var(--gold);
}
.nav-item svg { flex-shrink: 0; }
.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,0.1); }
.logout-btn {
    display: flex; align-items: center; gap: 0.5rem;
    background: none; border: none;
    color: rgba(255,255,255,0.5);
    font-size: 0.85rem;
    cursor: pointer;
    transition: color var(--transition);
}
.logout-btn:hover { color: var(--white); }

/* ── Main Content ── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 2rem 2.5rem;
    min-height: 100vh;
}
.page-header { margin-bottom: 2rem; }
.page-header h1 { font-family: var(--font-main); color: var(--blue); font-size: 1.8rem; margin-bottom: 0.25rem; }
.page-desc { color: var(--gray-500); font-size: 0.95rem; }

/* ── Tab Content ── */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border: none; border-radius: var(--radius-sm);
    font-size: 0.9rem; font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}
.btn-gold { background: var(--gold); color: var(--blue); }
.btn-gold:hover { background: var(--gold-dark); }
.btn-blue { background: var(--blue); color: var(--white); }
.btn-blue:hover { background: var(--blue-light); }
.btn-outline {
    background: transparent; border: 2px solid var(--blue);
    color: var(--blue);
}
.btn-outline:hover { background: var(--blue); color: var(--white); }
.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.82rem; }

/* ── Client Bar ── */
.client-bar {
    display: flex; align-items: center; gap: 1rem;
    flex-wrap: wrap;
    background: var(--white);
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}
.client-input-wrap { display: flex; align-items: center; gap: 0.75rem; flex: 1; min-width: 200px; }
.client-input-wrap label { font-weight: 600; color: var(--blue); white-space: nowrap; font-size: 0.9rem; }
.client-input-wrap input {
    flex: 1; padding: 0.55rem 0.85rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition);
}
.client-input-wrap input:focus { border-color: var(--gold); }

/* ── Process Flow ── */
.process-flow {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.process-step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    position: relative;
    padding-bottom: 0.5rem;
}
.process-step:last-child { padding-bottom: 0; }
.step-number {
    width: 44px; height: 44px;
    background: var(--blue);
    color: var(--white);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1rem;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    transition: background var(--transition);
}
.process-step[data-current-status="in-progress"] .step-number { background: var(--gold); color: var(--blue); }
.process-step[data-current-status="completed"] .step-number { background: #27ae60; }
.step-connector {
    position: absolute;
    left: 21px;
    top: 44px;
    bottom: -0.5rem;
    width: 2px;
    background: var(--gray-200);
}
.process-step:last-child .step-connector { display: none; }
.step-content {
    flex: 1;
    background: var(--white);
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 0.75rem;
    transition: border-color var(--transition);
    border-left: 3px solid transparent;
}
.process-step[data-current-status="in-progress"] .step-content { border-left-color: var(--gold); }
.process-step[data-current-status="completed"] .step-content { border-left-color: #27ae60; }
.step-content h3 { font-family: var(--font-main); color: var(--blue); font-size: 1.05rem; margin-bottom: 0.15rem; }
.step-duration { font-size: 0.82rem; color: var(--gray-500); }
.step-docs { font-size: 0.82rem; color: var(--gold-dark); font-weight: 500; margin-bottom: 0.5rem; }
.step-status { display: flex; align-items: center; gap: 0.5rem; }
.status-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--gray-300);
    transition: background var(--transition);
}
[data-status="in-progress"] .status-dot { background: var(--gold); }
[data-status="completed"] .status-dot { background: #27ae60; }
.status-select {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 0.82rem;
    color: var(--dark);
    outline: none;
    cursor: pointer;
}
.status-select:focus { border-color: var(--gold); }

/* ── Document Grid ── */
.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}
.doc-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition), box-shadow var(--transition);
}
.doc-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.doc-card-icon {
    width: 42px; height: 42px;
    background: rgba(13,41,87,0.06);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: var(--blue);
    margin-bottom: 1rem;
}
.doc-card h3 { font-family: var(--font-main); color: var(--blue); font-size: 1rem; margin-bottom: 0.35rem; }
.doc-card p { font-size: 0.85rem; color: var(--gray-500); flex: 1; margin-bottom: 1rem; }
.doc-card .btn { align-self: flex-start; }

/* ── Document Modal ── */
/* ── Document Modal ── */
.modal-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(4px);
}
.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    max-width: 800px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}
.modal-header h2 { font-family: var(--font-main); color: var(--blue); font-size: 1.2rem; }
.modal-close {
    background: none; border: none;
    font-size: 1.5rem; color: var(--gray-500);
    cursor: pointer; padding: 0.25rem;
    line-height: 1;
}
.modal-close:hover { color: var(--dark); }
.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

/* ── Markdown Rendering ── */
.markdown-body h1 { font-family: var(--font-main); color: var(--blue); font-size: 1.5rem; margin: 1.5rem 0 0.75rem; border-bottom: 2px solid var(--cream); padding-bottom: 0.5rem; }
.markdown-body h2 { font-family: var(--font-main); color: var(--blue); font-size: 1.25rem; margin: 1.25rem 0 0.5rem; }
.markdown-body h3 { font-family: var(--font-main); color: var(--blue); font-size: 1.1rem; margin: 1rem 0 0.4rem; }
.markdown-body h4 { color: var(--blue); font-size: 0.95rem; margin: 0.75rem 0 0.35rem; }
.markdown-body p { margin: 0.5rem 0; line-height: 1.7; }
.markdown-body ul, .markdown-body ol { padding-left: 1.5rem; margin: 0.5rem 0; }
.markdown-body li { margin: 0.25rem 0; }
.markdown-body strong { color: var(--dark); }
.markdown-body em { font-style: italic; }
.markdown-body code {
    background: var(--cream-light);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.88em;
}
.markdown-body pre {
    background: var(--dark);
    color: var(--cream);
    padding: 1rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 0.75rem 0;
}
.markdown-body pre code { background: none; padding: 0; color: inherit; }
.markdown-body blockquote {
    border-left: 3px solid var(--gold);
    padding: 0.5rem 1rem;
    margin: 0.75rem 0;
    background: rgba(239,201,129,0.08);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.markdown-body table { width: 100%; border-collapse: collapse; margin: 0.75rem 0; font-size: 0.9rem; }
.markdown-body th { background: var(--blue); color: var(--white); text-align: left; padding: 0.6rem 0.75rem; font-weight: 600; }
.markdown-body td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--gray-200); }
.markdown-body tr:hover td { background: var(--cream-light); }
.markdown-body hr { border: none; border-top: 2px solid var(--cream); margin: 1.5rem 0; }
.markdown-body a { color: var(--blue); text-decoration: underline; }
.markdown-body a:hover { color: var(--gold-dark); }

/* ── Email Templates ── */
.email-group { margin-bottom: 2rem; }
.email-group-title {
    font-family: var(--font-main);
    color: var(--blue);
    font-size: 1.15rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--cream);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.email-group-count {
    background: var(--blue);
    color: var(--white);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-family: var(--font-body);
}
.email-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
    overflow: hidden;
    transition: box-shadow var(--transition);
}
.email-card:hover { box-shadow: var(--shadow-lg); }
.email-card-header {
    padding: 1rem 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}
.email-card-header h3 { font-size: 0.95rem; color: var(--dark); font-weight: 600; }
.email-card-toggle {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    color: var(--gray-500);
    transition: transform var(--transition);
    flex-shrink: 0;
}
.email-card.open .email-card-toggle { transform: rotate(180deg); }
.email-card-body {
    display: none;
    padding: 0 1.25rem 1.25rem;
    border-top: 1px solid var(--gray-200);
}
.email-card.open .email-card-body { display: block; padding-top: 1rem; }
.email-preview {
    background: var(--cream-light);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    font-size: 0.88rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
}
.email-preview .merge-field {
    background: rgba(239,201,129,0.35);
    color: var(--dark);
    font-weight: 600;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    border-bottom: 2px solid var(--gold);
}
.email-actions { display: flex; gap: 0.5rem; }
.copy-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--dark);
    color: var(--white);
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    z-index: 99999;
    transition: transform 0.3s ease;
    pointer-events: none;
}
.copy-toast.show { transform: translateX(-50%) translateY(0); }
.merge-tag { background: rgba(239,201,129,0.35); padding: 0.1rem 0.35rem; border-radius: 3px; border-bottom: 2px solid var(--gold); font-weight: 600; }

/* ── AI Chat (Full page) ── */
.ai-chat-fullpage {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    height: calc(100vh - 200px);
    min-height: 400px;
    display: flex;
    flex-direction: column;
}
.chat-welcome {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--gray-500);
}
.chat-welcome-logo { height: 40px; margin-bottom: 1rem; opacity: 0.6; }
.chat-welcome h3 { font-family: var(--font-main); color: var(--blue); margin-bottom: 0.5rem; }
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.chat-msg {
    max-width: 80%;
    display: flex;
    flex-direction: column;
}
.chat-msg.user { align-self: flex-end; }
.chat-msg.assistant { align-self: flex-start; }
.chat-msg .bubble {
    padding: 0.75rem 1.1rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    line-height: 1.6;
    word-break: break-word;
}
.chat-msg.user .bubble {
    background: var(--blue);
    color: var(--white);
    border-bottom-right-radius: 4px;
}
.chat-msg.assistant .bubble {
    background: var(--cream-light);
    color: var(--dark);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--cream);
}
.chat-msg .bubble p { margin: 0.3rem 0; }
.chat-msg .bubble p:first-child { margin-top: 0; }
.chat-msg .bubble p:last-child { margin-bottom: 0; }
.chat-msg .bubble strong { color: var(--blue); }
.chat-msg .bubble ul, .chat-msg .bubble ol { padding-left: 1.2rem; margin: 0.3rem 0; }
.chat-msg .bubble code { background: rgba(0,0,0,0.06); padding: 0.1rem 0.3rem; border-radius: 3px; font-size: 0.85em; }
.typing-indicator {
    display: flex; gap: 4px; padding: 0.75rem 1.1rem;
    background: var(--cream-light);
    border-radius: var(--radius);
    border: 1px solid var(--cream);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.typing-indicator span {
    width: 8px; height: 8px;
    background: var(--gray-300);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}
.chat-input-form {
    display: flex; gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--gray-200);
}
.chat-input-form input {
    flex: 1;
    padding: 0.7rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition);
}
.chat-input-form input:focus { border-color: var(--gold); }
.chat-send-btn {
    width: 42px; height: 42px;
    background: var(--blue);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background var(--transition);
    flex-shrink: 0;
}
.chat-send-btn:hover { background: var(--blue-light); }

/* ── Floating Chat Widget ── */
[hidden] { display: none !important; }
.chat-widget { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9000; }
.chat-fab {
    width: 56px; height: 56px;
    background: var(--blue);
    color: var(--white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(13,41,87,0.3);
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition);
}
.chat-fab:hover { background: var(--blue-light); transform: scale(1.05); }
.chat-panel {
    position: absolute;
    bottom: 70px; right: 0;
    width: 380px;
    height: 520px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.chat-panel-header {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: var(--blue);
    color: var(--white);
    font-weight: 600;
    font-size: 0.9rem;
}
.chat-panel-logo { height: 24px; }
.chat-panel-close {
    margin-left: auto;
    background: none; border: none;
    color: rgba(255,255,255,0.7);
    font-size: 1.3rem;
    cursor: pointer;
    line-height: 1;
}
.chat-panel-close:hover { color: var(--white); }
.chat-panel .chat-messages { font-size: 0.88rem; padding: 1rem; }
.chat-panel .chat-input-form { padding: 0.75rem; }
.chat-panel .chat-input-form input { font-size: 0.85rem; padding: 0.6rem 0.85rem; }

/* ── Cliënten Management ── */
.clienten-layout {
    display: flex;
    gap: 1.5rem;
    min-height: calc(100vh - 200px);
}
.client-sidebar {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.client-new-btn {
    width: 100%;
    justify-content: center;
}
.client-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.client-list-empty {
    color: var(--gray-500);
    font-size: 0.88rem;
    text-align: center;
    padding: 2rem 1rem;
}
.client-list-item {
    background: var(--white);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    cursor: pointer;
    box-shadow: var(--shadow);
    border-left: 3px solid transparent;
    transition: all var(--transition);
}
.client-list-item:hover { background: var(--cream-light); }
.client-list-item.selected {
    border-left-color: var(--gold);
    background: var(--cream-light);
}
.client-list-name {
    font-weight: 600;
    color: var(--blue);
    font-size: 0.92rem;
    margin-bottom: 0.25rem;
}
.client-list-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.client-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.badge-new { background: rgba(52,152,219,0.15); color: #2980b9; }
.badge-active { background: rgba(39,174,96,0.15); color: #27ae60; }
.badge-done { background: rgba(149,165,166,0.2); color: #7f8c8d; }
.client-list-date {
    font-size: 0.75rem;
    color: var(--gray-500);
}
.client-detail {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}
.client-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: var(--gray-500);
    font-size: 0.95rem;
    gap: 1rem;
}
.client-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.client-detail-header h2 {
    font-family: var(--font-main);
    color: var(--blue);
    font-size: 1.4rem;
}
.client-detail-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.status-select-detail {
    padding: 0.4rem 0.6rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
}
.status-select-detail:focus { border-color: var(--gold); }

/* Detail Sections */
.detail-section {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
    overflow: hidden;
}
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    cursor: pointer;
    user-select: none;
    transition: background var(--transition);
}
.section-header:hover { background: var(--cream-light); }
.section-header h3 {
    font-family: var(--font-main);
    color: var(--blue);
    font-size: 1rem;
    margin: 0;
}
.toggle-icon {
    font-size: 1.1rem;
    color: var(--gray-500);
    transition: transform var(--transition);
}
.detail-section.collapsed .toggle-icon { transform: rotate(-90deg); }
.section-body {
    padding: 0 1.25rem 1.25rem;
}
.detail-section.collapsed .section-body { display: none; }

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.form-group { display: flex; flex-direction: column; gap: 0.25rem; }
.form-group.full { grid-column: 1 / -1; }
.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-700);
}
.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.55rem 0.75rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-family: var(--font-body);
    outline: none;
    transition: border-color var(--transition);
    background: var(--white);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--gold); }
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
    width: 18px; height: 18px;
    accent-color: var(--blue);
}
.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem 0;
}
.radio-label input[type="radio"] {
    accent-color: var(--blue);
}

/* Children */
.child-card {
    background: var(--cream-light);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--cream);
}
.child-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}
.child-card-header strong { color: var(--blue); font-size: 0.9rem; }
.btn-remove-child {
    background: none;
    border: none;
    color: #c0392b;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    transition: background var(--transition);
}
.btn-remove-child:hover { background: rgba(192,57,43,0.1); }

/* Traject Stepper */
.traject-progress-bar {
    position: relative;
    height: 28px;
    background: var(--gray-200);
    border-radius: 14px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}
.traject-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--blue), var(--gold));
    border-radius: 14px;
    transition: width 0.5s ease;
}
.traject-progress-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--dark);
    mix-blend-mode: difference;
    color: var(--white);
}
.traject-stepper {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}
.traject-step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding-bottom: 1rem;
    position: relative;
}
.traject-step:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 17px;
    top: 36px;
    bottom: 0;
    width: 2px;
    background: var(--gray-200);
}
.traject-step.done:not(:last-child)::after { background: #27ae60; }
.traject-step-dot {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-700);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
    z-index: 1;
    transition: all var(--transition);
}
.traject-step.planned .traject-step-dot { background: var(--gold); color: var(--blue); }
.traject-step.done .traject-step-dot { background: #27ae60; color: var(--white); }
.traject-step-info { flex: 1; padding-top: 0.3rem; }
.traject-step-info strong { color: var(--blue); font-size: 0.9rem; }
.traject-step-fields {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.35rem;
}
.traject-step-fields input,
.traject-step-fields select {
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 0.82rem;
    outline: none;
}
.traject-step-fields input:focus,
.traject-step-fields select:focus { border-color: var(--gold); }

/* Opdracht */
.opdracht-pricing {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.opdracht-preview {
    margin-bottom: 1rem;
}
.opdracht-doc {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 2rem;
    font-size: 0.9rem;
    line-height: 1.7;
}
.opdracht-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
.opdracht-logo { height: 40px; }
.opdracht-doc hr { border: none; border-top: 2px solid var(--cream); margin: 1rem 0; }
.opdracht-doc ul { padding-left: 1.5rem; margin: 0.5rem 0; }
.opdracht-doc li { margin: 0.25rem 0; }
.opdracht-actions {
    display: flex;
    gap: 0.5rem;
}

/* Notities */
.notities-textarea {
    width: 100%;
    min-height: 150px;
    padding: 0.85rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: var(--font-body);
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: border-color var(--transition);
}
.notities-textarea:focus { border-color: var(--gold); }

/* ── Email Planner ── */
.email-planner-table-wrap { overflow-x: auto; }
.email-planner-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.email-planner-table th {
    background: var(--blue);
    color: var(--white);
    text-align: left;
    padding: 0.6rem 0.75rem;
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
}
.email-planner-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--gray-200);
    vertical-align: middle;
}
.ep-row-even td { background: var(--white); }
.ep-row-odd td { background: var(--cream-light); }
.ep-trigger {
    font-size: 0.78rem;
    color: var(--gray-700);
    white-space: nowrap;
}
.ep-countdown {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 8px;
    margin-left: 0.35rem;
    white-space: nowrap;
}
.ep-future { background: rgba(52,152,219,0.12); color: #2980b9; }
.ep-today { background: rgba(39,174,96,0.15); color: #27ae60; }
.ep-past { background: rgba(149,165,166,0.15); color: #7f8c8d; }
.ep-sent-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    white-space: nowrap;
    font-size: 0.82rem;
}
.ep-sent-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--gold);
    cursor: pointer;
}
.ep-view-link {
    color: var(--blue);
    font-size: 0.8rem;
    text-decoration: underline;
    white-space: nowrap;
}
.ep-view-link:hover { color: var(--gold-dark); }

/* ── Print Styles ── */
@media print {
    body * { visibility: hidden; }
    .opdracht-preview, .opdracht-preview * { visibility: visible; }
    .opdracht-preview {
        position: absolute;
        left: 0; top: 0;
        width: 100%;
        margin: 0;
        padding: 2rem;
    }
    .opdracht-doc {
        border: none;
        box-shadow: none;
        padding: 0;
    }
    .opdracht-logo { height: 50px; }
    .opdracht-doc .handtekening-blok { page-break-inside: avoid; }
    .opdracht-doc .av-akkoord { page-break-inside: avoid; }
    .av-checkbox { width: 16px; height: 16px; }
}

/* ── Mobile Header ── */
.mobile-header {
    display: none;
    position: fixed; top: 0; left: 0; right: 0;
    height: 56px;
    background: var(--blue);
    z-index: 99;
    padding: 0 1rem;
    align-items: center;
}
.mobile-logo { height: 30px; margin-left: auto; }
.hamburger {
    background: none; border: none;
    width: 32px; height: 32px;
    display: flex; flex-direction: column;
    justify-content: center; gap: 5px;
    cursor: pointer;
}
.hamburger span {
    display: block; width: 22px; height: 2px;
    background: var(--white);
    transition: all 0.3s ease;
}
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .mobile-header { display: flex; }
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.active { display: block; }
    .main-content {
        margin-left: 0;
        padding: 4.5rem 1rem 2rem;
    }
    .doc-grid { grid-template-columns: 1fr; }
    .process-step { padding-left: 0; }
    .chat-panel { width: 92vw; right: -1rem; height: 60vh; }
    .chat-widget { bottom: 1rem; right: 1rem; }
    .ai-chat-fullpage { height: calc(100vh - 240px); }
    .chat-msg { max-width: 92%; }
    .modal { max-height: 90vh; }
    .clienten-layout { flex-direction: column; }
    .client-sidebar { width: 100%; }
    .client-detail { max-height: none; }
    .form-grid { grid-template-columns: 1fr; }
    .opdracht-pricing { flex-direction: column; gap: 0.5rem; }
    .traject-step-fields { flex-direction: column; }
}
