* {
    box-sizing: border-box;
}


body {
    margin: 0;
    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background: #f5f7fb;
    color: #1f2937;
}


a {
    text-decoration: none;
    color: #2563eb;
}


.topbar {
    background: white;
    border-bottom: 1px solid #e5e7eb;
}


.topbar-inner {
    max-width: 1400px;
    margin: auto;

    padding: 14px 24px;

    display: flex;
    justify-content: space-between;
    align-items: center;
}


.brand {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}


nav {
    display: flex;
    align-items: center;
    gap: 20px;
}


.container {
    max-width: 1400px;
    margin: auto;

    padding: 30px 24px;
}


.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 25px;
}


.page-header h1 {
    margin: 0 0 5px 0;
}


.muted {
    color: #6b7280;
}


.btn {
    display: inline-block;

    padding: 10px 16px;

    border-radius: 7px;

    font-weight: 600;

    border: none;

    cursor: pointer;
}


.btn-primary {
    background: #2563eb;
    color: white;
}


.btn-primary:hover {
    background: #1d4ed8;
}


.stats-grid {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 20px;

    margin-bottom: 25px;
}


.stat-card {
    background: white;

    border: 1px solid #e5e7eb;

    border-radius: 10px;

    padding: 22px;
}


.stat-label {
    display: block;

    font-size: 14px;

    color: #6b7280;

    margin-bottom: 8px;
}


.stat-card strong {
    font-size: 28px;
}


.card {
    background: white;

    border: 1px solid #e5e7eb;

    border-radius: 10px;

    overflow: hidden;
}


.card-header {
    padding: 18px 20px;

    border-bottom: 1px solid #e5e7eb;
}


.card-header h2 {
    margin: 0;

    font-size: 18px;
}


.table-wrap {
    overflow-x: auto;
}


table {
    width: 100%;

    border-collapse: collapse;
}


th,
td {
    padding: 14px 16px;

    text-align: left;

    border-bottom: 1px solid #e5e7eb;
}


th {
    background: #f9fafb;

    font-size: 13px;

    text-transform: uppercase;

    color: #6b7280;
}


.status {
    display: inline-block;

    padding: 5px 9px;

    border-radius: 20px;

    font-size: 12px;

    font-weight: 700;
}


.status-draft {
    background: #fef3c7;
    color: #92400e;
}


.status-completed {
    background: #dcfce7;
    color: #166534;
}


.status-submitted {
    background: #dbeafe;
    color: #1e40af;
}


.empty-state {
    text-align: center;

    padding: 70px 20px;
}


.empty-state h3 {
    margin-bottom: 8px;
}


.empty-state p {
    color: #6b7280;

    margin-bottom: 20px;
}


@media (max-width: 768px) {

    .stats-grid {
        grid-template-columns: 1fr;
    }


    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }


    nav > a:first-child {
        display: none;
    }

}

.form-card {
    padding: 24px;
}


.form-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 20px;
}


.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}


.form-full {
    grid-column: 1 / -1;
}


.form-group label {
    font-size: 14px;
    font-weight: 600;
}


.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;

    padding: 11px 12px;

    border: 1px solid #d1d5db;

    border-radius: 7px;

    font: inherit;

    background: white;
}


.form-group textarea {
    resize: vertical;
}


.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;

    border-color: #2563eb;
}


.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;

    margin-top: 25px;
}


.btn-secondary {
    background: #e5e7eb;
    color: #1f2937;
}


.timeline {
    padding: 10px 25px;
}


.timeline-item {
    display: grid;

    grid-template-columns: 90px 1fr;

    gap: 20px;

    padding: 20px 0;

    border-bottom: 1px solid #e5e7eb;
}


.timeline-item:last-child {
    border-bottom: none;
}


.timeline-time {
    font-weight: 700;
    color: #374151;
}


.timeline-content h3 {
    margin: 0;
}


.event-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 15px;
}


.event-meta {
    display: flex;
    flex-wrap: wrap;

    gap: 15px;

    margin-top: 10px;

    font-size: 13px;

    color: #6b7280;
}


.status-in_progress {
    background: #dbeafe;
    color: #1e40af;
}


.status-pending {
    background: #fef3c7;
    color: #92400e;
}


.status-blocked {
    background: #fee2e2;
    color: #991b1b;
}


.status-observation {
    background: #ede9fe;
    color: #5b21b6;
}


@media (max-width: 768px) {

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


    .form-full {
        grid-column: auto;
    }


    .timeline-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }


    .event-header {
        align-items: flex-start;
    }

}

.location-row {
    display: flex;
    gap: 10px;
}

.location-row input {
    flex: 1;
}

