.po-form-page .form-card,
.po-form-page .lines-card,
.po-form-page .totals-card {
    border: 0;
    border-radius: 14px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
}

.po-form-page .page-header h2 {
    font-weight: 700;
}

.po-form-page .form-card {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid #e6ecf5;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

.po-form-page .form-card .card-body {
    padding: 18px;
}

.po-form-page .form-card .row.g-3 {
    row-gap: 14px;
}

.po-form-page .form-card .form-label {
    color: #334155;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    margin-bottom: 6px;
}

.po-form-page .form-card .form-control,
.po-form-page .form-card .form-select,
.po-form-page .form-card .select2-container--default .select2-selection--single {
    border-color: #d8e2ef;
    border-radius: 10px;
    min-height: 40px;
}

.po-form-page .form-card textarea.form-control {
    min-height: 58px;
}

.po-form-page .form-card .form-control:focus,
.po-form-page .form-card .form-select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 0.18rem rgba(37, 99, 235, 0.12);
}

.po-form-page .form-card input[readonly] {
    background: #f8fafc;
    color: #0f172a;
    font-weight: 700;
}

.po-form-page .table thead th {
    white-space: nowrap;
    background: #f8f9fa;
    font-size: 13px;
}

.po-form-page input[readonly],
.po-form-page textarea[readonly] {
    background-color: #f8f9fa;
}

.po-form-page .line-remove-btn {
    border: none;
    background: transparent;
    color: #dc3545;
    font-size: 18px;
    cursor: pointer;
}

.po-form-page .desc-cell {
    min-width: 180px;
}

.po-form-page .small-cell {
    min-width: 80px;
}

.po-form-page .select2-container {
    width: 100% !important;
}
.lines-card .table-responsive {
    max-height: 400px;
    overflow: auto;
}

#linesTable thead th {
    position: sticky;
    top: 0;
    background: #f8f9fa;
    z-index: 2;
    font-weight: 600;
    font-size: 13px;
}

#linesTable td,
#linesTable th {
    white-space: nowrap;
    vertical-align: middle;
}

#linesTable input,
#linesTable select,
#linesTable textarea {
    font-size: 13px;
    padding: 4px 6px;
}

.desc-cell textarea {
    min-width: 200px;
}

.line-remove-btn {
    background: #dc3545;
    border: none;
    color: #fff;
    border-radius: 4px;
    padding: 4px 8px;
}

.po-import-modal {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(15, 23, 42, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.po-import-dialog {
    width: min(1120px, 96vw);
    max-height: 90vh;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, .25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.po-import-header,
.po-import-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.po-import-footer {
    border-top: 1px solid #e5e7eb;
    border-bottom: 0;
}

.po-import-body {
    padding: 16px;
    overflow: auto;
}

.po-import-upload {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin-bottom: 14px;
}

.po-import-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.po-import-grid label {
    font-size: 12px;
    font-weight: 700;
    color: #334155;
}

.po-import-thumb {
    width: 46px;
    height: 46px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.po-import-preview {
    max-height: 360px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.po-import-tools {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
}

.po-column-menu {
    max-height: 320px;
    min-width: 210px;
    overflow: auto;
}

.po-column-menu .dropdown-item {
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}

.po-column-menu-row {
    align-items: center;
    display: grid;
    gap: 8px;
    grid-template-columns: auto minmax(90px, 1fr) auto auto;
}

.po-column-menu-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.po-column-move {
    line-height: 1;
    min-width: 28px;
    padding: 4px 6px;
}

.po-import-tools .dropdown {
    display: inline-flex;
}

.po-import-preview th {
    position: sticky;
    top: 43px;
    background: #f8fafc;
    z-index: 1;
}

#linesTable td:has(.item-select),
.po-form-page td:has(.item-select) {
    min-width: 320px;
}

.erp-item-option-main {
    font-weight: 700;
    color: #111827;
    line-height: 1.25;
}

.erp-item-option-meta {
    margin-top: 2px;
    font-size: 11px;
    color: #64748b;
}

.select2-container--default .select2-results__option--highlighted .erp-item-option-main,
.select2-container--default .select2-results__option--highlighted .erp-item-option-meta {
    color: #fff;
}

@media (max-width: 768px) {
    .po-form-page .page-header {
        align-items: flex-start !important;
        flex-direction: column;
    }

    .po-import-upload {
        grid-template-columns: 1fr;
    }

    .po-import-tools {
        align-items: stretch;
        flex-wrap: wrap;
    }

    .po-import-footer {
        align-items: stretch;
        flex-direction: column;
    }
}
