/* Marinus Works Portal - Main Stylesheet */
/* Strak, professioneel design met automatische dark/light mode */

/* ===== FONT ===== */
@font-face {
    font-family: 'Urbanist';
    src: url('../fonts/Urbanist-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Urbanist';
    src: url('../fonts/Urbanist-Italic-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
}

/* ===== LIGHT MODE VARIABELEN ===== */
:root,
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f0f1f3;
    --bg-hover: #e9ecef;

    --text-primary: #1a1a1a;
    --text-secondary: #495057;
    --text-muted: #868e96;

    --accent-primary: #1a1a1a;
    --accent-secondary: #333333;
    --accent-hover: #4a4a4a;

    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;

    --border-color: #dee2e6;
    --border-light: #ced4da;
    --border-radius: 6px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);

    --transition: 0.15s ease;

    --logo-filter: invert(1);

    --sidebar-width: 200px;

    color-scheme: light;
}

/* ===== DARK MODE VARIABELEN ===== */
[data-theme="dark"] {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;
    --bg-hover: #242424;

    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;

    --accent-primary: #ffffff;
    --accent-secondary: #cccccc;
    --accent-hover: #e0e0e0;

    --success: #4ade80;
    --warning: #fbbf24;
    --error: #f87171;
    --info: #60a5fa;

    --border-color: #2a2a2a;
    --border-light: #333333;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);

    --logo-filter: none;

    color-scheme: dark;
}

/* ===== AUTO MODE: volg systeeminstelling ===== */
@media (prefers-color-scheme: dark) {
    [data-theme="auto"] {
        --bg-primary: #0a0a0a;
        --bg-secondary: #111111;
        --bg-tertiary: #1a1a1a;
        --bg-hover: #242424;

        --text-primary: #ffffff;
        --text-secondary: #a0a0a0;
        --text-muted: #666666;

        --accent-primary: #ffffff;
        --accent-secondary: #cccccc;
        --accent-hover: #e0e0e0;

        --success: #4ade80;
        --warning: #fbbf24;
        --error: #f87171;
        --info: #60a5fa;

        --border-color: #2a2a2a;
        --border-light: #333333;

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
        --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);

        --logo-filter: none;

        color-scheme: dark;
    }
}

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

html {
    font-size: 16px;
    touch-action: manipulation;
    -ms-touch-action: manipulation;
    overflow-x: hidden;
    overscroll-behavior: none;
    background-color: var(--bg-secondary);
}

body {
    font-family: 'Urbanist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    letter-spacing: 0.01em;
    font-size: 1.02rem;
    overflow-x: hidden;
}

a {
    color: var(--text-primary);
    text-decoration: none;
    transition: opacity var(--transition);
}

a:hover {
    opacity: 0.8;
}

/* ===== TOP NAVIGATION ===== */
.main-nav {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.5rem;
    display: flex;
    align-items: stretch;
    height: 48px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
}

.nav-brand a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

.brand-logo-wrapper {
    display: grid;
    align-items: center;
    height: 16px;
}

.brand-logo-wrapper .brand-logo {
    grid-area: 1 / 1;
    height: 16px;
    width: auto;
}

.brand-logo-dark { opacity: 1; }
.brand-logo-light { opacity: 0; }

[data-theme="dark"] .brand-logo-dark { opacity: 0; }
[data-theme="dark"] .brand-logo-light { opacity: 1; }

@media (prefers-color-scheme: dark) {
    [data-theme="auto"] .brand-logo-dark { opacity: 0; }
    [data-theme="auto"] .brand-logo-light { opacity: 1; }
}

.brand-text {
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.75rem;
}

.nav-links {
    display: flex;
    gap: 0;
    margin-left: 2rem;
    flex: 1;
    align-items: stretch;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0 1rem;
    color: var(--text-secondary);
    transition: all var(--transition);
    font-size: 0.85rem;
    font-weight: 400;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
    opacity: 1;
}

.nav-link.active {
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
    font-weight: 500;
}

.nav-icon {
    font-size: 0.9rem;
    opacity: 0.7;
}

.nav-actions {
    display: flex;
    gap: 0.125rem;
    align-items: center;
}

.nav-user {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0 0.25rem;
}

/* Search Bar */
.search-bar {
    display: none;
    background: var(--bg-secondary);
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
    align-items: center;
    position: fixed;
    top: 48px;
    left: 0;
    right: 0;
    z-index: 99;
}

.search-bar.active {
    display: flex;
    flex-wrap: wrap;
}

