/* Cortive — De Waard Dashboard */
:root {
    --c-navy: #2E5090;
    --c-navy-dark: #1c3160;
    --c-blue: #6FA8DC;
    --c-blue-light: #e8f0fe;
    --c-grey: #f9fafc;
    --c-grey-mid: #e5e7eb;
    --c-grey-dark: #6b7280;
    --c-text: #1f2937;
    --c-success: #16a34a;
    --c-warn: #ea580c;
    --c-danger: #dc2626;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    color: var(--c-text);
    background: var(--c-grey);
    line-height: 1.5;
    font-size: 14px;
}

/* ── Login ── */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--c-blue-light) 0%, #fff 100%);
}
.login-card {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    width: 380px;
    max-width: 90vw;
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-brand {
    color: var(--c-navy);
    font-size: 32px;
    margin-bottom: 4px;
}
.login-subtitle { color: var(--c-grey-dark); font-size: 13px; }
.login-form .form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 13px;
}
.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--c-grey-mid);
    border-radius: 6px;
    font-size: 14px;
}
.form-group input:focus {
    outline: none;
    border-color: var(--c-navy);
    box-shadow: 0 0 0 3px var(--c-blue-light);
}
.btn {
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.btn-primary {
    background: var(--c-navy);
    color: white;
    width: 100%;
    padding: 12px;
}
.btn-primary:hover { background: var(--c-navy-dark); }
.btn-text {
    background: transparent;
    color: var(--c-grey-dark);
    padding: 4px 8px;
    font-size: 12px;
}
.btn-text:hover { color: var(--c-navy); }
.alert {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
}
.alert-error {
    background: #fef2f2;
    color: var(--c-danger);
    border: 1px solid #fecaca;
}

/* ── Layout ── */
.layout {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 240px;
    background: white;
    border-right: 1px solid var(--c-grey-mid);
    display: flex;
    flex-direction: column;
}
.sidebar-brand {
    padding: 24px;
    border-bottom: 1px solid var(--c-grey-mid);
}
.sidebar-brand h2 { color: var(--c-navy); font-size: 22px; }
.sidebar-sub { color: var(--c-grey-dark); font-size: 12px; }
.sidebar-nav { flex: 1; padding: 16px 0; }
.nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
    color: var(--c-text);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s;
}
.nav-item:hover { background: var(--c-grey); }
.nav-item.active {
    background: var(--c-blue-light);
    color: var(--c-navy);
    font-weight: 500;
    border-left: 3px solid var(--c-navy);
    padding-left: 21px;
}
.nav-badge {
    background: var(--c-warn);
    color: white;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
}
.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--c-grey-mid);
}
.user-info { margin-bottom: 8px; }
.user-name { display: block; font-weight: 500; font-size: 13px; }
.user-role { display: block; font-size: 11px; color: var(--c-grey-dark); }

.main-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 24px; color: var(--c-text); }
.page-sub { color: var(--c-grey-dark); font-size: 13px; margin-top: 4px; }

/* ── Stats grid ── */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}
.stat-label {
    font-size: 12px;
    color: var(--c-grey-dark);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}
.stat-value {
    font-size: 32px;
    font-weight: 600;
    color: var(--c-navy);
    margin-bottom: 8px;
}
.stat-link {
    font-size: 13px;
    color: var(--c-navy);
    text-decoration: none;
}
.stat-link:hover { text-decoration: underline; }

