/* Pickscan Pack — Crimson Theme */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
    --primary: #D32F2F;
    --primary-dark: #B71C1C;
    --primary-light: #EF5350;
    --bg: #f3f4f6;
    --text: #374151;
    --surface: #ffffff;
}

body {
    background-color: #1a1a2e;
    color: #f1f5f9;
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Login */

.login-body {
    background-color: #1a1a2e;
    transition: opacity 0.4s ease;
}

.login-body.fade-out {
    opacity: 0;
}

.login-card {
    width: 100%;
    max-width: 420px;
    border-radius: 12px;
    border: none;
}

.device-code-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--primary);
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.device-code-inputs {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.device-code-inputs input {
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 8px;
    background-color: #e9eaec;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 600;
    color: #1a1a2e;
    caret-color: transparent;
    outline: none;
    transition: background-color 0.15s;
    -moz-appearance: textfield;
}

.device-code-inputs input::-webkit-outer-spin-button,
.device-code-inputs input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

.device-code-inputs input.active {
    background-color: var(--primary);
}

.device-code-inputs input:focus {
    background-color: var(--primary);
}

.device-code-inputs input.success {
    background-color: #2e7d32;
    color: #fff;
    transition: background-color 0.3s ease;
}

/* Toast */

.error-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #3a1a1a;
    color: #ffb3b3;
    padding: 0.85rem 1.5rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 9999;
}

.error-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.error-toast.error-toast-success {
    background: #1a3a1a;
    color: #b3ffb3;
}

/* Buttons */

.btn-orange {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn-orange:hover,
.btn-orange:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
}

.btn-orange:active {
    background-color: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
}

/* Nav */

.navbar {
    border-bottom: 3px solid var(--primary-dark);
    background-image: radial-gradient(circle, rgba(255,255,255,0.07) 1px, transparent 1px);
    background-size: 4px 4px;
}


.nav-company-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff !important;
    letter-spacing: 0.01em;
    text-decoration: none;
    transition: opacity 0.2s;
}

/* Pickscan logo — centered in nav, only shown during order view */
.nav-center-logo {
    display: none;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

#mainNav.order-active .nav-center-logo {
    display: block;
}

/* Subtle footer — company name + device ID */
.pack-footer {
    position: fixed;
    bottom: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.78rem;
    color: #9ca3af;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
    letter-spacing: 0.02em;
}

/* =============================================
   Packing UI — warehouse/packing-station scale
   ============================================= */

/* Full-width wrapper with generous padding */
.pack-wrap {
    padding: 1.5rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* --- Idle / scan input state --- */

.scan-idle-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
}

/* --- Idle screen --- */

.idle-screen {
    position: fixed;
    inset: 0;
    background: #1a1a2e;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.idle-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.idle-wordmark {
    height: 44px;
    width: auto;
}

.idle-scan-input {
    width: 520px;
    max-width: 80vw;
    height: 56px;
    border-radius: 999px;
    border: none;
    background: #ffffff;
    font-size: 1.05rem;
    font-family: 'Space Grotesk', sans-serif;
    text-align: center;
    color: #374151;
    outline: none;
    padding: 0 1.75rem;
    letter-spacing: 0.02em;
}

.idle-scan-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

.idle-scan-input.scanning {
    animation: scanInputPulse 0.9s ease-in-out infinite;
}

@keyframes scanInputPulse {
    0%, 100% { opacity: 0.55; }
    50%       { opacity: 1; }
}

.idle-ready-label {
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-family: 'Space Grotesk', sans-serif;
    transition: color 0.4s;
    color: rgba(255,255,255,0.25);
}

.idle-ready-label.status-scanning {
    color: rgba(251, 191, 36, 0.8);
}

.idle-ready-label.status-online {
    color: rgba(34, 197, 94, 0.7);
}

.idle-ready-label.status-offline {
    color: rgba(239, 68, 68, 0.8);
}

