:root {
    --bg: #f3f5f1;
    --surface: #ffffff;
    --surface-soft: #eef4f0;
    --ink: #18211d;
    --muted: #68736e;
    --line: #d8e0db;
    --green: #167a52;
    --green-dark: #0f5f42;
    --yellow: #f2bd38;
    --red: #c64b4b;
    --blue: #2767a8;
    --shadow: 0 18px 50px rgba(24, 33, 29, 0.12);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        linear-gradient(135deg, rgba(22, 122, 82, 0.12), transparent 35%),
        linear-gradient(315deg, rgba(242, 189, 56, 0.12), transparent 38%),
        var(--bg);
    color: var(--ink);
}

button,
input {
    font: inherit;
}

a {
    color: var(--green-dark);
}

.is-hidden {
    display: none !important;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--green-dark);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.btn,
.icon-button,
.pill {
    border: 0;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, color 160ms ease;
}

.btn {
    min-height: 44px;
    padding: 0 18px;
    border-radius: var(--radius);
    font-weight: 800;
}

.btn:hover,
.icon-button:hover,
.pill:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--green);
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(22, 122, 82, 0.22);
}

.btn-primary:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: #e8eee9;
    color: var(--ink);
}

.icon-button {
    width: 44px;
    height: 44px;
    display: inline-grid;
    place-items: center;
    border-radius: var(--radius);
    background: #e8eee9;
    color: var(--ink);
    font-size: 1.35rem;
    font-weight: 900;
}

.login-screen {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(420px, 0.95fr) minmax(420px, 1.05fr);
    gap: 40px;
    align-items: center;
    padding: clamp(28px, 5vw, 72px);
}

.login-panel {
    max-width: 560px;
    padding: clamp(28px, 5vw, 54px);
    border: 1px solid rgba(216, 224, 219, 0.9);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.82);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.brand-mark {
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    margin-bottom: 30px;
    border-radius: var(--radius);
    background: var(--ink);
    color: #ffffff;
    font-size: 2rem;
    font-weight: 900;
}

.login-panel h1,
.topbar h1,
.mobile-header h1 {
    margin: 0;
    font-size: clamp(2.5rem, 5vw, 5.5rem);
    line-height: 0.92;
}

.login-copy {
    max-width: 460px;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.55;
}

.pin-form {
    margin-top: 34px;
}

.pin-form label,
.scan-card label {
    display: block;
    margin-bottom: 10px;
    color: var(--muted);
    font-weight: 800;
}

.pin-row {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 12px;
}

.pin-row input,
.scan-input-row input {
    min-height: 52px;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #ffffff;
    color: var(--ink);
    font-size: 1.4rem;
    font-weight: 900;
    padding: 0 16px;
    outline: none;
}

.pin-row input:focus,
.scan-input-row input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 4px rgba(22, 122, 82, 0.14);
}

.hint {
    margin: 12px 0 0;
    color: var(--muted);
}

.error {
    min-height: 20px;
    margin: 10px 0 0;
    color: var(--red);
    font-weight: 800;
}

