/* ==========================================================
   REKVISISJON – SIDE
========================================================== */

.rekvisisjon-page-wrap {
    padding: 18px;
}

.rekvisisjon-sjafor-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;

    margin-bottom: 16px;
    padding: 14px 16px;

    background: #111827;

    border: 1px solid #334155;
    border-radius: 10px;
}

.rekvisisjon-sjafor-label {
    color: #94a3b8;

    font-size: 14px;
    font-weight: 600;
}

.rekvisisjon-sjafor-verdi {
    color: #ffffff;

    font-size: 18px;
    font-weight: 800;
}

.rekvisisjon-demo-info {
    margin-bottom: 16px;
    padding: 12px 14px;

    background: rgba(124, 58, 237, 0.15);
    color: #ddd6fe;

    border: 1px solid #6d28d9;
    border-radius: 9px;

    font-size: 14px;
    line-height: 1.45;
}

.rekvisisjon-form {
    width: 100%;
}


/* ==========================================================
   VERKTØYLINJE
========================================================== */

.rek-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;

    margin-bottom: 14px;
}


/* ==========================================================
   REKVISISJONSRADER
========================================================== */

.regning-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rek-row {
    display: grid;
    grid-template-columns:
        minmax(150px, 1.4fr)
        minmax(130px, 1fr)
        minmax(145px, 1fr)
        minmax(130px, 0.8fr)
        auto;
    align-items: end;
    gap: 12px;

    padding: 14px;

    background: #111827;

    border: 1px solid #334155;
    border-radius: 10px;
}

.rek-row-field {
    display: flex;
    flex-direction: column;
    gap: 6px;

    min-width: 0;
}

.rek-row-field label {
    color: #94a3b8;

    font-size: 12px;
    font-weight: 700;
}

.rek-row-field input {
    width: 100%;
    min-width: 0;
    min-height: 42px;

    padding: 9px 11px;

    background: #0f172a;
    color: #f8fafc;

    border: 1px solid #475569;
    border-radius: 8px;

    font: inherit;
    box-sizing: border-box;
}

.rek-row-field input:focus {
    border-color: #3b82f6;
    outline: 2px solid rgba(59, 130, 246, 0.2);
    outline-offset: 0;
}

.rek-row-field input[readonly] {
    color: #cbd5e1;
    background: #172033;
    cursor: default;
}

.rek-delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;

    padding: 0;

    background: rgba(220, 38, 38, 0.12);
    color: #fca5a5;

    border: 1px solid #7f1d1d;
    border-radius: 8px;

    font-size: 24px;
    line-height: 1;

    cursor: pointer;

    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease;
}

.rek-delete-btn:hover {
    background: #b91c1c;
    color: #ffffff;
    border-color: #ef4444;
}


/* ==========================================================
   TOM LISTE
========================================================== */

.rekvisisjon-empty {
    margin: 14px 0;
    padding: 18px;

    color: #94a3b8;
    text-align: center;

    background: #111827;

    border: 1px dashed #334155;
    border-radius: 10px;
}

.rekvisisjon-empty[hidden] {
    display: none;
}


/* ==========================================================
   LAGRING PÅ SIDEN
========================================================== */

.rekvisisjon-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;

    margin-top: 18px;
}


/* ==========================================================
   KNAPPER
========================================================== */

.regning-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 44px;
    padding: 10px 16px;

    background: #334155;
    color: #ffffff;

    border: 1px solid #475569;
    border-radius: 8px;

    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;

    cursor: pointer;

    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        transform 0.15s ease;
}

.regning-btn:hover {
    background: #475569;
    border-color: #64748b;
}

.regning-btn:active {
    transform: translateY(1px);
}

.regning-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.regning-btn.save-btn {
    background: #2563eb;
    border-color: #3b82f6;
}

.regning-btn.save-btn:hover {
    background: #1d4ed8;
}


/* ==========================================================
   POPUP – OVERLAY
========================================================== */

.rek-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;

    display: none;
    align-items: center;
    justify-content: center;

    padding: 20px;

    background: rgba(2, 6, 23, 0.82);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);

    box-sizing: border-box;
    overflow-y: auto;
}

.rek-overlay.open {
    display: flex;
}

.rek-overlay[aria-hidden="true"] {
    display: none;
}

.rek-overlay[aria-hidden="false"] {
    display: flex;
}


/* ==========================================================
   POPUP – VINDU
========================================================== */

.rek-modal {
    position: relative;

    width: min(100%, 520px);
    max-height: calc(100vh - 40px);

    padding: 26px;

    background: #111827;
    color: #f8fafc;

    border: 1px solid #334155;
    border-radius: 14px;

    box-shadow:
        0 24px 70px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(255, 255, 255, 0.02);

    box-sizing: border-box;
    overflow-y: auto;
}

.rek-modal h3 {
    margin: 0;
    padding-right: 42px;

    color: #ffffff;

    font-size: 22px;
    font-weight: 800;
    line-height: 1.25;
}

