/* ========================================
   Laser Offerte - Premium Design System
   Clean, Bold, Professional
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ========================================
   Design Tokens
   ======================================== */

:root {
    /* Brand Colors - Hex IQ */
    --brand-primary: #E53A55;
    --brand-secondary: #EA523A;
    --brand-gradient: linear-gradient(135deg, #EA523A 0%, #E02C6E 100%);
    --brand-glow: rgba(229, 58, 85, 0.4);
    
    /* Light Mode */
    --bg-base: #f8fafc;
    --bg-surface: #ffffff;
    --bg-elevated: #ffffff;
    --bg-subtle: #f1f5f9;
    --bg-muted: #e2e8f0;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-on-brand: #ffffff;
    
    --border-default: #e2e8f0;
    --border-subtle: #f1f5f9;
    
    /* Semantic */
    --success: #10b981;
    --success-soft: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-soft: rgba(245, 158, 11, 0.1);
    --error: #ef4444;
    --error-soft: rgba(239, 68, 68, 0.1);
    
    /* Effects */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.04), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.04), 0 4px 6px rgba(0, 0, 0, 0.06);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.06), 0 10px 10px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 40px var(--brand-glow);
    
    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;
}

/* Dark Mode */
[data-theme="dark"] {
    --brand-primary: #F0586B;
    --brand-secondary: #F2664A;
    --brand-gradient: linear-gradient(135deg, #F2664A 0%, #EE3C7E 100%);
    --brand-glow: rgba(240, 88, 107, 0.5);
    
    --bg-base: #030712;
    --bg-surface: #0f172a;
    --bg-elevated: #1e293b;
    --bg-subtle: #1e293b;
    --bg-muted: #334155;
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    
    --border-default: #1e293b;
    --border-subtle: #334155;
    
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.5);
}

/* ========================================
   Base Reset
   ======================================== */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background var(--duration-normal) var(--ease-out),
                color var(--duration-normal) var(--ease-out);
}

/* ========================================
   Typography
   ======================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

/* ========================================
   Logo Component
   ======================================== */

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-mark {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.logo-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 800;
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Large logo for login */
.logo-lg .logo-mark {
    width: 76px;
    height: 76px;
}

.logo-lg .logo-text {
    font-size: 2rem;
}

/* ========================================
   Login Page
   ======================================== */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

/* Animated gradient background */
.login-bg {
    position: fixed;
    inset: 0;
    background: 
        radial-gradient(ellipse at 30% 20%, rgba(37, 99, 235, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(14, 165, 233, 0.15) 0%, transparent 50%),
        var(--bg-base);
    z-index: 0;
}

.login-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23475569' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.login-container {
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
}

.login-card {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-default);
    animation: cardEnter 0.6s var(--ease-out) forwards;
}

@keyframes cardEnter {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-header .logo {
    justify-content: center;
    margin-bottom: 16px;
    flex-direction: column;
    gap: 16px;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ========================================
   Form Elements
   ======================================== */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 500;
    background: var(--bg-subtle);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: all var(--duration-fast) var(--ease-out);
    outline: none;
}

.form-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.form-input:hover {
    background: var(--bg-muted);
}

.form-input:focus {
    background: var(--bg-surface);
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.error-message {
    color: var(--error);
    font-size: 0.875rem;
    font-weight: 500;
    min-height: 24px;
    margin-bottom: 8px;
}

/* ========================================
   Buttons
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    outline: none;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    opacity: 0;
    transition: opacity var(--duration-fast);
}

.btn:hover::before {
    opacity: 1;
}

.btn-primary {
    background: var(--brand-gradient);
    background-size: 220% 100%;
    background-position: 0% 50%;
    color: var(--text-on-brand);
    box-shadow: var(--shadow-md), 0 4px 20px var(--brand-glow);
    transition: background-position 650ms var(--ease-out),
                transform var(--duration-fast) var(--ease-out),
                box-shadow var(--duration-fast) var(--ease-out);
}

.btn-primary:hover {
    background-position: 100% 50%;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 8px 30px var(--brand-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background: var(--bg-subtle);
    color: var(--text-primary);
    border: 2px solid var(--border-default);
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 10px 16px;
}

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

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

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

.btn-full {
    width: 100%;
}

/* Button arrow animation */
.btn .arrow {
    transition: transform var(--duration-fast) var(--ease-out);
}

.btn:hover .arrow {
    transform: translateX(4px);
}

/* ========================================
   Dashboard Layout
   ======================================== */

.dashboard-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header with glassmorphism */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 32px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-default);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background var(--duration-normal);
}