/* Tote strip */
.idle-tote-strip {
    display: flex;
    border-top: 1px solid rgba(255,255,255,0.06);
    min-height: 110px;
    max-height: 140px;
}

.idle-tote-strip:empty {
    display: none;
}

.idle-tote-card {
    flex: 1;
    background: #0f1020;
    border-left: 3px solid var(--primary);
    border-right: 1px solid rgba(255,255,255,0.04);
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}

.idle-tote-id {
    font-family: 'Space Grotesk', monospace;
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.03em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.idle-tote-meta {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.4);
    margin-top: 0.2rem;
    font-family: 'Space Grotesk', sans-serif;
}

.idle-tote-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.idle-tote-progress {
    flex: 1;
    height: 3px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    overflow: hidden;
}

.idle-tote-progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.4s ease;
    min-width: 2px;
}

.idle-tote-packer {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    font-family: 'Space Grotesk', sans-serif;
}

/* Printer row scan input */
.pack-scan-input {
    font-size: 1.2rem;
    height: 3.5rem;
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.12);
    color: #ffffff;
    font-family: 'Space Grotesk', sans-serif;
    letter-spacing: 0.04em;
}

.pack-scan-input::placeholder { color: rgba(255,255,255,0.3); }
.pack-scan-input:focus {
    background: rgba(255,255,255,0.09);
    border-color: rgba(255,255,255,0.2);
    box-shadow: none;
    color: #fff;
}

.pack-scan-btn {
    font-size: 1.4rem;
    padding: 0 1.5rem;
    height: 3.5rem;
}

/* --- Order header --- */

.pack-order-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: #0f1020;
    border-radius: 12px;
    border-left: 4px solid var(--primary);
    padding: 1.5rem 2rem;
    margin-bottom: 1.25rem;
}

.pack-order-num {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.25rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.1;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.pack-order-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.05rem;
    color: rgba(255,255,255,0.45);
    flex-wrap: wrap;
}

.pack-order-flag {
    font-size: 1.5rem;
    line-height: 1;
}

.pack-order-courier {
    font-weight: 500;
    color: rgba(255,255,255,0.7);
}

.pack-order-weight {
    font-weight: 600;
    color: rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.08);
    border-radius: 6px;
    padding: 0.15em 0.6em;
    font-size: 1rem;
}

.pack-type-badge {
    font-size: 0.85rem;
    padding: 0.3em 0.75em;
    border-radius: 6px;
    font-weight: 600;
    margin-top: 0.25rem;
    display: inline-block;
}

.pack-status {
    font-size: 1.05rem;
    font-weight: 600;
    color: rgba(255,255,255,0.45);
    text-align: right;
    margin-bottom: 0.25rem;
}

.pack-order-customer {
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
    margin-top: 0.5rem;
}

.pack-order-address {
    font-size: 0.88rem;
    color: rgba(255,255,255,0.38);
    margin-top: 0.15rem;
    font-family: 'Space Grotesk', monospace;
}

/* --- Order lines --- */

.pack-lines {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.pack-line-card {
    display: flex;
    align-items: center;
    background: #0f1020;
    border-radius: 12px;
    padding: 1.25rem 1.75rem;
    gap: 1.5rem;
    border: 2px solid transparent;
    transition: border-color 0.1s;
}

.pack-line-card.selected {
    border-color: rgba(59, 130, 246, 0.6);
}

.pack-line-card.status-correct,
.pack-line-card.status-ordercorrect {
    background: rgba(22, 163, 74, 0.25);
    border-left: 4px solid #16a34a;
}

.pack-line-card.status-partial {
    background: rgba(217, 119, 6, 0.2);
    border-left: 4px solid #d97706;
}

.pack-line-card.status-overcount {
    background: rgba(220, 38, 38, 0.2);
    border-left: 4px solid #dc2626;
}

.pack-line-img {
    width: 90px;
    height: 90px;
    object-fit: contain;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    flex-shrink: 0;
}

.pack-line-img-placeholder {
    width: 90px;
    height: 90px;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 2rem;
    color: rgba(255,255,255,0.15);
}

.pack-line-body {
    flex: 1;
    min-width: 0;
}

.pack-line-name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.35rem;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.3;
    margin-bottom: 0.35rem;
}

