/* =====================================================================
 * Migoflow — design tokens + components
 * Modern, neutral, readable.
 * --------------------------------------------------------------------- */

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

:root, [data-theme="light"] {
    /* Surfaces */
    --color-bg: #f3f5f9;
    --color-surface: #ffffff;
    --color-surface-2: #fafafa;
    --color-surface-offset: #f4f4f5;
    --color-surface-dynamic: #e4e4e7;
    --color-divider: #e4e4e7;
    --color-border: #d4d4d8;
    --color-bg-subtle: #f9fafb;
    --border-color: #e4e4e7;
    --color-surface-subtle: #f8fafc;

    /* Text */
    --color-text: #18181b;
    --color-text-muted: #52525b;
    --color-text-faint: #a1a1aa;
    --color-placeholder: #71717a;

    /* Primary — Rotterdam groen */
    --color-primary: #00811f;
    --color-primary-hover: #00602e;
    --color-primary-soft: #e1efe2;
    --color-primary-text: #00602e;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #00602e 0%, #00811f 40%, #4eb051 100%);
    --gradient-text: linear-gradient(135deg, #00602e, #00811f, #4eb051);
    --gradient-border: linear-gradient(135deg, rgba(0,129,31,0.3), rgba(0,96,46,0.2), rgba(78,176,81,0.3));

    /* Enhanced shadows */
    --shadow-glow: 0 0 20px -5px rgba(0, 129, 31, 0.15);
    --shadow-card-hover: 0 8px 30px rgba(15, 23, 42, 0.08), 0 2px 8px rgba(15, 23, 42, 0.04);
    --shadow-elevated: 0 20px 60px -15px rgba(15, 23, 42, 0.12), 0 8px 20px -8px rgba(15, 23, 42, 0.08);

    /* Semantic */
    --color-success: #047857;
    --color-success-soft: #ecfdf5;
    --color-warning: #b45309;
    --color-warning-soft: #fffbeb;
    --color-danger: #b91c1c;
    --color-danger-soft: #fef2f2;
    --color-info: #0e7490;
    --color-info-soft: #ecfeff;

    /* Effects */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.08), 0 4px 8px rgba(15, 23, 42, 0.04);

    /* Radii — softer, modern */
    --radius-sm: 0.375rem;   /* 6px */
    --radius-md: 0.5rem;     /* 8px */
    --radius-lg: 0.75rem;    /* 12px */
    --radius-xl: 1rem;       /* 16px */
    --radius-2xl: 1.25rem;   /* 20px */
    --radius-full: 9999px;

    /* Spacing scale */
    --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem;
    --space-4: 1rem;    --space-5: 1.25rem; --space-6: 1.5rem;
    --space-8: 2rem;    --space-10: 2.5rem; --space-12: 3rem;
    --space-16: 4rem;

    /* Type scale */
    --text-xs:   0.8125rem;            /* 13px */
    --text-sm:   0.875rem;             /* 14px */
    --text-base: 0.9375rem;            /* 15px — comfortable reading */
    --text-lg:   1.0625rem;            /* 17px */
    --text-xl:   clamp(1.25rem, 1.05rem + 0.6vw, 1.5rem);
    --text-2xl:  clamp(1.5rem,  1.20rem + 1.0vw, 1.875rem);
    --text-3xl:  clamp(1.875rem, 1.4rem + 1.5vw, 2.5rem);
    --text-4xl:  clamp(2.25rem, 1.6rem + 2vw, 3.25rem);

    --font-body: 'Geist', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono: 'Geist Mono', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    --leading-tight: 1.2;
    --leading-snug:  1.4;
    --leading-base:  1.55;

    --transition-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);

    --topbar-height: 52px;
    --topbar-bg: #00811f;
    --topbar-bg-hover: rgba(255, 255, 255, 0.12);
    --topbar-text: #ffffff;
    --topbar-text-muted: rgba(255, 255, 255, 0.82);
    --topbar-text-faint: rgba(255, 255, 255, 0.68);
    --topbar-accent: #ffffff;
    --topbar-rule: rgba(255, 255, 255, 0.28);
}

[data-theme="dark"] {
    --color-bg: #09090b;
    --color-surface: #111113;
    --color-surface-2: #18181b;
    --color-surface-offset: #1f1f23;
    --color-surface-dynamic: #27272a;
    --color-divider: #27272a;
    --color-border: #2e2e33;
    --color-bg-subtle: #18181b;
    --border-color: #2e2e33;
    --color-surface-subtle: #18181b;

    --color-text: #f4f4f5;
    --color-text-muted: #a1a1aa;
    --color-text-faint: #52525b;
    --color-placeholder: #a1a1aa;

    --color-primary: #4eb051;
    --color-primary-hover: #6bc86e;
    --color-primary-soft: rgba(0, 129, 31, 0.18);
    --color-primary-text: #7dcc80;

    --gradient-primary: linear-gradient(135deg, #00602e 0%, #00811f 40%, #4eb051 100%);
    --gradient-text: linear-gradient(135deg, #4eb051, #6bc86e, #99cca0);
    --gradient-border: linear-gradient(135deg, rgba(78,176,81,0.3), rgba(0,129,31,0.2), rgba(153,204,160,0.3));

    --shadow-glow: 0 0 20px -5px rgba(0, 129, 31, 0.25);
    --shadow-card-hover: 0 8px 30px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-elevated: 0 20px 60px -15px rgba(0, 0, 0, 0.5), 0 8px 20px -8px rgba(0, 0, 0, 0.3);

    --color-success: #34d399;
    --color-success-soft: rgba(16, 185, 129, 0.10);
    --color-warning: #fbbf24;
    --color-warning-soft: rgba(245, 158, 11, 0.10);
    --color-danger: #f87171;
    --color-danger-soft: rgba(239, 68, 68, 0.12);
    --color-info: #67e8f9;
    --color-info-soft: rgba(14, 165, 233, 0.10);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.30);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.30), 0 1px 2px rgba(0, 0, 0, 0.20);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.36), 0 2px 4px rgba(0, 0, 0, 0.24);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.50);
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
    color-scheme: light;
}
html[data-theme="dark"] {
    color-scheme: dark;
}
body {
    min-height: 100dvh;
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--leading-base);
    letter-spacing: -0.005em;
    color: var(--color-text);
    background: var(--color-bg);
    display: flex; flex-direction: column;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-hover); text-decoration: underline; text-underline-offset: 2px; }
button { cursor: pointer; background: none; border: none; font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }

/* UPN-canvas: native SVG-maat in een viewport, schaal/pan via transform. */
.upn-viewer {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}
.upn-toolbar {
    scroll-margin-top: 1rem;
}
.upn-canvas-shell {
    overflow: hidden;
    height: calc(100dvh - 210px);
    min-height: 650px;
    max-height: none;
}
.upn-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: default;
    touch-action: pan-y;
    user-select: none;
}
.upn-container.is-wheel-active {
    cursor: grab;
    touch-action: none;
    overscroll-behavior: contain;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 20%, transparent);
    outline: 1.5px solid color-mix(in srgb, var(--color-primary) 55%, transparent);
    outline-offset: -1px;
}
.upn-container.is-panning,
.upn-container.is-wheel-active.is-panning {
    cursor: grabbing;
}
.upn-viewer:fullscreen .upn-container {
    cursor: grab;
    touch-action: none;
    overscroll-behavior: contain;
}
.upn-viewer:fullscreen .upn-container.is-panning {
    cursor: grabbing;
}
.upn-stage {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    will-change: transform;
}
.upn-stage svg {
    display: block;
    max-width: none;
    max-height: none;
    width: auto;
    height: auto;
    margin: 0;
}
code, pre, kbd { font-family: var(--font-mono); font-size: 0.92em; }

a, button, input, textarea, [role="button"] {
    transition: color var(--transition-fast),
                background-color var(--transition-fast),
                border-color var(--transition-fast),
                box-shadow var(--transition-fast),
                transform var(--transition-fast);
}
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Headings — display weight, tighter tracking */
h1, h2, h3, h4 {
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: var(--leading-tight);
    color: var(--color-text);
}
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-base); font-weight: 600; }
p  { line-height: var(--leading-base); }

/* ----- TOPBAR ------------------------------------------------------- */
.topbar {
    position: sticky; top: 0; z-index: 100;
    flex-shrink: 0;
    height: var(--topbar-height);
    background: var(--topbar-bg);
    color: var(--topbar-text);
    border-bottom: 1px solid #00602e;
    display: flex; align-items: center; gap: 12px;
    padding: 0 16px;
}
.topbar :focus-visible {
    outline-color: var(--topbar-accent);
}
.topbar-logo {
    display: flex; align-items: center; gap: var(--space-2);
    color: var(--topbar-text); flex-shrink: 0;
}
.topbar-logo img {
    height: 26px; width: auto;
    filter: brightness(4) contrast(0.92);
}
.topbar-public .topbar-logo img {
    height: 32px;
}
.topbar-actions {
    display: flex; align-items: center; gap: 4px; margin-left: auto;
}
.topbar-rule {
    width: 1px;
    height: 18px;
    background: var(--topbar-rule);
    margin: 0 6px;
    flex-shrink: 0;
}
.topbar .btn-icon {
    color: var(--topbar-text-muted);
}
.topbar .btn-icon:hover {
    background: var(--topbar-bg-hover);
    color: var(--topbar-text);
}
.topbar-public .btn-ghost {
    color: var(--topbar-text);
}
.topbar-public .btn-ghost:hover {
    background: var(--topbar-bg-hover);
    color: var(--topbar-text);
}
.topbar-public .btn-primary {
    background: var(--topbar-text);
    color: var(--topbar-bg);
    border-color: var(--topbar-text);
}
.topbar-public .btn-primary:hover {
    background: var(--topbar-accent);
    border-color: var(--topbar-accent);
    color: var(--topbar-bg);
}
.btn-icon {
    width: 32px; height: 32px; border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    color: var(--color-text-muted);
}
.btn-icon:hover { background: var(--color-surface-offset); color: var(--color-text); }
.avatar {
    width: 32px; height: 32px; border-radius: var(--radius-full);
    background: var(--color-primary-soft); color: var(--color-primary-text);
    display: flex; align-items: center; justify-content: center;
    font-size: var(--text-xs); font-weight: 600;
}

/* ----- LAYOUT ------------------------------------------------------- */
.app-layout { display: flex; flex: 1; min-height: 0; }

.main {
    flex: 1; overflow-y: auto;
    padding: var(--space-10) var(--space-8);
    display: flex; flex-direction: column; gap: var(--space-6);
    max-width: 1100px; width: 100%; margin: 0 auto;
}
/* Wide pages (detail with diagram, edit) follow window width so the
   diagram has room to breathe. Applied via {% block main_class %} in
   base.html. */
.main.main-wide {
    max-width: none;
    padding-left: var(--space-6);
    padding-right: var(--space-6);
}
.main.main-detail,
.main:has(.process-detail-sticky) {
    padding-top: 0;
    overflow-y: visible;
}
.main.main-flush {
    max-width: none;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: calc(100dvh - var(--topbar-height));
}
.main.main-flush .bpmn-container-flush {
    flex: 1;
    height: auto;
    min-height: 0;
}

@media (max-width: 768px) {
    .main { padding: var(--space-5) var(--space-4); }
    .topbar { padding: var(--space-2) var(--space-3); gap: var(--space-2); }
}

/* ----- CARDS / SURFACES -------------------------------------------- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6) var(--space-8);
    box-shadow: var(--shadow-sm);
}
.card.narrow {
    max-width: 440px; margin: var(--space-12) auto; padding: var(--space-8);
    box-shadow: var(--shadow-lg);
}
.card h1 { margin-bottom: var(--space-2); }
.card h1 + p { color: var(--color-text-muted); margin-bottom: var(--space-5); }
.card h2, .card h3 { margin-top: var(--space-6); margin-bottom: var(--space-2); }

.row-between {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-4); flex-wrap: wrap;
}
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-4); flex-wrap: wrap;
    margin-bottom: var(--space-2);
}
.page-header h1 {
    font-size: var(--text-2xl);
    margin: 0;
}
.page-header p.muted {
    margin-top: var(--space-1);
    font-size: var(--text-sm);
}
.muted { color: var(--color-text-muted); }
.small { font-size: var(--text-xs); }

/* ----- FORMS -------------------------------------------------------- */
form label {
    display: block; margin-bottom: var(--space-4);
    font-weight: 500; font-size: var(--text-sm);
    color: var(--color-text);
}
form input[type=text],
form input[type=email],
form input[type=password],
form input[type=search],
form textarea {
    display: block; width: 100%; margin-top: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font: inherit; font-size: var(--text-sm);
    background: var(--color-surface); color: var(--color-text);
    line-height: var(--leading-snug);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
}
form textarea { resize: vertical; font-family: inherit; line-height: var(--leading-base); min-height: 6rem; }
form input[type=file] {
    display: block;
    width: 100%;
    margin-top: var(--space-2);
    font: inherit;
    font-size: var(--text-sm);
}
.import-bpmn-form {
    max-width: 40rem;
}
.import-bpmn-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-2);
}
form input:hover:not(:focus), form textarea:hover:not(:focus) {
    border-color: color-mix(in srgb, var(--color-primary) 25%, var(--color-border));
}
form input:focus, form textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px var(--color-primary-soft),
                inset 0 1px 2px rgba(15, 23, 42, 0.03);
}
form input::placeholder, form textarea::placeholder { color: var(--color-placeholder); }
.inline-form { display: inline; margin: 0; }

/* ----- BUTTONS ------------------------------------------------------ */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    background: var(--color-surface-offset);
    color: var(--color-text);
    font: inherit; font-size: var(--text-sm); font-weight: 500;
    line-height: 1.2; cursor: pointer; text-decoration: none;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(0.5px); box-shadow: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-sm { padding: var(--space-1) var(--space-3); font-size: var(--text-xs); }