.location-row .btn {
    white-space: nowrap;
}


@media (max-width: 768px) {

    .location-row {
        flex-direction: column;
    }

}

.location-row {
    display: flex;
    gap: 10px;
}

.location-row input {
    flex: 1;
}

.location-row .btn {
    white-space: nowrap;
}

@media (max-width: 768px) {

    .location-row {
        flex-direction: column;
    }

}


/* =========================================================
   EVENT DETAILS
   ========================================================= */

.event-description {
    margin: 14px 0;
    line-height: 1.6;
}


.event-details {
    margin-top: 18px;

    display: grid;
    gap: 10px;

    padding: 15px;

    background: #f9fafb;

    border-radius: 8px;

    border: 1px solid #e5e7eb;
}


.event-details > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}


.event-details strong {
    font-size: 13px;
    color: #374151;
}


.event-details span {
    color: #4b5563;
}


/* =========================================================
   EVENT ACTIONS
   ========================================================= */

.event-actions {
    display: flex;
    align-items: center;
    gap: 10px;

    margin-top: 18px;
}


.event-actions form {
    margin: 0;
}


.btn-small {
    padding: 7px 12px;
    font-size: 13px;
}


.btn-danger {
    background: #dc2626;
    color: white;
}


.btn-danger:hover {
    background: #b91c1c;
}


.link-danger {
    border: 0;
    background: transparent;

    color: #dc2626;

    cursor: pointer;

    padding: 0;

    font-size: 13px;
}


.link-danger:hover {
    text-decoration: underline;
}


/* =========================================================
   ATTACHMENTS
   ========================================================= */

.attachments-section {
    margin-top: 22px;

    padding-top: 18px;

    border-top: 1px solid #e5e7eb;
}


.attachments-heading {
    display: flex;
    align-items: center;
    gap: 8px;

    margin-bottom: 12px;
}


.attachment-count {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    min-width: 24px;
    height: 24px;

    padding: 0 7px;

    border-radius: 999px;

    background: #e5e7eb;

    color: #374151;

    font-size: 12px;
    font-weight: 700;
}


.attachment-grid {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fill,
            minmax(180px, 1fr)
        );

    gap: 15px;

    margin-bottom: 15px;
}


.attachment-card {
    border: 1px solid #e5e7eb;

    border-radius: 9px;

    background: #fff;

    overflow: hidden;
}


.attachment-preview {
    display: block;

    width: 100%;
    height: 150px;

    object-fit: cover;

    background: #f3f4f6;
}


.attachment-video {
    display: block;

    width: 100%;
    height: 150px;

    background: #111827;
}


.document-preview {
    height: 120px;

    display: flex;

    align-items: center;
    justify-content: center;

    background: #f3f4f6;
}


.document-icon {
    padding: 12px 16px;

    border-radius: 7px;

    background: #e5e7eb;

    color: #374151;

    font-weight: 700;
}


.attachment-info {
    padding: 12px;
}


.attachment-name {
    display: block;

    font-size: 13px;
    font-weight: 600;

    overflow-wrap: anywhere;
}


.attachment-caption {
    margin-top: 5px;
    margin-bottom: 8px;

    font-size: 12px;

    color: #6b7280;
}


.attachment-upload-form {
    margin-top: 12px;
}


.attachment-upload-row {
    display: grid;

    grid-template-columns:
        minmax(200px, 1fr)
        minmax(200px, 1fr)
        auto;

    gap: 10px;

    align-items: center;
}


.attachment-upload-row input {
    width: 100%;

    padding: 9px 10px;

    border: 1px solid #d1d5db;

    border-radius: 7px;

    background: white;
}


/* =========================================================
   HEADER ACTIONS
   ========================================================= */

.header-actions {
    display: flex;
    gap: 10px;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 768px) {

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


    .attachment-grid {
        grid-template-columns: 1fr;
    }


    .event-actions {
        flex-wrap: wrap;
    }


    .attachment-preview,
    .attachment-video {
        height: 220px;
    }

}

/* =========================================================
   REPORT PREPARATION
   ========================================================= */

.report-preparation-grid {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        minmax(340px, 0.65fr);

    gap: 25px;

    align-items: start;
}


.section-title {
    margin-top: 0;
    margin-bottom: 22px;
}


.report-event-list {
    padding: 0 20px;
}


.report-event-preview {
    display: grid;

    grid-template-columns: 70px 1fr;

    gap: 15px;

    padding: 18px 0;

    border-bottom: 1px solid #e5e7eb;
}


.report-event-preview:last-child {
    border-bottom: 0;
}


.report-event-time {
    font-weight: 700;
}


.report-event-preview p {
    margin: 8px 0;
    color: #4b5563;
}