[data-theme="dark"] .header {
    background: rgba(15, 23, 42, 0.8);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 32px;
}

.header-nav {
    display: flex;
    gap: 4px;
    background: var(--bg-subtle);
    padding: 4px;
    border-radius: var(--radius-md);
}

.nav-tab {
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.nav-tab:hover {
    color: var(--text-primary);
}

.nav-tab.active {
    background: var(--bg-surface);
    color: var(--brand-primary);
    box-shadow: var(--shadow-sm);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-greeting {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-right: 8px;
}

.header-greeting strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 32px;
}

/* Sections with staggered animation */
.section {
    display: none;
}

.section.active {
    display: block;
    animation: sectionEnter 0.5s var(--ease-out) forwards;
}

@keyframes sectionEnter {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   Cards
   ======================================== */

.card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--duration-normal) var(--ease-out);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    border-bottom: 1px solid var(--border-default);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.card-body {
    padding: 28px;
}

.card-footer {
    padding: 20px 28px;
    border-top: 1px solid var(--border-default);
    background: var(--bg-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ========================================
   Drop Zone
   ======================================== */

.drop-zone {
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-lg);
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
    position: relative;
    overflow: hidden;
}

.drop-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--brand-gradient);
    opacity: 0;
    transition: opacity 500ms var(--ease-out);
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--brand-primary);
    border-style: solid;
}

.drop-zone:hover::before,
.drop-zone.dragover::before {
    opacity: 0.06;
}

.drop-zone-content {
    position: relative;
    z-index: 1;
}

.drop-zone-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: var(--bg-subtle);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: transform 600ms var(--ease-spring),
                box-shadow 600ms var(--ease-out);
}

/* Gradient als aparte laag: faden + van onder naar boven instromen */
.drop-zone-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--brand-gradient);
    background-size: 100% 220%;
    background-position: 50% 100%;
    opacity: 0;
    transition: opacity 550ms var(--ease-out),
                background-position 700ms var(--ease-out);
}

.drop-zone:hover .drop-zone-icon,
.drop-zone.dragover .drop-zone-icon {
    transform: scale(1.08);
    box-shadow: 0 8px 30px var(--brand-glow);
}

.drop-zone:hover .drop-zone-icon::before,
.drop-zone.dragover .drop-zone-icon::before {
    opacity: 1;
    background-position: 50% 0%;
}

.drop-zone-icon svg {
    width: 36px;
    height: 36px;
    color: var(--text-muted);
    fill: none;
    position: relative;
    z-index: 1;
    transition: color 550ms var(--ease-out);
}

.drop-zone:hover .drop-zone-icon svg,
.drop-zone.dragover .drop-zone-icon svg {
    color: white;
}

.drop-zone h3 {
    font-size: 1.125rem;
    margin-bottom: 8px;
}

.drop-zone p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.drop-zone-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.drop-zone-divider::before,
.drop-zone-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-default);
}

/* ========================================
   File List
   ======================================== */

.file-list {
    margin-top: 24px;
}

.file-item {
    display: grid;
    /* compacte rij zonder thumbnail: naam | aantal | status | verwijderen */
    grid-template-columns: 1fr auto auto 44px;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--bg-subtle);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    animation: fileEnter 0.4s var(--ease-out) forwards;
    opacity: 0;
}