.btn-lg { padding: var(--space-3) var(--space-5); font-size: var(--text-base); }
.btn-primary {
    background: var(--topbar-bg); color: #fff;
    border-color: transparent;
    box-shadow:
        0 1px 0 rgba(255,255,255,0.10) inset,
        0 1px 2px rgba(0, 129, 31, 0.25),
        0 4px 10px -2px rgba(0, 129, 31, 0.30);
}
.btn-primary:hover {
    background: #00602e; color: #fff;
    transform: translateY(-1px);
    box-shadow:
        0 1px 0 rgba(255,255,255,0.10) inset,
        0 2px 4px rgba(0, 129, 31, 0.30),
        0 8px 18px -4px rgba(0, 129, 31, 0.35);
}
[data-theme="dark"] .btn-primary {
    background: var(--topbar-bg);
    color: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
[data-theme="dark"] .btn-primary:hover {
    background: #006e32;
    color: #fff;
}
.btn-lg.btn-primary { padding: var(--space-3) var(--space-6); }
.btn-secondary {
    background: var(--color-surface); color: var(--color-text);
    border-color: var(--color-border);
    box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
    background: var(--color-surface-offset); border-color: var(--color-border);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.btn-ghost { background: transparent; border-color: transparent; color: var(--color-text-muted); }
.btn-ghost:hover { background: var(--color-surface-offset); color: var(--color-text); }
.btn-danger {
    background: var(--color-surface); color: var(--color-danger);
    border-color: var(--color-border);
}
.btn-danger:hover { background: var(--color-danger); color: #fff; border-color: var(--color-danger); }
.btn-danger-solid {
    background: var(--color-danger); color: #fff;
    border-color: transparent;
}
.btn-danger-solid:hover { background: #991b1b; color: #fff; }

/* ----- ALERTS ------------------------------------------------------- */
.alert {
    padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
    font-size: var(--text-sm);
    border: 1px solid transparent;
}
.alert ul { margin: 0; padding-left: var(--space-5); }
.alert-error, .alert-danger   { background: var(--color-danger-soft);  color: var(--color-danger);  border-color: color-mix(in srgb, var(--color-danger) 25%, transparent); }
.alert-warn, .alert-warning    { background: var(--color-warning-soft); color: var(--color-warning); border-color: color-mix(in srgb, var(--color-warning) 25%, transparent); }
.alert-success { background: var(--color-success-soft); color: var(--color-success); border-color: color-mix(in srgb, var(--color-success) 25%, transparent); }
.alert-info    { background: var(--color-info-soft);    color: var(--color-info);    border-color: color-mix(in srgb, var(--color-info) 25%, transparent); }

/* ----- BADGES ------------------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: var(--space-1);
    padding: 2px var(--space-2); border-radius: var(--radius-full);
    font-size: var(--text-xs); font-weight: 500;
    background: var(--color-surface-offset);
    color: var(--color-text-muted);
    border: 1px solid transparent;
    line-height: 1.4;
}
.badge-primary { background: var(--color-primary-soft); color: var(--color-primary-text); }
.badge-success { background: var(--color-success-soft); color: var(--color-success); }
.badge-warn    { background: var(--color-warning-soft); color: var(--color-warning); }
.badge-info    { background: var(--color-info-soft); color: var(--color-info); }

.badge-task       { background: var(--color-success-soft); color: var(--color-success); }
.badge-decision   { background: var(--color-warning-soft); color: var(--color-warning); }
.badge-event      { background: var(--color-info-soft); color: var(--color-info); }
.badge-subprocess { background: var(--color-primary-soft); color: var(--color-primary-text); }

/* ----- PROCESS LIST ------------------------------------------------- */
.process-list {
    list-style: none; padding: 0;
    margin: var(--space-5) 0 0;
    display: grid; gap: var(--space-3);
}
.process-list-item {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: var(--space-5);
    padding: var(--space-4) var(--space-5);
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    transition: border-color var(--transition-fast),
                transform var(--transition-fast),
                box-shadow var(--transition-fast),
                background-color var(--transition-fast);
}
.process-list-item:hover {
    background: var(--color-surface);
    border-color: color-mix(in srgb, var(--color-primary) 35%, var(--color-border));
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.process-list-item > div:first-child { min-width: 0; flex: 1; }
.process-list-item h3 {
    margin: 0 0 var(--space-1);
    font-size: var(--text-lg); font-weight: 600;
    letter-spacing: -0.015em;
}
.process-list-item h3 a { color: var(--color-text); }
.process-list-item h3 a:hover { color: var(--color-primary); text-decoration: none; }
.process-list-item .actions {
    display: flex; gap: var(--space-2); flex-shrink: 0;
    align-items: center;
}

.empty {
    padding: var(--space-12) var(--space-4); text-align: center;
    color: var(--color-text-muted);
    background: var(--color-surface-2);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-lg);
    margin-top: var(--space-4);
}
.empty a { font-weight: 600; }

/* ----- TABS --------------------------------------------------------- */
.tabs {
    display: flex; gap: 0;
    margin: var(--space-5) 0 var(--space-4);
    border-bottom: 1px solid var(--color-border);
}
.tab {
    padding: var(--space-3) var(--space-4);
    color: var(--color-text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-size: var(--text-sm); font-weight: 500;
}
.tab:hover { color: var(--color-text); }
.tab.active {
    color: var(--color-text);
    border-bottom-color: var(--color-primary);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.toolbar {
    display: flex; gap: var(--space-2); margin-bottom: var(--space-4);
    flex-wrap: wrap;
}

/* ----- BPMN viewer -------------------------------------------------- */
.bpmn-container {
    width: 100%;
    height: calc(100dvh - 280px);
    min-height: 480px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}
.bpmn-container.bpmn-container-flush {
    border-radius: 0; border-left: none; border-right: none;
    height: calc(100dvh - 110px);
}
/* Diagram blijft op lichte achtergrond in dark mode — BPMN-notatie
   (zwarte lijnen op wit) blijft zo leesbaar en print-/exporteerbaar. */
[data-theme="dark"] .bpmn-container,
[data-theme="dark"] .bpmn-container.bpmn-container-flush {
    background: #f4f4f5;
    color-scheme: light;
}
[data-theme="dark"] .bpmn-container {
    border-color: #3f3f46;
}

/* ----- PRE/CODE ----------------------------------------------------- */
.code, pre.code {
    background: #0a0a0b; color: #e4e4e7;
    padding: var(--space-4); border-radius: var(--radius-md);
    overflow: auto; font-size: 0.8125rem;
    max-height: 400px;
    font-family: var(--font-mono);
    line-height: var(--leading-snug);
}
pre.prose {
    background: var(--color-surface-offset); padding: var(--space-4);
    border-radius: var(--radius-md); white-space: pre-wrap;
    border: 1px solid var(--color-border);
    font-family: inherit; font-size: var(--text-sm);
    color: var(--color-text);
    line-height: var(--leading-base);
}

/* ----- STEPS TABLE (detail page) ----------------------------------- */
.steps-table th.num, .steps-table td.num {
    width: 52px; text-align: center;
    font-variant-numeric: tabular-nums;
    color: var(--color-text-muted); font-weight: 600;
}
.steps-table tbody td { padding: var(--space-4); }
.steps-table tbody td:nth-child(2) { color: var(--color-text-muted); }
.steps-table tbody td:nth-child(3) { font-weight: 500; }
.steps-table tbody tr:hover td.num { color: var(--color-primary-text); }

/* ----- STEP LIST (legacy, will be reworked in step 3) -------------- */
.step-list { list-style: none; padding: 0; margin: var(--space-4) 0 0; }
.step-row {
    display: grid; grid-template-columns: 40px 1fr auto;
    gap: var(--space-4); align-items: start;
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--color-divider);
}
.step-row:last-child { border-bottom: none; }
.step-number { font-weight: 600; color: var(--color-text-muted); font-size: var(--text-base); font-variant-numeric: tabular-nums; }
.step-header {
    display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap;
}
.step-desc { margin: var(--space-2) 0 0; color: var(--color-text-muted); font-size: var(--text-sm); }
.step-row-editing { background: var(--color-surface-offset); border-radius: var(--radius-lg); padding: var(--space-4); }
.step-edit-form .form-actions { display: flex; gap: var(--space-2); margin-top: var(--space-2); }

/* ----- TABLE -------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; margin-top: var(--space-3); }
.table th, .table td {
    text-align: left; padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-divider); font-size: var(--text-sm);
}
.table th {
    font-weight: 600; color: var(--color-text-faint);
    font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.06em;
    background: var(--color-surface-2);
    position: sticky; top: 0;
}
.table tbody tr { transition: background-color var(--transition-fast); }
.table tbody tr:hover { background: var(--color-surface-2); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .total-row td { background: var(--color-surface-offset); font-weight: 600; border-top: 1px solid var(--color-border); }

/* ----- USER MENU (avatar + dropdown) ------------------------------ */
.user-menu { position: relative; }
.user-avatar {
    width: 28px; height: 28px; border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    background: var(--color-primary-soft); color: var(--color-primary-text);
    font-size: 11px; font-weight: 650; letter-spacing: 0.02em;
    flex-shrink: 0;
}
.user-menu-trigger {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 4px 8px 4px 4px;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--topbar-text-muted);
    font-size: var(--text-xs); font-weight: 500;
    border: 1px solid transparent;
}
.user-menu-trigger:hover {
    background: var(--topbar-bg-hover);
    color: var(--topbar-text);
}
.user-menu.open .user-menu-trigger {
    background: var(--topbar-bg-hover);
    border-color: var(--topbar-rule);
    color: var(--topbar-text);
}
.topbar .user-avatar {
    background: rgba(255, 255, 255, 0.16);
    color: var(--topbar-text);
}
.role-dot {
    width: 8px; height: 8px; border-radius: var(--radius-full);
    flex-shrink: 0;
}
.role-specialist { background: var(--color-primary); }
.role-medewerker { background: var(--color-success); }

.user-menu-panel {
    position: absolute;
    top: calc(100% + var(--space-2));
    right: 0;
    min-width: 280px;
    max-width: calc(100vw - 24px);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    opacity: 0; transform: translateY(-4px) scale(0.98);
    pointer-events: none;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    z-index: 200;
}
.user-menu.open .user-menu-panel {
    opacity: 1; transform: translateY(0) scale(1);
    pointer-events: auto;
}
.user-menu-header {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-divider);
}
.user-menu-email {
    font-size: var(--text-sm); font-weight: 500; color: var(--color-text);
    overflow: hidden; text-overflow: ellipsis;
}
.user-menu-role {
    font-size: var(--text-xs); color: var(--color-text-muted);
    margin-top: 2px;
}
.user-menu-item-form { display: block; margin: 0; }
.user-menu-item {
    width: 100%;
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm); color: var(--color-text);
    text-align: left; background: none; border: none; cursor: pointer;
    text-decoration: none;
}
.user-menu-item:hover { background: var(--color-surface-offset); text-decoration: none; }
.user-menu-item svg { color: var(--color-text-muted); }

/* ----- DETAILS / DISCLOSURE ---------------------------------------- */
details > summary { cursor: pointer; user-select: none; }
details > summary::-webkit-details-marker { display: none; }


/* ----- EXCEPTIONS FIELDSET (in step instruction edit form) -------- */
.exceptions-fieldset {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-5) var(--space-5);
    background: var(--color-surface-2);
}
.exceptions-fieldset legend {
    font-size: 0.6875rem; font-weight: 600;
    color: var(--color-text-faint);
    text-transform: uppercase; letter-spacing: 0.06em;
    padding: 0 var(--space-2);
}
.exceptions-help {
    font-size: var(--text-xs); color: var(--color-text-muted);
    margin-bottom: var(--space-4);
}
.exceptions-list { display: flex; flex-direction: column; gap: var(--space-3); }
.exceptions-empty {
    color: var(--color-text-faint);
    font-size: var(--text-sm); padding: var(--space-3) 0;
}
.exception-edit-row {
    display: flex; align-items: flex-end; gap: var(--space-3);
    padding: var(--space-3); background: var(--color-surface);
    border: 1px solid var(--color-border); border-radius: var(--radius-md);
}
.exception-edit-fields {
    flex: 1;
    display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3);
}
.exception-edit-fields label { margin-bottom: 0; }
.exception-edit-label {
    display: block;
    font-size: 0.6875rem; font-weight: 600;
    color: var(--color-text-faint);
    text-transform: uppercase; letter-spacing: 0.06em;
    margin-bottom: var(--space-1);
}
.exception-edit-fields input { margin-top: 0 !important; }
.exception-edit-remove { flex-shrink: 0; }
@media (max-width: 768px) {
    .exception-edit-row { flex-direction: column; align-items: stretch; }
    .exception-edit-fields { grid-template-columns: 1fr; }
}

/* Read-only "exceptions in other steps" panel below the editable list. */
.exceptions-other { background: var(--color-bg); }
.other-step-block + .other-step-block { margin-top: var(--space-4); }
.other-step-block-head {
    display: flex; justify-content: space-between; align-items: center;
    gap: var(--space-3); flex-wrap: wrap;
    margin-bottom: var(--space-2);
}
.other-step-block-title {
    font-size: var(--text-sm); font-weight: 600; color: var(--color-text);
}
.other-step-exceptions {
    margin: 0; padding-left: var(--space-5);
    font-size: var(--text-sm); line-height: var(--leading-base);
    color: var(--color-text-muted);
    display: flex; flex-direction: column; gap: var(--space-1);
}
.other-step-exceptions strong { color: var(--color-text); font-weight: 500; }

