.warehouse-writeoff-open {
    min-height: 44px;
    align-self: end;
    white-space: nowrap;
}

.warehouse-writeoff-dialog {
    width: min(820px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    padding: 0;
    border: 0;
    border-radius: 18px;
    background: #fff;
    color: #193a5c;
    box-shadow: 0 24px 80px rgba(14, 39, 67, .3);
}

.warehouse-writeoff-dialog::backdrop {
    background: rgba(12, 29, 47, .58);
}

.warehouse-writeoff-dialog form {
    padding: 20px;
}

.warehouse-writeoff-header,
.warehouse-writeoff-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.warehouse-planned-section {
    margin-top: 12px;
    border: 1px solid #dce6ef;
    border-radius: 12px;
    background: #f8fafc;
    overflow: hidden;
}

.warehouse-planned-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid #e1e9f0;
    background: #f1f5f9;
    font-size: 12px;
}

.warehouse-planned-heading span {
    color: #647789;
    font-weight: 700;
}

.warehouse-planned-materials {
    max-height: min(390px, 44vh);
    overflow: auto;
}

.warehouse-planned-row {
    display: grid;
    grid-template-columns: minmax(230px, 1.7fr) minmax(250px, 1.4fr) 130px;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid #e5ebf1;
    background: #fff;
    transition: background .15s ease, box-shadow .15s ease;
}

.warehouse-planned-row:last-child { border-bottom: 0; }
.warehouse-planned-row.selected {
    background: #eef7ff;
    box-shadow: inset 3px 0 #2874b8;
}

.warehouse-material-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #193a5c;
    text-align: left;
}

.warehouse-material-check {
    display: grid;
    flex: 0 0 21px;
    width: 21px;
    height: 21px;
    place-items: center;
    border: 1.5px solid #9eafbf;
    border-radius: 6px;
    background: #fff;
    color: transparent;
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
}

.warehouse-planned-row.selected .warehouse-material-check {
    border-color: #205f99;
    background: #205f99;
    color: #fff;
}

.warehouse-material-copy { min-width: 0; }
.warehouse-material-copy strong,
.warehouse-material-copy small { display: block; }
.warehouse-material-copy strong {
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.warehouse-material-copy small {
    margin-top: 3px;
    color: #718092;
    font-size: 10px;
}

.warehouse-material-numbers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
    color: #718092;
    font-size: 10px;
}
.warehouse-material-numbers strong { color: #314f6c; }

.warehouse-material-quantity {
    margin: 0 !important;
    color: #657789;
    font-size: 10px !important;
}
.warehouse-material-quantity input {
    height: 34px !important;
    margin-top: 3px !important;
    padding: 6px 8px;
    text-align: right;
}
.warehouse-material-quantity input:disabled {
    background: #edf1f5;
    color: #8a98a6;
}

.warehouse-planned-empty {
    margin: 0;
    padding: 18px 12px;
    color: #718092;
    font-size: 12px;
    text-align: center;
}

.warehouse-manual-material-section {
    margin-top: 13px;
    padding-top: 2px;
    border-top: 1px dashed #cbd8e4;
}

.warehouse-manual-material-section > label > span {
    color: #405d78;
    font-weight: 700;
}

.warehouse-writeoff-header { align-items: flex-start; }
.warehouse-writeoff-header h2 { margin: 2px 0 0; font-size: 25px; }
.warehouse-writeoff-header .eyebrow { margin: 0 0 4px; font-size: 11px; }

.warehouse-writeoff-modes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin: 15px 0;
    padding: 4px;
    border-radius: 11px;
    background: #eef3f8;
}

.warehouse-writeoff-modes button {
    min-height: 38px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #637386;
    font-size: 13px;
}

.warehouse-writeoff-modes button.active {
    background: #fff;
    color: #205089;
    box-shadow: 0 2px 8px rgba(25, 58, 92, .12);
}

.warehouse-writeoff-dialog label {
    position: relative;
    display: block;
    margin-top: 12px;
    font-size: 12px;
}

.warehouse-writeoff-dialog input,
.warehouse-writeoff-dialog select,
.warehouse-writeoff-dialog textarea {
    width: 100%;
    margin-top: 5px;
    font-size: 14px;
}

.warehouse-writeoff-dialog input,
.warehouse-writeoff-dialog select {
    height: 42px;
}

.warehouse-search-results {
    position: relative;
    z-index: 3;
    max-height: 220px;
    margin-top: 5px;
    overflow: auto;
    border: 1px solid #dce5ee;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(25, 58, 92, .15);
}

.warehouse-search-results button {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid #e6edf3;
    border-radius: 0;
    background: #fff;
    color: #193a5c;
    text-align: left;
}

.warehouse-search-results button:hover { background: #f1f6fb; }
.warehouse-search-results strong,
.warehouse-search-results span,
.warehouse-selected strong,
.warehouse-selected span { display: block; }
.warehouse-search-results span,
.warehouse-selected span { margin-top: 3px; color: #718092; font-size: 11px; }
.warehouse-search-results p { margin: 0; padding: 12px; color: #718092; }

.warehouse-selected {
    margin-top: 7px;
    padding: 10px 12px;
    border: 1px solid #bdd4ec;
    border-radius: 10px;
    background: #eef6fd;
    font-size: 13px;
}

.warehouse-writeoff-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 10px;
}

.warehouse-notification-note,
.warehouse-writeoff-success {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 12px;
}

.warehouse-notification-note { background: #fff4dc; color: #765700; }
.warehouse-writeoff-success { background: #e8f6ee; color: #176b57; }

.warehouse-writeoff-actions {
    justify-content: flex-end;
    margin-top: 16px;
    padding-top: 13px;
    border-top: 1px solid #e3eaf1;
}

@media (max-width: 620px) {
    .warehouse-writeoff-dialog form { padding: 15px; }
    .warehouse-writeoff-grid { grid-template-columns: 1fr; }
    .warehouse-writeoff-actions button { flex: 1; }
    .warehouse-writeoff-open { width: 100%; }

    .warehouse-planned-row {
        grid-template-columns: minmax(0, 1fr) 110px;
        gap: 8px;
    }

    .warehouse-material-numbers {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .warehouse-material-quantity {
        grid-column: 2;
        grid-row: 1;
    }
}