.pack-line-meta {
    font-size: 0.95rem;
    color: rgba(255,255,255,0.4);
    margin-bottom: 0.2rem;
}

.pack-line-sep {
    margin: 0 0.4rem;
    color: rgba(255,255,255,0.15);
}

.pack-line-barcode {
    font-family: 'Space Grotesk', monospace;
    font-size: 0.9rem;
}

.pack-line-location {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.3);
    margin-top: 0.2rem;
}

.pack-line-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    min-width: 130px;
    text-align: center;
    border-left: 2px solid rgba(255,255,255,0.08);
    padding-left: 1.5rem;
    margin-left: 0.5rem;
}

.pack-line-qty {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.75rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}

.pack-line-qty-sep {
    font-weight: 400;
    color: rgba(255,255,255,0.25);
    margin: 0 2px;
}

.pack-line-badge {
    display: inline-block;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.35em 1em;
    border-radius: 8px;
    color: #fff;
    letter-spacing: 0.02em;
}

.pack-line-badge.bg-secondary { background: rgba(255,255,255,0.15) !important; color: rgba(255,255,255,0.6) !important; }
.pack-line-badge.bg-success   { background: #16a34a !important; }
.pack-line-badge.bg-warning   { background: #d97706 !important; color: #fff !important; }
.pack-line-badge.bg-danger    { background: #dc2626 !important; }

/* --- Action buttons --- */

.pack-action-row {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.pack-action-btn {
    flex: 1;
    height: 4rem;
    font-size: 1.3rem;
    font-weight: 600;
    border-radius: 10px;
    font-family: 'Space Grotesk', sans-serif;
}

.btn-secondary.pack-action-btn {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.7);
}

.btn-secondary.pack-action-btn:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

/* --- Printer row --- */

.pack-printer-row {
    margin-top: 1rem;
}

.pack-printer-alert {
    background: rgba(22, 163, 74, 0.15);
    color: #86efac;
    border: 1px solid rgba(22, 163, 74, 0.3);
    border-radius: 10px;
    padding: 1rem 1.5rem;
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.pack-skip-btn {
    width: 100%;
    height: 3.5rem;
    font-size: 1.1rem;
    margin-top: 0.75rem;
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.6);
    font-family: 'Space Grotesk', sans-serif;
}

.pack-skip-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

/* --- Stock / Asset info cards --- */

.pack-info-card {
    background: #0f1020;
    border-radius: 12px;
    border-left: 4px solid var(--primary);
    padding: 2rem;
}

.pack-info-name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.4rem;
}

.pack-info-sub {
    font-size: 1rem;
    color: rgba(255,255,255,0.4);
    font-family: 'Space Grotesk', monospace;
    margin-bottom: 1rem;
}

.pack-info-row {
    display: flex;
    align-items: center;
    font-size: 1.25rem;
}

.pack-stock-qty {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 3rem;
    font-weight: 700;
    color: #ffffff;
    margin-right: 0.5rem;
}

.pack-info-label {
    color: rgba(255,255,255,0.45);
    font-weight: 500;
}

.pack-info-value {
    font-weight: 600;
    color: #ffffff;
}

.pack-stock-status {
    font-size: 1rem;
    font-weight: 600;
    padding: 0.4em 1em;
    border-radius: 8px;
    color: #fff;
}

/* --- Keyboard shortcut hints --- */

/* Nav ESC group — back arrow + keycap */
.nav-esc-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-right: 0.75rem;
}

.nav-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: rgba(255,255,255,0.75);
    font-size: 1.1rem;
    padding: 0.2rem 0.35rem;
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.nav-back-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.nav-manual-btn {
    color: rgba(255,255,255,0.6);
    font-size: 1.1rem;
    padding: 0.25rem 0.5rem;
    margin-right: 0.25rem;
    line-height: 1;
}

.nav-manual-btn:hover {
    color: #fff;
}

/* Navigate + Confirm hints — fixed bottom-left */
.pack-shortcuts {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    z-index: 200;
}

/* Printer shortcuts shown during print modal — top-left, above the modal overlay */
#printerShortcuts {
    top: 1.5rem;
    bottom: auto;
    z-index: 600;
}

