@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --cc-orange:           #EE7103;
    --cc-orange-deep:      #B8482E;
    --cc-orange-hover:     #D66503;
    --cc-navy:             #0E2841;
    --cc-navy-light:       #E6EBF0;
    --cc-green:            #4EA72E;
    --cc-green-light:      #EBF7E4;
    --cc-magenta:          #A02B93;
    --cc-violet:           #630080;
    --cc-gray:             #737373;
    --cc-light-gray:       #E8E8E8;
    --cc-hero-gradient:    linear-gradient(135deg, #3D1249 0%, #421474 30%, #280050 55%, #4A087D 75%, #6C1B56 100%);
    --color-heading:       #0E2841;
    --color-btn-primary:   #EE7103;
    --color-btn-hover:     #D66503;
    --color-focus:         #EE7103;
    --color-focus-shadow:  rgba(238, 113, 3, 0.2);
}

body {
    background: #f3f4f6;
    font-family: 'GT Walsheim Pro', 'Inter', 'Segoe UI', system-ui, sans-serif;
    color: #111827;
    margin: 0;
}

/* ==================== PAGINA BASIS ==================== */

.page-title {
    margin: 0 0 6px 0;
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-heading);
}

.page-subtitle {
    margin: 0 0 24px 0;
    color: #64748b;
    font-size: 1rem;
}

.app-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.form-container {
    max-width: 720px;
    margin: 0 auto;
    background: #fff;
    padding: 28px;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
    border: 1px solid #e5e7eb;
}

/* ==================== FORMS ALGEMEEN ==================== */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #374151;
}

.form-group select,
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 15px;
    background: #fff;
    color: #111827;
    box-sizing: border-box;
}

.form-group select:focus,
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-focus);
    box-shadow: 0 0 0 3px var(--color-focus-shadow);
}

.filter-bar input,
.filter-bar select,
.app-control {
    min-width: 180px;
    height: 42px;
    padding: 0 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    font-size: 15px;
    color: #111827;
    box-sizing: border-box;
}

.filter-bar input:focus,
.filter-bar select:focus,
.app-control:focus,
textarea.app-control:focus {
    outline: none;
    border-color: var(--color-focus);
    box-shadow: 0 0 0 3px var(--color-focus-shadow);
}

textarea.app-control {
    min-height: 120px;
    padding: 10px 12px;
    height: auto;
}

.disabled-input {
    background-color: #f3f4f6;
    color: #6b7280;
}

/* ==================== BUTTONS ==================== */