/* ----- DIALOG ------------------------------------------------------- */
dialog.app-dialog {
    border: none;
    background: transparent;
    padding: 0;
    max-width: min(560px, calc(100vw - 2rem));
    width: 100%;
}
dialog.app-dialog::backdrop {
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.app-dialog-body {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: var(--space-6) var(--space-8);
    display: flex; flex-direction: column; gap: var(--space-4);
    color: var(--color-text);
}
.app-dialog-body h2 {
    font-size: var(--text-xl);
    margin: 0;
}
.app-dialog-list {
    margin: 0;
    padding-left: var(--space-5);
    display: flex; flex-direction: column; gap: var(--space-2);
    font-size: var(--text-sm);
    line-height: var(--leading-base);
    color: var(--color-text);
}
.app-dialog-list li strong { color: var(--color-text); font-weight: 600; }
.app-dialog-actions {
    display: flex; justify-content: flex-end; gap: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px solid var(--color-divider);
    margin-top: var(--space-2);
}

/* ----- ENTRY ANIMATION --------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
    .card, .process-list-item, .step-card {
        animation: pf-rise 320ms cubic-bezier(0.22, 1, 0.36, 1) both;
    }
    .process-list-item:nth-child(1) { animation-delay: 0ms; }
    .process-list-item:nth-child(2) { animation-delay: 30ms; }
    .process-list-item:nth-child(3) { animation-delay: 60ms; }
    .process-list-item:nth-child(4) { animation-delay: 90ms; }
    .process-list-item:nth-child(5) { animation-delay: 120ms; }
    .process-list-item:nth-child(n+6) { animation-delay: 150ms; }
}
@keyframes pf-rise {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}
.process-list-item-settled {
    animation: none;
}
.publish-card-error {
    margin: 0;
    max-width: 18rem;
    font-size: var(--text-xs);
    line-height: 1.35;
    color: var(--color-danger);
}

/* ----- SPINNER ------------------------------------------------------ */
.spinner {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }


/* ====================================================================
 * Process detail page (medewerker-view) — work-instruction layout
 * ==================================================================== */

/* Step cards stay readable; the diagram tab uses the full window width. */
.view-panel[data-panel="instruction"],
.view-panel[data-panel="meta"] {
    max-width: 1100px; width: 100%; margin-left: auto; margin-right: auto;
    padding-top: var(--space-6);
}
.view-panel[data-panel="diagram"] {
    max-width: none;
    margin-top: var(--space-5);
    padding-top: var(--space-5);
}
.view-panel[data-panel="diagram"] .toolbar,
.view-panel[data-panel="upn"] .toolbar {
    margin-bottom: var(--space-5);
}
.view-panel[data-panel="upn"] {
    max-width: none;
    margin-top: var(--space-5);
    padding-top: var(--space-5);
}

/* Sticky header — process title, view-switcher, progress-track. Stays
   under the topbar so the user always sees where they are in the flow.
   Fully opaque background so content scrolling underneath never bleeds
   through. */
.process-detail-sticky {
    position: static;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-divider);
    padding: var(--space-5) var(--space-6) var(--space-3);
    margin: 0 calc(-1 * var(--space-6));
}
.process-detail-sticky-inner {
    max-width: 1100px; width: 100%; margin-left: auto; margin-right: auto;
    display: flex; flex-direction: column; gap: var(--space-3);
}

.process-detail-header {
    display: flex; flex-direction: column; gap: var(--space-2);
    margin-bottom: var(--space-2);
}
.process-detail-header .breadcrumb {
    font-size: var(--text-xs); color: var(--color-text-muted);
}
.process-detail-header .breadcrumb a { color: var(--color-text-muted); }
.process-detail-header .breadcrumb a:hover { color: var(--color-primary); }

.process-detail-header .process-detail-nav-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-1);
    flex-wrap: wrap;
}
.process-detail-header .process-detail-nav-row .process-breadcrumb {
    margin-bottom: 0;
}
.process-detail-header .process-detail-nav-row .back-link {
    color: var(--color-text-muted);
    font-size: 0.8rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: color 0.15s ease;
    white-space: nowrap;
}
.process-detail-header .process-detail-nav-row .back-link:hover {
    color: var(--color-primary);
}
.process-detail-header h1,
.process-title {
    font-size: var(--text-2xl);
    font-weight: 600;
    line-height: var(--leading-tight);
    letter-spacing: -0.02em;
    margin: 0;
}

/* Editable process title (HTMX inline edit) */
.process-title-display {
    display: flex; align-items: center; gap: var(--space-3);
}
.process-title-display .process-title-edit-btn {
    opacity: 0;
    width: 28px; height: 28px;
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
}
.process-title-display:hover .process-title-edit-btn,
.process-title-display .process-title-edit-btn:focus-visible {
    opacity: 1;
}
.process-title-display .process-title-edit-btn:hover {
    background: var(--color-surface-offset);
    color: var(--color-text);
}
.process-title-edit {
    display: flex; align-items: center; gap: var(--space-2);
    flex-wrap: wrap;
}
.process-title-edit input[type=text] {
    margin-top: 0;
    font-size: var(--text-2xl);
    font-weight: 600;
    letter-spacing: -0.02em;
    padding: var(--space-2) var(--space-3);
    min-width: 320px;
}
.process-detail-meta {
    display: flex; gap: var(--space-2); flex-wrap: wrap;
    margin-top: var(--space-1);
    font-size: var(--text-xs); color: var(--color-text-muted);
    align-items: center;
}

/* Two-Level Process Header Layout */
.process-header-main-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
    margin-bottom: var(--space-2);
}
.process-header-title-col {
    flex: 1;
    min-width: 280px;
}
.process-header-actions-col {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}
.header-action-btn {
    height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 500;
    font-size: 0.85rem;
    border-radius: var(--radius-md, 6px);
    padding: 0 var(--space-3);
    white-space: nowrap;
}
.btn-icon-action {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    border-radius: var(--radius-md, 6px);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all var(--transition-fast, 0.15s ease);
}
.btn-icon-action:hover {
    background: var(--color-surface-offset);
    color: var(--color-text);
    border-color: var(--color-text-muted);
}
.btn-icon-action.btn-danger-action:hover {
    background: color-mix(in srgb, var(--color-danger, #ef4444) 10%, transparent);
    border-color: color-mix(in srgb, var(--color-danger, #ef4444) 40%, transparent);
    color: var(--color-danger, #ef4444);
}

/* Rectangular Tab Bar */
.process-header-tabs-row {
    width: 100%;
    margin-top: var(--space-1);
}
.process-view-bar {
    display: flex;
    align-items: stretch;
    background: var(--color-surface-offset, #f8fafc);
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: var(--radius-md, 8px);
    padding: 3px;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
}
.process-view-bar::-webkit-scrollbar {
    display: none;
}
.process-view-tab {
    flex: 1;
    min-width: 110px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0 var(--space-4);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-muted, #64748b);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm, 6px);
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    white-space: nowrap;
    position: relative;
}
.process-view-tab:hover:not(.active) {
    color: var(--color-text, #0f172a);
    background: color-mix(in srgb, var(--color-surface) 70%, transparent);
}
.process-view-tab.active {
    background: var(--color-surface, #ffffff);
    color: var(--color-text, #0f172a);
    font-weight: 600;
    border-color: color-mix(in srgb, var(--color-border) 70%, transparent);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.04);
}
[data-theme="dark"] .process-view-bar {
    background: #0f172a;
    border-color: #1e293b;
}
[data-theme="dark"] .process-view-tab.active {
    background: #1e293b;
    color: #f8fafc;
    border-color: #334155;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.tab-icon {
    font-size: 0.95rem;
    line-height: 1;
}
.tab-label {
    letter-spacing: -0.01em;
}
.tab-warning-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #f59e0b;
    box-shadow: 0 0 0 2px var(--color-surface, #fff);
    display: inline-block;
    margin-left: 0.2rem;
}

.process-detail-actions {
    display: flex; gap: var(--space-2); flex-wrap: wrap;
    align-items: center;
}

/* ----- Legacy / Specialist view switcher fallback ----------------- */
.view-switcher {
    display: inline-flex;
    background: var(--color-surface-offset);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 4px;
    gap: 2px;
}
.view-switcher .view-btn {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs); font-weight: 500;
    color: var(--color-text-muted);
    border-radius: var(--radius-md);
}
.view-switcher .view-btn.active {
    background: var(--color-surface);
    color: var(--color-primary-text);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}
.view-switcher .view-btn:hover:not(.active) {
    color: var(--color-text);
    background: color-mix(in srgb, var(--color-surface) 60%, transparent);
}

/* ----- Progress track (horizontal step timeline) ------------------- */
.progress-track {
    display: flex;
    overflow-x: auto;
    padding: var(--space-4) 0;
    scrollbar-width: thin;
}
.progress-step {
    flex: 0 0 auto;
    min-width: 88px; max-width: 130px;
    display: flex; flex-direction: column; align-items: center;
    gap: var(--space-2);
    text-decoration: none;
    color: var(--color-text-muted);
    position: relative;
}
.progress-step:hover { color: var(--color-text); text-decoration: none; }
.progress-step::after {
    content: '';
    position: absolute;
    top: 17px;
    left: 50%; right: -50%;
    height: 2px;
    background: var(--color-divider);
    z-index: 0;
}
.progress-step:last-child::after { display: none; }
.progress-step .dot {
    width: 36px; height: 36px;
    border-radius: var(--radius-full);
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    display: flex; align-items: center; justify-content: center;
    font-size: var(--text-xs); font-weight: 600;
    color: var(--color-text-muted);
    position: relative; z-index: 1;
    font-variant-numeric: tabular-nums;
}
.progress-step .dot-label {
    font-size: var(--text-xs);
    text-align: center;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.progress-step.done::after { background: var(--color-success); }
.progress-step.done .dot {
    background: var(--color-success);
    border-color: var(--color-success);
    color: #fff;
}
.progress-step.done .dot-label { color: var(--color-text); }

.progress-step.active .dot {
    background: var(--color-surface);
    border-color: var(--color-primary);
    color: var(--color-primary-text);
    box-shadow: 0 0 0 4px var(--color-primary-soft);
}
.progress-step.active .dot-label {
    color: var(--color-primary-text);
    font-weight: 600;
}

/* ----- Stap-card --------------------------------------------------- */
.step-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    scroll-margin-top: 80px;
}
.step-card + .step-card { margin-top: var(--space-4); }

/* In single-step mode (data-mode="single") only the active card is
   visible. Used on the medewerker work-instruction view. */
.view-panel[data-mode="single"] .step-card { display: none; }
.view-panel[data-mode="single"] .step-card.active { display: block; }

/* Footer with Vorige / Volgende buttons. */
.step-card-footer {
    display: flex; justify-content: space-between; align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    background: var(--color-surface-2);
    border-top: 1px solid var(--color-divider);
}
.step-card-footer .step-progress-text {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
}
.step-card-footer .btn svg { flex-shrink: 0; }
.step-card-head {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: var(--space-4);
    align-items: center;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--color-divider);
}
.step-card-num {
    width: 36px; height: 36px;
    border-radius: var(--radius-md);
    background: var(--color-primary-soft);
    color: var(--color-primary-text);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: var(--text-sm);
    font-variant-numeric: tabular-nums;
}
.step-card-title {
    display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.step-card-title h3 { margin: 0; font-size: var(--text-lg); font-weight: 600; }
.step-card-title .step-meta {
    display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap;
    font-size: var(--text-xs); color: var(--color-text-muted);
}
.step-card-actions {
    display: flex; gap: var(--space-2); align-items: center;
}

.step-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
    padding: var(--space-5) var(--space-6);
}
@media (max-width: 768px) {
    .step-card-body { grid-template-columns: 1fr; }
}
.step-section { display: flex; flex-direction: column; gap: var(--space-2); }
.step-section-label {
    font-size: 0.6875rem; font-weight: 600;
    color: var(--color-text-faint);
    text-transform: uppercase; letter-spacing: 0.06em;
}
.step-section p { font-size: var(--text-sm); line-height: var(--leading-base); margin: 0; }
.step-section .system-pill {
    display: inline-flex; align-items: center; gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--color-surface-offset);
    border-radius: var(--radius-md);
    font-size: var(--text-sm); font-weight: 500;
    align-self: start;
}
.step-section .system-pill svg {
    width: 14px; height: 14px; color: var(--color-text-muted);
}
.step-section.tips {
    background: color-mix(in srgb, var(--color-primary-soft) 60%, transparent);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    border-left: 3px solid var(--color-primary);
    grid-column: 1 / -1;
}
.step-section.tips .step-section-label { color: var(--color-primary-text); }
.step-section.tips p { color: var(--color-text); }

.step-card-instruction {
    padding: var(--space-5) var(--space-6);
    background: var(--color-surface-2);
    border-top: 1px solid var(--color-divider);
}
.step-card-instruction details > summary {
    display: flex; align-items: center; gap: var(--space-2);
    font-size: var(--text-sm); font-weight: 500;
    color: var(--color-text);
}
.step-card-instruction details > summary::after {
    content: '';
    width: 8px; height: 8px;
    border-right: 1.5px solid var(--color-text-muted);
    border-bottom: 1.5px solid var(--color-text-muted);
    transform: rotate(45deg);
    margin-left: auto;
    transition: transform var(--transition);
}
.step-card-instruction details[open] > summary::after { transform: rotate(-135deg); }
.step-card-instruction .markdown-body {
    margin-top: var(--space-4);
    font-size: var(--text-sm);
    line-height: var(--leading-base);
    color: var(--color-text);
}
.step-card-empty {
    padding: var(--space-4) var(--space-6);
    color: var(--color-text-faint);
    font-size: var(--text-xs);
    background: var(--color-surface-2);
    border-top: 1px solid var(--color-divider);
}

/* Per-step "Wat doe ik als…" — lives on the step-card so each step
   shows only its own exceptions in single-step navigation. */
.step-card-exceptions {
    padding: var(--space-4) var(--space-6);
    background: var(--color-warning-soft);
    border-top: 1px solid var(--color-divider);
}
.step-card-exceptions h4 {
    font-size: var(--text-sm);
    font-weight: 600;
    margin: 0 0 var(--space-3);
    color: var(--color-warning);
    display: flex; align-items: center; gap: var(--space-2);
}
.step-card-exceptions h4::before {
    content: '?';
    width: 18px; height: 18px;
    border-radius: var(--radius-full);
    background: var(--color-warning); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
}
.step-card-exceptions ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.step-exception {
    background: var(--color-surface);
    border: 1px solid color-mix(in srgb, var(--color-warning) 25%, var(--color-border));
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
}
.step-exception summary {
    font-size: var(--text-sm); font-weight: 500;
    display: flex; align-items: center; gap: var(--space-2);
}
.step-exception summary::after {
    content: '';
    width: 7px; height: 7px;
    border-right: 1.5px solid var(--color-text-muted);
    border-bottom: 1.5px solid var(--color-text-muted);
    transform: rotate(45deg);
    margin-left: auto;
    transition: transform var(--transition);
}
.step-exception[open] summary::after { transform: rotate(-135deg); }
.step-exception p { margin: var(--space-2) 0 0; font-size: var(--text-sm); color: var(--color-text-muted); }

/* ----- Markdown body ----------------------------------------------- */
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 {
    margin-top: var(--space-4); margin-bottom: var(--space-2);
}
.markdown-body h3 { font-size: var(--text-base); font-weight: 600; }
.markdown-body h4 { font-size: var(--text-sm); font-weight: 600; }
.markdown-body p { margin: var(--space-3) 0; }
.markdown-body ul, .markdown-body ol { padding-left: var(--space-5); margin: var(--space-3) 0; }
.markdown-body li { margin: var(--space-1) 0; }
.markdown-body code { background: var(--color-surface-offset); padding: 1px 5px; border-radius: 4px; }
.markdown-body strong { color: var(--color-text); font-weight: 600; }
.markdown-body a { color: var(--color-primary); }

/* ----- Exceptions ("wat als…") ------------------------------------ */
.exceptions-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xs);
    padding: var(--space-6);
}
.exceptions-card h2 {
    font-size: var(--text-lg);
    margin: 0 0 var(--space-1);
}
.exceptions-card .lead {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
}
.exception-item {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface-2);
}
.exception-item + .exception-item { margin-top: var(--space-2); }
.exception-item summary {
    display: flex; align-items: center; gap: var(--space-3);
    font-size: var(--text-sm); font-weight: 500;
}
.exception-item summary::after {
    content: '';
    width: 7px; height: 7px;
    border-right: 1.5px solid var(--color-text-muted);
    border-bottom: 1.5px solid var(--color-text-muted);
    transform: rotate(45deg);
    margin-left: auto;
    transition: transform var(--transition);
}
.exception-item[open] summary::after { transform: rotate(-135deg); }
.exception-item .answer {
    margin-top: var(--space-3);
    color: var(--color-text);
    font-size: var(--text-sm);
    line-height: var(--leading-base);
}
.exception-source-row {
    display: flex; justify-content: space-between; align-items: center;
    gap: var(--space-3); flex-wrap: wrap;
    margin-top: var(--space-3);
}
.exception-source {
    display: inline-flex; align-items: center;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}
.exception-source a { color: var(--color-text-muted); }
.exception-source a:hover { color: var(--color-primary); }

/* ----- Tag chips --------------------------------------------------- */
.tag-chip {
    display: inline-block;
    padding: 1px var(--space-2);
    background: var(--color-surface-offset);
    color: var(--color-text-muted);
    border-radius: var(--radius-full);
    font-size: 0.6875rem;
    line-height: 1.4;
    margin-right: var(--space-1);
}

/* ----- Radio-group (generator mode keuze) -------------------------- */
.radio-group {
    border: none;
    padding: 0;
    margin: var(--space-4) 0 var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.radio-group legend {
    font-weight: 600;
    margin-bottom: var(--space-2);
}
.radio-option {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    background: var(--color-surface);
    transition: background 0.15s, border-color 0.15s;
}
.radio-option:hover {
    background: var(--color-surface-offset);
}
.radio-option input[type="radio"] {
    margin-top: 0.15rem;
    flex-shrink: 0;
}
.radio-option:has(input:checked) {
    border-color: var(--color-primary);
    background: var(--color-surface-offset);
}

/* ----- Usage table (LLM-pipeline doorlooptijd) --------------------- */
.usage-table {
    width: 100%;
    max-width: 640px;
    border-collapse: collapse;
    margin-top: var(--space-3);
    font-size: var(--text-sm);
}
.usage-table th,
.usage-table td {
    padding: var(--space-2) var(--space-3);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}
.usage-table th {
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.usage-table td:nth-child(3),
.usage-table td:nth-child(4),
.usage-table th:nth-child(3),
.usage-table th:nth-child(4) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ====================================================================
 * HERO / LANDING (new.html)
 * ==================================================================== */
.hero-section {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    padding: 0 0 var(--space-6);
    position: relative;
    width: 100%;
    max-width: 1360px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-4);
    border-radius: var(--radius-full);
    background: var(--color-primary-soft);
    color: var(--color-primary-text);
    font-size: var(--text-xs);
    font-weight: 600;
    margin-bottom: var(--space-5);
    letter-spacing: 0.02em;
    border: 1px solid color-mix(in srgb, var(--color-primary) 20%, transparent);
}
.hero-badge .dot {
    width: 6px; height: 6px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    animation: hero-pulse 2s ease-in-out infinite;
}
@keyframes hero-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

.hero-title {
    font-size: var(--text-3xl);
    font-weight: 650;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: var(--space-2);
    max-width: 40rem;
}
.hero-title .accent {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    max-width: 40rem;
    line-height: var(--leading-base);
    margin: var(--space-1) 0 0;
}
.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-6);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
    position: sticky;
    top: 0;
    z-index: 50;
}

.hero-form-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6) var(--space-6) var(--space-5);
    box-shadow: var(--shadow-sm);
    width: 100%;
    max-width: 1360px;
    text-align: left;
    position: relative;
}