/* Key cap — matches returns flow .keycap exactly */
.pack-key {
    font-family: 'Inter', 'Menlo', 'Monaco', 'Consolas', monospace;
    font-size: 1rem;
    border-radius: 0.375rem;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    color: #374151;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    padding: 0.25em 0.75em;
    display: inline-flex;
    align-items: center;
    font-weight: 500;
    transition: opacity 0.15s;
}

.pack-shortcut-icon {
    font-size: 0.95rem;
    color: #9ca3af;
    margin-right: 0.15rem;
}

.pack-shortcut-label {
    font-size: 0.9rem;
    color: #9ca3af;
    margin-right: 0.25rem;
    transition: opacity 0.15s;
}

.pack-shortcut-divider {
    width: 1px;
    height: 1rem;
    background: #e5e7eb;
    margin: 0 0.35rem;
}

.pack-key.dimmed,
.pack-shortcut-label.dimmed {
    opacity: 0.3;
}

/* Manual barcode input overlay */
.pack-manual-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 24, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 400;
    backdrop-filter: blur(4px);
}

.pack-manual-barcode-input {
    width: min(520px, 90vw);
    font-size: 1.25rem;
    height: 3.25rem;
    padding: 0 1.25rem;
    letter-spacing: 1px;
    background: #0f1020;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    color: #fff;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    outline: none;
}

.pack-manual-barcode-input::placeholder { color: rgba(255,255,255,0.3); }

.pack-manual-barcode-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(211,47,47,0.25), 0 8px 40px rgba(0,0,0,0.5);
}

/* Manual input button on idle scan bar */
.pack-manual-btn {
    height: 3.5rem;
    font-size: 1.2rem;
    color: #9ca3af;
    border-color: #d1d5db;
    border-right: none;
}

.pack-manual-btn:hover {
    color: var(--primary);
    border-color: #d1d5db;
    background: #f9fafb;
}

/* --- Print confirmation modal --- */

.print-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 60, 30, 0.96);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
}

.print-modal-card {
    background: #0f1020;
    border: 1px solid rgba(255,255,255,0.08);
    border-top: 4px solid #16a34a;
    border-radius: 20px;
    padding: 1.5rem 2.5rem;
    width: 100%;
    max-width: 600px;
    text-align: center;
    box-shadow: 0 32px 80px rgba(0,0,0,0.7);
}

.print-modal-icon {
    font-size: 1.75rem;
    color: #16a34a;
    margin-bottom: 0.1rem;
    line-height: 1;
}

.print-modal-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.05rem;
}

.print-modal-order-id {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.4);
    margin-bottom: 0.5rem;
    letter-spacing: 0.03em;
}

.print-modal-sub {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.4rem;
    font-family: 'Space Grotesk', sans-serif;
}

.print-modal-printer-select {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    padding: 0.45rem 0.75rem;
    width: 100%;
    margin-bottom: 0.75rem;
    cursor: pointer;
    appearance: auto;
}

.print-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
}

.print-modal-btn {
    width: 100%;
    height: 3.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 10px;
    font-family: 'Space Grotesk', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
}

.print-modal-key {
    position: absolute;
    right: 1rem;
}

.print-modal-error {
    margin-top: 1rem;
    background: rgba(220, 38, 38, 0.15);
    border: 1px solid rgba(220, 38, 38, 0.3);
    color: #fca5a5;
    border-radius: 8px;
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
}

