:root {
    --ink: #172027;
    --muted: #66737b;
    --line: #dce2e5;
    --surface: #ffffff;
    --canvas: #f4f6f5;
    --nav: #17262a;
    --nav-active: #263a3f;
    --green: #147d64;
    --green-dark: #0e6551;
    --amber: #b56a13;
    --red: #b73a3a;
    --blue: #2767a8;
    --radius: 6px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--canvas);
    color: var(--ink);
    font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}
button, input, select, textarea { font: inherit; letter-spacing: 0; }
a { color: var(--green); text-decoration: none; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 224px;
    display: flex;
    flex-direction: column;
    background: var(--nav);
    color: #fff;
    z-index: 10;
}
.wordmark { display: flex; align-items: center; gap: 10px; padding: 22px 20px; color: #fff; border-bottom: 1px solid #304147; }
.wordmark span { display: grid; place-items: center; width: 42px; height: 32px; background: #e7b943; color: #1c282b; font-size: 12px; font-weight: 800; }
.wordmark strong { font-size: 16px; }
.sidebar nav { padding: 14px 10px; flex: 1; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 0 12px; margin-bottom: 3px; border-radius: 5px; color: #c8d0d2; font-weight: 600; }
.sidebar nav a:hover, .sidebar nav a.active { color: #fff; background: var(--nav-active); }
.sidebar nav a.active { box-shadow: inset 3px 0 #e7b943; }
.nav-icon { width: 19px; text-align: center; font-size: 18px; }
.account { display: grid; grid-template-columns: 34px 1fr 30px; gap: 9px; align-items: center; padding: 16px; border-top: 1px solid #304147; }
.account strong, .account small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account small { color: #9fabad; font-size: 12px; }
.avatar { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%; background: #dcebe6; color: var(--green-dark); font-weight: 800; }
.icon-button { width: 30px; height: 30px; border: 0; background: transparent; color: #c8d0d2; cursor: pointer; font-size: 19px; }

.app-main { min-height: 100vh; margin-left: 224px; padding: 30px 36px 50px; }
.page-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 26px; }
.page-header h1 { margin: 0 0 3px; font-size: 25px; line-height: 1.2; }
.page-header p, .section-heading p { margin: 0; color: var(--muted); }
.alert { padding: 11px 14px; margin-bottom: 16px; border: 1px solid; border-radius: var(--radius); }
.alert.success { background: #e9f6f1; border-color: #a4d6c4; color: #0b654e; }
.alert.error { background: #fceded; border-color: #e5b5b5; color: #922c2c; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 16px; border: 1px solid transparent; border-radius: 5px; cursor: pointer; font-weight: 700; }
.button.primary { background: var(--green); color: #fff; }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { background: #fff; border-color: #cbd4d8; color: var(--ink); }
.button.danger { background: #fff; border-color: #d99b9b; color: var(--red); }
.button.danger:hover { color: #fff; background: var(--red); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 26px; }
.metric { min-width: 0; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--green); border-radius: var(--radius); }
.metric.warning { border-top-color: var(--amber); }
.metric span, .metric small { display: block; color: var(--muted); }
.metric strong { display: block; margin: 7px 0 3px; font-size: 28px; line-height: 1; }
.metric small { font-size: 12px; }

.section-block, .form-panel, .context-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.section-block { overflow: hidden; }
.section-heading { display: flex; align-items: center; justify-content: space-between; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.section-heading h2, .form-panel h2 { margin: 0 0 2px; font-size: 17px; }
.section-heading a { font-weight: 700; }
.table-tools { display: flex; justify-content: flex-end; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.item-tools { justify-content: space-between; align-items: end; gap: 12px; }
.job-filter { width: min(340px, 100%); }
.job-filter label { grid-template-columns: auto minmax(180px, 1fr); align-items: center; }
.job-filter select { min-height: 38px; }
.search { width: min(340px, 100%); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; border-bottom: 1px solid #e8ecee; text-align: left; vertical-align: middle; }
th { color: #536169; background: #fafbfb; font-size: 11px; text-transform: uppercase; font-weight: 800; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcfb; }
.numeric { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.cell-sub { display: block; color: var(--muted); font-weight: 400; }
.empty { padding: 30px; color: var(--muted); text-align: center; }
.bin-tag { display: inline-block; padding: 3px 7px; background: #edf1f2; border: 1px solid #d6dee1; border-radius: 4px; color: #34464c; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; }
.status { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.status.good, .status.receive { color: #08654d; background: #e2f3ed; }
.status.low, .status.pick { color: #95550c; background: #faecd9; }

.form-layout { display: grid; grid-template-columns: minmax(0, 720px) minmax(230px, 320px); gap: 18px; align-items: start; }
.form-panel { padding: 22px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
label { display: grid; gap: 6px; color: #425159; font-size: 12px; font-weight: 750; }
label.full { grid-column: 1 / -1; }
input, select, textarea { width: 100%; min-height: 40px; padding: 8px 10px; color: var(--ink); background: #fff; border: 1px solid #c9d2d6; border-radius: 4px; outline: none; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(20, 125, 100, .12); }
.form-actions { display: flex; justify-content: flex-end; padding-top: 20px; margin-top: 20px; border-top: 1px solid var(--line); }
.context-panel { padding: 20px; border-left: 3px solid var(--green); }
.context-panel h3 { margin: 0 0 6px; }
.context-panel p { margin: 0; color: var(--muted); }
.context-panel .alert { margin: 16px 0 0; }
.context-subheading { margin-top: 20px !important; }
.context-note { margin-top: 20px !important; padding-top: 16px; border-top: 1px solid var(--line); }
.upload-field input { padding: 8px; background: #f8faf9; }
.upload-field small { color: var(--muted); font-weight: 500; }
.scan-shell { display: grid; gap: 18px; }
.scan-bar { display: grid; grid-template-columns: minmax(260px, 620px) auto; gap: 12px; align-items: end; padding: 20px; background: var(--nav); border-radius: var(--radius); }
.scan-bar label { color: #fff; }
.scan-input { min-height: 48px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; font-weight: 700; }
.scan-bar .button { min-height: 48px; }
.putaway-panel { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.scan-result { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.scan-result > div { min-width: 0; padding: 18px; border-right: 1px solid var(--line); }
.scan-result > div:last-child { border-right: 0; }
.scan-result span, .scan-result small { display: block; color: var(--muted); }
.scan-result span { margin-bottom: 5px; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.scan-result strong { display: block; overflow-wrap: anywhere; font-size: 16px; }
.scan-result small { margin-top: 2px; }
.barcode-text { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0; }
.putaway-fields { display: grid; grid-template-columns: minmax(220px, 1fr) 150px auto; gap: 14px; align-items: end; padding: 20px; }

.label-sheet { display: grid; gap: 18px; }
.label-page { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; padding: 8px; background: #d5dcde; }
.box-label { display: grid; grid-template-columns: minmax(0, 1fr) 250px 64px; align-items: center; gap: 10px; min-width: 0; min-height: 96px; padding: 8px 10px; overflow: hidden; background: #fff; color: #111; }
.label-sku, .label-qty { min-width: 0; }
.label-sku span, .label-qty span { display: block; font-size: 9px; font-weight: 900; }
.label-sku .label-job-name { overflow: hidden; margin-bottom: 3px; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.label-sku strong { display: block; overflow-wrap: anywhere; font-size: 16px; line-height: 1.05; }
.label-qty { text-align: center; }
.label-qty strong { display: block; font-size: 22px; line-height: 1; }
.barcode-image { display: flex; justify-content: center; }
.barcode-image svg { width: 100%; max-width: 250px; height: 38px; }
.container-summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.container-summary > div { min-width: 0; padding: 16px 18px; border-right: 1px solid var(--line); }
.container-summary > div:last-child { border-right: 0; }
.container-summary span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.container-summary strong:not(.status) { display: block; overflow-wrap: anywhere; font-size: 18px; }
.expected-date-form { display: grid; grid-template-columns: minmax(0, 1fr) 34px; gap: 6px; }
.expected-date-form input { min-height: 34px; padding: 5px 7px; }
.icon-save { width: 34px; height: 34px; border: 0; border-radius: 4px; color: #fff; background: var(--green); cursor: pointer; font-weight: 900; }
.container-upload { margin-bottom: 18px; }
.container-upload .form-panel h2 { margin-bottom: 15px; }
.receive-container-bar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 18px; padding: 18px 20px; color: #fff; background: var(--nav); border-radius: var(--radius); }
.receive-container-bar strong, .receive-container-bar span { display: block; }
.receive-container-bar span { margin-top: 2px; color: #bac5c7; }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 18px; padding: 17px 20px; background: #fff; border: 1px solid #e2bcbc; border-left: 3px solid var(--red); border-radius: var(--radius); }
.danger-zone strong, .danger-zone span { display: block; }
.danger-zone span { margin-top: 2px; color: var(--muted); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.receipt-choices { display: grid; }
.receipt-choices a { display: grid; grid-template-columns: 1fr 1fr auto; gap: 18px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); color: var(--ink); }
.receipt-choices a:last-child { border-bottom: 0; }
.receipt-choices a:hover { background: #f7faf8; }
.receipt-choices span, .receipt-choices span strong { display: block; }
.receipt-choices span { color: var(--muted); }
.receipt-choices span strong { color: var(--ink); }
.receipt-choices b { color: var(--green); }
.split-view { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.form-panel.compact { display: grid; gap: 14px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.role-key { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 14px 18px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.role-key b { color: var(--ink); }
.user-row { display: grid; grid-template-columns: 34px minmax(150px, 1fr) 130px 76px 68px; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.user-row:last-child { border-bottom: 0; }
.user-identity strong, .user-identity small { display: block; }
.user-identity small { color: var(--muted); }
.user-row select { min-height: 36px; }
.toggle { display: flex; align-items: center; gap: 7px; }
.toggle input { width: 16px; min-height: 16px; accent-color: var(--green); }

.login-body { display: grid; place-items: center; background: #e9eeec; padding: 24px; }
.login-shell { display: grid; grid-template-columns: 310px 400px; width: min(100%, 710px); min-height: 410px; overflow: hidden; background: #fff; border: 1px solid #d2dadd; border-radius: 8px; box-shadow: 0 18px 50px rgba(26, 42, 45, .12); }
.login-brand { display: flex; flex-direction: column; justify-content: center; padding: 38px; color: #fff; background: var(--nav); }
.brand-mark { display: grid; place-items: center; width: 70px; height: 48px; margin-bottom: 24px; background: #e7b943; color: #17262a; font-size: 20px; font-weight: 900; }
.login-brand h1 { margin: 0; font-size: 30px; }
.login-brand p { margin: 8px 0 0; color: #b8c3c5; }
.login-panel { align-self: center; padding: 42px; }
.login-panel h2 { margin: 0; font-size: 24px; }
.muted { margin: 4px 0 22px; color: var(--muted); }
.form-stack { display: grid; gap: 16px; }
.form-stack .button { margin-top: 4px; }

@media (max-width: 980px) {
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .split-view, .form-layout { grid-template-columns: 1fr; }
    .users-view .form-panel { order: -1; }
}
@media (max-width: 720px) {
    .sidebar { position: static; width: 100%; height: auto; }
    .wordmark { padding: 12px 15px; }
    .sidebar nav { display: flex; overflow-x: auto; padding: 7px; }
    .sidebar nav a { flex: 0 0 auto; margin: 0 2px; padding: 0 10px; }
    .account { display: none; }
    .app-main { margin-left: 0; padding: 20px 14px 36px; }
    .page-header { align-items: flex-start; }
    .page-header h1 { font-size: 22px; }
    .metric-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
    .metric { padding: 14px; }
    .metric strong { font-size: 23px; }
    .form-grid { grid-template-columns: 1fr; }
    label.full { grid-column: auto; }
    .user-row { grid-template-columns: 34px 1fr; }
    .user-row select, .user-row .toggle, .user-row .button { grid-column: 2; }
    .scan-bar, .putaway-fields { grid-template-columns: 1fr; }
    .scan-result { grid-template-columns: 1fr 1fr; }
    .scan-result > div:nth-child(2) { border-right: 0; }
    .scan-result > div { border-bottom: 1px solid var(--line); }
    .label-page { grid-template-columns: 1fr; }
    .box-label { grid-template-columns: minmax(0, 1fr) minmax(130px, 250px) 58px; }
    .item-tools { align-items: stretch; flex-direction: column; }
    .item-tools .search, .job-filter { width: 100%; }
    .container-summary { grid-template-columns: 1fr 1fr; }
    .container-summary > div:nth-child(2) { border-right: 0; }
    .receive-container-bar { align-items: stretch; flex-direction: column; }
    .danger-zone { align-items: stretch; flex-direction: column; }
    .receipt-choices a { grid-template-columns: 1fr auto; }
    .receipt-choices a span:nth-child(2) { grid-column: 1; }
    .login-shell { grid-template-columns: 1fr; }
    .login-brand { padding: 24px 28px; }
    .login-brand p { display: none; }
    .brand-mark { width: 54px; height: 36px; margin-bottom: 12px; }
    .login-brand h1 { font-size: 23px; }
    .login-panel { padding: 30px 28px 36px; }
}

@media print {
    @page { size: letter portrait; margin: .5in .25in; }
    body { background: #fff; }
    .sidebar, .page-header, .alert, .no-print { display: none !important; }
    .app-main { margin: 0; padding: 0; }
    .label-sheet { display: block; }
    .label-page {
        display: grid;
        grid-template-columns: 4in 4in;
        grid-template-rows: repeat(10, 1in);
        gap: 0;
        width: 8in;
        height: 10in;
        padding: 0;
        background: #fff;
        break-after: page;
        page-break-after: always;
    }
    .label-page:last-child { break-after: auto; page-break-after: auto; }
    .box-label {
        width: 4in;
        height: 1in;
        min-height: 0;
        grid-template-columns: 1.05in 2.25in .55in;
        gap: .05in;
        padding: .08in;
        border: 1px solid #ddd;
        border-radius: 0;
        break-inside: avoid;
        page-break-inside: avoid;
    }
    .label-sku strong { font-size: 15px; }
    .label-qty strong { font-size: 21px; }
    .barcode-image svg { width: 2.25in; height: .45in; }
}