.btn-hero {
    width: 100%;
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-base);
    font-weight: 600;
    border-radius: var(--radius-lg);
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
    box-shadow:
        0 1px 0 rgba(255,255,255,0.10) inset,
        0 2px 8px rgba(13, 115, 119, 0.30),
        0 8px 24px -6px rgba(13, 115, 119, 0.35);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
}
.btn-hero:hover {
    transform: translateY(-2px);
    box-shadow:
        0 1px 0 rgba(255,255,255,0.10) inset,
        0 4px 12px rgba(13, 115, 119, 0.35),
        0 12px 32px -8px rgba(13, 115, 119, 0.40);
}
.btn-hero:active { transform: translateY(0); }
.btn-hero:disabled { opacity: 0.7; transform: none; cursor: not-allowed; }

.hero-features {
    display: flex;
    justify-content: center;
    gap: var(--space-6);
    margin-top: var(--space-8);
    flex-wrap: wrap;
}
.hero-feature {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}
.hero-feature svg { color: var(--color-primary); flex-shrink: 0; }

/* ----- Generation progress (in hero-form-card) --------------------- */
.generation-progress {
    margin-top: var(--space-4);
    width: 100%;
}

/* ── Nieuwe voortgangsbalk ─────────────────────────────────────────── */
.gen-progress-wrap {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.gen-progress-top {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text);
}

.gen-progress-label {
    flex: 1;
    min-width: 0;
}

.gen-progress-pct {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--color-primary-text);
    min-width: 2.75rem;
    text-align: right;
}

.gen-progress-time {
    font-variant-numeric: tabular-nums;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    min-width: 2.5rem;
    text-align: right;
}

/* Draaiend rondje */
.gen-spinner {
    display: inline-block;
    width: 18px; height: 18px;
    border-radius: 50%;
    border: 2.5px solid color-mix(in srgb, var(--color-primary) 25%, transparent);
    border-top-color: var(--color-primary);
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}
.gen-spinner--hidden {
    animation: none;
    border-top-color: var(--color-success);
    border-color: var(--color-success);
}
.gen-spinner--error {
    animation: none;
    border-top-color: var(--color-danger);
    border-color: var(--color-danger);
}

/* Balk: absolute fill zodat de kleur nooit tot 0 hoogte inklapt. */
.gen-progress-track {
    position: relative;
    height: 10px;
    border-radius: 99px;
    background: color-mix(in srgb, var(--color-primary) 18%, var(--color-surface-offset));
    overflow: hidden;
}

.gen-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 0%;
    border-radius: 99px;
    background: var(--gradient-primary);
    overflow: hidden;
    transition: width 0.45s cubic-bezier(.4, 0, .2, 1);
}
.gen-progress-fill.is-running::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.45) 50%,
        transparent 100%
    );
    animation: gen-progress-sheen 1.4s linear infinite;
}
.gen-progress-fill--error {
    background: var(--color-danger);
    transition: background 0.3s;
}
.gen-progress-fill--error::after {
    display: none;
}

@keyframes gen-progress-sheen {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}

.intake-preview-footer .generation-progress {
    margin-top: var(--space-3);
}

/* Verborgen fase-items die de JS gebruikt om data-phase te vinden */
.progress-phases-hidden {
    display: none;
    list-style: none; margin: 0; padding: 0;
}


@media (max-width: 768px) {
    .hero-section { padding: var(--space-6) 0 var(--space-4); }
    .hero-title { font-size: var(--text-3xl); }
    .hero-form-card { padding: var(--space-5); }
    .hero-features { flex-direction: column; align-items: center; gap: var(--space-3); }
}

/* ====================================================================
 * AUTH PAGES
 * ==================================================================== */
.auth-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100dvh - var(--topbar-height) - var(--space-8));
    padding: var(--space-8) var(--space-4);
}
.auth-logo {
    margin-bottom: var(--space-6);
}
.auth-logo img {
    height: 56px; width: auto;
}
[data-theme="dark"] .auth-logo img {
    filter: brightness(4) contrast(0.9);
}
.card.narrow {
    max-width: 420px; margin: 0 auto;
    padding: var(--space-8);
    box-shadow: var(--shadow-elevated);
    border-radius: var(--radius-2xl);
    position: relative;
    overflow: hidden;
}
.card.narrow::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--gradient-primary);
}
.card.narrow h1 { text-align: center; font-size: var(--text-2xl); }
.card.narrow > p.muted { text-align: center; margin-top: var(--space-4); }
.card.narrow .btn-primary {
    width: 100%;
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-base);
    border-radius: var(--radius-lg);
    margin-top: var(--space-2);
}

/* ====================================================================
 * ENHANCED PROCESS LIST
 * ==================================================================== */
.process-list-item {
    position: relative;
    overflow: hidden;
}
.process-list-item::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition);
}
.process-list-item:hover::before { opacity: 1; }

.empty {
    background: color-mix(in srgb, var(--color-primary) 4%, var(--color-surface-2));
    border: 1px dashed color-mix(in srgb, var(--color-primary) 25%, var(--color-border));
}
.empty svg { margin: 0 auto var(--space-4); color: var(--color-primary); }

/* ====================================================================
 * ENHANCED DETAIL PAGE (CSS-only)
 * ==================================================================== */
.process-detail-sticky::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, var(--color-divider), color-mix(in srgb, var(--color-primary) 20%, var(--color-divider)), var(--color-divider));
}

.view-switcher {
    border-radius: var(--radius-full);
    padding: 3px;
}
.view-switcher .view-btn {
    border-radius: var(--radius-full);
}
.view-switcher .view-btn.active {
    box-shadow: var(--shadow-sm), 0 0 0 1px var(--color-border);
}

.step-card-num {
    background: var(--gradient-primary);
    color: #fff;
    border-radius: var(--radius-lg);
}

.progress-step.active .dot {
    box-shadow: 0 0 0 4px var(--color-primary-soft),
                0 0 16px -4px rgba(13, 115, 119, 0.3);
}

/* ====================================================================
 * MICRO-INTERACTIONS + FORM POLISH
 * ==================================================================== */
.btn:active:not(:disabled) {
    transform: translateY(1px) scale(0.99);
    transition-duration: 60ms;
}
.card:hover {
    border-color: color-mix(in srgb, var(--color-primary) 15%, var(--color-border));
}

form input[type=text],
form input[type=email],
form input[type=password],
form input[type=search],
form textarea {
    border-radius: var(--radius-lg);
    transition: border-color var(--transition-fast),
                box-shadow var(--transition-fast);
}
form input:focus, form textarea:focus {
    box-shadow: 0 0 0 4px var(--color-primary-soft),
                0 0 16px -8px rgba(13, 115, 119, 0.2),
                inset 0 1px 2px rgba(15, 23, 42, 0.03);
}

#charcount { font-variant-numeric: tabular-nums; }