.file-item.active {
    border-color: var(--brand-primary);
    background: var(--bg-muted);
}

/* ========================================
   File tabs (meerdere uploads -> tabbladen)
   ======================================== */

.file-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}

.file-tabs:empty {
    display: none;
}

.file-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 260px;
    padding: 8px 14px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-default);
    border-radius: 999px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.file-tab:hover {
    background: var(--bg-muted);
}

.file-tab.active {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
}

.file-tab-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-tab-count {
    flex: none;
    padding: 1px 8px;
    border-radius: 999px;
    background: rgba(127, 127, 127, 0.18);
    font-size: 11px;
    font-weight: 600;
}

.file-tab.active .file-tab-count {
    background: rgba(255, 255, 255, 0.25);
}

@keyframes fileEnter {
    from {
        opacity: 0;
        transform: translateX(-16px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.file-item:nth-child(1) { animation-delay: 0ms; }
.file-item:nth-child(2) { animation-delay: 50ms; }
.file-item:nth-child(3) { animation-delay: 100ms; }
.file-item:nth-child(4) { animation-delay: 150ms; }
.file-item:nth-child(5) { animation-delay: 200ms; }

.file-item:hover {
    background: var(--bg-muted);
}

.file-thumbnail {
    width: 60px;
    height: 60px;
    background: var(--bg-surface);
    border: 2px solid var(--border-default);
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.file-thumbnail:hover {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    transform: scale(1.05);
}

.file-thumbnail canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.file-info {
    min-width: 0;
}

.file-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.file-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.file-predictions {
    display: flex;
    gap: 24px;
}

.file-pred-item {
    text-align: center;
}

.file-pred-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.file-pred-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--brand-primary);
}

.file-status {
    text-align: right;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--radius-full);
}

.status-badge.pending {
    background: var(--bg-muted);
    color: var(--text-muted);
}

.status-badge.loading {
    background: var(--warning-soft);
    color: var(--warning);
}

.status-badge.done {
    background: var(--success-soft);
    color: var(--success);
}

.status-badge.error {
    background: var(--error-soft);
    color: var(--error);
}

.file-remove {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.25rem;
    transition: all var(--duration-fast);
}

.file-remove:hover {
    background: var(--error-soft);
    color: var(--error);
}

/* Spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-default);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-small {
    width: 14px;
    height: 14px;
}

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

/* ========================================
   Assembly Styling
   ======================================== */

.assembly-item {
    display: flex;
    flex-direction: column;
    padding: 0;
    gap: 0;
}

.assembly-item .assembly-header {
    display: grid;
    grid-template-columns: 60px 1fr auto auto 44px;
    align-items: center;
    gap: 16px;
    padding: 16px;
    width: 100%;
}

.assembly-item .file-info {
    min-width: 0;
}

.assembly-item .file-name {
    display: flex;
    align-items: center;
    gap: 8px;
}

.assembly-toggle,
.subassembly-toggle {
    background: var(--bg-muted);
    border: none;
    border-radius: var(--radius-sm);
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--text-secondary);
    transition: all var(--duration-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
}

.assembly-toggle:hover,
.subassembly-toggle:hover {
    background: var(--brand-primary);
    color: white;
}

.assembly-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--brand-gradient);
    color: white;
    border-radius: var(--radius-full);
    margin-left: 8px;
}

.assembly-parts {
    display: block;
    width: 100%;
    padding: 16px;
    border-top: 1px solid var(--border-default);
    background: var(--bg-subtle);
    animation: slideDown 0.3s var(--ease-out);
}

.assembly-item.collapsed .assembly-parts {
    display: none;
}

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

.assembly-part {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    margin-top: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    transition: all var(--duration-fast);
}

.assembly-part:hover {
    border-color: var(--brand-primary);
}