/* --- Label preview --- */

.label-preview-section {
    margin: 0.75rem 0 1rem;
    border-radius: 10px;
    overflow: hidden;
    background: #0a0a14;
    border: 1px solid rgba(255,255,255,0.08);
    /* Fixed height prevents modal jumping as the label loads in */
    height: 420px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
}

.label-preview-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    flex: 1;
    color: rgba(255,255,255,0.45);
    font-size: 0.85rem;
}

.label-preview-spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255,255,255,0.15);
    border-top-color: rgba(255,255,255,0.6);
    border-radius: 50%;
    animation: labelSpinAnim 0.7s linear infinite;
}

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

.label-preview-frame {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.label-preview-canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
}

.label-preview-error {
    padding: 10px 12px;
    color: #f8d7da;
    font-size: 0.85rem;
    text-align: center;
}

/* --- Printer settings overlay --- */

.printer-settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
}

.printer-settings-card {
    background: #1a1b2e;
    border-radius: 16px;
    padding: 2rem 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.8);
    position: relative;
}

.printer-settings-close-x {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    background: none;
    border: none;
    color: rgba(255,255,255,0.45);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}
.printer-settings-close-x:hover { color: #fff; }

.printer-settings-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 1.25rem;
}

.printer-settings-current {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.35);
    margin-bottom: 0.75rem;
    font-family: 'Space Grotesk', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.printer-settings-select {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: rgba(255,255,255,0.85);
    font-size: 0.95rem;
    font-family: 'Space Grotesk', sans-serif;
    cursor: pointer;
    appearance: auto;
}
.printer-settings-select option {
    background: #1a1b2e;
    color: #fff;
}

/* Idle screen printer settings button */
.idle-settings-btn {
    position: fixed;
    bottom: 1.25rem;
    right: 1.5rem;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    color: rgba(255,255,255,0.3);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 150;
    transition: color 0.15s, background 0.15s;
}

.idle-settings-btn:hover { color: rgba(255,255,255,0.7); background: rgba(255,255,255,0.12); }

/* =============================================
   Adaptive full-height order layout
   ============================================= */

/* When an order is active, prevent body scroll — layout is fully contained */
body.order-active {
    overflow: hidden;
}

/* When an order is active, strip Bootstrap container padding/margin */
body.order-active main.container-fluid {
    margin-top: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

body.order-active .pack-wrap {
    padding: 0;
    max-width: 100%;
}

/* resultOrder fills exactly the viewport below the navbar — no overflow */
body.order-active #resultOrder {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 58px);
    overflow: hidden;
}

/* Order header — no card, sinks into page background; item cards are the primary focus */
body.order-active .pack-order-header {
    background: transparent;
    border-radius: 0;
    border: none;
    margin: 0 !important;
    padding: 0.65rem 1.5rem 0.65rem;
    flex-shrink: 0;
}

/* Lines region fills remaining height — no scroll, cards scale to fit */
/* padding-bottom clears the fixed shortcuts bar (~1.5rem offset + ~1.5rem height) and footer */
body.order-active .pack-lines {
    flex: 1;
    min-height: 0;
    padding: 0 1.25rem 4rem;
    overflow: hidden;
    gap: 0.5rem;
    margin-bottom: 0;
}

/* Equal-height cards for all order sizes — cards share available height equally */
body.order-active #resultOrder[data-lines="1"] .pack-line-card,
body.order-active #resultOrder[data-lines="2"] .pack-line-card,
body.order-active #resultOrder[data-lines="3"] .pack-line-card,
body.order-active #resultOrder[data-lines="4"] .pack-line-card,
body.order-active #resultOrder[data-lines="5"] .pack-line-card,
body.order-active #resultOrder[data-lines="6"] .pack-line-card,
body.order-active #resultOrder[data-lines="7"] .pack-line-card,
body.order-active #resultOrder[data-lines="8"] .pack-line-card,
body.order-active #resultOrder[data-lines="9"] .pack-line-card,
body.order-active #resultOrder[data-lines="10"] .pack-line-card {
    flex: 1;
    min-height: 0;
    align-items: center;
    overflow: hidden;
}