/* Gradient text utility */
.gradient-text {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes shimmer {
    from { background-position: -200% 0; }
    to { background-position: 200% 0; }
}
.skeleton {
    background: linear-gradient(90deg, var(--color-surface-offset) 25%, var(--color-surface) 37%, var(--color-surface-offset) 63%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

/* ====================================================================
 * PRODUCT UI UPGRADE
 * ==================================================================== */
.topbar-nav {
    display: flex;
    align-items: stretch;
    align-self: stretch;
    gap: 4px;
    margin-left: 0;
}
.topbar-link {
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    position: relative;
    color: var(--topbar-text-muted);
    font-size: 13.5px;
    font-weight: 500;
}
.topbar-link:hover {
    color: var(--topbar-text);
    text-decoration: none;
}
.topbar-link.active {
    color: var(--topbar-text);
    font-weight: 600;
}
.topbar-link.active::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: -1px;
    height: 2px;
    background: var(--topbar-accent);
    border-radius: 2px 2px 0 0;
}

/* ----- ADMIN SECTION SUBNAV TABS ---------------------------------- */
.admin-nav-tabs {
    display: inline-flex;
    align-items: center;
    background: var(--color-surface-offset, #f1f5f9);
    border: 1px solid var(--color-border, #cbd5e1);
    border-radius: var(--radius-md, 8px);
    padding: 3px;
    gap: 3px;
    max-width: 100%;
    margin-bottom: var(--space-5);
}
.admin-nav-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 1.05rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-muted, #64748b);
    text-decoration: none;
    border-radius: var(--radius-sm, 6px);
    border: 1px solid transparent;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.admin-nav-tab:hover:not(.active) {
    color: var(--color-text, #0f172a);
    background: color-mix(in srgb, var(--color-surface, #ffffff) 80%, transparent);
    text-decoration: none;
}
.admin-nav-tab.active {
    background: var(--color-surface, #ffffff);
    color: var(--color-primary, #008744);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border-color: var(--color-border, #cbd5e1);
}
.admin-nav-tab-icon {
    font-size: 1rem;
    line-height: 1;
}

[data-theme="dark"] .admin-nav-tabs {
    background: #0f172a;
    border-color: #334155;
}
[data-theme="dark"] .admin-nav-tab {
    color: #94a3b8;
}
[data-theme="dark"] .admin-nav-tab:hover:not(.active) {
    color: #f1f5f9;
    background: #1e293b;
}
[data-theme="dark"] .admin-nav-tab.active {
    background: #1e293b;
    color: #34d399;
    border-color: #475569;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.topbar-balance {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--topbar-text);
    text-decoration: none;
}
.topbar-balance:hover {
    background: var(--topbar-bg-hover);
    text-decoration: none;
}
.topbar-balance-label {
    color: var(--topbar-text-faint);
    font-size: 12px;
    font-weight: 500;
}
.topbar-balance strong {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}
.topbar-balance.is-negative,
.topbar-balance.is-negative .topbar-balance-label {
    color: #fecaca;
}
.topbar-balance.balance-updated-flash {
    animation: topbarBalancePulse 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes topbarBalancePulse {
    0% {
        transform: scale(1);
    }
    30% {
        transform: scale(1.12);
        background: var(--topbar-bg-hover);
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary, #2563eb) 35%, transparent);
    }
    100% {
        transform: scale(1);
    }
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.hero-section-upgraded {
    gap: var(--space-5);
}
.hero-section-upgraded .page-header {
    margin-bottom: 0;
}
.hero-dashboard {
    width: 100%;
    max-width: 1360px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
}
.hero-stat-card {
    background: color-mix(in srgb, var(--color-surface) 86%, transparent);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    text-align: left;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: inherit;
}
.hero-stat-card:hover {
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.hero-stat-card-muted {
    background: color-mix(in srgb, var(--color-surface-offset) 88%, transparent);
}
.hero-stat-label {
    display: block;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: var(--space-2);
}
.hero-stat-value {
    display: block;
    font-size: var(--text-2xl);
    line-height: 1;
    margin-bottom: var(--space-2);
}
.hero-stat-meta {
    display: block;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}
.hero-form-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}
.hero-form-header h2 {
    margin: 0 0 var(--space-2);
}
.hero-form-header p {
    margin: 0;
}
.progress-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
    padding: var(--space-4);
    background: color-mix(in srgb, var(--color-primary) 5%, var(--color-surface));
    border: 1px solid color-mix(in srgb, var(--color-primary) 14%, var(--color-border));
    border-radius: var(--radius-xl);
}
.progress-summary-label {
    display: block;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.progress-summary-value {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-top: 2px;
}
.progress-summary-metrics {
    display: flex;
    gap: var(--space-6);
    align-items: center;
}
.progress-state-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 74px;
    padding: 6px 10px;
    border-radius: var(--radius-full);
    background: var(--color-primary-soft);
    color: var(--color-primary-text);
}
.progress-phase-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.progress-phase-label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text);
}
.progress-phase-subtitle {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.recent-processes {
    margin-top: var(--space-2);
    width: 100%;
    max-width: 1360px;
    margin-left: auto;
    margin-right: auto;
}
.recent-process-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
    margin-top: var(--space-5);
}
.recent-process-card {
    background: color-mix(in srgb, var(--color-surface-2) 88%, transparent);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    box-shadow: var(--shadow-xs);
}
.recent-process-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}
.recent-process-card-head h3 {
    margin: 0 0 var(--space-1);
}
.recent-process-description {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
}
.recent-process-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* ----- PROCESS SEARCH BAR ------------------------------------------- */
.process-search-wrapper {
    margin: var(--space-2) 0 var(--space-3);
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: var(--space-3);
}

.process-search-wrapper ~ .process-list {
    margin-top: 0;
}

.process-search-box {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 20rem;
    max-width: 640px;
    min-width: min(100%, 16rem);
    width: auto;
}

.process-filter-mine-container {
    flex: 0 0 auto;
}

.filter-mine-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    height: 42px;
    box-sizing: border-box;
    cursor: pointer;
    user-select: none;
    font-size: 0.9rem;
    font-weight: 500;
    background: var(--color-surface);
    padding: 0 0.85rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.filter-mine-label input {
    cursor: pointer;
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--color-primary);
}

.process-search-icon {
    position: absolute;
    left: var(--space-3);
    color: var(--color-text-muted);
    pointer-events: none;
}

.process-search-input {
    width: 100%;
    padding-left: 2.5rem !important;
    padding-right: 2.5rem !important;
    height: 42px;
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    font-size: var(--text-sm);
    color: var(--color-text);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.process-search-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 18%, transparent);
    outline: none;
}

.process-search-clear-btn {
    position: absolute;
    right: var(--space-3);
    background: none;
    border: none;
    padding: 4px 8px;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: var(--text-sm);
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast), background var(--transition-fast);
}

.process-search-clear-btn:hover {
    color: var(--color-text);
    background: var(--color-surface-offset);
}

.process-search-status {
    padding-left: var(--space-1);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

/* ====================================================================
 * PROCESKAARTEN (OPTIE 1: KRUIMELPAD + EIGENAARBADGE + ACTIEKOLOM)
 * ==================================================================== */
.process-list-item {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: var(--space-6);
    padding: var(--space-5) var(--space-6);
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    transition: border-color var(--transition-fast),
                transform var(--transition-fast),
                box-shadow var(--transition-fast),
                background-color var(--transition-fast);
}
.process-list-item:hover {
    background: var(--color-surface);
    border-color: color-mix(in srgb, var(--color-primary) 35%, var(--color-border));
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.process-item-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.process-breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--color-text-muted);
    letter-spacing: 0.02em;
    margin-bottom: var(--space-1);
    text-transform: uppercase;
}
.process-breadcrumb .sep {
    color: var(--color-text-faint);
    font-weight: normal;
}

.process-item-title {
    margin: 0 0 var(--space-2);
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.015em;
}
.process-item-title a {
    color: var(--color-text);
    text-decoration: none;
}
.process-item-title a:hover {
    color: var(--color-primary);
    text-decoration: none;
}

.process-upl-tag {
    display: inline;
    font-size: 0.88em;
    font-weight: 500;
    color: var(--color-text-muted);
    margin-left: 0.4rem;
    letter-spacing: normal;
}

.process-item-desc {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    line-height: 1.5;
    margin: 0 0 var(--space-3);
    flex: 1;
}

.process-owner-badge {
    margin-top: auto;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    background: color-mix(in srgb, var(--color-surface-offset) 85%, transparent);
    padding: 0.25rem 0.65rem;
    height: 31px;
    box-sizing: border-box;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    width: fit-content;
}
.process-owner-badge .owner-name {
    color: var(--color-text);
    font-weight: 600;
}
.process-owner-badge .owner-missing {
    color: var(--color-warning);
    font-style: italic;
}

.process-item-aside {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    flex-shrink: 0;
    min-width: 210px;
}

.process-btn-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.process-bottom-actions {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    height: 31px;
}

.btn-published {
    background: color-mix(in srgb, var(--color-primary-soft) 80%, transparent) !important;
    color: var(--color-primary-text) !important;
    border-color: color-mix(in srgb, var(--color-primary) 35%, var(--color-border)) !important;
    font-weight: 600;
}

.btn-delete-action {
    color: var(--color-danger) !important;
}
.btn-delete-action:hover {
    background: color-mix(in srgb, var(--color-danger) 12%, transparent) !important;
    color: var(--color-danger) !important;
}

.card-dates-column {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    line-height: 1.35;
}
.card-dates-column .date-row {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.card-dates-column .date-label {
    color: var(--color-text-faint);
    min-width: 74px;
}

.btn-success-temporary {
    background: var(--color-primary) !important;
    color: #ffffff !important;
    border-color: var(--color-primary) !important;
}

@media (max-width: 768px) {
    .process-list-item {
        flex-direction: column;
        gap: var(--space-4);
    }
    .process-item-aside {
        width: 100%;
        min-width: 0;
        align-items: flex-start;
        gap: var(--space-3);
    }
    .process-actions-group {
        justify-content: flex-start;
        width: 100%;
    }
    .card-dates-column {
        align-items: flex-start;
    }
}


.catalog-summary-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.catalog-summary-bar .catalog-divider {
    display: inline-block;
    height: 1.25rem;
    width: 1px;
    background: var(--color-divider);
}
.catalog-summary-bar .catalog-add-btn {
    border: 1px dashed var(--color-border);
    font-size: var(--text-xs);
}
.catalog-summary-bar .catalog-add-btn:hover {
    border-style: solid;
    border-color: var(--color-primary);
}
.kenmerken-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}

@media (max-width: 820px) {
    .kenmerken-cards-grid {
        grid-template-columns: 1fr;
    }
}

.passport-block {
    margin-top: var(--space-5);
}
.passport-block-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-3);
}
.passport-block-head h3 {
    margin: 0;
    font-size: 1.15rem;
}
.passport-block-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
}
.passport-advice-btn {
    border-color: var(--color-primary);
    color: var(--color-primary-text);
    font-weight: 600;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
#governance-ai-advice-box.passport-advice {
    margin-top: var(--space-5);
    margin-bottom: var(--space-5);
}
.passport-advice {
    margin: 0 0 var(--space-3);
    padding: var(--space-4);
    background: var(--color-surface-offset);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--radius-md, 8px);
}
.passport-advice[hidden] {
    display: none;
}
.passport-advice-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.75rem;
    margin: 0;
    cursor: pointer;
    list-style: none;
}
.passport-advice-head::-webkit-details-marker {
    display: none;
}
.passport-advice-head::marker {
    content: "";
}
.passport-advice-title {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}
.passport-advice-hint {
    flex: 1 1 auto;
}
.passport-advice-chevron {
    width: 0.5rem;
    height: 0.5rem;
    margin-left: auto;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    translate: 0 -0.1rem;
}
.passport-advice[open] .passport-advice-chevron {
    transform: rotate(45deg);
    translate: 0 0.1rem;
}
.passport-advice[open] .passport-advice-head {
    margin-bottom: var(--space-3);
}
.passport-advice-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: var(--space-3);
    margin-bottom: var(--space-3);
}
.passport-advice-item-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 0.75rem;
}
.passport-advice-item:last-child {
    margin-bottom: 0;
}
.passport-advice-note {
    margin-top: var(--space-3);
    padding-top: 0.35rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.75rem;
    color: var(--color-text-muted);
}
.passport-item {
    padding: 0.85rem 0;
    border-top: 1px solid var(--color-border, #e5e7eb);
}
.passport-item.is-muted {
    opacity: 0.62;
}
.passport-item-main {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(5.5rem, 0.7fr)) auto;
    gap: 0.5rem 0.85rem;
    align-items: center;
}
.passport-item-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    justify-content: flex-end;
}
.passport-item details {
    margin-top: 0.45rem;
}
.passport-item summary {
    cursor: pointer;
    color: var(--color-text-muted);
    font-size: 0.82rem;
}
.passport-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem 1rem;
    margin-top: 0.65rem;
    font-size: 0.88rem;
}
.passport-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1rem;
}
.passport-form-grid label {
    display: block;
    font-weight: 500;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}
.passport-form-grid .form-input,
.passport-form-grid textarea,
.passport-form-grid select {
    width: 100%;
}
.passport-span-2 {
    grid-column: 1 / -1;
}
.passport-form-quad {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem 1rem;
}
dialog.passport-dialog {
    max-width: min(1040px, calc(100vw - 2rem));
}
dialog.passport-dialog .app-dialog-body {
    max-height: min(92vh, 1200px);
    overflow: auto;
}
dialog.passport-dialog textarea.form-input {
    min-height: 8.75rem;
    line-height: 1.45;
    resize: vertical;
}
@media (max-width: 900px) {
    .passport-form-quad {
        grid-template-columns: 1fr 1fr;
    }
}
@media (max-width: 720px) {
    .passport-item-main,
    .passport-form-grid,
    .passport-form-quad {
        grid-template-columns: 1fr;
    }
    .passport-span-2 {
        grid-column: auto;
    }
    .passport-item-actions {
        justify-content: flex-start;
    }
    dialog.passport-dialog .app-dialog-body {
        padding: var(--space-4);
    }
}