.search-bar input {
    flex: 1;
    padding: 0.6rem 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 160, 227, 0.15);
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

/* Search Results Dropdown */
.search-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-top: none;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.search-section {
    border-bottom: 1px solid var(--border-color);
}

.search-section:last-child {
    border-bottom: none;
}

.search-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    position: sticky;
    top: 0;
}

.search-result-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.1s;
}

.search-result-item a:hover,
.search-result-item.selected a {
    background: var(--bg-secondary);
}

.search-result-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: 6px;
    color: var(--text-muted);
}

.search-result-icon svg,
.search-result-icon i {
    width: 15px;
    height: 15px;
}

.search-result-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.search-result-title {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-title mark {
    background: rgba(0, 160, 227, 0.25);
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}

.search-result-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.search-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.search-empty {
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===== NAV DROPDOWN MENU ===== */
.nav-dropdown-wrapper {
    position: relative;
    height: 100%;
}

.nav-dropdown-wrapper > .nav-link {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    height: 100%;
}

.nav-chevron {
    width: 10px;
    height: 6px;
    opacity: 0.5;
    transition: transform var(--transition);
    flex-shrink: 0;
}

.nav-dropdown-wrapper:hover .nav-chevron {
    transform: rotate(180deg);
    opacity: 0.8;
}

.nav-dropdown {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    box-shadow: var(--shadow-md);
    min-width: 200px;
    z-index: 200;
    padding: 0.5rem 0;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    pointer-events: none;
}

.nav-dropdown-wrapper:hover > .nav-dropdown {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.nav-dropdown-section {
    padding: 0.25rem 0;
}

.nav-dropdown-section + .nav-dropdown-section {
    border-top: 1px solid var(--border-color);
    margin-top: 0.25rem;
    padding-top: 0.5rem;
}

.nav-dropdown-heading {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0.25rem 1rem 0.25rem;
}

.nav-dropdown-link {
    display: block;
    padding: 0.375rem 1rem;
    color: var(--text-secondary);
    font-size: 0.825rem;
    transition: all var(--transition);
    white-space: nowrap;
}

.nav-dropdown-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
    opacity: 1;
}

.nav-dropdown-link.active {
    color: var(--info);
    font-weight: 500;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition);
    letter-spacing: 0.01em;
}

.btn-primary {
    background: var(--text-primary);
    color: var(--bg-primary);
}

.btn-primary:hover {
    background: var(--accent-secondary);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    opacity: 0.9;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.375rem;
    font-size: 0.9rem;
    border-radius: var(--border-radius);
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Lucide icon sizing */
.btn-icon svg,
.btn-icon .lucide {
    width: 16px;
    height: 16px;
    stroke-width: 1.75;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    padding: 1.25rem 1.5rem;
    padding-top: calc(48px + 1.25rem);
    padding-bottom: 3rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Back Navigation */
.back-nav {
    margin-bottom: 0.75rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    transition: all var(--transition);
}

.back-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
}

/* Flash Messages */
.flash-messages {
    margin-bottom: 1rem;
}

.flash-message {
    padding: 0.625rem 0.875rem;
    border-radius: var(--border-radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.375rem;
    font-size: 0.825rem;
}

.flash-success {
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.3);
    color: var(--success);
}

.flash-error {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: var(--error);
}

.flash-warning {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: var(--warning);
}

.flash-info {
    background: rgba(96, 165, 250, 0.1);
    border: 1px solid rgba(96, 165, 250, 0.3);
    color: var(--info);
}

.flash-close {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    opacity: 0.6;
    display: inline-flex;
    align-items: center;
}

.flash-close:hover {
    opacity: 1;
}

.flash-close svg,
.flash-close .lucide {
    width: 14px;
    height: 14px;
    stroke-width: 2;
}

/* ===== PORTAL HOME ===== */
.portal-home {
    max-width: 900px;
    margin: 0 auto;
}

.portal-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-top: 2rem;
}

.portal-header-logo {
    height: 40px;
    width: 40px;
    object-fit: contain;
    margin-bottom: 0.75rem;
}

.portal-logo-dark { display: block; margin: 0 auto; }
.portal-logo-light { display: none; }

[data-theme="dark"] .portal-logo-dark { display: none; }
[data-theme="dark"] .portal-logo-light { display: block; margin: 0 auto; }

@media (prefers-color-scheme: dark) {
    [data-theme="auto"] .portal-logo-dark { display: none; }
    [data-theme="auto"] .portal-logo-light { display: block; margin: 0 auto; }
}

.portal-header h1 {
    font-size: 1.5rem;
    font-weight: 300;
    margin-bottom: 0;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-primary);
}

