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

:root {
    --primary: #7B5EA7;
    --primary-dark: #6A4E96;
    --secondary: #9C27B0;
    --success: #4CAF50;
    --warning: #FFA500;
    --error: #F44336;
    --bg: #F5F5F5;
    --card-bg: #FFFFFF;
    --text: #212121;
    --text-secondary: #757575;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
    --shadow-modal: 0 8px 32px rgba(0,0,0,0.2);
    --radius: 12px;
    --radius-sm: 8px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

    /* Hulpvariabelen */
    --surface:    #FFFFFF;
    --border:     #E0E0E0;
    --muted:      #757575;
    --delete:     #F44336;

    /* Techniek-kleuren */
    --crochet:    #E91E63;
    --sewing:     #2196F3;
    --embroidery: #4CAF50;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ===== Header ===== */
.header {
    background: var(--primary);
    color: white;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: white;
}

.header h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

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

.back-link {
    color: white;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 44px;
}

.back-link:hover { opacity: 0.9; }

/* ===== User Menu ===== */
.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: white;
    cursor: pointer;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.4);
    flex-shrink: 0;
    transition: border-color 0.2s;
}

.user-avatar:hover { border-color: rgba(255,255,255,0.8); }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-modal);
    min-width: 200px;
    z-index: 200;
    overflow: hidden;
    animation: slideUp 0.15s;
}

.user-dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid #E0E0E0;
}

.user-dropdown-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--text);
}

.user-dropdown-email {
    font-size: 13px;
    color: var(--text-secondary);
}

.user-dropdown a,
.user-dropdown button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    font-size: 15px;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
}

.user-dropdown a:hover,
.user-dropdown button:hover {
    background: #F5F5F5;
}

.user-dropdown .logout-btn {
    color: var(--error);
    border-top: 1px solid #E0E0E0;
}

/* ===== Container ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 44px;
    min-width: 44px;
    text-decoration: none;
    font-family: var(--font);
}

.btn-primary {
    background: white;
    color: var(--primary);
}
.btn-primary:hover { background: rgba(255,255,255,0.9); }

.btn-action {
    background: var(--primary);
    color: white;
}
.btn-action:hover { background: var(--primary-dark); }

.btn-secondary {
    background: var(--primary);
    color: white;
}
.btn-secondary:hover { background: var(--primary-dark); }

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

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: white; }

.btn-ghost {
    background: transparent;
    color: white;
    opacity: 0.85;
}
.btn-ghost:hover { opacity: 1; background: rgba(255,255,255,0.15); }

.btn-sm {
    padding: 6px 14px;
    font-size: 14px;
    min-height: 36px;
}

.btn-full { width: 100%; }

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    font-size: 18px;
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    color: var(--text-secondary);
    font-family: var(--font);
}

.btn-icon:hover { background: rgba(0,0,0,0.05); }
.btn-icon.danger:hover { background: rgba(244,67,54,0.1); color: var(--error); }

/* ===== View Switcher ===== */
.view-switcher {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    padding: 4px;
    box-shadow: var(--shadow);
}

.view-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    min-height: 44px;
    color: var(--text-secondary);
    font-family: var(--font);
}

.view-btn.active {
    background: var(--primary);
    color: white;
}

.view-content { display: none; }
.view-content.active { display: block; }

/* ===== Craft Filter ===== */
.craft-filter {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
}

.craft-filter::-webkit-scrollbar { display: none; }

.craft-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 2px solid #E0E0E0;
    border-radius: 24px;
    background: var(--card-bg);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    min-height: 44px;
    color: var(--text-secondary);
    font-family: var(--font);
}

.craft-filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.craft-filter-btn.active {
    color: white;
    border-color: var(--craft-color, var(--primary));
    background: var(--craft-color, var(--primary));
}

/* ===== Craft Badge ===== */
.craft-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: color-mix(in srgb, var(--craft-color, var(--primary)) 12%, white);
    color: var(--craft-color, var(--primary));
    border: 1px solid color-mix(in srgb, var(--craft-color, var(--primary)) 25%, transparent);
}