/* ---- Size scaling by line count ---- */

/* 1 line: fill the screen */
#resultOrder[data-lines="1"] .pack-line-card {
    padding: 3rem 4rem;
    gap: 3rem;
}
#resultOrder[data-lines="1"] .pack-line-img,
#resultOrder[data-lines="1"] .pack-line-img-placeholder {
    width: 220px;
    height: 220px;
    font-size: 4rem;
}
#resultOrder[data-lines="1"] .pack-line-name {
    font-size: 2.5rem;
    margin-bottom: 0.65rem;
}
#resultOrder[data-lines="1"] .pack-line-meta {
    font-size: 1.15rem;
}
#resultOrder[data-lines="1"] .pack-line-location {
    font-size: 1.1rem;
    margin-top: 0.4rem;
}
#resultOrder[data-lines="1"] .pack-line-qty {
    font-size: 6rem;
    margin-bottom: 0.65rem;
}
#resultOrder[data-lines="1"] .pack-line-badge {
    font-size: 1.15rem;
    padding: 0.4em 1.2em;
}
#resultOrder[data-lines="1"] .pack-line-right {
    min-width: 210px;
}

/* 2 lines: large, two cards share the height */
#resultOrder[data-lines="2"] .pack-line-card {
    padding: 2rem 3rem;
    gap: 2.25rem;
}
#resultOrder[data-lines="2"] .pack-line-img,
#resultOrder[data-lines="2"] .pack-line-img-placeholder {
    width: 150px;
    height: 150px;
    font-size: 3rem;
}
#resultOrder[data-lines="2"] .pack-line-name {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}
#resultOrder[data-lines="2"] .pack-line-meta {
    font-size: 1.05rem;
}
#resultOrder[data-lines="2"] .pack-line-qty {
    font-size: 4.5rem;
    margin-bottom: 0.5rem;
}
#resultOrder[data-lines="2"] .pack-line-badge {
    font-size: 1rem;
    padding: 0.4em 1.1em;
}
#resultOrder[data-lines="2"] .pack-line-right {
    min-width: 170px;
}

/* 3 lines: medium */
#resultOrder[data-lines="3"] .pack-line-card {
    padding: 1.5rem 2.5rem;
    gap: 1.75rem;
}
#resultOrder[data-lines="3"] .pack-line-img,
#resultOrder[data-lines="3"] .pack-line-img-placeholder {
    width: 110px;
    height: 110px;
    font-size: 2.5rem;
}
#resultOrder[data-lines="3"] .pack-line-name {
    font-size: 1.65rem;
}
#resultOrder[data-lines="3"] .pack-line-qty {
    font-size: 3.5rem;
}
#resultOrder[data-lines="3"] .pack-line-badge {
    font-size: 0.95rem;
}
#resultOrder[data-lines="3"] .pack-line-right {
    min-width: 145px;
}

/* 4 lines — each card ~217px tall, image sized to use the space */
#resultOrder[data-lines="4"] .pack-line-card {
    padding: 1rem 1.75rem;
    gap: 1.5rem;
}
#resultOrder[data-lines="4"] .pack-line-img,
#resultOrder[data-lines="4"] .pack-line-img-placeholder {
    width: 160px;
    height: 160px;
    font-size: 3.25rem;
}
#resultOrder[data-lines="4"] .pack-line-name {
    font-size: 1.35rem;
}
#resultOrder[data-lines="4"] .pack-line-qty {
    font-size: 3.25rem;
}
#resultOrder[data-lines="4"] .pack-line-right {
    min-width: 150px;
}