/* =========================================================
   GENERATED REPORT VIEW
   ========================================================= */

.report-status-row {
    display: flex;
    justify-content: flex-end;

    margin-bottom: 12px;
}


.report-view-card {
    padding: 35px;
}


.report-title {
    text-align: center;

    padding-bottom: 25px;

    border-bottom: 2px solid #111827;
}


.report-title h2 {
    margin: 0 0 7px 0;
}


.report-info-grid {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 1px;

    margin-top: 25px;

    background: #e5e7eb;

    border: 1px solid #e5e7eb;
}


.report-info-grid > div {
    display: flex;
    flex-direction: column;

    gap: 5px;

    padding: 15px;

    background: white;
}


.report-info-grid span {
    font-size: 12px;
    color: #6b7280;
}


.report-section {
    margin-top: 30px;
}


.report-section > h3 {
    padding-bottom: 8px;

    border-bottom: 1px solid #d1d5db;
}


.generated-event {
    padding: 20px 0;

    border-bottom: 1px solid #e5e7eb;
}


.generated-event:last-child {
    border-bottom: 0;
}


.generated-event-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 15px;
}


.generated-event-number {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    width: 26px;
    height: 26px;

    margin-right: 7px;

    border-radius: 50%;

    background: #2563eb;
    color: white;

    font-weight: 700;
    font-size: 12px;
}


.generated-event-remarks {
    margin-top: 12px;

    padding: 10px 12px;

    background: #f9fafb;

    border-radius: 6px;
}


.report-attachments {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fill,
            minmax(200px, 1fr)
        );

    gap: 15px;

    margin-top: 15px;
}


.report-evidence-image {
    border: 1px solid #e5e7eb;

    border-radius: 8px;

    overflow: hidden;
}


.report-evidence-image img {
    display: block;

    width: 100%;
    height: 180px;

    object-fit: cover;
}


.report-evidence-image span {
    display: block;

    padding: 8px 10px;

    font-size: 12px;

    color: #4b5563;
}


.report-document-link {
    padding: 12px;

    border: 1px solid #e5e7eb;

    border-radius: 7px;

    background: #f9fafb;
}


.report-bottom-actions {
    display: flex;

    justify-content: flex-end;
    align-items: center;

    gap: 10px;

    margin-top: 20px;
}


.report-bottom-actions form {
    margin: 0;
}


.status-generated {
    background: #dbeafe;
    color: #1e40af;
}


.status-finalized {
    background: #dcfce7;
    color: #166534;
}


/* =========================================================
   MOBILE REPORT VIEW
   ========================================================= */

@media (max-width: 900px) {

    .report-preparation-grid {
        grid-template-columns: 1fr;
    }


    .report-info-grid {
        grid-template-columns: 1fr 1fr;
    }

}


@media (max-width: 600px) {

    .report-info-grid {
        grid-template-columns: 1fr;
    }


    .report-view-card {
        padding: 20px;
    }


    .generated-event-header {
        align-items: flex-start;
    }


    .report-bottom-actions {
        flex-direction: column;
        align-items: stretch;
    }


    .report-bottom-actions .btn,
    .report-bottom-actions button {
        width: 100%;
        text-align: center;
    }


    .report-event-preview {
        grid-template-columns: 1fr;
        gap: 5px;
    }

}

/* =========================================================
   REPORT HISTORY FILTERS
   ========================================================= */

.report-filter-card {
    padding: 22px;
}


.report-filter-grid {
    display: grid;

    grid-template-columns:
        2fr
        1fr
        1fr
        1fr;

    gap: 15px;
}


.report-filter-actions {
    display: flex;

    justify-content: flex-end;

    gap: 10px;

    margin-top: 18px;
}


.report-list-header {
    display: flex;

    align-items: center;
    justify-content: space-between;
}


.report-list-header h2 {
    margin-bottom: 3px;
}


.report-number-link {
    font-weight: 600;
}


.report-row-actions {
    display: flex;

    align-items: center;

    flex-wrap: wrap;

    gap: 12px;
}


.report-row-actions form {
    margin: 0;
}


/* =========================================================
   TABLE HOVER
   ========================================================= */

tbody tr:hover {
    background: #f9fafb;
}


/* =========================================================
   REPORT FILTER MOBILE
   ========================================================= */

@media (max-width: 1000px) {

    .report-filter-grid {
        grid-template-columns:
            1fr 1fr;
    }

}


@media (max-width: 600px) {

    .report-filter-grid {
        grid-template-columns: 1fr;
    }


    .report-filter-actions {
        flex-direction: column;
    }


    .report-filter-actions .btn {
        width: 100%;
        text-align: center;
    }

}