/* Parts Grid Layout */
.parts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
    padding: 16px 0;
    max-width: 100%;
}

.grid-part {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}

.grid-thumbnail {
    width: 140px;
    height: 140px;
    background: var(--bg-surface);
    border: 2px solid var(--border-default);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid-thumbnail:hover {
    border-color: var(--brand-primary);
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.grid-thumbnail canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.grid-thumbnail.empty {
    background: var(--bg-subtle);
}

.grid-count-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 700;
    background: var(--success);
    color: white;
    border-radius: var(--radius-full);
    z-index: 1;
}

.grid-part-name {
    margin-top: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.grid-part-info {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.grid-part-info span:first-child {
    color: var(--brand-primary);
    font-weight: 600;
}

/* Actieknopjes onder een onderdeel (→ inkoop / 🚩 melden / ✕) */
.grid-part-acts {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    opacity: 0;
    transition: opacity var(--duration-fast) var(--ease-out);
}

.grid-part:hover .grid-part-acts {
    opacity: 1;
}

.bd-act {
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 9px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-default);
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    white-space: nowrap;
}

.bd-act:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

.bd-flag:hover {
    background: var(--warning-soft);
    border-color: var(--warning);
    color: var(--warning);
}

.bd-x:hover {
    background: var(--error-soft);
    border-color: var(--error);
    color: var(--error);
}

/* ========================================
   Feedback-modal (onderdeel melden)
   ======================================== */

.feedback-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    animation: fadeIn 0.18s var(--ease-out);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.feedback-card {
    width: 100%;
    max-width: 460px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 24px;
    animation: cardEnter 0.28s var(--ease-out);
}

.feedback-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.feedback-head strong {
    font-size: 1.1rem;
}

.feedback-close {
    border: none;
    background: transparent;
    font-size: 1.1rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.feedback-close:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

.feedback-sub {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 18px;
}

.feedback-part-name {
    font-weight: 600;
    color: var(--text-primary);
}

.feedback-now {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.feedback-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 12px 0 6px;
}

.feedback-select,
.feedback-text {
    width: 100%;
    font-family: inherit;
    font-size: 0.95rem;
    padding: 10px 12px;
    background: var(--bg-subtle);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    outline: none;
    transition: all var(--duration-fast) var(--ease-out);
}

.feedback-text {
    resize: vertical;
    line-height: 1.5;
}

.feedback-select:focus,
.feedback-text:focus {
    border-color: var(--brand-primary);
    background: var(--bg-surface);
}

.feedback-text-error {
    border-color: var(--error);
}

.feedback-acts {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.feedback-done {
    text-align: center;
    padding: 24px 8px;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--success);
}

/* Subassembly in grid context */
.assembly-subassembly {
    margin-bottom: 16px;
}

.assembly-subassembly .subassembly-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    gap: 8px;
}

.assembly-subassembly .subassembly-children {
    display: none;
    padding-left: 20px;
    margin-top: 8px;
}

.assembly-subassembly.expanded .subassembly-children {
    display: block;
}

/* Legacy part-thumbnail (fallback) */
.part-thumbnail {
    width: 40px;
    height: 40px;
    min-width: 40px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
}

.part-thumbnail canvas {
    width: 100%;
    height: 100%;
}

.assembly-part .part-name {
    flex: 1;
    min-width: 0;
}

.assembly-part .part-pred {
    margin-left: auto;
}

.assembly-part.subassembly {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    background: transparent;
    border: none;
}

.subassembly-header {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.subassembly-children {
    display: none;
    padding-left: 16px;
}

.assembly-part.subassembly.expanded .subassembly-children {
    display: block;
}

.part-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.part-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: auto;
}

.part-pred {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
}

.part-pred .pred-item {
    color: var(--text-secondary);
}

.part-pred .pred-item:first-child {
    color: var(--brand-primary);
    font-weight: 600;
}

.count-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--success);
    color: white;
    border-radius: var(--radius-full);
    margin-left: 6px;
}