.login-visual {
    min-height: 540px;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    background:
        linear-gradient(rgba(24, 33, 29, 0.68), rgba(24, 33, 29, 0.72)),
        repeating-linear-gradient(90deg, #26332d 0 16px, #202b26 16px 32px);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.scan-frame {
    position: relative;
    width: min(440px, 72%);
    aspect-ratio: 1.15;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

.scan-frame span {
    position: absolute;
    width: 42px;
    height: 42px;
    border-color: var(--yellow);
    border-style: solid;
}

.scan-frame span:nth-child(1) {
    top: 20px;
    left: 20px;
    border-width: 4px 0 0 4px;
}

.scan-frame span:nth-child(2) {
    top: 20px;
    right: 20px;
    border-width: 4px 4px 0 0;
}

.scan-frame span:nth-child(3) {
    right: 20px;
    bottom: 20px;
    border-width: 0 4px 4px 0;
}

.scan-frame span:nth-child(4) {
    left: 20px;
    bottom: 20px;
    border-width: 0 0 4px 4px;
}

.barcode-lines {
    width: 74%;
    height: 110px;
    background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 9px, currentColor 9px 13px, transparent 13px 22px);
    color: #ffffff;
}

.workspace {
    min-height: 100vh;
    padding: clamp(20px, 3vw, 42px);
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.topbar h1 {
    font-size: clamp(2.25rem, 4vw, 4.6rem);
}

.top-actions {
    display: flex;
    gap: 10px;
}

.stats-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stats-strip article,
.orders-panel,
.detail-panel,
.mobile-summary,
.scan-card,
.finish-sheet {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 10px 28px rgba(24, 33, 29, 0.07);
}

.stats-strip article {
    min-height: 106px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 18px;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 900;
}

.stat-label {
    color: var(--muted);
    font-weight: 700;
}

.work-grid {
    display: grid;
    grid-template-columns: minmax(560px, 1.2fr) minmax(420px, 0.8fr);
    gap: 18px;
    align-items: start;
}

.orders-panel,
.detail-panel {
    min-height: calc(100vh - 230px);
    padding: 18px;
}

.panel-head,
.detail-head,
.section-title,
.dialog-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.panel-head h2,
.detail-head h2,
.products-box h3,
.mobile-transfer h3,
.finish-sheet h2,
.dialog-head h2 {
    margin: 0;
}

.panel-head p,
.mobile-transfer p,
.empty-state p,
.finish-sheet p {
    margin: 6px 0 0;
    color: var(--muted);
}

.filter-pills {
    display: flex;
    gap: 8px;
}

.pill {
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    background: #e8eee9;
    color: var(--muted);
    font-weight: 800;
}

.pill.is-active {
    background: var(--ink);
    color: #ffffff;
}

.orders-list {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.order-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 18px;
    width: 100%;
    min-height: 96px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #ffffff;
    color: var(--ink);
    text-align: left;
}

.order-row.is-active {
    border-color: var(--green);
    box-shadow: 0 0 0 4px rgba(22, 122, 82, 0.12);
}

.order-row strong {
    display: block;
    font-size: 1.15rem;
}

.order-row span {
    color: var(--muted);
}

.order-tags,
.product-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.tag,
.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 900;
}

.tag.priority,
.status-badge.priority {
    background: #fff1c7;
    color: #8a5f00;
}

.tag.ready,
.status-badge.ready {
    background: #dff2e8;
    color: var(--green-dark);
}

.tag.done,
.status-badge.done {
    background: #e3e7eb;
    color: #52606b;
}

.empty-state {
    min-height: calc(100vh - 270px);
    display: grid;
    place-items: center;
    align-content: center;
    text-align: center;
    padding: 40px;
}

.empty-icon {
    width: 74px;
    height: 74px;
    display: grid;
    place-items: center;
    margin-bottom: 18px;
    border-radius: var(--radius);
    background: var(--ink);
    color: #ffffff;
    font-size: 2rem;
    font-weight: 900;
}

.detail-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 18px 0;
}

