html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f6f8;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#top-bar {
    align-items: center;
    background: #ffffff;
    border-bottom: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
    padding: 8px 16px;
}
.top-bar-left {
    align-items: center;
    display: flex;
    gap: 8px;
}
.top-bar-right {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.bin-box {
    border: 2px solid #dee2e6;
    border-radius: 12px;
    padding: 16px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    transition: 0.3s ease;
    height: 100px;
}
.bin-box.matched {
    border-color: #fd7e14;
    background: #fff3e0;
}
.bin-box.packed {
    border-color: #198754;
    background: #e6ffed;
}
.item-row.completed {
    background: #d1e7dd;
}
tr.packed-item {
    background: #c8facc;
}
tr.current-item {
    background: #fff3e0;
    box-shadow: inset 4px 0 0 #fd7e14;
}
table {
    border-collapse: collapse;
    width: 100%;
    margin-top: 10px;
}
th, td {
    border: 1px solid #ced4da;
    padding: 8px;
    text-align: left;
}
th {
    background-color: #f8f9fa;
}
.order-header {
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 1.1rem;
}
#order-popup {
    background: white;
    border: 2px solid #ccc;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
    height: 80%;
    left: 10%;
    overflow: auto;
    padding: 20px;
    position: fixed;
    top: 10%;
    width: 80%;
    z-index: 1000;
}
.popup-header {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 16px;
}
.popup-header h3 {
    margin-bottom: 0;
}
.popup-close-button {
    align-items: center;
    background: #f8f9fa;
    border: 1px solid #ced4da;
    border-radius: 999px;
    color: #495057;
    display: inline-flex;
    font-size: 1rem;
    font-weight: 700;
    height: 34px;
    justify-content: center;
    line-height: 1;
    padding: 0;
    width: 34px;
}
.popup-close-button:hover {
    background: #e9ecef;
}
.popup-scan-row {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}
.popup-scan-row input {
    margin-bottom: 0;
}
.popup-table-wrap {
    overflow-x: auto;
}
.popup-footer {
    align-items: center;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}
.danger-button {
    background-color: #dc3545;
    color: white;
}
.popup-packed-qty-input {
    max-width: 86px;
}
.popup-edit-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.popup-edit-actions button {
    padding: 0.35rem 0.75rem;
}
.popup-action-cell {
    min-width: 132px;
}
input[type="text"] {
    margin-bottom: 10px;
}
h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}
#order-bin-columns {
    max-width: 88px;
}
#main-container {
    display: flex;
    flex: 1 1 0;
    gap: 6px;
    min-height: 0;
    overflow: hidden;
    padding: 8px;
}
#packing-list-panel {
    border: 1px solid #ccc;
    flex: 0 0 45%;
    height: 100%;
    min-height: 0;
    min-width: 360px;
    overflow: auto;
    padding: 10px;
}
#packing-list-section-resizer {
    align-self: stretch;
    background: #dee2e6;
    border-radius: 999px;
    cursor: col-resize;
    flex: 0 0 8px;
    touch-action: none;
}
#packing-list-section-resizer:hover,
#packing-list-section-resizer.resizing {
    background: #0d6efd;
}
#packing-list-table {
    table-layout: fixed;
    width: max-content;
}
#packing-list-table th {
    overflow: visible;
    position: relative;
}
#packing-list-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.column-resizer {
    bottom: 0;
    cursor: col-resize;
    position: absolute;
    right: -4px;
    touch-action: none;
    top: 0;
    width: 8px;
    z-index: 1;
}
.column-resizer:hover,
.column-resizer.resizing {
    background: rgba(13, 110, 253, 0.18);
}
button {
    background-color: #ffffff;
    color: rgb(0, 0, 0);
    border: 1px solid #a2a2a2;
    border-radius: 50rem;
    padding: 0.5rem 1.5rem;
    box-shadow: 0 .125rem .25rem rgba(0, 0, 0, 0.075);
    cursor: pointer;
    transition: background-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
button:hover {
    background-color: #f3f3f3;
    border-color: #a2a2a2;
    box-shadow: 0 .25rem .5rem rgba(0, 0, 0, 0.15);
}
button:focus {
    outline: none;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.5);
}

#order-bins {
    --bin-columns: 5;
    align-content: start;
    display: grid;
    flex: 1 1 auto;
    gap: 10px;
    grid-template-columns: repeat(var(--bin-columns), minmax(100px, 1fr));
    align-items: start;
    min-height: 0;
    overflow-x: auto;
    overflow-y: auto;
}

#order-section {
    flex: 0 0 auto;
    padding: 8px 16px;
}

#order-section select {
    display: block;
    margin-bottom: 10px;
}