.count-badge-inline {
    color: var(--brand-primary);
    font-weight: 700;
    margin-left: 4px;
}

.assembly-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--bg-subtle);
}

/* Calc table assembly styling */
.assembly-header-row {
    background: var(--bg-subtle);
}

.assembly-header-row td {
    padding: 12px 16px !important;
    border-bottom: 2px solid var(--brand-primary) !important;
}

.assembly-part-row {
    background: rgba(37, 99, 235, 0.03);
}

.assembly-part-row td:first-child {
    padding-left: 32px !important;
}

[data-theme="dark"] .assembly-part-row {
    background: rgba(59, 130, 246, 0.05);
}

/* ========================================
   Stats Cards
   ======================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    transition: all var(--duration-fast) var(--ease-out);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--brand-gradient);
    opacity: 0;
    transition: opacity var(--duration-fast);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ========================================
   Calculation Table
   ======================================== */

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
}

.calc-table {
    width: 100%;
    border-collapse: collapse;
}

.calc-table th {
    padding: 14px 16px;
    text-align: left;
    background: var(--bg-subtle);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-default);
    white-space: nowrap;
}

.calc-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}

.calc-table tbody tr {
    transition: background var(--duration-fast);
}

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

.calc-table tbody tr:last-child td {
    border-bottom: none;
}

.calc-table .cell-name {
    font-weight: 600;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calc-table .cell-profile {
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--bg-subtle);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}

.calc-table .cell-number {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.calc-table .cell-price {
    text-align: right;
    font-weight: 700;
    color: var(--brand-primary);
    font-variant-numeric: tabular-nums;
}

.calc-table tfoot td {
    padding: 18px 16px;
    background: var(--bg-subtle);
    font-weight: 700;
    border-top: 2px solid var(--border-default);
}

.input-aantal {
    width: 80px;
    padding: 10px 12px;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
    background: var(--bg-surface);
    border: 2px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    transition: all var(--duration-fast);
    outline: none;
}

.input-aantal:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* ========================================
   Nesting
   ======================================== */

.nesting-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.nesting-tabs {
    display: flex;
    gap: 8px;
    background: var(--bg-subtle);
    padding: 4px;
    border-radius: var(--radius-md);
}

.nesting-tab {
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration-fast);
    color: var(--text-muted);
}

.nesting-tab:hover {
    color: var(--text-primary);
}

.nesting-tab.active {
    background: var(--bg-surface);
    color: var(--brand-primary);
    box-shadow: var(--shadow-sm);
}

.nesting-content {
    display: none;
    animation: sectionEnter 0.4s var(--ease-out);
}

.nesting-content.active {
    display: block;
}

.nesting-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.nesting-stat {
    background: var(--bg-subtle);
    padding: 24px;
    border-radius: var(--radius-md);
    text-align: center;
}

.nesting-stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.nesting-stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-top: 8px;
}

.materiaal-prijs-section {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
}

.materiaal-prijs-section label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.materiaal-prijs-input {
    width: 120px;
    padding: 10px 14px;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: right;
    background: var(--bg-surface);
    border: 2px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    outline: none;
    transition: all var(--duration-fast);
}

.materiaal-prijs-input:focus {
    border-color: var(--brand-primary);
}

.materiaal-totaal {
    margin-left: auto;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--brand-primary);
}

/* Buizen visualisatie */
.buizen-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.buis-row {
    display: grid;
    grid-template-columns: 100px 1fr 180px;
    align-items: center;
    gap: 20px;
    animation: fileEnter 0.4s var(--ease-out) forwards;
    opacity: 0;
}

.buis-row:nth-child(1) { animation-delay: 0ms; }
.buis-row:nth-child(2) { animation-delay: 80ms; }
.buis-row:nth-child(3) { animation-delay: 160ms; }
.buis-row:nth-child(4) { animation-delay: 240ms; }