/* Kenmerken inline bewerkmodus */
#kenmerken-form:not(.is-editing) .kenmerken-edit-el {
    display: none !important;
}
#kenmerken-form.is-editing .kenmerken-view-el {
    display: none !important;
}
#kenmerken-form {
    scroll-margin-top: calc(var(--topbar-height, 52px) + var(--space-4));
}
.kenmerken-view-toolbar,
.kenmerken-edit-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}
.kenmerken-edit-toolbar {
    position: sticky;
    top: var(--topbar-height, 52px);
    z-index: 90;
    padding: var(--space-2) var(--space-3);
    margin-left: calc(-1 * var(--space-3));
    margin-right: calc(-1 * var(--space-3));
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-divider);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* ====================================================================
 * PROCESCATALOGUS STYLES
 * ==================================================================== */
.catalog-filter-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-5);
    box-shadow: var(--shadow-xs);
}

.catalog-filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: center;
    justify-content: space-between;
}

.catalog-search-field {
    flex: 1;
    min-width: 260px;
    position: relative;
    display: flex;
    align-items: center;
}

.catalog-dropdown-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
}

.filter-select {
    height: 40px;
    padding: 0 var(--space-3);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-surface-2);
    font-size: var(--text-xs);
    color: var(--color-text);
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.filter-select:focus {
    border-color: var(--color-primary);
    outline: none;
}

.catalog-card-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-1);
    flex-wrap: wrap;
}

.badge-published {
    background: color-mix(in srgb, var(--color-primary-soft) 85%, transparent);
    color: var(--color-primary-text);
    font-weight: 600;
    font-size: 0.72rem;
    border: 1px solid color-mix(in srgb, var(--color-primary) 30%, var(--color-border));
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.catalog-card-meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: auto;
}

.catalog-card-apps {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    flex-wrap: wrap;
}

.app-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    background: var(--color-surface-offset);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

.catalog-empty-state {
    padding: var(--space-10) var(--space-4);
    text-align: center;
}

.diagram-panel {
    padding-top: var(--space-3);
}
.diagram-panel-head {
    display: none;
}
.diagram-viewer {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}
.diagram-toolbar {
    position: sticky;
    top: calc(var(--space-4) + 1rem);
    z-index: 4;
    padding: var(--space-2) var(--space-3);
    background: color-mix(in srgb, var(--color-surface) 94%, transparent);
    border: 1px solid color-mix(in srgb, var(--color-border) 88%, transparent);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
}
.toolbar-spread {
    justify-content: space-between;
    align-items: center;
}
.toolbar-group {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}
.diagram-zoom-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3.5rem;
    padding: 0.25rem 0.6rem;
    background: color-mix(in srgb, var(--color-surface-offset) 85%, transparent);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text);
}
.diagram-toolbar-hint {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}
.diagram-status {
    display: none;
}
.diagram-canvas-shell {
    position: relative;
    padding: var(--space-3);
    background:
        linear-gradient(180deg, color-mix(in srgb, #f8fafc 92%, transparent), color-mix(in srgb, #ffffff 97%, transparent)),
        radial-gradient(circle at top left, color-mix(in srgb, var(--color-primary) 10%, transparent), transparent 32%);
    border: 1px solid color-mix(in srgb, var(--color-border) 88%, transparent);
    border-radius: var(--radius-xl);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.diagram-canvas-shell .alert {
    margin-bottom: var(--space-3);
}
.bpmn-container-upgraded {
    height: calc(100dvh - 210px);
    min-height: 750px;
    border-radius: calc(var(--radius-xl) - 4px);
    background:
        radial-gradient(circle at top, rgba(14, 116, 144, 0.06), transparent 28%),
        linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.98));
    overflow: hidden;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    border: 1.5px solid transparent;
}
@media (min-height: 900px) {
    .bpmn-container-upgraded {
        height: calc(100dvh - 190px);
        min-height: 800px;
    }
}
.bpmn-container-upgraded.is-wheel-active {
    border-color: color-mix(in srgb, var(--color-primary, #00811f) 65%, transparent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary, #00811f) 20%, transparent);
}
[data-theme="dark"] .bpmn-container-upgraded {
    background: #ffffff;
    color-scheme: light;
}
[data-theme="dark"] .diagram-canvas-shell {
    background: #ffffff;
    border-color: var(--color-border);
    box-shadow: none;
}
.diagram-viewer.is-theater-mode,
.diagram-viewer:fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: var(--color-bg);
    padding: var(--space-3) var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    box-sizing: border-box;
}
.diagram-viewer.is-theater-mode .diagram-toolbar,
.diagram-viewer:fullscreen .diagram-toolbar {
    position: static;
    margin-bottom: 0;
    top: 0;
}
.diagram-viewer.is-theater-mode .diagram-canvas-shell,
.diagram-viewer:fullscreen .diagram-canvas-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0;
}
.diagram-viewer.is-theater-mode .bpmn-container-upgraded,
.diagram-viewer:fullscreen .bpmn-container-upgraded {
    flex: 1;
    height: 100%;
    min-height: 0;
    border-radius: var(--radius-md);
}
body.theater-mode-active {
    overflow: hidden !important;
}
body.theater-mode-active .app-layout,
body.theater-mode-active .main,
body.theater-mode-active .diagram-panel,
body.theater-mode-active .card {
    transform: none !important;
    animation: none !important;
}
.upn-viewer:fullscreen {
    padding: var(--space-5);
    background: var(--color-bg);
    overflow: auto;
}
.upn-viewer:fullscreen .upn-toolbar {
    top: var(--space-4);
}
.upn-viewer:fullscreen .upn-canvas-shell {
    min-height: 0;
    height: calc(100dvh - 180px);
}
.diagram-viewer .djs-container,
.diagram-viewer .djs-container > svg,
.diagram-viewer .viewport {
    width: 100%;
    height: 100%;
}
/* Color toggle button in diagram toolbar */
.btn-color-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-color-toggle.is-active {
    background: color-mix(in srgb, var(--color-primary-soft) 85%, var(--color-surface));
    color: var(--color-primary);
    border-color: color-mix(in srgb, var(--color-primary) 35%, var(--color-border));
}
.btn-color-toggle:not(.is-active) {
    color: var(--color-text-muted);
}
.color-toggle-icon {
    font-size: 0.95em;
    line-height: 1;
}

/* =====================================================================
 * BPMN Color Mode Styling
 * Semantisch, rustig en professioneel kleurenpalet voor BPMN-diagrammen.
 * --------------------------------------------------------------------- */

/* 1. Start Events (Groen - passend bij Migoflow brand identity) */
.diagram-viewer.color-mode-enabled .pf-start-event .djs-visual > circle {
    stroke: #047857 !important;
    stroke-width: 2.2px !important;
    fill: #ecfdf5 !important;
    transition: stroke 0.15s ease, fill 0.15s ease, filter 0.15s ease;
}
.diagram-viewer.color-mode-enabled .pf-start-event.djs-hover .djs-visual > circle {
    stroke: #065f46 !important;
    fill: #d1fae5 !important;
    filter: drop-shadow(0 2px 6px rgba(4, 120, 87, 0.25));
}

/* 2. End Events (Rood / Koraal) */
.diagram-viewer.color-mode-enabled .pf-end-event .djs-visual > circle {
    stroke: #b91c1c !important;
    stroke-width: 3.2px !important;
    fill: #fef2f2 !important;
    transition: stroke 0.15s ease, fill 0.15s ease, filter 0.15s ease;
}
.diagram-viewer.color-mode-enabled .pf-end-event.djs-hover .djs-visual > circle {
    stroke: #991b1b !important;
    fill: #fee2e2 !important;
    filter: drop-shadow(0 2px 6px rgba(185, 28, 28, 0.25));
}

/* 3. Intermediate & Boundary Events (Amber) */
.diagram-viewer.color-mode-enabled .pf-intermediate-event .djs-visual > circle {
    stroke: #d97706 !important;
    stroke-width: 2px !important;
    fill: #fffbeb !important;
}

/* 4. Gateways (Amber/Warm Oranje voor keuzes en splitsingen) */
.diagram-viewer.color-mode-enabled .pf-gateway .djs-visual > polygon {
    stroke: #d97706 !important;
    stroke-width: 2px !important;
    fill: #fffbeb !important;
    transition: stroke 0.15s ease, fill 0.15s ease, filter 0.15s ease;
}
.diagram-viewer.color-mode-enabled .pf-gateway.djs-hover .djs-visual > polygon {
    stroke: #b45309 !important;
    fill: #fef3c7 !important;
    filter: drop-shadow(0 2px 8px rgba(217, 119, 6, 0.25));
}
.diagram-viewer.color-mode-enabled .pf-gateway .djs-visual > path {
    stroke: #b45309 !important;
    fill: #b45309 !important;
}

/* 5. Activiteiten / Taken (Lichte zachtblauwe pastel passend bij de blauwe rand) */
.diagram-viewer.color-mode-enabled .pf-task .djs-visual > rect {
    stroke: #2563eb !important;
    stroke-width: 1.8px !important;
    fill: #eff6ff !important;
    rx: 8px !important;
    ry: 8px !important;
    transition: stroke 0.15s ease, fill 0.15s ease, filter 0.15s ease;
}
.diagram-viewer.color-mode-enabled .pf-task.djs-hover .djs-visual > rect {
    stroke: #1d4ed8 !important;
    fill: #dbeafe !important;
    filter: drop-shadow(0 3px 12px rgba(37, 99, 235, 0.2));
}

/* 6. Subprocessen & Call Activities (Violet / Paars) */
.diagram-viewer.color-mode-enabled .pf-subprocess .djs-visual > rect {
    stroke: #7c3aed !important;
    stroke-width: 2px !important;
    fill: #f5f3ff !important;
    rx: 8px !important;
    ry: 8px !important;
    transition: stroke 0.15s ease, fill 0.15s ease, filter 0.15s ease;
}
.diagram-viewer.color-mode-enabled .pf-subprocess.djs-hover .djs-visual > rect {
    stroke: #6d28d9 !important;
    fill: #ede9fe !important;
    filter: drop-shadow(0 3px 10px rgba(124, 58, 237, 0.2));
}

/* 7. Happy Path Sequence Flows (Fris groen accent langs de default-route) */
.diagram-viewer.color-mode-enabled .pf-happy-flow .djs-visual > :first-child {
    stroke: #00811f !important;
    stroke-width: 2.6px !important;
}

/* 8. Message Flows */
.diagram-viewer .pf-message-flow .djs-visual > :first-child {
    stroke: color-mix(in srgb, var(--color-primary) 58%, #475569);
    stroke-width: 2.6px;
    stroke-dasharray: 8 6;
    opacity: 0.92;
}
.diagram-viewer.color-mode-enabled .pf-message-flow .djs-visual > :first-child {
    stroke: color-mix(in srgb, var(--color-primary) 85%, #047857);
    stroke-width: 2.6px;
    stroke-dasharray: 8 6;
    opacity: 0.95;
}
.diagram-viewer .pf-message-flow.djs-hover .djs-visual > :first-child,
.diagram-viewer .pf-message-flow-active .djs-visual > :first-child {
    stroke: var(--color-primary);
    stroke-width: 3.2px;
    opacity: 1;
}
.diagram-viewer .pf-message-flow-active .djs-visual > :first-child {
    filter: drop-shadow(0 0 10px color-mix(in srgb, var(--color-primary) 28%, transparent));
}

/* 9. Pools & Swimlanes in Color Mode */
.diagram-viewer.color-mode-enabled .pf-participant .djs-visual > rect:first-child {
    stroke: #94a3b8 !important;
}
.diagram-viewer.color-mode-enabled .pf-lane .djs-visual > rect:first-child {
    stroke: #cbd5e1 !important;
}
.btn-danger-inline {
    color: var(--color-danger);
}
.btn-danger-inline:hover {
    background: var(--color-danger-soft);
    color: var(--color-danger);
}

.billing-page h1 { margin-bottom: 0; }
.billing-page h2 {
    margin: var(--space-8) 0 var(--space-2);
    font-size: var(--text-xl);
}
.billing-section-lede {
    margin: 0 0 var(--space-4);
    max-width: 42rem;
}
.billing-balance {
    margin: var(--space-5) 0 0;
}
.billing-card-label {
    display: block;
    color: var(--color-text-muted);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: var(--space-2);
}
.billing-balance-value {
    display: block;
    font-size: var(--text-xl);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--space-2);
}
.billing-balance-note {
    display: block;
    margin-top: var(--space-2);
    font-weight: 700;
}
.billing-package-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-4);
    margin-top: 0;
}
.billing-package-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    box-shadow: var(--shadow-sm);
}
.billing-package-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
}
.billing-package-head h3 {
    margin: 0 0 var(--space-1);
}
.billing-package-head p {
    margin: 0;
}
.billing-package-value {
    font-size: var(--text-xl);
    font-weight: 700;
}
.billing-table td:nth-child(4),
.billing-table td:nth-child(5),
.billing-table th:nth-child(4),
.billing-table th:nth-child(5) {
    text-align: right;
}
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }

@media (max-width: 980px) {
    .hero-dashboard,
    .billing-package-grid,
    .recent-process-grid,
    .billing-summary-grid {
        grid-template-columns: 1fr;
    }
    .toolbar-spread,
    .diagram-status,
    .hero-form-header,
    .progress-summary {
        flex-direction: column;
        align-items: stretch;
    }
    .progress-summary-metrics {
        justify-content: space-between;
    }
}

@media (max-width: 768px) {
    .topbar {
        height: auto;
        min-height: var(--topbar-height);
        flex-wrap: wrap;
        row-gap: 0;
        padding: 0 12px;
        gap: 8px;
    }
    .topbar-nav {
        order: 3;
        width: calc(100% + 24px);
        margin-left: -12px;
        margin-right: -12px;
        padding: 0 4px;
        height: 40px;
        border-top: 1px solid var(--topbar-rule);
    }
    .topbar-link.active::after {
        bottom: 0;
    }
    .process-detail-actions {
        width: 100%;
        justify-content: space-between;
    }
    .view-switcher {
        width: 100%;
        overflow-x: auto;
    }
    .recent-process-actions,
    .page-header-actions,
    .toolbar-group {
        width: 100%;
    }
    .recent-process-actions .btn,
    .page-header-actions .btn,
    .toolbar-group .btn {
        flex: 1;
    }
    .bpmn-container-upgraded {
        min-height: 560px;
        height: calc(100dvh - 260px);
    }
}