.form-actions {
    margin-top: 32px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.primary-btn,
.secondary-btn {
    height: 42px;
    padding: 0 18px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: 0.15s ease-in-out;
}

.primary-btn {
    background: var(--color-btn-primary);
    color: #fff;
}

.primary-btn:hover {
    background: var(--color-btn-hover);
}

.secondary-btn {
    background: #fff;
    color: var(--cc-navy);
    border-color: var(--cc-navy);
}

.secondary-btn:hover {
    background: var(--cc-navy-light);
}

.danger-btn {
    color: #dc2626;
    border-color: #dc2626;
}

.danger-btn:hover {
    background: #fee2e2;
    color: #991b1b;
}

/* ==================== KPI / FILTER / OVERZICHT ==================== */

.kpi-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.kpi-card {
    min-width: 180px;
    padding: 18px 20px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.kpi-card.warning {
    border-left: 4px solid #f59e0b;
}

.kpi-card.danger {
    border-left: 4px solid #ef4444;
}

.kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.1;
}

.kpi-label {
    margin-top: 4px;
    color: #475569;
    font-size: 0.95rem;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    margin-bottom: 18px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.filter-input {
    min-width: 200px;
    flex: 1;
}

.filter-select {
    min-width: 160px;
}

.filter-count {
    font-size: 13px;
    color: #6b7280;
    margin-left: auto;
    white-space: nowrap;
}

.badge-compliance-required {
    display: inline-block;
    background: #EDE6F8;
    color: #5B1A75;
    border: 1px solid #C9A8E0;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-weight: 600;
    color: #374151;
    margin: 0;
}

.search-group {
    min-width: 260px;
}

/* ==================== WEEK / ACTIE NODIG ==================== */

.week-box {
    margin-bottom: 18px;
    padding: 18px 20px;
    background: #fff7f7;
    border: 1px solid #fecaca;
    border-radius: 14px;
}

.week-box h4 {
    margin: 0 0 12px 0;
    color: #b91c1c;
    font-size: 1.1rem;
}

.week-item {
    margin-bottom: 6px;
}

.week-item a {
    color: var(--cc-orange);
    text-decoration: none;
}

.week-item a:hover {
    text-decoration: underline;
}

/* ==================== BADGES ==================== */

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 92px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}

.badge-status-new {
    background: #FFF0E0;
    color: var(--cc-orange);
}

.badge-status-planned {
    background: var(--cc-navy-light);
    color: var(--cc-navy);
}

.badge-status-active {
    background: var(--cc-green-light);
    color: var(--cc-green);
}

.badge-status-done {
    background: var(--cc-light-gray);
    color: var(--cc-gray);
}

.badge-priority-very-high {
    background: #fce4e4;
    color: #991b1b;
}

.badge-priority-high {
    background: #FFF0E0;
    color: var(--cc-orange);
}

.badge-priority-medium {
    background: #fef3c7;
    color: #a16207;
}

.badge-priority-low {
    background: var(--cc-light-gray);
    color: var(--cc-gray);
}

.badge-default {
    background: #e5e7eb;
    color: #374151;
}

.badge-code {
    background: #EDE6F8;
    color: #5B1A75;
    font-weight: 700;
    letter-spacing: 0.03em;
    border: 1px solid #C9A8E0;
}

.record-number-cell {
    font-family: monospace;
    font-size: 13px;
    color: #374151;
    white-space: nowrap;
}

/* ==================== TABELLEN ==================== */

.table-scroll-container {
    overflow-x: auto;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.cmms-table,
.operator-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.cmms-table th,
.operator-table th {
    background: #5B1A75;
    color: #fff;
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid #7B2D90;
}

.cmms-table td,
.operator-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #eef2f7;
    vertical-align: top;
}

.cmms-table tr:nth-child(even),
.operator-table tr:nth-child(even) {
    background-color: #fafafa;
}

.cmms-table tr:hover,
.operator-table tr:hover {
    background: #f8fbff;
}

.sticky-header-table th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.open-cell {
    width: 50px;
    text-align: center;
}

.open-icon-link {
    font-size: 16px;
}

.location-cell,
.issue-cell {
    white-space: normal;
}

.highlight-row {
    background-color: #FFF0E0 !important;
}

.row-overdue {
    background-color: #FEF2F2 !important;
}

.cell-overdue {
    color: #dc2626;
    font-weight: 600;
}

/* ==================== MELDINGEN ==================== */

.alert-danger {
    padding: 12px 16px;
    background: #fee2e2;
    color: #b91c1c;
    border-radius: 10px;
    border: 1px solid #fecaca;
    margin-bottom: 20px;
}

.alert-success {
    padding: 12px 16px;
    background: #dcfce7;
    color: #166534;
    border-radius: 10px;
    border: 1px solid #86efac;
    margin-bottom: 20px;
}

.alert-warning {
    padding: 12px 16px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 10px;
    border: 1px solid #fcd34d;
    margin-bottom: 20px;
}

.empty-text {
    color: #64748b;
}

.helper-text-inline {
    margin-left: 12px;
    color: #6b7280;
}

/* ==================== EDIT PAGINA'S (SCOPED) ==================== */

.record-edit-page,
.plan-edit-page,
.form-page {
    max-width: 1400px;
    margin: 0 auto;
}

.record-edit-page .detail-card,
.plan-edit-page .detail-card {
    width: 100%;
    background: #fff;
    padding: 32px;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
    box-sizing: border-box;
}

.record-edit-page .info-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px 24px;
    margin-bottom: 28px;
}

.record-edit-page .info-grid div {
    line-height: 1.5;
}

.record-edit-page .inline-meta {
    margin-left: 30px;
    font-weight: 600;
}

.record-edit-page .form-grid,
.plan-edit-page .form-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 20px 24px !important;
    align-items: start;
}