/* 5 lines — each card ~172px tall */
#resultOrder[data-lines="5"] .pack-line-card {
    padding: 0.85rem 1.5rem;
    gap: 1.25rem;
}
#resultOrder[data-lines="5"] .pack-line-img,
#resultOrder[data-lines="5"] .pack-line-img-placeholder {
    width: 126px;
    height: 126px;
    font-size: 2.75rem;
}
#resultOrder[data-lines="5"] .pack-line-name {
    font-size: 1.25rem;
}
#resultOrder[data-lines="5"] .pack-line-qty {
    font-size: 2.6rem;
}
#resultOrder[data-lines="5"] .pack-line-right {
    min-width: 130px;
}

/* 6–7 lines: tighter gap; padding-bottom stays at 4rem */
#resultOrder[data-lines="6"] .pack-lines,
#resultOrder[data-lines="7"] .pack-lines {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    gap: 0.35rem;
}

/* 6 lines — each card ~144px tall */
#resultOrder[data-lines="6"] .pack-line-card {
    padding: 0.65rem 1.25rem;
    gap: 1rem;
}
#resultOrder[data-lines="6"] .pack-line-img,
#resultOrder[data-lines="6"] .pack-line-img-placeholder {
    width: 106px;
    height: 106px;
    font-size: 2.25rem;
}
#resultOrder[data-lines="6"] .pack-line-name {
    font-size: 1.15rem;
}
#resultOrder[data-lines="6"] .pack-line-qty {
    font-size: 2.15rem;
}
#resultOrder[data-lines="6"] .pack-line-right {
    min-width: 112px;
}

/* 7 lines — each card ~122px tall */
#resultOrder[data-lines="7"] .pack-line-card {
    padding: 0.5rem 1rem;
    gap: 0.85rem;
}
#resultOrder[data-lines="7"] .pack-line-img,
#resultOrder[data-lines="7"] .pack-line-img-placeholder {
    width: 90px;
    height: 90px;
    font-size: 2rem;
}
#resultOrder[data-lines="7"] .pack-line-name {
    font-size: 1.05rem;
}
#resultOrder[data-lines="7"] .pack-line-qty {
    font-size: 1.85rem;
}
#resultOrder[data-lines="7"] .pack-line-right {
    min-width: 96px;
}

/* 8–10 lines: tightest gap; padding-bottom stays at 4rem */
#resultOrder[data-lines="8"] .pack-lines,
#resultOrder[data-lines="9"] .pack-lines,
#resultOrder[data-lines="10"] .pack-lines {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    gap: 0.25rem;
}

/* 8 lines — each card ~108px tall */
#resultOrder[data-lines="8"] .pack-line-card {
    padding: 0.4rem 0.9rem;
    gap: 0.75rem;
}
#resultOrder[data-lines="8"] .pack-line-img,
#resultOrder[data-lines="8"] .pack-line-img-placeholder {
    width: 76px;
    height: 76px;
    font-size: 1.65rem;
}
#resultOrder[data-lines="8"] .pack-line-name {
    font-size: 0.95rem;
}
#resultOrder[data-lines="8"] .pack-line-qty {
    font-size: 1.6rem;
}
#resultOrder[data-lines="8"] .pack-line-right {
    min-width: 84px;
}

/* 9 lines — each card ~95px tall */
#resultOrder[data-lines="9"] .pack-line-card {
    padding: 0.3rem 0.8rem;
    gap: 0.65rem;
}
#resultOrder[data-lines="9"] .pack-line-img,
#resultOrder[data-lines="9"] .pack-line-img-placeholder {
    width: 64px;
    height: 64px;
    font-size: 1.4rem;
}
#resultOrder[data-lines="9"] .pack-line-name {
    font-size: 0.85rem;
}
#resultOrder[data-lines="9"] .pack-line-qty {
    font-size: 1.35rem;
}
#resultOrder[data-lines="9"] .pack-line-right {
    min-width: 72px;
}