/* ====================================================================
 * AI PROCESS INTERVIEWER (BEGELEIDE INTAKE)
 * ==================================================================== */

.new-process-page h1 {
    margin-bottom: 0;
}
.page-lede {
    color: var(--color-text-muted);
    margin: 0.35rem 0 1.25rem;
    max-width: 42rem;
}
.intake-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.intake-topbar .intake-tabs {
    margin-bottom: 0;
}
.direct-form {
    max-width: 720px;
}

.intake-tabs {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-6);
    background: color-mix(in srgb, var(--color-surface-offset) 70%, transparent);
    padding: var(--space-1);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    width: fit-content;
}

.intake-tab-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-muted);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.intake-tab-btn:hover {
    color: var(--color-text);
}

.intake-tab-btn.active {
    background: var(--color-surface);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.intake-context-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-4) var(--space-5);
    margin-bottom: var(--space-4);
    box-shadow: var(--shadow-sm);
}

.intake-context-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--color-border);
    gap: var(--space-3);
    flex-wrap: wrap;
}

.intake-context-row-3col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
    align-items: flex-start;
}

.intake-context-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr;
    gap: var(--space-4);
    align-items: flex-start;
}

.intake-split {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: var(--space-5);
    align-items: stretch;
}

.intake-chat-pane {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    height: 600px;
    box-shadow: var(--shadow-sm);
}

.intake-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    background: color-mix(in srgb, var(--color-surface-offset) 60%, transparent);
    border-bottom: 1px solid var(--color-border);
}

.intake-consultant-badge {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text);
}

.intake-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.intake-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    scroll-behavior: smooth;
}

.chat-bubble {
    display: flex;
    gap: var(--space-3);
    max-width: 88%;
    animation: fadeIn 0.2s ease-out;
}

.chat-bubble-assistant {
    align-self: flex-start;
}

.chat-bubble-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: var(--text-sm);
}

.chat-avatar-assistant {
    background: color-mix(in srgb, var(--color-primary) 15%, transparent);
    color: var(--color-primary);
}

.chat-avatar-user {
    background: color-mix(in srgb, var(--color-text-muted) 20%, transparent);
    color: var(--color-text);
}

.chat-text {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    line-height: 1.5;
    white-space: pre-wrap;
}

.chat-bubble-assistant .chat-text {
    background: color-mix(in srgb, var(--color-surface-offset) 80%, transparent);
    color: var(--color-text);
    border-top-left-radius: var(--space-1);
    border: 1px solid var(--color-border);
}

.chat-bubble-user .chat-text {
    background: var(--color-primary);
    color: #ffffff;
    border-top-right-radius: var(--space-1);
}

.intake-chat-input-area {
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
}

.intake-input-form {
    display: flex;
    gap: var(--space-2);
    align-items: flex-end;
}

.intake-charcount {
    display: block;
    margin-top: 0.35rem;
}

.intake-charcount.is-limit {
    color: var(--color-danger, #b91c1c);
}

.intake-textarea {
    flex: 1;
    resize: none;
    min-height: 42px;
    max-height: 120px;
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    line-height: 1.4;
    background: var(--color-surface);
    color: var(--color-text);
}
.intake-textarea::placeholder {
    color: var(--color-placeholder);
    opacity: 1;
}

.model-selection-wrapper {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.model-choice {
    display: flex;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface-offset);
}
.model-choice-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--color-text-muted);
    font: inherit;
    font-size: var(--text-sm);
    font-weight: 500;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    white-space: nowrap;
}
.model-choice-btn:hover { color: var(--color-text); }
.model-choice-btn.active {
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}
[data-theme="dark"] .model-choice {
    background: #18181b;
    border-color: #52525b;
}
[data-theme="dark"] .model-choice-btn.active {
    background: #27272a;
    color: #f4f4f5;
}
.model-select {
    appearance: auto;
    padding: 4px 8px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    font: inherit;
    font-size: var(--text-sm);
    background: var(--color-surface-offset);
    color: var(--color-text);
    color-scheme: inherit;
}
.model-select option {
    background: var(--color-surface-offset);
    color: var(--color-text);
}
[data-theme="dark"] .model-select {
    background: #27272a;
    border-color: #71717a;
    color: #f4f4f5;
}
[data-theme="dark"] .model-select option {
    background: #27272a;
    color: #f4f4f5;
}