.buis-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.buis-bar {
    position: relative;
    height: 48px;
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid var(--border-default);
}

.buis-item {
    position: absolute;
    top: 4px;
    height: calc(100% - 8px);
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-spring);
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.2), 0 2px 4px rgba(0,0,0,0.1);
}

.buis-item:hover {
    transform: scaleY(1.15);
    filter: brightness(1.1);
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.buis-rest {
    position: absolute;
    top: 4px;
    height: calc(100% - 8px);
    background: repeating-linear-gradient(
        45deg,
        var(--bg-muted),
        var(--bg-muted) 4px,
        var(--bg-subtle) 4px,
        var(--bg-subtle) 8px
    );
    border-radius: 4px;
    opacity: 0.6;
}

.buis-info {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* Tooltip */
.tooltip {
    position: fixed;
    display: none;
    padding: 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    max-width: 300px;
    font-size: 0.9rem;
    animation: tooltipEnter 0.2s var(--ease-out);
}

@keyframes tooltipEnter {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tooltip-thumb {
    width: 250px;
    height: 250px;
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    overflow: hidden;
}

.tooltip-thumb canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* ========================================
   Modal
   ======================================== */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: var(--shadow-xl);
    animation: modalEnter 0.4s var(--ease-out);
}

@keyframes modalEnter {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(16px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

.modal-header h2 {
    font-size: 1.25rem;
}

.modal-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--duration-fast);
}

.modal-close:hover {
    background: var(--bg-subtle);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-body h3 {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.modal-body h3:not(:first-child) {
    margin-top: 32px;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-default);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ========================================
   3D Viewer Modal
   ======================================== */

.viewer-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

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

.viewer-modal-content {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    width: 94%;
    max-width: 1600px;
    height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    animation: modalEnter 0.4s var(--ease-out);
}

.viewer-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border-default);
}

.viewer-modal-header span {
    font-weight: 700;
}

.viewer-modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--duration-fast);
}

.viewer-modal-close:hover {
    color: var(--text-primary);
}

.viewer-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
}

.viewer-modal-canvas {
    flex: 1 1 auto;      /* vult alle ruimte tussen header en info-balk */
    min-width: 0;
    min-height: 0;
    background: var(--bg-base);
}

.viewer-head-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.viewer-debug-btn {
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-default);
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.viewer-debug-btn:hover { background: var(--bg-muted); color: var(--text-primary); }
.viewer-debug-btn.active {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
}