.detail-meta div {
    padding: 14px;
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.detail-meta span,
.mobile-summary span,
.mobile-link-box span,
.label-address span {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.products-box {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #ffffff;
}

.section-title {
    margin-bottom: 10px;
}

.section-title span {
    color: var(--green-dark);
    font-weight: 900;
}

.product-row,
.mobile-product {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 14px 0;
    border-top: 1px solid var(--line);
}

.product-row:first-child,
.mobile-product:first-child {
    border-top: 0;
}

.qty-badge {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    background: var(--ink);
    color: #ffffff;
    font-weight: 900;
}

.product-row h4,
.mobile-product h2 {
    margin: 0 0 4px;
}

.product-row p,
.mobile-product p {
    margin: 0;
    color: var(--muted);
}

.pick-check {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #edf1ee;
    color: var(--muted);
    font-weight: 900;
}

.product-row.is-picked .pick-check,
.mobile-product.is-picked .pick-check {
    background: var(--green);
    color: #ffffff;
}

.mobile-transfer,
.mobile-link-box,
.packing-actions {
    margin-top: 14px;
    padding: 16px;
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.mobile-transfer,
.mobile-link-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.qr-placeholder {
    width: 64px;
    height: 64px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 7px;
    padding: 7px;
    border-radius: var(--radius);
    background: #ffffff;
}

.qr-placeholder span {
    background: var(--ink);
}

.packing-actions {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    align-items: center;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-weight: 800;
}

.check-row input {
    width: 22px;
    height: 22px;
    accent-color: var(--green);
}

.label-dialog {
    width: min(760px, calc(100vw - 28px));
    border: 0;
    border-radius: var(--radius);
    padding: 0;
    background: transparent;
}

.label-dialog::backdrop {
    background: rgba(24, 33, 29, 0.55);
}

.dialog-shell {
    padding: 20px;
    border-radius: var(--radius);
    background: #ffffff;
    box-shadow: var(--shadow);
}

.shipping-label {
    width: min(520px, 100%);
    margin: 18px auto;
    padding: 22px;
    border: 2px solid var(--ink);
    background: #ffffff;
    color: #000000;
}

.label-top,
.label-foot {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    font-weight: 900;
}

.label-top {
    padding-bottom: 14px;
    border-bottom: 2px solid #000000;
    font-size: 1.35rem;
}

.label-address {
    padding: 20px 0;
}

.label-address strong {
    display: block;
    font-size: 1.5rem;
}

.label-address p {
    margin: 6px 0 0;
    font-size: 1.1rem;
    line-height: 1.45;
}

.label-barcode {
    display: grid;
    gap: 8px;
    padding: 16px 0;
    border-top: 2px solid #000000;
    border-bottom: 2px solid #000000;
    text-align: center;
    font-weight: 900;
}

.label-barcode .barcode-lines {
    width: 100%;
    color: #000000;
}

.label-foot {
    padding-top: 14px;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
}

.mobile-body {
    background: #ecf1ed;
}

.mobile-app {
    min-height: 100vh;
    padding: max(16px, env(safe-area-inset-top)) 14px max(20px, env(safe-area-inset-bottom));
}

.mobile-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.mobile-header h1 {
    font-size: 2.35rem;
}

.mobile-summary {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 12px;
    padding: 14px;
    margin-bottom: 12px;
}

.scan-card {
    padding: 14px;
    margin-bottom: 12px;
}

.scan-input-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.scan-shortcuts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.shortcut {
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #ffffff;
    color: var(--green-dark);
    font-weight: 900;
}

.scan-message {
    min-height: 22px;
    margin: 12px 0 0;
    color: var(--muted);
    font-weight: 800;
}

.pick-list {
    display: grid;
    gap: 10px;
}

.mobile-product {
    grid-template-columns: auto 1fr;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(24, 33, 29, 0.06);
}

.mobile-product .pick-check {
    grid-column: 1 / -1;
    width: 100%;
    height: 38px;
    border-radius: var(--radius);
}

.location-block {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.location-block div {
    padding: 10px;
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.location-block span {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
}

.location-block strong {
    font-size: 1.08rem;
}

.finish-sheet {
    position: sticky;
    bottom: 14px;
    margin-top: 12px;
    padding: 16px;
    text-align: center;
}

@media (max-width: 1100px) {
    .login-screen,
    .work-grid {
        grid-template-columns: 1fr;
    }

    .login-visual {
        min-height: 320px;
    }

    .stats-strip {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 720px) {
    body:not(.mobile-body) .login-screen,
    body:not(.mobile-body) .workspace {
        padding: 16px;
    }

    .pin-row,
    .topbar,
    .panel-head,
    .mobile-transfer,
    .mobile-link-box,
    .packing-actions,
    .detail-meta {
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .stats-strip {
        grid-template-columns: 1fr;
    }

    .orders-panel,
    .detail-panel {
        min-height: auto;
    }

    .filter-pills {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 3px;
    }
}

@media print {
    body * {
        visibility: hidden;
    }

    .label-dialog,
    .label-dialog *,
    .shipping-label,
    .shipping-label * {
        visibility: visible;
    }

    .label-dialog {
        position: static;
        width: 100%;
    }

    .dialog-head,
    .dialog-actions {
        display: none;
    }

    .dialog-shell {
        box-shadow: none;
        padding: 0;
    }

    .shipping-label {
        margin: 0;
    }
}