/* ===== Status Filter ===== */
.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
}

.filter-bar::-webkit-scrollbar { display: none; }

.filter-btn {
    padding: 8px 20px;
    border: 2px solid #E0E0E0;
    border-radius: 24px;
    background: var(--card-bg);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    min-height: 44px;
    color: var(--text-secondary);
    font-family: var(--font);
}

.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ===== Search ===== */
.search-bar { margin-bottom: 16px; }

.search-input {
    width: 100%;
    max-width: 600px;
    padding: 12px 16px;
    border: 2px solid #E0E0E0;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-family: var(--font);
    transition: border-color 0.2s;
    background: var(--card-bg);
}

.search-input:focus { outline: none; border-color: var(--primary); }

/* ===== Feed ===== */
.feed-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 600px;
    margin: 0 auto;
}

.feed-item {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.feed-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
}

.feed-header:hover { background: #FAFAFA; }

.feed-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.feed-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #EDE7F6, #E8EAF6);
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.feed-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.feed-user-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.feed-project-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.feed-date {
    font-size: 13px;
    color: var(--text-secondary);
}

.feed-craft-badge { margin-left: auto; flex-shrink: 0; }

.feed-photo img {
    width: 100%;
    display: block;
    max-height: 500px;
    object-fit: cover;
    cursor: pointer;
}

.feed-text {
    padding: 12px 16px;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    white-space: pre-wrap;
}

.feed-footer {
    padding: 8px 16px 12px;
    border-top: 1px solid #EEEEEE;
    display: flex;
    align-items: center;
}

.like-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 15px;
    color: var(--text-secondary);
    transition: all 0.2s;
    min-height: 36px;
    font-family: var(--font);
}

.like-btn:hover { background: #FCE4EC; color: #E91E63; }
.like-btn.liked { color: #E91E63; }
.like-btn.liked i { transform: scale(1.1); }
.like-icon { font-size: 18px; transition: transform 0.2s; }
.like-count { font-weight: 600; font-size: 14px; min-width: 8px; }

/* ===== Project Grid ===== */
.project-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 768px) {
    .project-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1025px) {
    .project-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ===== Project Card ===== */
.project-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

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

.card-craft-stripe {
    height: 4px;
    background: var(--craft-color, var(--primary));
}

.card-thumbnail {
    width: 100%;
    aspect-ratio: 16/9;
    max-height: 200px;
    object-fit: cover;
    background: #E0E0E0;
    display: block;
}

.card-placeholder {
    width: 100%;
    aspect-ratio: 16/9;
    max-height: 200px;
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--craft-color, var(--primary)) 15%, white),
        color-mix(in srgb, var(--craft-color, var(--primary)) 8%, white));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

.card-body { padding: 16px; }

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

.card-date {
    font-size: 13px;
    color: var(--text-secondary);
}

.card-author {
    font-size: 13px;
    color: var(--text-secondary);
}

.card-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.project-card:hover .card-actions { opacity: 1; }

.card-actions .btn-icon {
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(4px);
    color: var(--text);
}

/* ===== Status Badge ===== */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.in_progress  { background: var(--warning); }
.status-badge.completed    { background: var(--success); }
.status-badge.planned      { background: #2196F3; }
.status-badge.on_hold      { background: var(--text-secondary); }

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 64px 16px;
    color: var(--text-secondary);
}

.empty-state p { margin-bottom: 16px; font-size: 18px; }

.empty-state-small {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-secondary);
}

.empty-state-sub {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ===== Project Detail ===== */
.project-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.project-title {
    font-size: 26px;
    font-weight: 700;
    flex: 1;
    min-width: 200px;
    outline: none;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s;
    padding: 4px 0;
}

.project-title:focus,
.project-title[contenteditable="true"] {
    border-bottom-color: var(--primary);
}

.status-select {
    padding: 8px 16px;
    border: 2px solid #E0E0E0;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    background: var(--card-bg);
    cursor: pointer;
    min-height: 44px;
    font-family: var(--font);
}

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

/* ===== Tabs ===== */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #E0E0E0;
    margin-bottom: 24px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    touch-action: pan-x;
}

