/* ============================================================
   BASKET — picker, confirm, badges, totals
   All rules prefixed .basket- to avoid collisions.
   ============================================================ */

/* ---- Picker screen ---- */
.basket-picker {
    margin-top: 8px;
}
.basket-picker table {
    width: 100%;
}

/* ---- Top bar: total on the left, Checkout on the right ---- */
.basket-picker-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    margin: 8px 0;
    background: #f5f5f5;
    border: 1px solid #000;
    gap: 10px;
    flex-wrap: nowrap;
}
.basket-grand-total {
    font-size: 16px;
    font-weight: 700;
    color: #000;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1 1 auto;
    min-width: 0;
}
.basket-checkout-top {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid #000;
    background: #000;
    color: #fff;
    cursor: pointer;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    white-space: nowrap;
    flex: 0 0 auto;
}
.basket-checkout-top:disabled {
    background: #999;
    border-color: #999;
    cursor: not-allowed;
}
.basket-checkout-top:hover:not(:disabled) {
    background: #333;
}

/* ---- Qty and Add cells ---- */
.basket-qty-cell {
    width: 1%;
    white-space: nowrap;
    padding-left: 6px;
    padding-right: 4px;
}
.basket-qty-input {
    width: 52px;
    max-width: 100%;
    padding: 6px 6px;
    font-size: 14px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    color: #111;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
}
.basket-qty-input:focus {
    outline: none;
    border-color: #0066cc;
}

.basket-add-cell {
    width: 1%;
    white-space: nowrap;
    text-align: right;
    padding-left: 4px;
    padding-right: 6px;
}

/* Add button shrinks to fit the space it has */
.basket-add-btn {
    display: inline-block;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid #0066cc;
    background: #0066cc;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    line-height: 1.2;
}
.basket-add-btn:disabled {
    background: #999;
    border-color: #999;
    cursor: not-allowed;
}

/* Row badge showing qty already in basket */
.basket-row-badge {
    display: inline-block;
    min-width: 22px;
    padding: 1px 6px;
    margin-left: 4px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: #2e7d32;
    border-radius: 10px;
    text-align: center;
    vertical-align: middle;
}

/* Flash on Add */
@keyframes basket-flash {
    0%   { background: #d4f5d4; }
    100% { background: transparent; }
}
.basket-row-flash {
    animation: basket-flash 0.6s ease-out;
}

/* ---- Confirm screen ---- */
.basket-lines {
    margin-top: 12px;
    border-top: 1px solid #ddd;
}
.basket-line {
    display: flex;
    align-items: center;
    padding: 10px 4px;
    border-bottom: 1px solid #eee;
    gap: 10px;
    flex-wrap: wrap;
}
.basket-line-name {
    flex: 1 1 120px;
    min-width: 0;
    font-weight: 500;
    color: #111;
    word-break: break-word;
}
.basket-line-qty {
    min-width: 40px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    color: #555;
}
.basket-line-price {
    min-width: 64px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: #666;
    font-size: 13px;
}
.basket-line-total {
    min-width: 74px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: #111;
}
.basket-line-remove {
    padding: 4px 10px;
    font-size: 12px;
    border: 1px solid #cc0000;
    background: #fff;
    color: #cc0000;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}
.basket-line-remove:hover {
    background: #cc0000;
    color: #fff;
}

/* Totals */
.basket-total-row {
    display: flex;
    justify-content: flex-end;
    padding: 14px 4px;
    font-size: 16px;
    font-weight: 700;
    color: #111;
    gap: 12px;
    border-top: 2px solid #333;
    margin-top: 4px;
}
.basket-total-label {
    color: #555;
    font-weight: 500;
}
.basket-total-value {
    min-width: 100px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Actions on the confirm screen */
.basket-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
    gap: 8px;
    flex-wrap: wrap;
}
.basket-actions button {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
}
.basket-back-btn {
    border: 1px solid #ccc;
    background: #fff;
    color: #333;
}
.basket-checkout-btn {
    border: 1px solid #2e7d32;
    background: #2e7d32;
    color: #fff;
}
.basket-checkout-btn:disabled {
    background: #999;
    border-color: #999;
    cursor: not-allowed;
}

/* Empty state */
.basket-empty {
    padding: 24px 4px;
    text-align: center;
    color: #777;
    font-size: 14px;
}

/* ============================================================
   Responsive — narrow phones
   ============================================================ */
@media (max-width: 480px) {
    .basket-picker-topbar {
        padding: 8px 10px;
        gap: 8px;
    }
    .basket-grand-total {
        font-size: 15px;
    }
    .basket-checkout-top {
        padding: 7px 12px;
        font-size: 13px;
    }

    .basket-qty-input {
        width: 44px;
        padding: 5px 4px;
        font-size: 13px;
    }
    .basket-add-btn {
        padding: 5px 8px;
        font-size: 12px;
    }
    .basket-row-badge {
        min-width: 20px;
        padding: 1px 5px;
        font-size: 10px;
        margin-left: 3px;
    }

    .basket-line {
        gap: 6px;
        padding: 8px 2px;
    }
    .basket-line-name {
        flex: 1 1 100%;
        font-size: 13px;
    }
    .basket-line-qty,
    .basket-line-price,
    .basket-line-total {
        font-size: 12px;
        min-width: 0;
    }
    .basket-line-remove {
        padding: 3px 8px;
        font-size: 11px;
    }
}
/* Editable qty input on the confirm screen */
.basket-line-qty-input {
    width: 56px;
    max-width: 100%;
    padding: 5px 6px;
    font-size: 14px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    color: #111;
    font-variant-numeric: tabular-nums;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}
.basket-line-qty-input:focus {
    outline: none;
    border-color: #0066cc;
}
.log-table .log-when    { white-space: nowrap; width: 130px; color: #8e8ea0; }
.log-table .log-who     { white-space: nowrap; width: 100px; }
.log-table .log-action  { white-space: nowrap; width: 110px; color: #f0c040; }
.log-table .log-detail  { font-family: monospace; font-size: 12px; color: #a0a0b0; }
.log-table .log-summary { color: #e0e0e0; }
.log-table .log-row     { cursor: pointer; }
.log-table .log-row:hover { background: #1e1e2a; }
.log-table .log-command-row code { font-size: 12px; color: #b0b0c0; }