/* Debug-zijpaneel */
.viewer-debug-panel {
    width: 320px;
    flex: none;
    background: var(--bg-subtle);
    border-left: 1px solid var(--border-default);
    padding: 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dbg-title { font-weight: 700; font-size: 1.05rem; }
.dbg-hint { font-size: 0.8rem; color: var(--text-muted); line-height: 1.4; }
.dbg-list { display: flex; flex-direction: column; gap: 10px; margin: 4px 0; }
.dbg-empty { font-size: 0.85rem; color: var(--text-muted); font-style: italic; }

.dbg-face, .dbg-group {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
}

.dbg-group.active {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px var(--brand-glow);
}

.dbg-group-head { display: flex; align-items: center; gap: 6px; }
.dbg-swatch { width: 14px; height: 14px; border-radius: 4px; flex: none; border: 1px solid rgba(0,0,0,0.2); }
.dbg-faces { font-size: 0.75rem; color: var(--text-muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dbg-face-head { display: flex; justify-content: space-between; align-items: center; }
.dbg-del {
    border: none; background: transparent; color: var(--text-muted);
    cursor: pointer; font-size: 0.9rem; padding: 2px 6px; border-radius: var(--radius-sm);
}
.dbg-del:hover { background: var(--error-soft); color: var(--error); }

.dbg-label, .dbg-note, .dbg-opm {
    width: 100%;
    font-family: inherit;
    font-size: 0.85rem;
    padding: 7px 9px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    outline: none;
}
.dbg-label:focus, .dbg-note:focus, .dbg-opm:focus { border-color: var(--brand-primary); }

.dbg-oplabel { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); margin-top: 4px; }
.dbg-opm { resize: vertical; }

.dbg-acts { display: flex; gap: 8px; margin-top: auto; padding-top: 10px; }
.dbg-acts .btn { flex: 1; }

.dbg-done { text-align: center; padding: 30px 8px; font-weight: 600; color: var(--success); }

@media (max-width: 820px) {
    .viewer-modal-body { flex-direction: column; }
    .viewer-debug-panel { width: auto; border-left: none; border-top: 1px solid var(--border-default); max-height: 40%; }
}

.viewer-modal-info {
    padding: 14px 24px;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: var(--bg-subtle);
    border-top: 1px solid var(--border-default);
}

/* ========================================
   Loading Overlay
   ======================================== */

.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

[data-theme="dark"] .loading-overlay {
    background: rgba(3, 7, 18, 0.95);
}

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

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 56px;
    height: 56px;
    border: 3px solid var(--border-default);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

.loading-text {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.progress-bar {
    width: 280px;
    height: 6px;
    background: var(--bg-muted);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--brand-gradient);
    width: 0%;
    transition: width 0.3s var(--ease-out);
    border-radius: var(--radius-full);
}

/* ========================================
   Offerte Preview
   ======================================== */

.offerte-section {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    overflow: hidden;
}

.offerte-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 28px;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border-default);
}

.offerte-form {
    padding: 28px;
    border-bottom: 1px solid var(--border-default);
}

.offerte-form h3 {
    font-size: 1rem;
    margin-bottom: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.offerte-preview {
    padding: 48px;
    background: white;
    color: #0f172a;
}

@media print {
    .offerte-preview {
        padding: 24px;
    }
}

.offerte-document {
    max-width: 800px;
    margin: 0 auto;
    font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
}

.offerte-doc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 48px;
    padding-bottom: 32px;
    border-bottom: 3px solid #2563eb;
}

.offerte-company-name {
    font-size: 1.75rem;
    font-weight: 800;
    color: #2563eb;
    margin-bottom: 8px;
}

.offerte-company-details {
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1.6;
}

.offerte-title {
    text-align: right;
}

.offerte-title h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.offerte-number {
    color: #64748b;
    font-size: 0.95rem;
    font-weight: 500;
}

.offerte-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    margin-bottom: 48px;
}

.offerte-meta-section h3 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    margin-bottom: 12px;
}

.offerte-meta-section p {
    margin: 6px 0;
    color: #0f172a;
}

.offerte-meta-section strong {
    font-weight: 700;
}

.offerte-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 32px;
}

.offerte-table th {
    padding: 14px 16px;
    text-align: left;
    background: #f1f5f9;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    border-bottom: 2px solid #e2e8f0;
}

.offerte-table td {
    padding: 16px;
    border-bottom: 1px solid #e2e8f0;
    color: #0f172a;
}

.offerte-table .text-right {
    text-align: right;
}

.offerte-table tfoot td {
    font-weight: 600;
    background: #f8fafc;
}

.offerte-table .total-row td {
    font-size: 1.1rem;
    font-weight: 700;
    border-top: 2px solid #0f172a;
    background: #f1f5f9;
}

.offerte-summary {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 48px;
}

.offerte-summary-box {
    width: 300px;
    background: #f1f5f9;
    border-radius: 12px;
    padding: 24px;
}

.offerte-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.95rem;
}

.offerte-summary-row:last-child {
    border-bottom: none;
    padding-top: 16px;
    margin-top: 8px;
    font-size: 1.35rem;
    font-weight: 800;
    color: #2563eb;
}