.tabs::-webkit-scrollbar { display: none; }

.tab-btn {
    padding: 12px 20px;
    border: none;
    background: none;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: all 0.2s;
    min-height: 44px;
    font-family: var(--font);
}

.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== Sections ===== */
.section { margin-bottom: 32px; }

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.section-header h2 { font-size: 20px; font-weight: 600; }
.section-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== Cover Photo ===== */
.cover-photo {
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    margin-bottom: 24px;
}

.cover-photo img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    display: block;
}

/* ===== Cost Summary ===== */
.costs-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
}

.cost-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #E0E0E0;
}

.cost-item:last-child { border-bottom: none; }
.cost-label { font-size: 15px; color: var(--text-secondary); }
.cost-value { font-size: 15px; font-weight: 600; }

.cost-total .cost-label,
.cost-total .cost-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

/* ===== Tables ===== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table th {
    background: #F5F5F5;
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.data-table td {
    padding: 12px 16px;
    font-size: 14px;
    border-top: 1px solid #EEEEEE;
}

.data-table tr:hover { background: #FAFAFA; }
.table-actions { display: flex; gap: 4px; white-space: nowrap; }

/* ===== Stitch Counters ===== */
.counters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.counter-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    text-align: center;
}

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

.counter-name { font-size: 15px; font-weight: 600; }
.counter-actions { display: flex; gap: 2px; }

.counter-actions .btn-icon {
    min-height: 32px;
    min-width: 32px;
    padding: 4px;
    font-size: 14px;
}

.counter-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.counter-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 24px;
    background: #F5F5F5;
    color: var(--text);
    border: 2px solid #E0E0E0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font);
}

.counter-btn-plus {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.counter-btn:active { transform: scale(0.9); }

.counter-value {
    font-size: 36px;
    font-weight: 700;
    min-width: 60px;
    font-variant-numeric: tabular-nums;
}

/* ===== Progress Timeline ===== */
.progress-timeline {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.timeline-item {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    position: relative;
}

.timeline-date {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
}

.timeline-photo {
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 8px;
    cursor: pointer;
}

.timeline-photo img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    display: block;
    transition: transform 0.2s;
}

.timeline-photo:hover img { transform: scale(1.02); }

.timeline-text {
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    white-space: pre-wrap;
}

.timeline-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

.timeline-delete {
    position: absolute;
    top: 8px;
    right: 8px;
}

/* ===== Pattern ===== */
.upload-cta {
    text-align: center;
    padding: 48px;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 2px dashed #E0E0E0;
}

.upload-cta p { margin-bottom: 16px; color: var(--text-secondary); }

.pattern-info {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.pattern-name { font-size: 16px; font-weight: 600; }
.pattern-actions { display: flex; gap: 8px; }

/* ===== PDF Viewer ===== */
.pdf-viewer { margin-top: 16px; }

.pdf-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px;
    background: var(--card-bg);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 56px;
    z-index: 10;
}

.pdf-page-info,
.pdf-zoom-info {
    font-size: 14px;
    font-weight: 500;
    min-width: 60px;
    text-align: center;
}

.pdf-canvas-wrapper {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    background: #E0E0E0;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    text-align: center;
    padding: 16px;
    max-height: 75vh;
}

.pdf-canvas-wrapper canvas { display: inline-block; }

/* ===== Notes ===== */
.notes-textarea {
    width: 100%;
    min-height: 300px;
    padding: 16px;
    border: 2px solid #E0E0E0;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-family: var(--font);
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s;
    background: var(--card-bg);
}

.notes-textarea:focus { outline: none; border-color: var(--primary); }

.notes-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

/* ===== Tool Panel ===== */
.tool-panel {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    border-left: 4px solid var(--primary);
}

.tool-panel h3 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--primary);
}

