/* same colors as Admin / Job Reconcile: cream page, thin lines, black text */
:root{
    --main-color: #1a1a1a;
    --cream: #f8f5ee;
    --line: #cbc1ad;
    --soft-line: #e6e0d4;
    --hover: #f1ece1;
    --muted: #6b6558;
}

*{
    box-sizing: border-box;
}

body{
    margin: 0;
    background-color: var(--cream);
    color: var(--main-color);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

button, input{
    font-family: inherit;
}

/* logo | title (centered) | admin button, same header as Job Reconcile */
.head{
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 18px;
    border-bottom: 1px solid var(--line);
    padding: 14px 40px;
}

.logo img{
    height: 35px;
    display: block;
}

.head .name{
    font-size: 19px;
    font-weight: 600;
}

.adminBtn{
    justify-self: end;
    padding: 8px 18px;
    color: var(--main-color);
    text-decoration: none;
    font-size: 15px;
    border: 1px solid var(--main-color);
    border-radius: 6px;
}

.adminBtn:hover{
    background-color: var(--main-color);
    color: #fff;
}

/* tables | tools */
.page{
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 40px;
    padding: 10px 40px 48px;
}

/* tools stay in view while scrolling the tables */
.side{
    position: sticky;
    top: 24px;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* starts just under the first table's column-name line
       (24px + 30px title + 10px under it + 44px column names) */
    margin-top: 108px;
}

.side button{
    width: 100%;
    padding: 15px 16px;
    background-color: transparent;
    color: var(--main-color);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease;
}

.side button:hover{
    background-color: var(--hover);
    border-color: #9c917b;
}

.search{
    display: flex;
    gap: 8px;
}

.search input{
    flex: 1;
    min-width: 0;
    background: transparent;
    color: var(--main-color);
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 17px;
    outline: none;
}

.search input:focus{
    border-color: var(--main-color);
}

.search button{
    width: auto;
    padding: 12px 18px;
    background-color: var(--main-color);
    border-color: var(--main-color);
    color: #fff;
}

.search button:hover{
    background-color: #333;
    border-color: #333;
}

.sideHint{
    margin: 4px 0 0;
    font-size: 14px;
    color: var(--muted);
    text-align: center;
}

.my-swal-popup {
    border: 1px solid var(--line);
    border-radius: 10px;
}

.categoryHeader{
    margin: 34px 0 10px;
}

.items > .categoryHeader:first-child{
    margin-top: 24px;
}

.categoryHeader h2{
    margin: 0;
    font-size: 24px;
    line-height: 30px;
}

/* one kind inside Fasteners / Bits, e.g. "wood screw" */
.kindHeader h3{
    margin: 16px 0 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--muted);
    text-transform: capitalize;
}

.noItems{
    margin-top: 60px;
    text-align: center;
    color: var(--muted);
    font-size: 16px;
}

/* same column widths in every table so they line up down the page */
.items table{
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.items th:nth-child(1){ width: 6%; }
.items th:nth-child(2){ width: 26%; }
.items th:nth-child(n+3){ width: 10.8%; }
.items th:nth-child(4){ width: 14%; }

.items th, .items td{
    padding: 12px 11px;
    text-align: left;
    font-size: 16px;
}

.items th{
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    border-bottom: 1px solid var(--main-color);
}

.items td{
    border-bottom: 1px solid var(--soft-line);
    font-variant-numeric: tabular-nums;
}

.items tr[id]:hover{
    background-color: var(--hover);
}

/* quantity under 5 */
.items td.low{
    color: #b91c1c;
    font-weight: 600;
}

/* Wiring on/off, pinned to the right of the Name column so they line up */
.wireSwitch{
    float: right;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 10px;
    cursor: pointer;
    font-size: 12px;
    color: var(--muted);
}

.wireSwitch input{
    display: none;
}

.wireSwitch .track{
    position: relative;
    width: 30px;
    height: 17px;
    border-radius: 999px;
    background: var(--line);
    transition: background-color 150ms ease;
}

.wireSwitch .track::after{
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #fff;
    transition: transform 150ms ease;
}

.wireSwitch input:checked + .track{
    background: var(--main-color);
}

.wireSwitch input:checked + .track::after{
    transform: translateX(13px);
}

.wireSwitch input:checked ~ .wireText{
    color: var(--main-color);
    font-weight: 600;
}

.headRight{
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 18px;
}

/* the header one isn't pinned right like the row ones */
.headWire{
    float: none;
    margin-left: 0;
    font-size: 14px;
}

/* header switch off: hide the row switches */
body.hideWire .items .wireSwitch{
    display: none;
}

/* Quantity: number + "+ Add" */
.qtyCell{
    white-space: nowrap;
}

.qtyNum{
    display: inline-block;
    min-width: 34px;
}

.addQty, .addBox button{
    margin-left: 6px;
    padding: 4px 11px;
    background: transparent;
    color: var(--main-color);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
}

.addQty:hover{
    background: var(--main-color);
    border-color: var(--main-color);
    color: #fff;
}

.addBox{
    display: inline-flex;
    align-items: center;
}

.items .addBox input{
    width: 72px;
    margin-left: 6px;
    padding: 4px 8px;
    font-size: 15px;
}

.addBox button{
    background: var(--main-color);
    border-color: var(--main-color);
    color: #fff;
}

/* quick "+5" after adding */
.added{
    margin-left: 8px;
    color: #15803d;
    font-weight: 600;
    font-size: 15px;
}

.items tr input{
    width: 90%;
    padding: 4px 6px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #fdfbf6;
    font: inherit;
    margin: 0;
}

.ropeItem h2{
    font-size: 17px;
}

/* bottom-right "back to top" */
.toTop{
    position: fixed;
    right: 28px;
    bottom: 28px;
    z-index: 20;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: var(--main-color);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease, background-color 150ms ease;
}

.toTop.show{
    opacity: 1;
    pointer-events: auto;
}

.toTop:hover{
    background: #333;
}

.loading{
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    align-items: center;
    justify-content: center;
}

.spinner {
    transform-origin: 50% 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* tablets / phones: tools on top, tables underneath and scroll sideways */
@media (max-width: 900px){
    .head{
        padding: 12px 16px;
    }

    .logo img{
        height: 26px;
    }

    .page{
        grid-template-columns: 1fr;
        gap: 0;
        padding: 0 14px 40px;
    }

    .side{
        position: static;
        order: -1;
        margin-top: 16px;
    }

    .items{
        overflow-x: auto;
    }

    .items table{
        min-width: 920px;
    }
}

/* Inventory | Recycled, centered in the header (Recycled = returnStock.html) */
.pageTabs{
    display: flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 999px;
}

.pageTabs a{
    padding: 7px 20px;
    border-radius: 999px;
    color: var(--main-color);
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
}

.pageTabs a:hover{
    background: var(--hover);
}

.pageTabs a.active{
    background: var(--main-color);
    color: #fff;
}