.section { background: white; padding: 24px; border-radius: 8px; box-shadow: var(--shadow-sm); }
.section h2 { font-size: 16px; margin-bottom: 12px; }
.text-muted { color: var(--c-grey-dark); }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--c-grey-mid); font-size: 13px; }
th { font-weight: 600; color: var(--c-grey-dark); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
tr:hover { background: var(--c-grey); }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}
.badge-bon { background: #fef3c7; color: #92400e; }
.badge-offerte { background: #dbeafe; color: #1e40af; }
.badge-klantvraag { background: #fee2e2; color: #991b1b; }
.badge-monteur_update { background: #d1fae5; color: #065f46; }
.badge-overig { background: #f3f4f6; color: #4b5563; }

/* ── Filter bar ── */
.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.filter-btn {
    padding: 6px 14px;
    background: white;
    border: 1px solid var(--c-grey-mid);
    border-radius: 16px;
    font-size: 13px;
    color: var(--c-grey-dark);
    text-decoration: none;
    transition: all 0.15s;
}
.filter-btn:hover {
    border-color: var(--c-navy);
    color: var(--c-navy);
}
.filter-btn.active {
    background: var(--c-navy);
    color: white;
    border-color: var(--c-navy);
}

.btn-small {
    padding: 4px 10px;
    font-size: 12px;
    background: var(--c-blue-light);
    color: var(--c-navy);
    border: 1px solid var(--c-blue);
}
.btn-small:hover { background: var(--c-blue); color: white; }
.status-done {
    color: var(--c-success);
    font-size: 12px;
    font-weight: 500;
}

/* ── Forms ── */
.form-row { display: flex; gap: 16px; margin-bottom: 16px; }
.form-group { flex: 1; }
.form-group.half { flex: 1; }
.form-group.quarter { flex: 0 0 25%; }
.form-group.three-quarter { flex: 0 0 73%; }
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--c-grey-mid);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}
.form-group textarea:focus {
    outline: none;
    border-color: var(--c-navy);
    box-shadow: 0 0 0 3px var(--c-blue-light);
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    cursor: pointer;
}
.checkbox-label input { width: auto; }
.form-actions { display: flex; gap: 12px; align-items: center; }

.alert-success {
    background: #d1fae5;
    color: var(--c-success);
    border: 1px solid #a7f3d0;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.info-table { width: auto; }
.info-table td { padding: 6px 16px 6px 0; font-size: 13px; }
.info-table td:first-child { color: var(--c-grey-dark); width: 140px; }

/* ── Offertes ── */
.quote-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.quote-summary-grid .stat-card.highlight {
    background: var(--c-navy);
    color: white;
}
.quote-summary-grid .stat-card.highlight .stat-label {
    color: rgba(255,255,255,0.8);
}
.quote-summary-grid .stat-card.highlight .stat-value {
    color: white;
}
.stat-value-text {
    font-size: 18px;
    margin-bottom: 8px;
}

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

.row-bundle { background: #fafbfc; }
.row-bundle td { font-style: italic; }

.badge-pending_review { background: #fef3c7; color: #92400e; }
.badge-approved { background: #d1fae5; color: #065f46; }
.badge-sent { background: #dbeafe; color: #1e40af; }
.badge-draft { background: #f3f4f6; color: #4b5563; }
.badge-rejected { background: #fee2e2; color: #991b1b; }

code {
    background: var(--c-grey);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.badge-pending_send { background: #fef3c7; color: #92400e; }
.badge-sent { background: #dbeafe; color: #1e40af; }
.badge-paid { background: #d1fae5; color: #065f46; }
.badge-overdue { background: #fee2e2; color: #991b1b; }

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}
.chart-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}
.chart-card h2 {
    font-size: 14px;
    color: var(--c-grey-dark);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
}
@media (max-width: 768px) {
    .charts-grid { grid-template-columns: 1fr; }
}

/* ── Planning ── */
.planning-week { margin-bottom: 24px; }
.planning-toolbar {
    display: flex;
    gap: 4px;
    background: white;
    padding: 8px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}
.day-tab {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--c-text);
    transition: all 0.15s;
}
.day-tab:hover { background: var(--c-grey); }
.day-tab.active {
    background: var(--c-navy);
    color: white;
}
.day-tab.active .day-count { background: rgba(255,255,255,0.3); color: white; }
.day-name { font-size: 11px; text-transform: uppercase; opacity: 0.7; }
.day-num { font-size: 20px; font-weight: 600; margin: 4px 0; }
.day-count {
    display: inline-block;
    background: var(--c-grey);
    color: var(--c-grey-dark);
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
}

.planning-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.planning-col {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    min-height: 400px;
}
.planning-col.unassigned {
    background: #fafbfc;
    border: 2px dashed var(--c-grey-mid);
}
.col-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--c-grey-mid);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.col-header h3 {
    font-size: 14px;
    margin: 0;
    color: var(--c-text);
}
.col-count {
    background: var(--c-blue-light);
    color: var(--c-navy);
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
}

.planning-list {
    list-style: none;
    padding: 8px;
    margin: 0;
    flex: 1;
    min-height: 200px;
}
.wo-card {
    background: white;
    border: 1px solid var(--c-grey-mid);
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 8px;
    cursor: move;
    box-shadow: var(--shadow-sm);
    transition: all 0.15s;
}
.wo-card:hover { box-shadow: var(--shadow); border-color: var(--c-blue); }
.wo-card.priority-1 { border-left: 4px solid var(--c-danger); }
.wo-card.priority-2 { border-left: 4px solid var(--c-warn); }
.wo-card.priority-3 { border-left: 4px solid var(--c-grey-mid); }
.wo-card.pushed { background: var(--c-blue-light); }
.wo-ghost { opacity: 0.3; }

.wo-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 11px;
}
.wo-type {
    background: var(--c-blue-light);
    color: var(--c-navy);
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 500;
}
.wo-priority { color: var(--c-grey-dark); font-weight: 600; }
.wo-client { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.wo-desc { color: var(--c-grey-dark); font-size: 12px; }
.wo-deadline { color: var(--c-warn); font-size: 11px; margin-top: 4px; font-weight: 500; }
.wo-pushed { color: var(--c-success); font-size: 11px; margin-top: 4px; font-weight: 500; }

.planning-actions {
    text-align: right;
    padding: 16px 0;
}

@media (max-width: 1024px) {
    .planning-grid { grid-template-columns: 1fr; }
}