.tool-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.tool-result {
    background: #F3E5F5;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
    margin-top: 12px;
}

.tool-result.crochet { background: color-mix(in srgb, var(--crochet) 12%, white); color: var(--crochet); }
.tool-result.sewing  { background: color-mix(in srgb, var(--sewing)  12%, white); color: var(--sewing); }
.tool-result.embroidery { background: color-mix(in srgb, var(--embroidery) 12%, white); color: var(--embroidery); }

/* DMC kleurentabel */
.dmc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.dmc-swatch {
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s;
    border: 2px solid transparent;
}

.dmc-swatch:hover { transform: scale(1.05); border-color: var(--primary); }

.dmc-color {
    height: 44px;
}

.dmc-label {
    padding: 4px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    background: white;
    color: var(--text);
}

/* ===== Hooks/Chips list ===== */
.chips-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--card-bg);
    border-radius: 24px;
    box-shadow: var(--shadow);
    font-size: 14px;
}

.chip-item .chip-main { font-weight: 600; }
.chip-item .chip-sub  { color: var(--text-secondary); font-size: 13px; }

.chip-item .btn-icon {
    min-height: 28px;
    min-width: 28px;
    padding: 2px;
    font-size: 13px;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
    animation: fadeIn 0.2s;
}

.modal-overlay.keyboard-open {
    position: absolute;
    bottom: auto;
    min-height: 100%;
}

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

.modal {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-modal);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.2s;
}

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

.modal-header {
    padding: 20px 24px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 { font-size: 20px; font-weight: 600; }
.modal-body { padding: 16px 24px; }
.modal-footer {
    padding: 0 24px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #E0E0E0;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-family: var(--font);
    transition: border-color 0.2s;
    background: var(--card-bg);
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-error {
    color: var(--error);
    font-size: 14px;
    margin-bottom: 12px;
    padding: 10px 12px;
    background: #FFEBEE;
    border-radius: var(--radius-sm);
}

.input-prefix {
    position: relative;
}

.input-prefix::before {
    content: attr(data-prefix);
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 16px;
}

.input-prefix input { padding-left: 28px; }

/* ===== Lightbox ===== */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.92);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: white;
    font-size: 36px;
    cursor: pointer;
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-hover);
    animation: slideInRight 0.3s, fadeOut 0.3s 2.7s;
    max-width: 320px;
}

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

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

.toast.success { background: var(--success); }
.toast.error   { background: var(--error); }
.toast.info    { background: var(--primary); }

/* ===== Loading ===== */
.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #E0E0E0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
}

/* ===== Confirm Dialog ===== */
.confirm-text {
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    margin-bottom: 8px;
}

/* ===== Login Page ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #7B5EA7 0%, #5E35B1 50%, #4527A0 100%);
    padding: 24px 16px;
}

.login-container {
    width: 100%;
    max-width: 440px;
}

.login-logo {
    text-align: center;
    margin-bottom: 24px;
    color: white;
}

.login-logo-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 8px;
}

.login-logo h1 {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 4px;
}

.login-logo p {
    font-size: 15px;
    opacity: 0.85;
}

.login-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 16px 48px rgba(0,0,0,0.25);
    overflow: hidden;
}

.login-tabs {
    display: flex;
    background: #F5F5F5;
    border-bottom: 1px solid #E0E0E0;
}

.login-tab {
    flex: 1;
    padding: 14px;
    border: none;
    background: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    font-family: var(--font);
    min-height: 48px;
}

.login-tab.active {
    background: white;
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

.login-form { padding: 24px; }

.password-wrapper {
    position: relative;
}

.password-wrapper input { padding-right: 48px; }

.btn-show-password {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    color: var(--text-secondary);
}

/* ===== Account Page ===== */
.account-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 768px) {
    .account-layout {
        grid-template-columns: 240px 1fr;
    }
}

