body.material-card-open {
    overflow: hidden;
}

.material-card-overlay {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    justify-content: flex-end;
    width: 100vw;
    max-width: none;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    overflow: hidden;
}

.material-card-overlay:not([open]) {
    display: none !important;
}

.material-card-overlay::backdrop {
    background: rgba(17, 31, 45, .42);
    backdrop-filter: blur(2px);
}

.material-card-panel {
    width: min(540px, calc(100vw - 42px));
    height: 100dvh;
    overflow-y: auto;
    background: #fff;
    box-shadow: -18px 0 54px rgba(18, 40, 61, .2);
}

.material-card-header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px 18px;
    border-bottom: 1px solid #e4ebf2;
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(12px);
}

.material-card-header h2 {
    margin: 4px 0 3px;
    color: #193550;
    font-size: 22px;
    line-height: 1.2;
}

.material-card-close {
    width: 36px;
    min-width: 36px;
    min-height: 36px;
    margin: 0;
    padding: 0;
    border: 1px solid #dce5ed;
    border-radius: 10px;
    background: #fff;
    color: #52677a;
    font-size: 24px;
    font-weight: 400;
}

.material-card-loading,
.material-card-error {
    margin: 22px 24px;
}

#material-card-content {
    padding: 20px 24px 30px;
}

.material-card-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.material-card-metrics article {
    min-width: 0;
    padding: 13px;
    border: 1px solid #e0e8f0;
    border-radius: 13px;
    background: #f8fafc;
}

.material-card-metrics article.accent {
    border-color: #bed2e6;
    background: #edf5fc;
}

.material-card-metrics span,
.material-card-metrics strong {
    display: block;
}

.material-card-metrics span {
    margin-bottom: 6px;
    color: #748494;
    font-size: 11px;
}

.material-card-metrics strong {
    overflow-wrap: anywhere;
    color: #203f5d;
    font-size: 16px;
}

.material-card-meta {
    margin: 10px 2px 20px;
    color: #738293;
    font-size: 12px;
}

.material-receipt-form {
    margin-bottom: 24px;
    padding: 16px;
    border: 1px solid #dce6ef;
    border-radius: 15px;
    background: #f8fafc;
}

.material-receipt-form h3,
.material-receipts-section h3 {
    margin: 0 0 13px;
    color: #233e58;
    font-size: 15px;
}

.material-receipt-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 11px;
}

.material-receipt-grid label {
    display: grid;
    gap: 6px;
    color: #627487;
    font-size: 11px;
}

.material-receipt-grid label.wide {
    grid-column: 1 / -1;
}

.material-receipt-grid input,
.material-receipt-grid textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 10px;
    border: 1px solid #d5e0e9;
    border-radius: 9px;
    background: #fff;
    color: #263f57;
    font: inherit;
    font-size: 13px;
}

.material-receipt-form > button {
    width: 100%;
    min-height: 42px;
    margin-top: 12px;
}

.material-receipts-section {
    border-top: 1px solid #e4ebf1;
    padding-top: 19px;
}

#material-receipts-list {
    display: grid;
    gap: 8px;
}

.material-receipt {
    display: grid;
    grid-template-columns: 120px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid #e1e8ef;
    border-radius: 12px;
    background: #fff;
}

.material-receipt.cancelled {
    opacity: .55;
}

.material-receipt-main strong,
.material-receipt-main span,
.material-receipt-copy strong,
.material-receipt-copy span,
.material-receipt-copy small {
    display: block;
}

.material-receipt-main strong {
    color: #205089;
    font-size: 13px;
}

.material-receipt-main span,
.material-receipt-copy span,
.material-receipt-copy small {
    margin-top: 3px;
    color: #748495;
    font-size: 10px;
}

.material-receipt-copy strong {
    color: #304a63;
    font-size: 12px;
}

.material-receipt-cancel {
    width: auto;
    min-height: 30px;
    margin: 0;
    padding: 5px 8px;
    border: 1px solid #ead7d4;
    border-radius: 8px;
    background: #fff7f6;
    color: #a0443b;
    font-size: 10px;
}

.material-receipts-empty {
    margin: 0;
    padding: 18px 12px;
    border: 1px dashed #dce5ed;
    border-radius: 11px;
    color: #7d8b98;
    font-size: 12px;
    text-align: center;
}

[data-material-card] {
    cursor: pointer;
}

.production-material-name[data-material-card]:hover strong,
.production-material-name[data-material-card]:hover span,
.materials-table tr[data-material-card]:hover .materials-name {
    color: #205089 !important;
}

@media (max-width: 620px) {
    .material-card-panel {
        width: 100vw;
    }

    .material-card-header {
        padding: 17px 15px 14px;
    }

    #material-card-content {
        padding: 15px;
    }

    .material-card-metrics {
        grid-template-columns: 1fr;
    }

    .material-receipt-grid {
        grid-template-columns: 1fr;
    }

    .material-receipt-grid label.wide {
        grid-column: auto;
    }

    .material-receipt {
        grid-template-columns: 1fr;
    }

    .material-receipt-cancel {
        justify-self: start;
    }
}