.record-edit-page .full-width,
.plan-edit-page .full-width {
    grid-column: 1 / -1 !important;
}

.record-edit-page .location-display,
.plan-edit-page .location-display {
    min-height: 42px;
    display: flex;
    align-items: center;
    padding: 0 2px;
    font-weight: 500;
    color: #111827;
}

.record-edit-page .app-textarea,
.plan-edit-page .app-textarea {
    min-height: 120px;
    padding: 10px 12px;
    height: auto;
}

.record-edit-page .attachments-section,
.plan-edit-page .attachments-section {
    margin-top: 32px;
}

.record-edit-page .upload-area {
    margin-bottom: 20px;
}

.record-edit-page .attachment-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

.record-edit-page .attachment-table th,
.record-edit-page .attachment-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.record-edit-page .attachment-table th {
    font-weight: 600;
    color: #374151;
    background: #f8fafc;
}

.record-edit-page .delete-confirmation,
.plan-edit-page .delete-confirmation {
    margin-top: 20px;
    padding: 16px;
    border: 1px solid #fecaca;
    background: #fff1f2;
    border-radius: 10px;
}

.record-edit-page .full-width textarea,
.plan-edit-page .full-width textarea {
    min-height: 120px;
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover {
    background-color: #f8fbff;
}


/* ==================== RESPONSIVE ==================== */

@media (max-width: 900px) {
    .record-edit-page .form-grid,
    .plan-edit-page .form-grid {
        grid-template-columns: 1fr !important;
    }

    .record-edit-page .info-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== LOGIN PAGINA ==================== */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    padding: 32px;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.login-title {
    margin: 0 0 8px 0;
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--color-heading);
}

.login-subtitle {
    margin: 0 0 24px 0;
    color: #64748b;
    font-size: 0.95rem;
}


/* ==================== HOME ==================== */

.kpi-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.kpi-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--color-heading);
}

.kpi-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.kpi-card {
    background: #fff;
    padding: 16px 20px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    min-width: 180px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
}

.kpi-label {
    font-size: 13px;
    color: #6b7280;
}

.kpi-sublabel {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 2px;
}

.kpi-card.warning {
    border-left: 4px solid #f59e0b;
}

.kpi-card.danger {
    border-left: 4px solid #ef4444;
}

.chart-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
    padding: 20px;
}

.chart-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.bar-chart.multi-series,
.bar-chart.single-series {
    display: flex;
    align-items: end;
    gap: 18px;
    min-height: 260px;
    padding-top: 12px;
    overflow-x: auto;
}

.bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 72px;
}

.bar-stack {
    height: 220px;
    display: flex;
    align-items: end;
    gap: 8px;
}

.bar-stack.single {
    gap: 0;
}

.bar {
    width: 16px;
    min-height: 6px;
    border-radius: 8px 8px 0 0;
}

.wide-bar {
    width: 28px;
}

.corrective-bar {
    background: var(--cc-orange);
}

.preventive-bar {
    background: var(--cc-green);
}

.improvement-bar {
    background: var(--cc-navy);
}

.danger-bar {
    background: #dc2626;
}

.actual-cost-bar {
    background: var(--cc-orange);
}

.estimated-cost-bar {
    background: var(--cc-violet);
}

.bar-value-label {
    font-size: 11px;
    color: #5B1A75;
    font-weight: 600;
    text-align: center;
    margin-top: 3px;
    white-space: nowrap;
}

.bar-actual-label {
    font-size: 11px;
    color: var(--cc-orange);
    font-weight: 600;
    text-align: center;
    margin-top: 1px;
    white-space: nowrap;
}

.bar-label {
    margin-top: 10px;
    font-size: 13px;
    color: #475569;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
    max-width: 72px;
    word-break: break-word;
}

.chart-legend {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #374151;
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    display: inline-block;
}

@media (max-width: 1100px) {
    .chart-grid-2 {
        grid-template-columns: 1fr;
    }
}
.chart-with-axis {
    display: flex;
    gap: 10px;
}

.y-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 220px;
    font-size: 12px;
    color: #6b7280;
    text-align: right;
    padding-right: 6px;
}