.intake-send-btn {
    height: 42px;
    padding: 0 var(--space-4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

.typing-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: var(--space-2) var(--space-3);
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-text-muted);
    animation: typingPulse 1.4s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingPulse {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* Live Draft Preview Pane */
.intake-preview-pane {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    height: 600px;
    box-shadow: var(--shadow-sm);
}

.intake-preview-header {
    padding: var(--space-3) var(--space-4);
    background: color-mix(in srgb, var(--color-surface-offset) 60%, transparent);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.intake-preview-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.draft-box {
    background: color-mix(in srgb, var(--color-surface-offset) 50%, transparent);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-4);
}

.draft-box-title {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: var(--space-2);
    font-weight: 600;
}

.draft-badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.draft-badge {
    background: color-mix(in srgb, var(--color-primary) 12%, transparent);
    color: var(--color-primary);
    font-size: var(--text-xs);
    font-weight: 500;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid color-mix(in srgb, var(--color-primary) 24%, transparent);
}

.draft-step-list {
    margin: 0;
    padding-left: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    font-size: var(--text-sm);
}

.intake-preview-footer {
    padding: var(--space-3) var(--space-4);
    background: color-mix(in srgb, var(--color-surface-offset) 40%, transparent);
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

@media (max-width: 980px) {
    .intake-context-row-3col,
    .intake-context-grid {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }
    .intake-split {
        grid-template-columns: 1fr;
    }
    .intake-chat-pane,
    .intake-preview-pane {
        height: 480px;
    }
}

/* Publication Button States */
.btn-publish-disabled,
.btn.btn-publish-disabled:disabled {
    opacity: 0.55 !important;
    cursor: not-allowed !important;
    pointer-events: auto !important;
    background: var(--color-surface-offset, #f1f5f9) !important;
    color: var(--color-text-muted, #94a3b8) !important;
    border-color: var(--color-border, #cbd5e1) !important;
    box-shadow: none !important;
    transform: none !important;
}
[data-theme="dark"] .btn-publish-disabled,
[data-theme="dark"] .btn.btn-publish-disabled:disabled {
    background: #1e293b !important;
    color: #64748b !important;
    border-color: #334155 !important;
}

/* ==========================================================================
   Two-Level Modern Process Detail Header & Classic Navigation Menu
   ========================================================================== */

.process-header-main-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
    padding-top: var(--space-1);
    padding-bottom: var(--space-2);
}

.process-header-title-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1 1 auto;
}

.process-header-actions-col {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
    margin-top: 2px;
}

.header-action-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 500;
    padding: 0.45rem 0.9rem;
    font-size: 0.875rem;
    border-radius: var(--radius-md, 6px);
}

.btn-icon-action {
    padding: 0.45rem 0.65rem !important;
    font-size: 1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md, 6px);
}

.btn-danger-action {
    color: var(--color-danger, #ef4444);
    background: var(--color-surface, #ffffff);
    border: 1px solid var(--color-border, #e2e8f0);
}

.btn-danger-action:hover {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #dc2626;
}

[data-theme="dark"] .btn-danger-action {
    background: var(--color-surface, #1e293b);
    border-color: var(--color-border, #334155);
    color: #f87171;
}

[data-theme="dark"] .btn-danger-action:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #fca5a5;
}

/* Row 2: Duidelijke Menubalk links met Actieknoppen rechts */
.process-header-tabs-row {
    width: 100%;
    margin-top: var(--space-2);
    margin-bottom: var(--space-1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.process-nav-menu,
.process-view-bar {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    background: var(--color-surface-offset, #f1f5f9);
    border: 1px solid var(--color-border, #cbd5e1);
    border-radius: var(--radius-md, 6px);
    padding: 3px;
    gap: 3px;
    max-width: 100%;
}

.process-nav-menu .view-btn,
.process-view-bar .view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.45rem 0.95rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-muted, #475569);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm, 4px);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast, 0.15s ease);
}

.process-nav-menu .view-btn:hover:not(.active),
.process-view-bar .view-btn:hover:not(.active) {
    color: var(--color-text, #0f172a);
    background: color-mix(in srgb, var(--color-surface, #ffffff) 80%, transparent);
}

/* Zeer duidelijke kleur wanneer knop is ingedrukt / actief */
.process-nav-menu .view-btn.active,
.process-view-bar .view-btn.active {
    background: var(--color-primary, #008744) !important;
    color: #ffffff !important;
    font-weight: 600;
    border-color: var(--color-primary, #008744) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16);
}

.process-nav-menu .view-btn.active .badge-warn,
.process-view-bar .view-btn.active .badge-warn {
    background: #ffffff;
    color: #92400e;
    font-weight: 600;
}

[data-theme="dark"] .process-nav-menu,
[data-theme="dark"] .process-view-bar {
    background: #0f172a;
    border-color: #334155;
}

[data-theme="dark"] .process-nav-menu .view-btn,
[data-theme="dark"] .process-view-bar .view-btn {
    color: #94a3b8;
}

[data-theme="dark"] .process-nav-menu .view-btn:hover:not(.active),
[data-theme="dark"] .process-view-bar .view-btn:hover:not(.active) {
    color: #f1f5f9;
    background: #1e293b;
}

[data-theme="dark"] .process-nav-menu .view-btn.active,
[data-theme="dark"] .process-view-bar .view-btn.active {
    background: var(--color-primary, #10b981) !important;
    color: #ffffff !important;
    border-color: var(--color-primary, #10b981) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.btn-text-short {
    display: none;
}

@media (max-width: 900px) {
    .process-header-main-row {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-2);
    }

    .process-header-tabs-row {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
    }

    .process-nav-menu,
    .process-view-bar {
        width: auto;
        max-width: 100%;
        display: inline-flex;
        flex-wrap: wrap;
        padding: 3px;
        gap: 3px;
    }

    .process-header-actions-col {
        width: auto;
        display: inline-flex;
        align-items: center;
        justify-content: flex-start;
        gap: var(--space-2);
        flex-wrap: wrap;
    }

    .process-header-actions-col .header-action-btn {
        flex: 0 0 auto;
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .btn-text-full {
        display: none;
    }

    .btn-text-short {
        display: inline;
    }

    .process-nav-menu,
    .process-view-bar {
        gap: 2px;
        padding: 2px;
    }

    .process-nav-menu .view-btn,
    .process-view-bar .view-btn {
        padding: 0.35rem 0.65rem;
        font-size: 0.825rem;
        flex: 0 0 auto;
    }

    .header-action-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.825rem;
    }
}

/* ====================================================================
 * Werkinstructies styling
 * ==================================================================== */
.view-panel[data-panel="instructions"] {
    max-width: 1100px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.instruction-editor-wrap {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm, 6px);
    overflow: hidden;
    background: var(--color-surface);
}

.instruction-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: var(--space-2) var(--space-3);
    background: var(--color-surface-offset, #f8fafc);
    border-bottom: 1px solid var(--color-border);
    align-items: center;
}

.instruction-toolbar .btn-tool {
    padding: 0.25rem 0.55rem;
    font-size: 0.82rem;
    border-radius: 4px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    font-weight: 500;
    line-height: 1.2;
    transition: background 0.15s, border-color 0.15s;
}

.instruction-toolbar .btn-tool:hover {
    background: color-mix(in srgb, var(--color-primary-soft) 40%, var(--color-surface));
    border-color: var(--color-primary);
}

.instruction-toolbar .btn-tool-sm {
    padding: 0.15rem 0.45rem;
    font-size: 0.76rem;
    height: 24px;
    line-height: 1;
}

.instruction-editor {
    min-height: 250px;
    max-height: 520px;
    overflow-y: auto;
    padding: var(--space-4);
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--color-text);
    outline: none;
}

.instruction-editor:focus {
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--color-primary) 30%, transparent);
}

.instruction-content-body {
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--color-text);
}

.instruction-content-body h1,
.instruction-editor h1 {
    font-size: 1.45rem;
    font-weight: 700;
    margin-top: 1.25rem;
    margin-bottom: 0.6rem;
    color: var(--color-text);
}

.instruction-content-body h2,
.instruction-editor h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.instruction-content-body h3,
.instruction-editor h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 0.85rem;
    margin-bottom: 0.4rem;
    color: var(--color-text);
}

.instruction-content-body ul,
.instruction-editor ul,
.instruction-content-body ol,
.instruction-editor ol {
    padding-left: 1.4rem;
    margin: 0.5rem 0;
}

.instruction-content-body table,
.instruction-editor table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0;
}

.instruction-content-body th,
.instruction-content-body td,
.instruction-editor th,
.instruction-editor td {
    border: 1px solid var(--color-border);
    padding: 0.45rem 0.65rem;
    text-align: left;
}

.instruction-content-body th,
.instruction-editor th {
    background: var(--color-surface-offset, #f8fafc);
    font-weight: 600;
}

.instruction-editor td:focus,
.instruction-editor th:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: -1px;
    background: color-mix(in srgb, var(--color-primary-soft) 25%, var(--color-surface));
}

.instruction-content-body img,
.instruction-editor img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 0.5rem 0;
    border: 1px solid var(--color-border);
}

.instruction-callout {
    position: relative;
    padding: 0.75rem 1rem;
    border-left: 4px solid var(--color-primary);
    background: color-mix(in srgb, var(--color-primary-soft) 30%, var(--color-surface));
    border-radius: 4px;
    margin: 0.75rem 0;
}

.instruction-editor .instruction-callout {
    padding-right: 2.2rem;
}

.instruction-callout-delete {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    line-height: 1;
    font-weight: bold;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.15s, background-color 0.15s, color 0.15s;
    user-select: none;
    -webkit-user-select: none;
}

.instruction-callout:hover .instruction-callout-delete,
.instruction-callout-delete:hover,
.instruction-callout-delete:focus {
    opacity: 1;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

.instruction-toolbar .btn-tool.active {
    background: var(--color-primary, #0284c7);
    color: #ffffff;
    border-color: var(--color-primary, #0284c7);
    font-weight: 600;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
}

.instruction-toolbar .btn-tool.active:hover {
    background: var(--color-primary-hover, #0369a1);
    color: #ffffff;
    border-color: var(--color-primary-hover, #0369a1);
}

/* ====================================================================
 * Form inputs & Select dropdowns in Dialogs & Modals
 * ==================================================================== */
.app-dialog .form-input,
.app-dialog select,
.app-dialog input[type=text],
.app-dialog input[type=url],
#work-instruction-form select,
#work-instruction-form input[type=text],
#work-instruction-form input[type=url] {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 0.65rem 0.95rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font: inherit;
    font-size: 0.95rem;
    background-color: var(--color-surface);
    color: var(--color-text);
    line-height: var(--leading-snug);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.app-dialog select,
#work-instruction-form select {
    min-height: 44px;
    padding: 0.65rem 2.4rem 0.65rem 0.95rem;
    cursor: pointer;
    font-size: 0.95rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2352525b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 1.1rem;
    appearance: none;
    -webkit-appearance: none;
}

.app-dialog select option,
#work-instruction-form select option {
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    background-color: var(--color-surface);
    color: var(--color-text);
}

[data-theme="dark"] .app-dialog select,
[data-theme="dark"] #work-instruction-form select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.app-dialog .form-input:hover:not(:focus),
.app-dialog select:hover:not(:focus),
.app-dialog input[type=url]:hover:not(:focus),
.app-dialog input[type=text]:hover:not(:focus),
#work-instruction-form select:hover:not(:focus),
#work-instruction-form input[type=url]:hover:not(:focus),
#work-instruction-form input[type=text]:hover:not(:focus) {
    border-color: color-mix(in srgb, var(--color-primary) 25%, var(--color-border));
}

.app-dialog .form-input:focus,
.app-dialog select:focus,
.app-dialog input[type=url]:focus,
.app-dialog input[type=text]:focus,
#work-instruction-form select:focus,
#work-instruction-form input[type=url]:focus,
#work-instruction-form input[type=text]:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px var(--color-primary-soft),
                inset 0 1px 2px rgba(15, 23, 42, 0.03);
}

.filter-select {
    display: inline-block !important;
    width: auto !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 var(--space-3) !important;
    border-radius: var(--radius-md) !important;
    border: 1px solid var(--color-border) !important;
    background: var(--color-surface-2) !important;
    font-size: var(--text-xs) !important;
    color: var(--color-text) !important;
    cursor: pointer !important;
    background-image: none !important;
    appearance: auto !important;
    -webkit-appearance: auto !important;
}

.form-input-sm {
    min-height: 34px !important;
    padding: 0.35rem 0.65rem !important;
    font-size: var(--text-xs) !important;
}

/* =====================================================================
 * Application Contract Expiration States (< 6 months RED, < 1 year YELLOW)
 * ===================================================================== */
.app-card-contract-danger {
    border-left: 5px solid #ef4444 !important;
    background: #fef2f2 !important;
}
.app-card-contract-danger:hover {
    background: #fee2e2 !important;
}
[data-theme="dark"] .app-card-contract-danger {
    background: rgba(239, 68, 68, 0.12) !important;
    border-left-color: #f87171 !important;
}
[data-theme="dark"] .app-card-contract-danger:hover {
    background: rgba(239, 68, 68, 0.18) !important;
}

.app-card-contract-warning {
    border-left: 5px solid #f59e0b !important;
    background: #fffbeb !important;
}
.app-card-contract-warning:hover {
    background: #fef3c7 !important;
}
[data-theme="dark"] .app-card-contract-warning {
    background: rgba(245, 158, 11, 0.12) !important;
    border-left-color: #fbbf24 !important;
}
[data-theme="dark"] .app-card-contract-warning:hover {
    background: rgba(245, 158, 11, 0.18) !important;
}

.badge-contract-danger {
    background: #fee2e2 !important;
    color: #991b1b !important;
    border: 1px solid #f87171 !important;
    font-weight: 600 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.3rem !important;
}

.badge-contract-warning {
    background: #fef3c7 !important;
    color: #92400e !important;
    border: 1px solid #f59e0b !important;
    font-weight: 600 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.3rem !important;
}

[data-theme="dark"] .badge-contract-danger {
    background: rgba(239, 68, 68, 0.25) !important;
    color: #fca5a5 !important;
    border-color: #ef4444 !important;
}

[data-theme="dark"] .badge-contract-warning {
    background: rgba(245, 158, 11, 0.25) !important;
    color: #fde68a !important;
    border-color: #f59e0b !important;
}

.process-header-contract-danger {
    border-left: 5px solid #ef4444 !important;
    background: #fef2f2 !important;
    padding: var(--space-3) var(--space-4) !important;
    border-radius: var(--radius-md) !important;
    margin-bottom: var(--space-3) !important;
}
[data-theme="dark"] .process-header-contract-danger {
    background: rgba(239, 68, 68, 0.12) !important;
    border-left-color: #f87171 !important;
}

.process-header-contract-warning {
    border-left: 5px solid #f59e0b !important;
    background: #fffbeb !important;
    padding: var(--space-3) var(--space-4) !important;
    border-radius: var(--radius-md) !important;
    margin-bottom: var(--space-3) !important;
}
[data-theme="dark"] .process-header-contract-warning {
    background: rgba(245, 158, 11, 0.12) !important;
    border-left-color: #fbbf24 !important;
}

/* =====================================================================
 * Organisatiebeheer — compacte boom
 * ===================================================================== */
.org-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}
.org-page-header { margin-bottom: var(--space-5); }
.org-board.card {
    padding: var(--space-5) var(--space-6) var(--space-4);
    margin-bottom: var(--space-6);
}
.org-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    position: sticky;
    top: 0;
    z-index: 4;
    margin: calc(var(--space-2) * -1) calc(var(--space-2) * -1) var(--space-3);
    padding: var(--space-3) var(--space-2);
    background: color-mix(in srgb, var(--color-surface) 92%, transparent);
    backdrop-filter: blur(10px);
}
.org-search-wrap {
    position: relative;
    flex: 1 1 16rem;
    min-width: 12rem;
}
.org-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    width: 15px;
    height: 15px;
    transform: translateY(-50%);
    color: var(--color-text-faint);
    pointer-events: none;
}
.org-search-wrap input {
    display: block;
    width: 100%;
    height: 38px;
    margin: 0;
    padding: 0 0.85rem 0 2.2rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-offset);
    color: var(--color-text);
    font: inherit;
    font-size: var(--text-sm);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
}
.org-search-wrap input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: var(--color-surface);
    box-shadow: 0 0 0 4px var(--color-primary-soft);
}
.org-search-count {
    margin: 0;
    color: var(--color-text-muted);
    font-size: var(--text-xs);
}
.org-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.55rem;
    margin: 0 0 var(--space-3);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}
.org-tree { display: flex; flex-direction: column; gap: 2px; }
.org-node.is-filtered-out { display: none; }
.org-children {
    margin: 0 0 0.15rem 0.7rem;
    padding-left: 0.85rem;
    border-left: 1px solid var(--color-divider);
}
.org-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 2.75rem;
    padding: 0.28rem 0.4rem 0.28rem 0.2rem;
    border-radius: var(--radius-md);
}
.org-row:hover,
.org-node.is-fresh > .org-row {
    background: var(--color-surface-offset);
}
.org-node[data-kind="organisatieonderdeel"] > .org-row {
    background: color-mix(in srgb, var(--color-primary-soft) 62%, var(--color-surface));
}
.org-node[data-kind="organisatieonderdeel"] > .org-row:hover,
.org-node[data-kind="organisatieonderdeel"].is-fresh > .org-row {
    background: var(--color-primary-soft);
}
.org-twist {
    width: 1.35rem;
    height: 1.35rem;
    flex: none;
    display: grid;
    place-items: center;
    color: var(--color-text-muted);
}
button.org-twist {
    border: 0;
    padding: 0;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
button.org-twist:hover {
    background: var(--color-surface);
    color: var(--color-text);
}
.org-node:not(.is-open) > .org-row .org-twist .org-svg { transform: rotate(-90deg); }
.org-node:not(.org-leaf) .org-identity { cursor: pointer; }
.org-svg {
    width: 15px;
    height: 15px;
    display: block;
}
.org-identity {
    display: flex;
    align-items: center;
    gap: 0.45rem 0.6rem;
    min-width: 0;
    flex: 1;
    flex-wrap: wrap;
}
.org-kind {
    flex: none;
    font-size: 0.68rem;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.2;
    padding: 0.18rem 0.45rem;
    border-radius: var(--radius-full);
}
.org-kind-organisatieonderdeel {
    background: var(--color-primary-soft);
    color: var(--color-primary-text);
}
.org-kind-afdeling {
    background: var(--color-info-soft);
    color: var(--color-info);
}
.org-kind-team {
    background: var(--color-surface-dynamic);
    color: var(--color-text-muted);
}
.org-name {
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.org-node[data-kind="afdeling"] .org-name { font-weight: 500; }
.org-node[data-kind="team"] .org-name { font-weight: 450; }
.org-code {
    flex: none;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--color-primary-text);
    background: var(--color-surface);
    border: 1px solid color-mix(in srgb, var(--color-primary) 25%, var(--color-border));
    border-radius: var(--radius-sm);
    padding: 0.05rem 0.4rem;
}
.org-meta,
.org-flag {
    flex: none;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}
.org-flag {
    color: var(--color-warning);
    background: var(--color-warning-soft);
    border-radius: var(--radius-full);
    padding: 0.05rem 0.45rem;
    font-weight: 600;
}
.org-node.is-inactive .org-name { color: var(--color-text-muted); }
.org-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.15rem;
    flex: none;
}
.org-add-btn { color: var(--color-primary-text); }
.org-move { display: inline-flex; margin: 0; }
.org-icon-btn {
    width: 1.85rem;
    height: 1.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
}
.org-icon-btn:hover:not(:disabled) {
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text);
}
.org-icon-btn:disabled { opacity: 0.28; cursor: default; }
.org-empty {
    margin: var(--space-2) 0 var(--space-4);
    padding: var(--space-6) var(--space-4);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface-subtle);
    text-align: center;
}
.org-empty p { margin: 0; }
.org-empty p + p { margin-top: var(--space-2); }
.org-section-head {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.org-leftover-card h2,
.org-section-head h2 {
    margin: 0;
    font-size: 1.15rem;
}
.org-leftover-card > .muted { margin: var(--space-2) 0 var(--space-3); }
.org-leftover-empty { margin: 0; }
.org-leftover {
    display: grid;
    grid-template-columns: minmax(14rem, 0.9fr) minmax(16rem, 1.3fr) auto;
    gap: 0.75rem 1rem;
    align-items: center;
    padding: 0.9rem 0;
    border-top: 1px solid var(--color-divider);
}
.org-leftover-id strong { margin-right: 0.4rem; }
.org-leftover-id .small { margin: 0.25rem 0 0; }
.org-link-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    margin: 0;
}
.org-link-form select {
    flex: 1 1 14rem;
    min-width: 12rem;
    height: 36px;
    margin: 0;
    padding: 0 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
    font-size: var(--text-sm);
}
.org-dialog label.org-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 0;
    font-weight: 600;
    font-size: var(--text-sm);
}
.org-dialog .org-field input,
.org-dialog .org-field select,
.org-dialog .org-field textarea {
    margin-top: 0;
    font-weight: 450;
}
.org-dialog textarea {
    display: block;
    width: 100%;
    min-height: 12rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text);
    font-family: var(--font-mono);
    font-size: 0.84rem;
    line-height: 1.5;
    resize: vertical;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
}
.org-dialog textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px var(--color-primary-soft);
}
.org-field-row {
    display: grid;
    grid-template-columns: 1.2fr 0.7fr 0.9fr;
    gap: var(--space-3);
}
.org-field-label {
    width: 100%;
    font-size: var(--text-sm);
    font-weight: 600;
}
.org-layout-choice,
.org-examples { display: flex; flex-direction: column; gap: var(--space-2); }
.org-choice {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    margin: 0 !important;
    font-weight: 500 !important;
}
.org-choice input { width: auto; margin: 0; }
.org-check {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    margin: 0 !important;
    font-weight: 500 !important;
}
.org-check input { width: auto; margin: 0; }
.org-example {
    margin: 0;
    padding: 0.75rem 0.9rem;
    overflow-x: auto;
    background: var(--color-surface-offset);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.55;
    white-space: pre-wrap;
}
dialog.app-dialog.org-dialog-wide {
    max-width: min(720px, calc(100vw - 2rem));
}
.org-dialog-actions { align-items: center; }
.org-dialog-actions form { margin-right: auto; }
.org-dialog .muted.small { margin: 0; }

@media (max-width: 860px) {
    .org-board.card { padding: var(--space-4); }
    .org-leftover,
    .org-field-row { grid-template-columns: 1fr; }
    .org-name { white-space: normal; }
    .org-actions { flex-wrap: wrap; }
}

