/**
 * Daily Overview - Dag-gecentreerde email weergave
 * Kalme, overzichtelijke layout voor digibeten
 * Status via subtiele kleur aan linkerkant van cards
 */

/* === PAGINA BASIS === */
.daily-overview-page {
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #f8f7f5 0%, #f3f1ed 100%);
    min-height: 100vh;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: #1c1917;
}

/* Bij open canvas: voorkom scroll van de pagina achter de grid */
.daily-overview-page.canvas-open {
    overflow: hidden;
}

/* === HEADER === */
.daily-header {
    background: #fff;
    border-bottom: 1px solid #e7e5e4;
    padding: 12px 20px;
}

.daily-header-inner {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.back-link {
    color: #78716c;
    text-decoration: none;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.15s;
}

.back-link:hover {
    background: #f5f5f4;
    color: #1c1917;
}

.daily-title {
    flex: 1;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.daily-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.status-guide-link {
    color: #57534e;
    text-decoration: none;
    border: 1px solid #d6d3d1;
    background: #fafaf9;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1;
}

.status-guide-link:hover {
    background: #f5f5f4;
    color: #292524;
}

.status-legend {
    max-width: 1600px;
    margin: 10px auto 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 16px;
    color: #57534e;
    font-size: 12px;
}

.legend-title {
    font-weight: 600;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    display: inline-block;
}

.legend-dot.action_needed { background: #d14343; }
.legend-dot.in_progress { background: #a97315; }
.legend-dot.waiting { background: #6366f1; }
.legend-dot.completed { background: #15803d; }

.status-guide-content {
    max-width: 1600px;
    margin: 16px auto 0;
    display: grid;
    gap: 12px;
}

.status-guide-content.status-guide-large {
    gap: 20px;
    margin: 24px auto 40px;
    padding: 0 24px;
}

.status-guide-card {
    background: #fff;
    border: 1px solid #e7e5e4;
    border-radius: 10px;
    padding: 14px;
}

.status-guide-large .status-guide-card {
    padding: 28px 32px;
}

.status-guide-card h2 {
    font-size: 16px;
    margin-bottom: 8px;
}

.status-guide-large .status-guide-card h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 12px;
    color: #1c1917;
}

.status-guide-large .status-guide-card h3 {
    font-size: 18px;
    font-weight: 600;
    margin-top: 20px;
    margin-bottom: 10px;
    color: #292524;
}

.status-guide-card p {
    color: #57534e;
    margin-bottom: 10px;
    font-size: 13px;
}

.status-guide-large .status-guide-card p {
    font-size: 16px;
    line-height: 1.6;
    color: #44403c;
    margin-bottom: 16px;
}

.status-guide-list {
    list-style: none;
    padding: 0;
    display: grid;
    gap: 10px;
    font-size: 16px;
    line-height: 1.6;
    color: #292524;
}

.status-guide-numbered {
    list-style: decimal;
    padding-left: 24px;
}

.status-guide-faq {
    font-size: 16px;
    line-height: 1.6;
    color: #292524;
}

.status-guide-faq dt {
    font-weight: 700;
    margin-top: 16px;
    color: #1c1917;
}

.status-guide-faq dt:first-child {
    margin-top: 0;
}

.status-guide-faq dd {
    margin-left: 0;
    margin-bottom: 4px;
    color: #44403c;
}

.status-guide-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.status-guide-large .status-guide-table {
    font-size: 16px;
}

.status-guide-table th,
.status-guide-table td {
    border-top: 1px solid #f1f0ee;
    padding: 10px 8px;
    vertical-align: top;
    text-align: left;
}

.status-guide-large .status-guide-table th,
.status-guide-large .status-guide-table td {
    padding: 14px 12px;
}

.status-guide-large .status-guide-table td:first-child {
    white-space: nowrap;
}

.status-guide-table th {
    color: #57534e;
    font-weight: 600;
    font-size: 12px;
    border-top: none;
}

.status-guide-large .status-guide-table th {
    font-size: 14px;
    color: #78716c;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid transparent;
}

.status-guide-large .status-pill {
    padding: 6px 14px;
    font-size: 15px;
}

.status-guide-large .wis-status-badge {
    font-size: 15px;
    padding: 6px 14px;
}

.status-guide-large .order-progress-chip {
    font-size: 14px;
    padding: 5px 12px;
}

.status-pill.action_needed {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}

.status-pill.in_progress {
    background: #fff7ed;
    color: #9a3412;
    border-color: #fed7aa;
}

.status-pill.waiting {
    background: #eef2ff;
    color: #4338ca;
    border-color: #c7d2fe;
}

.status-pill.completed {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

.status-guide-scenarios {
    list-style: none;
    display: grid;
    gap: 10px;
    font-size: 16px;
    color: #292524;
}

.status-guide-scenarios li {
    border-top: 1px solid #f5f5f4;
    padding-top: 8px;
}

.status-guide-scenarios li:first-child {
    border-top: none;
    padding-top: 0;
}

.phone-intake-bar {
    max-width: 1600px;
    margin: 12px auto 0;
    background: #fafaf9;
    border: 1px solid #c8c3bc;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.phone-intake-field label.phone-intake-section-title {
    font-size: 15px;
    font-weight: 700;
    color: #1c1917;
}

.phone-intake-row {
    display: grid;
    grid-template-columns: minmax(260px, 2fr) minmax(160px, 1fr) minmax(220px, 1.2fr);
    gap: 10px;
    align-items: end;
}

.phone-intake-row.phone-intake-row-search {
    grid-template-columns: 1fr;
}

.phone-intake-row.phone-intake-row-details {
    grid-template-columns: 1fr;
}

.phone-intake-row.phone-intake-row-message {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 12px;
}

.phone-intake-row.phone-intake-row-message .phone-intake-field {
    min-height: 0;
}

.phone-intake-row.phone-intake-row-message .phone-intake-field textarea {
    min-height: 120px;
    flex: 1;
}

.phone-intake-field {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.phone-intake-field label {
    font-size: 12px;
    color: #57534e;
}

.phone-intake-field input,
.phone-intake-field select,
.phone-intake-field textarea {
    width: 100%;
    border: 1px solid #d6d3d1;
    border-radius: 8px;
    background: #fff;
    color: #1c1917;
    font-size: 13px;
    padding: 8px 10px;
    font-family: inherit;
}

.phone-intake-field textarea {
    min-height: 72px;
    resize: vertical;
}

.phone-intake-field input:focus,
.phone-intake-field select:focus,
.phone-intake-field textarea:focus {
    outline: none;
    border-color: #a8a29e;
}

.phone-intake-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    background: #fff;
    border: 1px solid #e7e5e4;
    border-radius: 8px;
    box-shadow: 0 8px 18px rgba(28, 25, 23, 0.08);
    z-index: 20;
    max-height: 220px;
    overflow-y: auto;
}

.phone-intake-suggestion {
    width: 100%;
    border: none;
    border-bottom: 1px solid #f5f5f4;
    background: #fff;
    text-align: left;
    padding: 8px 10px;
    cursor: pointer;
    color: #292524;
    font-size: 13px;
}

.phone-intake-suggestion:last-child {
    border-bottom: none;
}

.phone-intake-suggestion:hover {
    background: #fafaf9;
}

.phone-intake-suggestion small {
    display: block;
    color: #78716c;
    margin-top: 2px;
}

/* Link customer modal (klant koppelen/wijzigen) */
.link-customer-modal-content .modal-body {
    position: relative;
}

#linkCustomerSearch {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e7e5e4;
    border-radius: 8px;
    font-size: 14px;
}

#linkCustomerSearch:focus {
    outline: none;
    border-color: #a8a29e;
}

.link-customer-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    background: #fff;
    border: 1px solid #e7e5e4;
    border-radius: 8px;
    box-shadow: 0 8px 18px rgba(28, 25, 23, 0.08);
    z-index: 25;
    max-height: 220px;
    overflow-y: auto;
}

.link-customer-suggestions .link-customer-suggestion {
    width: 100%;
    border: none;
    border-bottom: 1px solid #f5f5f4;
    background: #fff;
    text-align: left;
    padding: 8px 10px;
    cursor: pointer;
    color: #292524;
    font-size: 13px;
}

.link-customer-suggestions .link-customer-suggestion:last-child {
    border-bottom: none;
}

.link-customer-suggestions .link-customer-suggestion:hover {
    background: #fafaf9;
}

.link-customer-suggestions .link-customer-suggestion:disabled {
    opacity: 0.7;
    cursor: wait;
}

.link-customer-suggestions .link-customer-suggestion small {
    display: block;
    color: #78716c;
    margin-top: 2px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.phone-intake-actions {
    justify-self: end;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.phone-intake-actions-primary {
    justify-self: stretch;
    align-items: flex-start;
}

.phone-intake-submit-btn {
    min-height: 120px;
    margin: 0;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-color: #c8c3bc;
    background: #fff;
    align-self: stretch;
}

.phone-intake-actions-message {
    align-items: stretch;
    justify-content: flex-end;
    align-self: stretch;
}

.phone-intake-actions small {
    font-size: 11px;
    color: #78716c;
}

.sync-status-banner {
    max-width: 1600px;
    margin: 10px auto 0;
    border: 1px solid #e7e5e4;
    border-radius: 8px;
    padding: 10px 14px;
    background: #fafaf9;
    color: #44403c;
    font-size: 13px;
    animation: fadeSlideIn 0.18s ease;
}

.sync-status-banner.level-success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.sync-status-banner.level-error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.search-bar {
    padding: 8px 14px;
    border: 1px solid #e7e5e4;
    border-radius: 8px;
    font-size: 14px;
    min-width: 200px;
}

.search-bar:focus {
    outline: none;
    border-color: #a8a29e;
}

.refresh-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #e7e5e4;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.refresh-btn:hover {
    background: #f5f5f4;
}

/* === LOADING / ERROR / EMPTY === */
.loading-state,
.error-state,
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #78716c;
}

.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 2px solid #e7e5e4;
    border-top-color: #a8a29e;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.error-state h3,
.empty-state p {
    margin-bottom: 12px;
}

.fallback-link {
    color: #78716c;
    text-decoration: underline;
}

.fallback-link:hover {
    color: #1c1917;
}

/* === MAIN CONTENT === */
.daily-overview-body {
    display: block;
}

.daily-overview-body.canvas-open {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 0;
    min-height: 0;
    flex: 1;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: linear-gradient(180deg, #f8f7f5 0%, #f3f1ed 100%);
}

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

.daily-overview-body.canvas-open .daily-content-column {
    overflow-y: auto;
    min-height: 0;
}

.daily-overview-body.canvas-open .detail-canvas {
    display: flex !important;
    flex-direction: column;
    min-width: 0;
    border-left: 1px solid #e7e5e4;
    background: #fafaf9;
}

.detail-canvas {
    flex-direction: column;
    padding: 16px 20px;
    overflow: auto;
}

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

.detail-canvas-close {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    color: #78716c;
    cursor: pointer;
    border-radius: 6px;
}

.detail-canvas-close:hover {
    background: #e7e5e4;
    color: #1c1917;
}

.detail-canvas-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: #1c1917;
}

.detail-canvas-content {
    flex: 1;
    min-height: 0;
}

.detail-canvas-placeholder {
    color: #78716c;
    font-size: 14px;
    margin: 0;
}

.daily-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 28px 20px 34px;
    min-width: 0;
}

/* === DAG CARD === */
.day-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e7e5e4;
    margin-bottom: 24px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(28, 25, 23, 0.04);
}

.day-card-header {
    padding: 16px 20px;
    background: #fafaf9;
    border-bottom: 1px solid #e7e5e4;
    font-weight: 600;
    font-size: 15px;
    color: #44403c;
}

.day-card-body {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* === THREAD CARD === */
.thread-card {
    background: #fafaf9;
    border-radius: 10px;
    border: 1px solid #e7e5e4;
    overflow: hidden;
    transition: border-color 0.16s ease, background 0.16s ease;
}

/* Status balk links - subtiel */
.thread-card {
    border-left: 4px solid #d6d3d1;
}

.thread-card.status-urgent,
.thread-card.status-action_needed {
    border-left-color: #dc2626;
}

.thread-card.status-in_progress {
    border-left-color: #d97706;
}

.thread-card.status-waiting {
    border-left-color: #6366f1;
}

.thread-card.status-completed {
    border-left-color: #15803d;
}

.thread-card.thread-card-pending {
    border-left-color: #6366f1;
    animation: thread-card-pending-border 2s ease-in-out infinite;
}

.thread-card-pending-label {
    display: inline-flex;
    align-items: center;
    font-size: 13px;
    color: #57534e;
    margin-right: 10px;
}

@keyframes thread-card-pending-border {
    0%, 100% {
        box-shadow: 0 0 0 2px #6366f1, 0 0 12px 0 rgba(99, 102, 241, 0.2);
    }
    50% {
        box-shadow: 0 0 0 2px #8b5cf6, 0 0 16px 2px rgba(139, 92, 246, 0.3);
    }
}

.thread-card-header {
    padding: 14px 18px;
    display: grid;
    grid-template-columns: 1fr minmax(0, 400px) auto;
    gap: 10px 16px;
    align-items: start;
}

.thread-card-primary {
    grid-column: 1 / 2;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 11px;
    cursor: pointer;
}

.thread-card-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.thread-status-badge {
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.01em;
    border: 1.5px solid transparent;
}

.thread-status-badge.status-action_needed {
    background: #fff1f1;
    color: #9f1239;
    border-color: #fecdd3;
}

.thread-status-badge.status-in_progress {
    background: #fff7e7;
    color: #9a3412;
    border-color: #fde68a;
}

.thread-status-badge.status-waiting {
    background: #eef2ff;
    color: #312e81;
    border-color: #c7d2fe;
}

.thread-status-badge.status-completed {
    background: #ecfdf3;
    color: #166534;
    border-color: #bbf7d0;
}

/* Offerte aangemaakt in WIS: groene badge i.p.v. oranje "In behandeling" */
.thread-status-badge.status-in_progress.has-quote,
.status-pill.in_progress.has-quote {
    background: #ecfdf3;
    color: #166534;
    border-color: #bbf7d0;
}

/* WIS offerte status badge */
.wis-status-badge {
    display: inline-block;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.01em;
    border: 1.5px solid #c7d2fe;
    background: #eef2ff;
    color: #312e81;
    margin-bottom: 2px;
}

/* WIS status 1 = Nieuw */
.wis-status-badge.wis-status-1 {
    background: #eff6ff;
    color: #1e40af;
    border-color: #93c5fd;
}

/* WIS status 2 = In behandeling */
.wis-status-badge.wis-status-2 {
    background: #fff7e7;
    color: #9a3412;
    border-color: #fde68a;
}

/* WIS status 3 = Akkoord */
.wis-status-badge.wis-status-3 {
    background: #ecfdf3;
    color: #166534;
    border-color: #bbf7d0;
}

/* WIS status 4 = In uitvoering */
.wis-status-badge.wis-status-4 {
    background: #fdf4ff;
    color: #6b21a8;
    border-color: #d8b4fe;
}

/* WIS status 5 = Opgeleverd */
.wis-status-badge.wis-status-5 {
    background: #ecfdf3;
    color: #166534;
    border-color: #bbf7d0;
}

/* WIS status 6 = Afgewezen */
.wis-status-badge.wis-status-6 {
    background: #fff1f1;
    color: #9f1239;
    border-color: #fecdd3;
}

.thread-card-header {
    cursor: pointer;
    transition: background 0.15s;
}

.thread-card-header:hover {
    background: #f5f5f4;
}

.thread-card-title {
    font-weight: 600;
    font-size: 16px;
    color: #1c1917;
    flex: 1;
    min-width: 0;
}

/* Bedrijfsnaam:zelfde badge-stijl als verzender (thread-customer) */
.thread-card-company {
    font-weight: 700;
    font-size: 15px;
    border-radius: 6px;
    padding: 1px 6px;
    margin-right: 6px;
    display: inline-block;
    flex: 0 0 auto;
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #292524;
    background: #e7e5e4;
    border: 1px solid #d6d3d1;
}

/* Suggested content status badge (subtiel, bij subject) */
.suggested-content-badge {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
    margin-left: 8px;
    opacity: 0.92;
}

.suggested-content-badge--pending {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}

.suggested-content-badge--approved {
    background: #d1fae5;
    color: #065f46;
    border-color: #a7f3d0;
}

.suggested-content-badge--modified {
    background: #e0e7ff;
    color: #3730a3;
    border-color: #c7d2fe;
}

.suggested-content-badge--rejected {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

.suggested-content-badge--finalized {
    background: #e7e5e4;
    color: #57534e;
    border-color: #d6d3d1;
}

.thread-card-meta {
    font-size: 14px;
    color: #6b645d;
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    line-height: 1.35;
    margin-top: 3px;
}

.thread-card-preview {
    font-size: 13px;
    color: #78716c;
    line-height: 1.5;
    max-height: 80px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

.thread-customer {
    font-weight: 700;
    font-size: 15px;
    border-radius: 6px;
    padding: 1px 6px;
    margin-right: 4px;
    display: inline-block;
    flex: 0 0 auto;
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thread-customer.customer-linked {
    color: #5f6f66;
    background: #f8faf8;
    border: 1px solid #edf4ef;
}

.thread-customer.customer-unlinked {
    color: #7c2d12;
    background: #fff7ed;
    border: 1px solid #fed7aa;
}

/* Koppel/Wijzig: oranje alleen als nog geen klant gekoppeld (Koppel), anders subtiel (Wijzig) */
.btn-link-customer-mini {
    appearance: none;
    border: 1px solid #fdba74;
    background: #fffbeb;
    color: #9a3412;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 10px;
    line-height: 1.7;
    cursor: pointer;
    transition: background 0.14s ease, border-color 0.14s ease;
}

.btn-link-customer-mini:hover {
    background: #fff7ed;
    border-color: #fb923c;
}

/* Wijzig (klant al gekoppeld): subtiele grijze stijl */
.btn-link-customer-mini.btn-change-customer-mini {
    border-color: #d6d3d1;
    background: #fafaf9;
    color: #57534e;
}

.btn-link-customer-mini.btn-change-customer-mini:hover {
    background: #f5f5f4;
    border-color: #a8a29e;
}

.thread-card-secondary {
    grid-column: 2 / 3;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-self: end;
    gap: 4px;
    padding-top: 2px;
    padding-left: 16px;
    margin-left: 8px;
    max-width: 400px;
    min-width: 0;
    width: 100%;
    text-align: right;
    border-left: 1px solid #e7e5e4;
}

.thread-card-secondary .thread-status-badge {
    margin-bottom: 2px;
}

/* Tab-specifieke breedte secondary: werkvoorraad (en rest) 400px; offertefase/uitvoering/archief 500px */
.daily-content[data-active-tab="offertefase"] .thread-card-header,
.daily-content[data-active-tab="uitvoering"] .thread-card-header,
.daily-content[data-active-tab="archief"] .thread-card-header {
    grid-template-columns: 1fr minmax(0, 500px) auto;
}
.daily-content[data-active-tab="offertefase"] .thread-card-secondary,
.daily-content[data-active-tab="uitvoering"] .thread-card-secondary,
.daily-content[data-active-tab="archief"] .thread-card-secondary {
    max-width: 500px;
}

.thread-card-reason {
    font-size: 13px;
    color: #78716c;
    line-height: 1.45;
}

.thread-card-next-step {
    font-size: 13px;
    color: #a8a29e;
    line-height: 1.45;
}

/* Journey indicator: horizontale stappen (grijs/geel/groen) */
.journey-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.journey-step {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.journey-step-not_done {
    background: #e7e5e4;
}

.journey-step-active {
    background: #eab308;
}

.journey-step-done {
    background: #22c55e;
}

.thread-order-progress {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    justify-content: flex-end;
}

.order-progress-ref {
    font-size: 13px;
    font-weight: 600;
    color: #57534e;
    border: 1.5px solid #d6d3d1;
    border-radius: 999px;
    padding: 3px 10px;
    background: #fafaf9;
}

.order-progress-ref-empty {
    color: #a8a29e;
    font-weight: 500;
}

.thread-order-progress-chips {
    display: inline-flex;
    gap: 6px;
    flex-wrap: nowrap;
}

.order-progress-chip,
.issue-dossier-chip {
    border-radius: 999px;
    border: 1.5px solid #d6d3d1;
    background: #fafaf9;
    color: #44403c;
    font-size: 13px;
    font-weight: 600;
    padding: 3px 10px;
    line-height: 1.5;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.order-progress-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.order-progress-chip:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.order-progress-chip:active {
    transform: translateY(0);
    box-shadow: none;
}

.order-progress-chip.state-not_connected,
.order-progress-chip.state-unknown,
.issue-dossier-chip.state-unknown,
.issue-dossier-chip.state-none {
    color: #78716c;
    border-color: #d6d3d1;
    background: #f5f5f4;
}

.order-progress-chip.state-pending,
.issue-dossier-chip.state-in_progress {
    color: #9a3412;
    border-color: #fdba74;
    background: #fff7ed;
}

.order-progress-chip.state-ok,
.issue-dossier-chip.state-resolved {
    color: #15803d;
    border-color: #86efac;
    background: #f0fdf4;
}

.order-progress-chip.state-attention,
.issue-dossier-chip.state-open {
    color: #92400e;
    border-color: #fbbf24;
    background: #fffbeb;
    animation: chipPulse 2.5s ease-in-out infinite;
}

.order-progress-chip.state-blocked {
    color: #991b1b;
    border-color: #f87171;
    background: #fef2f2;
    animation: chipPulse 2.5s ease-in-out infinite;
}

@keyframes chipPulse {
    0%, 100% { box-shadow: 0 0 0 0 transparent; }
    50% { box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.15); }
}

.order-progress-detail-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.order-progress-detail-item {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 6px 10px;
    font-size: 12px;
    color: #44403c;
}

.order-progress-detail-key {
    color: #6b7280;
    font-weight: 600;
}

.order-progress-detail-value {
    color: #292524;
}

.order-progress-detail-note {
    grid-column: 2 / 3;
    color: #78716c;
    font-size: 11.5px;
}

/* === TOGGLE BUTTON (hamburger → X) === */
.thread-card-toggle {
    grid-row: 1 / -1;
    align-self: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
    flex-shrink: 0;
}

.thread-card-toggle:hover {
    background: #e7e5e4;
}

.thread-card-toggle:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.toggle-bar {
    display: block;
    width: 14px;
    height: 1.5px;
    background: #78716c;
    border-radius: 1px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.thread-card.expanded .thread-card-toggle .toggle-bar:nth-child(1) {
    transform: translateY(4.5px) rotate(45deg);
}

.thread-card.expanded .thread-card-toggle .toggle-bar:nth-child(2) {
    opacity: 0;
}

.thread-card.expanded .thread-card-toggle .toggle-bar:nth-child(3) {
    transform: translateY(-4.5px) rotate(-45deg);
}

/* Right-side toggle in actions area */
.thread-card-toggle.thread-card-toggle-end {
    grid-column: unset;
    grid-row: unset;
}

/* === THREAD CARD ACTIONS (right side) === */
.thread-card-actions {
    grid-column: 3 / 4;
    grid-row: 1 / -1;
    align-self: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

/* === STATUS PICKER === */
.status-picker-wrapper {
    position: relative;
    display: inline-flex;
}

.status-picker-trigger {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: box-shadow 0.12s ease, transform 0.12s ease;
}

.status-picker-trigger:hover {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.status-picker-trigger:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.status-picker-chevron {
    flex-shrink: 0;
    opacity: 0.5;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.status-picker-wrapper.open .status-picker-chevron {
    transform: rotate(180deg);
    opacity: 0.8;
}

.status-picker-dropdown {
    display: none;
    position: fixed;
    z-index: 9999;
    min-width: 190px;
    background: #fff;
    border: 1px solid #e7e5e4;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06);
    padding: 4px;
    animation: statusPickerIn 0.12s ease;
}

.status-picker-wrapper.open .status-picker-dropdown {
    display: flex;
    flex-direction: column;
}

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

.status-picker-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #44403c;
    text-align: left;
    white-space: nowrap;
    transition: background 0.1s ease;
}

.status-picker-option:hover {
    background: #f5f5f4;
}

.status-picker-option.active {
    font-weight: 700;
    background: #f5f5f4;
}

.status-picker-option:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: -2px;
}

.status-picker-option-archive {
    color: #15803d;
}

.status-picker-option-archive:hover {
    background: #f0fdf4;
}

.status-picker-divider {
    border: none;
    border-top: 1px solid #e7e5e4;
    margin: 2px 8px;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.status-action_needed { background: #dc2626; }
.status-dot.status-in_progress { background: #d97706; }
.status-dot.status-waiting { background: #6366f1; }
.status-dot.status-completed { background: #15803d; }

.thread-card-emails {
    display: none;
    padding: 0 16px 16px;
}

.thread-card.expanded .thread-card-emails {
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: fadeSlideIn 0.16s ease;
}

/* === EMAIL CARD (compact) === */
.email-card-mini {
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e7e5e4;
    overflow: hidden;
    position: relative;
    --semantic-ring-color: transparent;
    transition: border-color 0.14s ease, background 0.14s ease;
}

/* Semantische signalen als subtiele binnenrand: blijft zichtbaar op grijze kaarten */
.email-card-mini.has-suggested-offerte {
    --semantic-ring-color: #93c5fd;
}

.email-card-mini.has-erp-offerte {
    --semantic-ring-color: #86efac;
}

.email-card-mini::after {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: 7px;
    border: 1px solid var(--semantic-ring-color);
    pointer-events: none;
    opacity: 0.9;
}

/* Status balk links - subtiel */
.email-card-mini {
    border-left: 3px solid #d6d3d1;
}

.email-card-mini.status-pending {
    border-left-color: #d97706;
}

.email-card-mini.status-sent {
    border-left-color: #22c55e;
}

.email-card-mini.status-new {
    border-left-color: #3b82f6;
}

.email-card-mini.status-completed {
    border-left-color: #9ca3af;
}

.email-card-mini.is-latest {
    box-shadow: inset 0 0 0 1px #d6d3d1;
    border-color: #d6d3d1;
}

.email-card-mini-header {
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.email-card-mini-header:hover {
    background: #fafaf9;
}

.email-card-mini:hover {
    background: #fcfcfb;
}

.email-card-mini-from {
    font-weight: 500;
    font-size: 14px;
    color: #1c1917;
}

.email-card-mini-time {
    font-size: 13px;
    color: #78716c;
}

.email-card-mini-subject {
    padding: 0 14px 10px;
    font-size: 14px;
    color: #44403c;
    line-height: 1.4;
}

.email-card-mini-preview {
    padding: 0 14px 12px;
    font-size: 13px;
    color: #78716c;
    line-height: 1.4;
    max-height: 80px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
}

.email-card-mini-marker {
    margin: 0 14px 10px;
    font-size: 12px;
    color: #57534e;
}

/* === SPINNER BIJ OPENEN E-MAIL === */
.email-open-spinner-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(248, 247, 245, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(1px);
}

.email-open-spinner-overlay.is-visible {
    display: flex;
}

.email-open-spinner-box {
    background: #fff;
    padding: 1.5rem 2rem;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.email-open-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e7e5e4;
    border-top-color: #0d9488;
    border-radius: 50%;
    animation: email-open-spin 0.7s linear infinite;
    margin: 0 auto 0.75rem;
}

.email-open-spinner-text {
    margin: 0;
    font-size: 0.9375rem;
    color: #57534e;
    font-weight: 500;
}

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

/* === FULLSCREEN EMAIL OVERLAY === */
.email-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: stretch;
    justify-content: center;
    padding: 12px;
}

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

.email-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    cursor: pointer;
}

.email-overlay-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 1920px;
    height: calc(100vh - 24px);
    max-height: calc(100vh - 24px);
    overflow: hidden;
    display: flex;
    flex-direction: row;
}

.email-overlay-left {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.email-overlay-content.has-configurator .email-overlay-left {
    flex: 0 0 25%;
    min-width: 280px;
    border-right: 1px solid #e7e5e4;
}

.email-overlay-header {
    flex-shrink: 0;
    padding: 12px 20px;
    border-bottom: 1px solid #e7e5e4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.email-overlay-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f5f5f4;
    border-radius: 8px;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    color: #78716c;
    flex-shrink: 0;
}

.email-overlay-close:hover {
    background: #e7e5e4;
    color: #1c1917;
}

.email-overlay-meta {
    flex: 1;
}

.overlay-offerte-badge {
    display: inline-block;
    margin-top: 6px;
    padding: 3px 10px;
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

/* Mail verzonden feedback banner in overlay */
.overlay-sent-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    margin: 0 0 16px 0;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #6ee7b7;
    border-radius: 10px;
    color: #065f46;
    animation: overlay-sent-slide-in 0.35s ease-out;
}

.overlay-sent-banner svg {
    flex-shrink: 0;
    color: #059669;
}

.overlay-sent-banner-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.overlay-sent-banner-text strong {
    font-size: 14px;
    font-weight: 600;
    color: #065f46;
}

.overlay-sent-banner-text small {
    font-size: 12px;
    color: #047857;
    opacity: 0.8;
}

@keyframes overlay-sent-slide-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Overlay dimmen/blur na mail verzonden */
.overlay-mail-sent .email-overlay-configurator {
    opacity: 0.3;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.overlay-mail-sent .email-overlay-actions {
    opacity: 0.3;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.email-overlay-body {
    flex: 1;
    min-height: 0;
    padding: 20px;
    overflow-y: auto;
    font-size: 15px;
    line-height: 1.6;
}

.email-overlay-section {
    margin-bottom: 18px;
}

.email-overlay-section-title {
    margin: 0 0 8px;
    font-size: 13px;
    color: #78716c;
    font-weight: 600;
}

.email-overlay-section-content {
    white-space: pre-wrap;
}

/* Wedervraag sectie: inklapbaar, formulier en feedback */
.email-overlay-section-wedervraag .email-overlay-section-title {
    margin-bottom: 0;
}

.wedervraag-toggle-btn {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: 13px;
    color: #78716c;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}

.wedervraag-toggle-btn:hover {
    color: #57534e;
}

.wedervraag-content {
    margin-top: 8px;
}

.wedervraag-content.collapsed {
    display: none;
}

.wedervraag-label {
    display: block;
    margin: 10px 0 4px;
    font-size: 12px;
    color: #57534e;
    font-weight: 500;
}

.wedervraag-label:first-of-type {
    margin-top: 0;
}

.wedervraag-input,
.wedervraag-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #e7e5e4;
    border-radius: 6px;
    font: inherit;
    font-size: 14px;
    box-sizing: border-box;
}

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

.wedervraag-signature {
    margin: 8px 0;
    font-size: 12px;
    color: #a8a29e;
}

.wedervraag-send-btn {
    margin-top: 10px;
    padding: 8px 16px;
    font: inherit;
    font-size: 14px;
    border: 1px solid #78716c;
    border-radius: 6px;
    background: #fafaf9;
    color: #44403c;
    cursor: pointer;
}

.wedervraag-send-btn:hover:not(:disabled) {
    background: #e7e5e4;
}

.wedervraag-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.wedervraag-message {
    margin-top: 8px;
    font-size: 13px;
}

.wedervraag-message.success {
    color: #15803d;
}

.wedervraag-message.error {
    color: #b91c1c;
}

.email-overlay-attachments {
    flex-shrink: 0;
}

.email-overlay-attachments-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 140px;
    overflow-y: auto;
}

.email-overlay-attachment {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px;
    border: 1px solid #e7e5e4;
    border-radius: 6px;
    background: #fafaf9;
    min-width: 52px;
}

.email-overlay-attachment--image img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

.email-overlay-attachment-name {
    font-size: 10px;
    color: #57534e;
    max-width: 64px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-overlay-attachment-icon {
    font-size: 16px;
}

/* Kleine bijlage-preview (tussen e-mail en bijlagenlijst) */
.email-overlay-attachment-preview {
    flex-shrink: 0;
    display: none;
    flex-direction: column;
    gap: 8px;
    padding: 10px 20px;
    margin: 0 20px 12px;
    max-height: 220px;
    border: 1px solid #e7e5e4;
    border-radius: 8px;
    background: #fafaf9;
    position: relative;
}

.email-overlay-attachment-preview.is-visible {
    display: flex;
}

.email-overlay-attachment-preview-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 6px;
    background: #fff;
    color: #78716c;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.email-overlay-attachment-preview-close:hover {
    background: #f5f5f4;
    color: #44403c;
}

.email-overlay-attachment-preview img {
    max-width: 100%;
    max-height: 180px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    display: block;
}

.email-overlay-attachment-preview-filename {
    font-size: 12px;
    color: #57534e;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-overlay-attachment-preview-actions {
    display: flex;
    gap: 8px;
}

.btn-vergroten {
    padding: 6px 12px;
    font-size: 12px;
    border: 1px solid #d6d3d1;
    border-radius: 6px;
    background: #fff;
    color: #44403c;
    cursor: pointer;
}

.btn-vergroten:hover {
    background: #f5f5f4;
    border-color: #a8a29e;
}

.email-overlay-attachment--image {
    cursor: pointer;
}

.email-overlay-attachment--image:hover {
    background: #f5f5f4;
    border-color: #d6d3d1;
}

/* Fullscreen bijlage-afbeelding viewer (bovenop email overlay) */
.attachment-image-viewer-overlay {
    position: fixed;
    inset: 0;
    z-index: 1001;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.attachment-image-viewer-overlay.is-visible {
    display: flex;
}

.attachment-image-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    cursor: pointer;
}

.attachment-image-viewer-box {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 1;
}

.attachment-image-viewer-box img {
    max-width: 90vw;
    max-height: calc(90vh - 48px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.attachment-image-viewer-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    color: #44403c;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.attachment-image-viewer-close:hover {
    background: #fff;
    color: #1c1917;
}

.attachment-image-viewer-filename {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-overlay-configurator {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.configurator-iframe-container {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

.configurator-iframe {
    width: 100%;
    height: 100%;
    min-height: 400px;
    border: none;
    display: block;
}

.iframe-loading-state {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 13px;
    color: #57534e;
    background: #fafaf9;
}

.iframe-loading-spinner {
    width: 15px;
    height: 15px;
    border: 2px solid #d6d3d1;
    border-top-color: #78716c;
    border-radius: 999px;
    animation: spin 0.8s linear infinite;
}

.email-overlay-actions {
    flex-shrink: 0;
    padding: 12px 20px;
    border-top: 1px solid #e7e5e4;
    background: #fafaf9;
}

.btn-reply-overlay {
    padding: 10px 20px;
    background: #1c1917;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.btn-reply-overlay:hover {
    background: #44403c;
}

.email-overlay-action-stack {
    display: grid;
    gap: 10px;
}

/* Notitie voor Flooras (bijsturing): uitklapbaar, standaard ingeklapt */
.thread-adjustment-details {
    margin: 0;
}

.thread-adjustment-summary {
    list-style: none;
    cursor: pointer;
    padding: 6px 0;
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: #57534e;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.thread-adjustment-summary::-webkit-details-marker,
.thread-adjustment-summary::marker {
    display: none;
}

.thread-adjustment-summary::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 4px solid #78716c;
    border-top: 3px solid transparent;
    border-bottom: 3px solid transparent;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.thread-adjustment-details[open] .thread-adjustment-summary::before {
    transform: rotate(90deg);
}

.thread-adjustment-summary:hover {
    color: #44403c;
}

.thread-adjustment-details .thread-adjustment-box {
    margin-top: 8px;
}

.thread-adjustment-box {
    border: 1px solid #e7e5e4;
    border-radius: 8px;
    background: #fff;
    padding: 10px;
    display: grid;
    gap: 8px;
}

.thread-adjustment-title {
    font-size: 12px;
    color: #57534e;
    font-weight: 600;
}

.thread-adjustment-message {
    width: 100%;
    min-height: 78px;
    resize: vertical;
    border: 1px solid #d6d3d1;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
    color: #1c1917;
}

.thread-adjustment-message:focus {
    outline: none;
    border-color: #a8a29e;
}

.thread-adjustment-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-thread-adjustment {
    margin: 0;
}

.thread-adjustment-help {
    font-size: 11px;
    color: #78716c;
}

.retry-btn {
    margin: 12px 0;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid #d6d3d1;
    background: #fff;
    color: #1c1917;
    cursor: pointer;
    transition: background 0.14s ease, border-color 0.14s ease;
}

.retry-btn:hover {
    background: #f5f5f4;
    border-color: #bfb8af;
}

.phone-intake-submit-btn.retry-btn {
    margin: 0;
}

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

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .daily-header-inner {
        flex-direction: column;
        align-items: stretch;
    }

    .daily-title {
        text-align: center;
    }

    .search-bar {
        min-width: 100%;
    }

    .daily-content {
        padding: 16px;
    }

    .phone-intake-row {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .phone-intake-row.phone-intake-row-message {
        grid-template-columns: 1fr;
    }

    .phone-intake-actions {
        justify-self: stretch;
        align-items: flex-start;
    }

    .phone-intake-submit-btn {
        width: 100%;
        min-height: 46px;
    }

    .thread-card-header {
        grid-template-columns: 1fr auto;
        align-items: center;
    }

    .thread-card-secondary {
        grid-column: 1 / -1;
        align-items: flex-start;
        justify-self: start;
        text-align: left;
        max-width: none;
        width: 100%;
        padding-top: 0;
        padding-left: 0;
        margin-left: 0;
        border-left: none;
    }

    .thread-order-progress {
        flex-wrap: wrap;
    }

    .thread-card-actions {
        grid-column: 2 / 3;
        grid-row: 1 / 2;
        flex-direction: row;
    }
}

/* === ARCHIVING ANIMATION === */
.thread-card.archiving {
    animation: archiveFadeOut 0.35s ease forwards;
    pointer-events: none;
}

@keyframes archiveFadeOut {
    0% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateX(40px) scale(0.96);
        max-height: 0;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }
}

.thread-card.canvas-active-thread {
    box-shadow: 0 0 0 2px #0d9488;
    position: relative;
    z-index: 1;
}

.thread-card.canvas-disabled {
    pointer-events: none;
    opacity: 0.5;
    filter: saturate(0.6);
}

/* === TAB NAVIGATIE === */
/* Zelfde patroon als header: volle breedte balk, inhoud max 1600px gecentreerd */
.overview-tabs {
    border-bottom: 2px solid #e7e5e4;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 20;
    font-family: inherit;
}

.overview-tabs-inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.overview-tabs-list {
    display: flex;
    gap: 0;
}

/* Refresh-status rechts in tabbalk (zelfde stijl als inactieve tabs) */
#dailyRefreshMeta.overview-tabs-refresh,
.overview-tabs .overview-tabs-refresh {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    margin-left: auto;
    padding: 12px 0 12px 20px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: #78716c;
}

#dailyRefreshMeta .overview-tabs-refresh-text,
.overview-tabs-refresh-text {
    white-space: nowrap;
}

#tabRefreshBtn.overview-tabs-refresh-btn,
.overview-tabs-refresh-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #e7e5e4;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 18px;
    color: #57534e;
    transition: background 0.15s, border-color 0.15s;
}

.overview-tabs-refresh-btn:hover {
    background: #f5f5f4;
    border-color: #d6d3d1;
}

.overview-tabs-refresh-btn:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.overview-tabs-refresh-icon,
.overview-tabs-refresh-spinner {
    position: absolute;
    inset: 0;
    margin: auto;
}

.overview-tabs-refresh-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.overview-tabs-refresh-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #e7e5e4;
    border-top-color: #57534e;
    border-radius: 50%;
    animation: overview-refresh-spin 0.8s linear infinite;
    opacity: 0;
}

.overview-tabs-refresh-btn.is-refreshing .overview-tabs-refresh-icon {
    opacity: 0;
}

.overview-tabs-refresh-btn.is-refreshing .overview-tabs-refresh-spinner {
    opacity: 1;
}

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

.overview-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #78716c;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
}

.overview-tab:hover {
    color: #44403c;
    background: #fafaf9;
}

.overview-tab:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: -2px;
    border-radius: 4px 4px 0 0;
}

.overview-tab.active {
    color: #292524;
    font-weight: 600;
    border-bottom-color: #292524;
}

/* Badge basis */
.overview-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

/* Werkvoorraad badge: warm oranje */
.badge-werkvoorraad {
    background: #fed7aa;
    color: #9a3412;
}

.overview-tab.active .badge-werkvoorraad {
    background: #ea580c;
    color: #fff;
}

/* Wachtend badge: neutraal grijs */
.badge-wachtend {
    background: #e7e5e4;
    color: #57534e;
}

.overview-tab.active .badge-wachtend {
    background: #78716c;
    color: #fff;
}

/* Offertefase badge (zelfde stijl als wachtend) */
.badge-offertefase {
    background: #e7e5e4;
    color: #57534e;
}

.overview-tab.active .badge-offertefase {
    background: #78716c;
    color: #fff;
}

/* Uitvoering badge */
.badge-uitvoering {
    background: #d1fae5;
    color: #047857;
}

.overview-tab.active .badge-uitvoering {
    background: #047857;
    color: #fff;
}

/* Archief badge: gedempt */
.badge-archief {
    background: #e7e5e4;
    color: #a8a29e;
}

.overview-tab.active .badge-archief {
    background: #a8a29e;
    color: #fff;
}

/* Ongekoppeld tab badge */
.badge-ongekoppeld {
    background: #fef3c7;
    color: #b45309;
}

.overview-tab.active .badge-ongekoppeld {
    background: #b45309;
    color: #fff;
}

/* Ongekoppelde AV items tab badge */
.badge-ongekoppelde-av {
    background: #e0e7ff;
    color: #4338ca;
}

.overview-tab.active .badge-ongekoppelde-av {
    background: #4338ca;
    color: #fff;
}

/* Ongekoppeld tab content */
.unmatched-tab-state {
    padding: 32px 20px;
    text-align: center;
    color: #57534e;
}

.unmatched-tab-error {
    background: #fef2f2;
    border-radius: 8px;
    margin: 0 16px;
}

.unmatched-tab-error-detail {
    font-size: 13px;
    color: #78716c;
    margin: 8px 0 16px;
}

.unmatched-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 0;
}

.unmatched-card {
    background: #fff;
    border: 1px solid #e7e5e4;
    border-radius: 8px;
    padding: 14px 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.unmatched-card-meta {
    font-size: 13px;
    color: #78716c;
    margin-bottom: 6px;
}

.unmatched-card-identifiers,
.unmatched-card-payload {
    font-size: 12px;
    color: #57534e;
    margin-bottom: 8px;
    word-break: break-word;
}

.unmatched-card-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.btn-unmatched-link,
.btn-unmatched-ignore {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid #d6d3d1;
    background: #fafaf9;
    color: #44403c;
}

.btn-unmatched-ignore {
    background: transparent;
}

.btn-unmatched-link:hover,
.btn-unmatched-ignore:hover {
    background: #e7e5e4;
}

.link-unmatched-form label {
    display: block;
    margin-top: 12px;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 500;
    color: #44403c;
}

.link-unmatched-form select {
    width: 100%;
    max-width: 400px;
    padding: 8px 10px;
    font-size: 14px;
    border: 1px solid #d6d3d1;
    border-radius: 6px;
    background: #fff;
}

.link-unmatched-form select:disabled {
    background: #f5f5f4;
    color: #78716c;
}

/* Overlay rechts: quotes, timeline, lifecycle, te koppelen */
.email-overlay-right-sections {
    flex: 0 0 300px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 20px;
    max-height: 100%;
    overflow-y: auto;
    border-left: 1px solid #e7e5e4;
}

.overlay-section {
    margin: 0;
}

.overlay-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #44403c;
    margin: 0 0 8px 0;
}

.overlay-section-content {
    font-size: 13px;
    color: #57534e;
}

.overlay-fallback {
    margin: 0;
    font-style: italic;
    color: #a8a29e;
}

.overlay-av-notitie {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.overlay-timeline-list,
.overlay-lifecycle-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.overlay-timeline-list li,
.overlay-lifecycle-list li {
    padding: 4px 0;
    border-bottom: 1px solid #f5f5f4;
}

.overlay-timeline-type {
    font-weight: 500;
    color: #44403c;
}

.overlay-quotes-picker {
    list-style: none;
    padding: 0;
    margin: 0;
}

.overlay-quote-option {
    padding: 8px 12px;
    width: 100%;
    text-align: left;
    border: 1px solid #e7e5e4;
    border-radius: 6px;
    background: #fafaf9;
    cursor: pointer;
    font-size: 13px;
}

.overlay-quote-option:hover {
    background: #f5f5f4;
}

.overlay-te-koppelen-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.overlay-te-koppelen-item {
    padding: 10px 0;
    border-bottom: 1px solid #e7e5e4;
}

.overlay-te-koppelen-meta {
    display: block;
    font-size: 12px;
    color: #78716c;
    margin-bottom: 6px;
}

.overlay-te-koppelen-actions {
    display: flex;
    gap: 8px;
}

.btn-te-koppelen-link,
.btn-te-koppelen-ignore {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid #d6d3d1;
    background: #fafaf9;
    color: #44403c;
}

.btn-te-koppelen-ignore {
    background: transparent;
}

/* Tab lege staat */
.tab-empty-state {
    text-align: center;
    padding: 48px 20px;
    color: #78716c;
    font-size: 15px;
}

.tab-empty-state p {
    margin: 0;
}

/* Responsive: kleinere tabs op mobiel */
@media (max-width: 600px) {
    .overview-tabs-inner {
        padding: 0 10px;
    }
    .overview-tab {
        padding: 10px 12px;
        font-size: 13px;
    }
}