.offerte-footer {
    margin-top: 64px;
    padding-top: 32px;
    border-top: 1px solid #e2e8f0;
}

.offerte-terms h4 {
    font-size: 0.875rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 12px;
}

.offerte-terms ul {
    margin: 0;
    padding-left: 20px;
    color: #64748b;
    font-size: 0.9rem;
}

.offerte-terms li {
    margin: 6px 0;
}

/* ========================================
   Utilities
   ======================================== */

.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 768px) {
    .header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .header-left {
        width: 100%;
        justify-content: space-between;
    }
    
    .header-nav {
        width: 100%;
        order: 3;
    }
    
    .nav-tab {
        flex: 1;
        text-align: center;
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .main-content {
        padding: 16px;
    }
    
    .card-header, .card-body {
        padding: 20px;
    }
    
    .buis-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .buis-label {
        font-size: 0.8rem;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .offerte-meta {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .nesting-stats {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    body {
        background: white;
        color: black;
    }
    
    .header,
    .offerte-header-bar,
    .offerte-form,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        max-width: none;
        padding: 0;
    }
    
    .offerte-section {
        border: none;
        box-shadow: none;
    }
}

/* ---------------------------------------------------------------------------
   Tegel-layout upload (2026-07-14): geen bestandsrijen/categorie-secties meer.
   Eén kopbalk voor het actieve bestand + één tegel-grid; elke tegel gaat van
   snel voorbeeld (gestippeld) naar herkend (categorie-badge + maat + acties). */
.file-headbar {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 14px; margin-top: 20px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
}
.file-headbar-name {
    font-weight: 600; color: var(--text-primary);
    max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-headbar-meta { color: var(--text-muted); font-size: 0.8rem; flex: 1; }
.file-headbar .file-aantal { display: flex; align-items: center; gap: 8px; }
.file-headbar .form-label { margin: 0; }
.bd-cat-badge {
    margin-top: 8px; display: inline-flex; align-items: center; gap: 4px;
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
    color: var(--text-secondary); background: var(--bg-subtle);
    border: 1px solid var(--border-default); border-radius: var(--radius-full);
    padding: 3px 10px; max-width: 150px; white-space: nowrap;
}
.grid-part.bd-pending .grid-thumbnail { opacity: 0.65; border-style: dashed; }
.grid-part.bd-pending .bd-cat-badge { border-style: dashed; color: var(--text-muted); }


/* Voortgangsbalk bij importeren: uploaden (bestand x/n) + herkennen (onderdeel x/totaal) */
.upload-progress { margin-top: 16px; }
.upload-progress-text {
    font-size: 0.8rem; font-weight: 600; color: var(--text-secondary);
    margin-bottom: 6px; display: flex; justify-content: space-between;
}
.upload-progress-track {
    height: 8px; border-radius: var(--radius-full);
    background: var(--bg-subtle); border: 1px solid var(--border-default);
    overflow: hidden;
}
.upload-progress-fill {
    height: 100%; width: 0%;
    background: var(--brand-gradient, var(--brand-primary));
    border-radius: var(--radius-full);
    transition: width 0.25s ease-out;
}
.upload-progress.klaar .upload-progress-fill { background: var(--success); }


/* Tegel-extra's: aantal-invoer in de tegel + herkomst-regel bij assembly-onderdelen */
.grid-aantal {
    display: inline-flex; align-items: center; gap: 6px; margin-top: 6px;
    font-size: 0.72rem; color: var(--text-muted);
}
.grid-aantal label { font-weight: 600; }
.grid-aantal .input-aantal-tegel {
    width: 56px; padding: 3px 6px; font-size: 0.8rem; text-align: center;
    border: 1px solid var(--border-default); border-radius: var(--radius-sm);
    background: var(--bg-surface); color: var(--text-primary);
}
.grid-part-sub {
    margin-top: 4px; font-size: 0.7rem; color: var(--text-muted);
    max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