.account-sidebar {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.account-sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    text-decoration: none;
    color: var(--text);
    font-size: 15px;
    font-weight: 500;
    transition: background 0.15s;
    border-left: 3px solid transparent;
}

.account-sidebar nav a:hover { background: #F5F5F5; }
.account-sidebar nav a.active { border-left-color: var(--primary); color: var(--primary); background: #F3E5F5; }

.account-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
}

.account-content h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #E0E0E0;
}

.avatar-upload {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.avatar-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, #EDE7F6, #E8EAF6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    flex-shrink: 0;
    border: 3px solid #E0E0E0;
}

.avatar-preview img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

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

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-number {
    font-size: 36px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.admin-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 28px;
    overflow: hidden;
}

.admin-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #E0E0E0;
}

.admin-section-header h2 {
    font-size: 18px;
    font-weight: 700;
}

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

.admin-table th {
    padding: 12px 20px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: #F9F9F9;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.admin-table td {
    padding: 14px 20px;
    font-size: 14px;
    border-top: 1px solid #EEEEEE;
}

.admin-table tr:hover { background: #FAFAFA; }

.admin-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    background: #7B5EA7;
    color: white;
}

/* ===== Mobile ===== */
@media (max-width: 767px) {
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .modal {
        border-radius: var(--radius) var(--radius) 0 0;
        max-height: 85vh;
    }

    .header h1 { font-size: 19px; }
    .project-title { font-size: 22px; }
    .card-actions { opacity: 1; }

    .toast-container { bottom: 16px; left: 16px; right: 16px; }
    .toast { max-width: none; }

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

    /* Card-based tables on mobile */
    .data-table thead { display: none; }

    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100%;
    }

    .data-table { background: none; box-shadow: none; }

    .data-table tr {
        background: var(--card-bg);
        border-radius: var(--radius-sm);
        box-shadow: var(--shadow);
        padding: 12px 16px;
        margin-bottom: 12px;
    }

    .data-table td {
        padding: 4px 0;
        border: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .data-table td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 13px;
        color: var(--text-secondary);
        margin-right: 12px;
        flex-shrink: 0;
    }

    .data-table td:last-child {
        justify-content: flex-end;
        padding-top: 8px;
        border-top: 1px solid #EEE;
        margin-top: 4px;
    }

    .data-table td:last-child::before { display: none; }
    .table-responsive { overflow-x: visible; }

    .admin-table thead { display: none; }
    .admin-table,
    .admin-table tbody,
    .admin-table tr,
    .admin-table td { display: block; }
    .admin-table td { padding: 6px 16px; }
}

@media (min-width: 1025px) {
    .header h1 { font-size: 26px; }
    .container { padding: 24px; }
}

/* ===== Project Detail ===== */
.project-header { margin-bottom: 20px; }
.project-header-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.project-header-badges { display: flex; align-items: center; gap: 10px; }
.btn-back { font-size: .85rem; color: var(--primary); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.btn-back:hover { text-decoration: underline; }
.project-title-row { display: flex; align-items: center; gap: 10px; }
.project-title { font-size: 1.4rem; font-weight: 700; flex: 1; min-width: 0; word-break: break-word; }
.project-title[contenteditable="true"] { outline: 2px solid var(--primary); border-radius: 4px; padding: 2px 6px; }
.project-meta { display: flex; align-items: center; gap: 16px; margin-top: 6px; font-size: .85rem; color: var(--muted); flex-wrap: wrap; }
.project-cost::before { content: '💰 '; }
.project-cost { color: var(--primary); font-weight: 600; }
.cover-section { margin-bottom: 8px; }
.cover-section .cover-upload-btn { margin-top: 8px; }

/* ===== Module-specifieke lijsten ===== */
.empty-state-inline { color: var(--muted); font-size: .9rem; padding: 12px 0; text-align: center; }
.hooks-list, #embFabricList, #embHoopsList, .measurements-list { display: flex; flex-direction: column; gap: 8px; }
.hook-item, .hoop-item, .fabric-item, .measurement-item {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    background: var(--bg); border-radius: 8px; padding: 10px 12px; font-size: .9rem;
}
.hook-size, .hoop-item > span:first-child { font-weight: 600; min-width: 56px; }
.measurement-label { font-weight: 600; min-width: 100px; }
.measurement-value { color: var(--primary); font-weight: 700; }
.measurement-item { align-items: flex-start; }

/* ===== Counters grid ===== */
.counters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }

/* ===== Kleurswatches ===== */
.color-swatch {
    display: inline-block; width: 22px; height: 22px; border-radius: 50%;
    border: 2px solid #0002; vertical-align: middle;
}
.dmc-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 8px; background: var(--bg); border-radius: 8px; font-size: .78rem; text-align: center; }
.dmc-swatch { display: block; width: 36px; height: 36px; border-radius: 50%; border: 2px solid #0002; }
.dmc-nr { font-weight: 700; font-size: .8rem; }
.dmc-name { color: var(--muted); }

/* ===== Gereedschap ===== */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 12px; }
.tool-desc { color: var(--muted); font-size: .875rem; margin-bottom: 12px; }
.tool-result { background: var(--bg); border-radius: 8px; padding: 12px 16px; margin-top: 12px; font-size: .9rem; line-height: 1.6; }
.size-table-wrap { overflow-x: auto; }
.size-table { font-size: .8rem; }

/* ===== Account pagina ===== */
.account-avatar { width: 80px; height: 80px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 700; overflow: hidden; }
.account-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.account-avatar-section { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }

/* ===== Token items ===== */
.token-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; background: var(--bg); border-radius: 8px; margin-bottom: 8px; }
.token-info { display: flex; flex-direction: column; gap: 2px; font-size: .875rem; }
.token-display { background: #1e1e2e; border-radius: 8px; padding: 12px; margin: 12px 0; }
.token-display code { color: #cdd6f4; font-size: .8rem; word-break: break-all; }

/* ===== Admin badges ===== */
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: .75rem; font-weight: 600; }
.badge-admin { background: #ede8f5; color: var(--primary); }
.user-avatar-sm { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: .85rem; font-weight: 700; overflow: hidden; flex-shrink: 0; }
.user-avatar-sm img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* ===== Patroon upload ===== */
.pattern-upload-bar { padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }

/* ===== Notes ===== */
.notes-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; font-size: .8rem; color: var(--muted); }
.notes-textarea { width: 100%; min-height: 320px; padding: 14px; border: 1px solid var(--border); border-radius: 8px; font-size: .9rem; font-family: inherit; line-height: 1.7; resize: vertical; }
.notes-textarea:focus { outline: none; border-color: var(--primary); }

/* ===== Danger zone ===== */
.danger-zone { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); }

/* ===== Status select in project header ===== */
.status-select { border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; font-size: .85rem; background: var(--surface); color: var(--text); cursor: pointer; }

/* ===== Required marker ===== */
.required { color: var(--delete); }

/* ===== Generieke card ===== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}

/* Admin-secties: geen card-padding, tabel loopt tot aan de rand */
.admin-section.card {
    padding: 0;
}
.admin-section > .section-header {
    padding: 20px 24px;
    margin-bottom: 0;
    border-bottom: 1px solid #e0e0e0;
}
.admin-section > .section-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
}
.admin-section > .search-bar {
    padding: 14px 24px 6px;
}

/* Account-secties: gewone card-padding */
.account-section {
    margin-bottom: 24px;
}
.account-section h2 {
    margin-bottom: 20px;
    font-size: 1.1rem;
}

/* ===== Iconoir icon alignment ===== */
[class*="iconoir-"] {
    vertical-align: -0.15em;
}

/* Headings that contain icons: align icon + text vertically */
h2:has([class*="iconoir-"]),
h3:has([class*="iconoir-"]) {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Section-header h3 already in a flex row — reset to inline-flex to not break layout */
.section-header h3:has([class*="iconoir-"]) {
    display: inline-flex;
}