/* Module Cards */
.module-cards {
    display: grid;
    gap: 1px;
    background: var(--border-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 2rem;
}

.module-card {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 1.25rem;
    padding: 1rem 1.25rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all var(--transition);
}

.module-card:hover {
    background: var(--bg-tertiary);
}

.module-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
}

.module-icon svg,
.module-icon .lucide {
    width: 20px;
    height: 20px;
    stroke-width: 1.5;
}

.module-card:hover .module-icon {
    color: var(--text-primary);
}

.module-info h2 {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.125rem;
}

.module-info p {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.module-stats {
    display: flex;
    gap: 1.5rem;
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.module-arrow {
    font-size: 1rem;
    color: var(--text-muted);
    transition: all var(--transition);
}

.module-card:hover .module-arrow {
    color: var(--text-primary);
    transform: translateX(4px);
}

/* Quick Actions */
.quick-actions {
    margin-bottom: 2rem;
}

.quick-actions h3 {
    margin-bottom: 0.75rem;
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 500;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: 0.8rem;
    transition: all var(--transition);
}

.action-btn:hover {
    border-color: var(--border-light);
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.action-icon {
    display: inline-flex;
    align-items: center;
}

.action-icon svg,
.action-icon .lucide {
    width: 14px;
    height: 14px;
    stroke-width: 1.75;
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.card-header {
    padding: 0.625rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-tertiary);
}

.card-header h2, .card-header h3 {
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.card-body {
    padding: 1rem;
}

.card-footer {
    padding: 0.625rem 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 0.875rem;
}

.form-label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.5rem 0.625rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 0.825rem;
    transition: border-color var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--text-muted);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    min-height: 80px;
    resize: vertical;
}

.form-hint {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.form-error {
    color: var(--error);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

/* ===== TABLES - COMPACT ===== */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

/* Scroll hints: links en rechts, via JS overlay divs */
.table-scroll-wrapper {
    position: relative;
    overflow: hidden;
}

.table-scroll-hint {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 32px;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.table-scroll-hint-right {
    right: 0;
    background: linear-gradient(to right, transparent, var(--bg-secondary));
}

.table-scroll-hint-left {
    left: 0;
    background: linear-gradient(to left, transparent, var(--bg-secondary));
}

.table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

/* Cellen met child-elementen (divs) ook nowrap forceren */
.table td > div {
    white-space: nowrap;
}

.table th {
    background: var(--bg-tertiary);
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
}

.table tr:hover {
    background: var(--bg-hover);
}

.table td {
    font-size: 0.8rem;
}

.table-actions {
    display: flex;
    gap: 0.375rem;
    white-space: nowrap;
}

/* MWP items tabel: compacte kolommen, content bepaalt breedte */
.mwp-items-table th,
.mwp-items-table td {
    padding: 0.375rem 0.5rem;
}

/* Compact table variant */
.table-compact th,
.table-compact td {
    padding: 0.375rem 0.625rem;
}

.table-compact td {
    font-size: 0.775rem;
}

/* ===== STATUS BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.375rem;
    font-size: 0.65rem;
    font-weight: 500;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-success {
    background: rgba(74, 222, 128, 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning);
}

.badge-error {
    background: rgba(248, 113, 113, 0.15);
    color: var(--error);
}

.badge-credit {
    background: rgba(248, 113, 113, 0.12);
    color: var(--error);
    border: 1px solid rgba(248, 113, 113, 0.35);
    font-weight: 600;
}

.badge-info {
    background: rgba(96, 165, 250, 0.15);
    color: var(--info);
}

.badge-neutral,
.badge-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.875rem;
    border-bottom: 1px solid var(--border-color);
}

.page-title {
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.page-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
    font-size: 0.7rem;
    margin-bottom: 0.25rem;
}

.page-breadcrumb a {
    color: var(--text-muted);
}

.page-breadcrumb a:hover {
    color: var(--text-primary);
}

.page-breadcrumb span {
    opacity: 0.5;
}

/* ===== FOOTER ===== */
.main-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 90;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 0.625rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.7rem;
    letter-spacing: 0.02em;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.footer-left {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    mask-image: linear-gradient(to right, transparent, black 2rem, black calc(100% - 2rem), transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 2rem, black calc(100% - 2rem), transparent);
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    white-space: nowrap;
}

.footer-right .footer-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: inherit;
    transition: color var(--transition);
}

.footer-right .footer-link:hover {
    color: var(--text-secondary);
}

.footer-sync {
    display: inline-block;
    white-space: nowrap;
    animation: footer-scroll 25s linear infinite;
    padding-left: 100%;
}

@keyframes footer-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

.footer-left:hover .footer-sync {
    animation-play-state: paused;
}

.footer-separator {
    margin: 0 0.5rem;
    opacity: 0.3;
}

/* Info icon (footer) */
.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid var(--text-muted);
    font-size: 0.6rem;
    font-style: italic;
    font-family: Georgia, 'Times New Roman', serif;
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: color var(--transition), border-color var(--transition);
}

.info-icon:hover {
    color: var(--text-secondary);
    border-color: var(--text-secondary);
}

/* Info popup */
.info-popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.info-popup-overlay.active {
    display: flex;
}

.info-popup {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    max-width: 520px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.info-popup p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.7;
    margin-bottom: 1rem;
}

.info-popup p:last-of-type {
    margin-bottom: 1.5rem;
}

.info-popup p strong {
    color: var(--text-primary);
}

.info-popup-close {
    display: block;
    margin: 0 auto;
    padding: 0.5rem 1.5rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.8rem;
}

.info-popup-close:hover {
    background: var(--bg-hover);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state-icon {
    margin-bottom: 0.75rem;
    opacity: 0.4;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state-icon svg,
.empty-state-icon .lucide {
    width: 32px;
    height: 32px;
    stroke-width: 1.25;
}

.empty-state h3 {
    margin-bottom: 0.375rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.empty-state p {
    font-size: 0.825rem;
}

/* ===== LOADING ===== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 2px solid var(--border-color);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 200;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 0.9rem;
    font-weight: 500;
}

.modal-body {
    padding: 1rem;
}

.modal-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Code/Reference styling */
code {
    background: var(--bg-primary);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.8em;
    color: var(--text-secondary);
}

/* ===== UTILITIES ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 0.75rem; }
.mt-3 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 0.75rem; }
.mb-3 { margin-bottom: 1rem; }

.d-flex { display: flex; }
.gap-1 { gap: 0.375rem; }
.gap-2 { gap: 0.75rem; }

/* Category sections */
.category-section {
    border-bottom: 1px solid var(--border-color);
}

.category-section:last-child {
    border-bottom: none;
}

/* Global Loading Indicator */
.global-loading {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(96, 165, 250, 0.1);
    border: 1px solid rgba(96, 165, 250, 0.25);
    border-radius: var(--border-radius);
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
    color: var(--info);
    animation: fadeIn 0.3s ease;
}

.global-loading.active {
    display: flex;
}

.global-loading-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(96, 165, 250, 0.3);
    border-top-color: var(--info);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== WEEK CALENDAR ===== */
.week-calendar {
    max-width: 480px;
}

.week-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.week-calendar-header h4 {
    font-size: 0.85rem;
    font-weight: 500;
    margin: 0;
    min-width: 140px;
    text-align: center;
}

.week-calendar-nav {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    transition: all var(--transition);
}

.week-calendar-nav:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.week-calendar-grid {
    display: grid;
    grid-template-columns: 36px repeat(7, 1fr) auto;
    gap: 1px;
    font-size: 0.75rem;
}

.week-calendar-grid .cal-header {
    padding: 0.25rem 0.125rem;
    text-align: center;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.03em;
}

.week-calendar-grid .cal-wk {
    padding: 0.25rem 0.25rem;
    text-align: center;
    font-weight: 500;
    color: var(--info);
    cursor: pointer;
    border-radius: 3px;
    transition: all var(--transition);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.week-calendar-grid .cal-wk:hover {
    background: rgba(96, 165, 250, 0.15);
    opacity: 1;
}

.week-calendar-grid .cal-day {
    padding: 0.3rem 0.125rem;
    text-align: center;
    color: var(--text-primary);
    border-radius: 3px;
}

.week-calendar-grid .cal-day.outside {
    color: var(--text-muted);
    opacity: 0.4;
}

.week-calendar-grid .cal-day.today {
    background: var(--text-primary);
    color: var(--bg-primary);
    font-weight: 600;
}

.week-calendar-grid .cal-uren {
    padding: 0.3rem 0.375rem;
    text-align: right;
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.week-calendar-grid .cal-uren.has-uren {
    color: var(--success);
    font-weight: 500;
}

.week-calendar-row-current .cal-wk {
    color: var(--bg-primary);
    background: var(--info);
    font-weight: 600;
}

.week-calendar-row-current .cal-wk:hover {
    background: rgba(96, 165, 250, 0.85);
}

.week-calendar-row-current .cal-day:not(.today) {
    background: rgba(96, 165, 250, 0.08);
}

/* ===== INFO GRID ===== */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 250px));
    gap: 1.5rem;
}

/* ===== ITEM DETAIL LAYOUT ===== */
.item-detail-layout {
    display: grid;
    grid-template-columns: 1fr minmax(auto, 350px);
    gap: 1.5rem;
}

.item-detail-layout > * {
    min-width: 0;
}

/* ===== QUICK ADD GRID ===== */
.quick-add-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 0.75rem;
    align-items: end;
}

/* ===== HAMBURGER MENU (mobile) ===== */
.nav-hamburger {
    display: none;
}

.mobile-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 300;
}

.mobile-nav-overlay.active {
    display: block;
}

.mobile-nav-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 280px;
    max-width: 85vw;
    height: 100%;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
    animation: slideInRight 0.2s ease;
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.mobile-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.mobile-nav-links {
    padding: 0.5rem 0;
}

.mobile-nav-link {
    display: block;
    padding: 0.625rem 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: all var(--transition);
}

.mobile-nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    opacity: 1;
}

.mobile-nav-link.active {
    color: var(--text-primary);
    font-weight: 500;
    background: var(--bg-tertiary);
}

.mobile-nav-link.mobile-nav-sub {
    padding-left: 1.75rem;
    font-size: 0.8rem;
}

.mobile-nav-group-label {
    padding: 0.75rem 1rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    margin-top: 0.25rem;
}

/* ===== PREVENT MOBILE ZOOM ON INPUT FOCUS ===== */
@media (max-width: 768px) {
    input, select, textarea,
    .form-input, .form-select, .form-textarea,
    .search-bar input {
        font-size: 16px !important;
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .main-nav {
        padding: 0 0.75rem;
        justify-content: space-between;
    }

    .nav-links {
        display: none;
    }

    .nav-hamburger {
        display: inline-flex;
    }

    .nav-actions {
        margin-left: auto;
    }

    .main-content {
        padding: 1rem;
        padding-top: calc(48px + 1rem);
    }

    .module-card {
        grid-template-columns: auto 1fr;
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .module-stats,
    .module-arrow {
        display: none;
    }

    .action-buttons {
        flex-direction: column;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .page-header .d-flex {
        flex-wrap: wrap;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    /* Item detail: sidebar onder content op mobiel */
    .item-detail-layout {
        grid-template-columns: 1fr;
    }

    /* Quick add panel: stack op mobiel */
    .quick-add-grid {
        grid-template-columns: 1fr;
    }

    /* Werkbon form rows: stack op klein scherm */
    .wb-form-row-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .wb-form-row {
        grid-template-columns: 1fr !important;
    }

    /* Werkbon summary bar: stack */
    .wb-summary-bar {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }

    .wb-summary-bar .info {
        justify-content: center;
    }

    /* Generieke inline grids met vaste px kolommen: stack */
    [style*="grid-template-columns: 200px 1fr"],
    [style*="grid-template-columns: 1fr 1fr 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Rapport header: stack */
    .rapport-header {
        flex-direction: column;
        gap: 0.75rem;
    }

    /* Tabellen op mobiel: iets compacter maar behoud horizontale scroll */
    .table th,
    .table td {
        padding: 0.375rem 0.5rem;
    }

    .table th {
        font-size: 0.65rem;
    }

    .table td {
        font-size: 0.75rem;
    }

    /* Cards compacter op mobiel */
    .card-body {
        padding: 0.75rem;
    }

    .card-header {
        padding: 0.5rem 0.75rem;
    }

    /* Info grids: 2 kolommen op mobiel, compacter */
    .info-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    [style*="minmax(150px, 1fr)"] {
        gap: 0.75rem !important;
    }

    .footer-content {
        flex-direction: column;
        gap: 0.25rem;
        text-align: center;
    }

    .main-footer {
        font-size: 0.6rem;
        padding: 0.5rem 1rem;
    }

    .footer-left {
        order: 2;
        width: 100%;
        overflow: hidden;
    }

    .footer-right {
        order: 1;
        flex-wrap: wrap;
        justify-content: center;
    }

    .footer-sync {
        white-space: nowrap;
    }

    .footer-separator {
        margin: 0 0.25rem;
    }
}


/* ── AI-collega markering op uren-regels ─────────────────────────────── */
.table tr[data-source="sms_ai"] td {
    background: #eff6ff;  /* subtiel lichtblauw */
}
.table tr[data-source="sms_ai"][data-confidence="low"] td {
    background: #fff7ed;  /* amber — onzeker */
}
.table tr[data-source="sms_ai"][data-user-edited="true"] td:first-child {
    border-left: 3px solid #10b981;  /* groene edge: gereviewd */
}
[data-theme="dark"] .table tr[data-source="sms_ai"] td {
    background: rgba(96, 165, 250, 0.08);
}
[data-theme="dark"] .table tr[data-source="sms_ai"][data-confidence="low"] td {
    background: rgba(251, 191, 36, 0.10);
}
@media (prefers-color-scheme: dark) {
    [data-theme="auto"] .table tr[data-source="sms_ai"] td {
        background: rgba(96, 165, 250, 0.08);
    }
    [data-theme="auto"] .table tr[data-source="sms_ai"][data-confidence="low"] td {
        background: rgba(251, 191, 36, 0.10);
    }
}
.uren-ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.9em;
    cursor: help;
    margin-right: 4px;
}
.uren-ai-warn {
    font-size: 0.85em;
    color: #d97706;
}

/* ── AI-batch history sectie (MWP visit detail) ──────────────────────── */
.ai-batch-history {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}
.ai-batch-history h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.85rem;
    color: #475569;
}
.ai-batch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.35rem 0;
    font-size: 0.82rem;
    border-top: 1px solid #e2e8f0;
}
.ai-batch-row:first-of-type { border-top: 0; }
.ai-batch-row.undone { opacity: 0.55; }
.ai-batch-row .ai-batch-undo-btn {
    padding: 0.15rem 0.55rem;
    font-size: 0.75rem;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
}
.ai-batch-row .ai-batch-undo-btn:hover {
    background: #fee2e2;
    border-color: #ef4444;
    color: #b91c1c;
}
.ai-batch-row .undone-label {
    font-size: 0.72rem;
    color: #94a3b8;
}

/* ============================================================
   Portal-brede achtergrondtaken-balk (#bgJobs)
   ============================================================ */
.bg-jobs {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 340px;
    pointer-events: none;
}
.bg-job-card {
    pointer-events: auto;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #dee2e6);
    border-left: 3px solid var(--accent-primary, #00A0E3);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    padding: 10px 12px;
    font-size: 0.82rem;
    animation: fadeIn 0.25s ease;
}
.bg-job-top {
    display: flex;
    align-items: center;
    gap: 8px;
}
.bg-job-label {
    font-weight: 600;
    color: var(--text-primary, #1a1a2e);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bg-job-count {
    color: var(--text-secondary, #667);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.bg-job-spinner {
    width: 13px;
    height: 13px;
    border: 2px solid rgba(0, 160, 227, 0.3);
    border-top-color: var(--accent-primary, #00A0E3);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}
.bg-job-bar {
    height: 5px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 7px;
}
.bg-job-bar-fill {
    height: 100%;
    background: var(--accent-primary, #00A0E3);
    border-radius: 3px;
    transition: width 0.4s ease;
}
.bg-job-bar-indeterminate {
    height: 100%;
    width: 40%;
    background: var(--accent-primary, #00A0E3);
    border-radius: 3px;
    animation: bgJobSlide 1.2s ease-in-out infinite;
}
@keyframes bgJobSlide {
    0%   { margin-left: -40%; }
    100% { margin-left: 100%; }
}
.bg-job-msg {
    color: var(--text-secondary, #667);
    margin-top: 5px;
    font-size: 0.76rem;
}

/* ============ Privacymodus (presentaties) ============ */
/* Gevoelige waarden geblurd; span voor tekst, klasse ook op inputs/svg-text.
   Blur in em zodat hij meeschaalt met de lettergrootte: grote statistiek-
   cijfers waren bij een vaste 5px nog leesbaar. */
.pv-mask {
    filter: blur(0.45em);
    user-select: none;
    border-radius: 3px;
}

/* Verberg content tot de eerste maskeer-pass klaar is (geen flits van echte data) */
body.privacy-mode .main-content {
    visibility: hidden;
}

body.privacy-mode.pv-ready .main-content {
    visibility: visible;
}

#privacyToggle.privacy-on {
    color: var(--warning);
}