.rek-close {
    position: absolute;
    top: 14px;
    right: 14px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 38px;
    height: 38px;

    padding: 0;

    background: transparent;
    color: #94a3b8;

    border: 1px solid transparent;
    border-radius: 8px;

    font-size: 27px;
    line-height: 1;

    cursor: pointer;

    transition:
        color 0.15s ease,
        background 0.15s ease,
        border-color 0.15s ease;
}

.rek-close:hover {
    background: #1e293b;
    color: #ffffff;
    border-color: #334155;
}


/* ==========================================================
   STEGVEIVISER
========================================================== */

.rek-step-indicator {
    margin-top: 8px;
    margin-bottom: 22px;

    color: #93c5fd;

    font-size: 14px;
    font-weight: 700;
}

.rek-step {
    min-height: 130px;
}

.rek-step[hidden] {
    display: none;
}

.rek-step label {
    display: block;

    margin-bottom: 8px;

    color: #cbd5e1;

    font-size: 14px;
    font-weight: 700;
}

.rek-step input,
.rek-step select {
    display: block;

    width: 100%;
    min-height: 48px;

    padding: 11px 13px;

    background: #0f172a;
    color: #f8fafc;

    border: 1px solid #475569;
    border-radius: 9px;

    font-family: inherit;
    font-size: 16px;

    box-sizing: border-box;
}

.rek-step input::placeholder {
    color: #64748b;
}

.rek-step input:focus,
.rek-step select:focus {
    border-color: #3b82f6;
    outline: 3px solid rgba(59, 130, 246, 0.18);
    outline-offset: 0;
}

.rek-step select option {
    background: #0f172a;
    color: #f8fafc;
}


/* ==========================================================
   SAMMENDRAG
========================================================== */

.rek-summary {
    margin-top: 18px;
    padding: 14px;

    background: #0f172a;
    color: #cbd5e1;

    border: 1px solid #334155;
    border-radius: 9px;

    font-size: 14px;
    line-height: 1.7;
}

.rek-summary:empty {
    display: none;
}

.rek-summary strong {
    color: #ffffff;
}


/* ==========================================================
   POPUP – NAVIGASJON OG LAGRING
========================================================== */

.rek-actions,
.rek-save-actions {
    display: flex;
    align-items: center;
    gap: 10px;

    margin-top: 22px;
}

.rek-actions {
    justify-content: space-between;
}

.rek-save-actions {
    justify-content: flex-end;
}

.rek-save-actions[hidden] {
    display: none;
}

.rek-error {
    margin-top: 14px;
    padding: 11px 13px;

    background: rgba(220, 38, 38, 0.12);
    color: #fecaca;

    border: 1px solid #991b1b;
    border-radius: 8px;

    font-size: 14px;
    font-weight: 600;
}

.rek-error[hidden] {
    display: none;
}


/* ==========================================================
   NETTBRETT
========================================================== */

@media (max-width: 900px) {
    .rek-row {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .rek-delete-btn {
        grid-column: 2;
        justify-self: end;
    }
}


/* ==========================================================
   MOBIL
========================================================== */

@media (max-width: 700px) {
    .rekvisisjon-page-wrap {
        padding: 12px;
    }

    .rekvisisjon-sjafor-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }

    .rek-toolbar .regning-btn {
        width: 100%;
    }

    .rek-row {
        grid-template-columns: 1fr;
    }

    .rek-delete-btn {
        grid-column: 1;
        justify-self: end;
    }

    .rekvisisjon-footer {
        display: block;
    }

    .rekvisisjon-footer .regning-btn {
        width: 100%;
    }

    .rek-overlay {
        align-items: flex-end;
        padding: 10px;
    }

    .rek-modal {
        width: 100%;
        max-height: calc(100vh - 20px);

        padding: 22px 18px 18px;

        border-radius: 14px 14px 10px 10px;
    }

    .rek-step {
        min-height: 115px;
    }

    .rek-actions,
    .rek-save-actions {
        flex-wrap: wrap;
    }

    .rek-save-actions .regning-btn {
        flex: 1 1 100%;
    }
}
/* ==========================================================
   DATOVELGER
========================================================== */

.rek-date-picker {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        48px;
    gap: 8px;

    width: 100%;
}

.rek-date-picker input {
    color-scheme: dark;
}

.rek-calendar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 48px;
    min-height: 48px;
    padding: 0;

    background: #2563eb;
    color: #ffffff;

    border: 1px solid #3b82f6;
    border-radius: 9px;

    font-size: 22px;
    line-height: 1;

    cursor: pointer;
}

.rek-calendar-btn:hover {
    background: #1d4ed8;
}

.rek-calendar-btn:focus-visible {
    outline: 3px solid rgba(
        59,
        130,
        246,
        0.3
    );

    outline-offset: 2px;
}

.rek-date-picker
input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 1;
}

body.rekvisisjon-popup-open {
    overflow: hidden;
}