.y-axis-line {
    width: 1px;
    background: #d1d5db;
}

/* ==================== KOSTEN VERGELIJKING TABEL ==================== */

.cost-comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
}

.cost-comparison-table th,
.cost-comparison-table td {
    padding: 9px 14px;
    border: 1px solid #e2e8f0;
    vertical-align: middle;
}

.cost-comparison-table th {
    background: #f8fafc;
    font-weight: 600;
    text-align: left;
    color: #374151;
}

.cost-comparison-table .estimated-value {
    color: #64748b;
    background: #f8fafc;
    font-size: 0.95rem;
}

.cost-comparison-table .cost-total-row td {
    background: #f1f5f9;
    font-weight: 700;
}

.cost-comparison-table .cost-input {
    max-width: 160px;
    margin: 0;
}

.deviation-over {
    color: #dc2626;
    font-weight: 600;
}

.deviation-under {
    color: #16a34a;
    font-weight: 600;
}

.compliance-check-block {
    margin: 20px 0;
    padding: 16px 20px;
    background: #f5f0fa;
    border: 1px solid #C9A8E0;
    border-radius: 8px;
}

.compliance-check-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.compliance-check-icon {
    font-size: 18px;
}

.compliance-requirement-badge {
    background: #EDE6F8;
    color: #5B1A75;
    border: 1px solid #C9A8E0;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
}

.compliance-check-desc {
    font-size: 13px;
    color: #6b7280;
    margin: 4px 0 12px;
}

.compliance-radio-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.compliance-radio {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    background: white;
    transition: border-color 0.15s, background 0.15s;
}

.compliance-radio:hover {
    border-color: #C9A8E0;
}

.compliance-radio.selected-yes {
    border-color: #16a34a;
    background: #f0fdf4;
    color: #15803d;
    font-weight: 600;
}

.compliance-radio.selected-no {
    border-color: #dc2626;
    background: #fef2f2;
    color: #dc2626;
    font-weight: 600;
}

.compliance-radio.selected-none {
    border-color: #9ca3af;
    background: #f9fafb;
    color: #6b7280;
}

.compliance-warning {
    display: block;
    margin-top: 10px;
    color: #d97706;
    font-size: 13px;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}

.toggle-label {
    font-size: 14px;
    color: #374151;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #d1d5db;
    border-radius: 24px;
    transition: background 0.2s;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: #5B1A75;
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* ===== PRINT ===== */
.print-template {
    display: none;
}

@media print {
    @page { size: A4 portrait; margin: 15mm; }

    /* Verberg alle directe body-kinderen behalve de print-kopie */
    body > *:not(#print-output) {
        display: none !important;
    }

    #print-output {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Werkorder stijlen */
    .print-template {
        font-family: Arial, sans-serif;
        font-size: 12px;
        color: #000;
        box-sizing: border-box;
    }

    .print-template p,
    .print-template strong,
    .print-template td,
    .print-template div {
        font-size: 12px;
    }

    .print-header {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        border-bottom: 2px solid #000;
        padding-bottom: 10px;
        margin-bottom: 14px;
    }

    .print-logo { height: 55px; }

    .print-title-block h1 { font-size: 22px; margin: 0; color: #000; }
    .print-title-block p  { font-size: 12px; margin: 2px 0 0 0; color: #000; }

    .print-section { margin-bottom: 16px; }

    .print-section h3 {
        font-size: 10px;
        text-transform: uppercase;
        letter-spacing: 1px;
        color: #000;
        border-bottom: 1px solid #000;
        padding-bottom: 3px;
        margin-bottom: 6px;
    }

    .print-table { width: 100%; border-collapse: collapse; font-size: 12px; }
    .print-table td { padding: 3px 8px 3px 0; vertical-align: top; width: 25%; }

    .print-textblock {
        font-size: 12px;
        white-space: pre-wrap;
        padding: 4px 0;
        min-height: 40px;
    }

    .print-line {
        border-bottom: 1px solid #333;
        margin: 10px 0 4px 0;
        height: 22px;
    }

    .print-writelines .print-line { margin-bottom: 12px; }
    .print-sign .print-table td  { padding: 6px 16px 6px 0; vertical-align: bottom; }
}