/* 10+ lines — each card ~85px tall */
#resultOrder[data-lines="10"] .pack-line-card {
    padding: 0.25rem 0.75rem;
    gap: 0.55rem;
}
#resultOrder[data-lines="10"] .pack-line-img,
#resultOrder[data-lines="10"] .pack-line-img-placeholder {
    width: 56px;
    height: 56px;
    font-size: 1.2rem;
}
#resultOrder[data-lines="10"] .pack-line-name {
    font-size: 0.78rem;
}
#resultOrder[data-lines="10"] .pack-line-qty {
    font-size: 1.2rem;
}
#resultOrder[data-lines="10"] .pack-line-right {
    min-width: 64px;
}

/* ===== Tote view ===== */

body.tote-active {
    overflow: hidden;
}

body.tote-active main.container-fluid {
    margin-top: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    height: calc(100vh - 58px);
    display: flex;
    flex-direction: column;
}

body.tote-active main.container-fluid > section {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

body.tote-active .pack-wrap {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
    max-width: 100%;
    margin: 0;
}

body.tote-active #resultTote {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tote-view {
    display: flex;
    flex-direction: row;
    flex: 1;
    overflow: hidden;
}

/* Left panel */
.tote-side {
    flex: 0 0 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2.5rem 1.75rem 2rem;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    gap: 0.4rem;
}

.tote-view-icon {
    font-size: 4rem;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.tote-view-name {
    font-size: 2rem;
    font-weight: 700;
    color: #f1f5f9;
    letter-spacing: 0.02em;
    word-break: break-all;
}

.tote-view-batch {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.42);
    font-family: 'Space Grotesk', monospace;
    letter-spacing: 0.04em;
    margin-top: 0.1rem;
}

.tote-view-count {
    font-size: 1.2rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 0.5rem;
}

.tote-view-picker {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.65);
    margin-top: 0.2rem;
}

.tote-view-date {
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.35);
    font-family: 'Space Grotesk', monospace;
}


/* Right panel — scan prompt */
.tote-scan-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    /* Offset by sidebar width so content centres relative to full viewport, not just right panel */
    padding-right: 300px;
}

.tote-scan-panel-icon {
    font-size: 5rem;
    color: rgba(255, 255, 255, 0.12);
    line-height: 1;
}

.tote-scan-panel-label {
    font-size: 1.5rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 0.01em;
    animation: tote-text-breathe 3s ease-in-out infinite;
}

@keyframes tote-text-breathe {
    0%, 100% { opacity: 0.3; }
    50%       { opacity: 0.9; }
}

/* ===== Tote-order split view (tote sidebar + order detail side-by-side) ===== */

body.tote-order-active {
    overflow: hidden;
}

body.tote-order-active main.container-fluid {
    margin-top: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    height: calc(100vh - 58px);
    display: flex;
    flex-direction: column;
}

body.tote-order-active main.container-fluid > section {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

body.tote-order-active .pack-wrap {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    padding: 0;
    max-width: 100%;
    margin: 0;
}

/* Tote sidebar — fixed 300px left column (order: -1 forces it left despite DOM position) */
body.tote-order-active #resultTote {
    order: -1;
    flex: 0 0 300px !important;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex !important;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

body.tote-order-active #resultTote .tote-view {
    flex-direction: column;
    flex: 0 0 auto;
}

body.tote-order-active #resultTote .tote-side {
    border-right: none;
}

/* Hide scan prompt — only the summary panel stays visible */
body.tote-order-active .tote-scan-panel {
    display: none !important;
}

/* Order panel fills remaining width */
body.tote-order-active #resultOrder {
    flex: 1 !important;
    min-height: unset !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

body.tote-order-active .pack-order-header {
    padding: 0.65rem 1.25rem;
}

body.tote-order-active .pack-lines {
    overflow-y: auto;
    padding-bottom: 4rem;
}
