/* QMS Manufacturing — Incidental Ltd */

:root {
    --primary: #2d3a4a;
    --primary-dark: #243040;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #3a4d62;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --header-height: 72px;
    --topnav-height: 72px;
    --topnav-offset: 72px;
    --sidebar-top: 80px;
    --sidebar-width: 0px;
    --sidebar-collapsed-width: 0px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.5;
    font-size: 14px;
}

/* ============================================================
   GLOBAL HEADER BANNER (replaces sidebar + topbar)
   ============================================================ */
.global-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-height);
    display: flex;
    align-items: stretch;
    gap: 0.4rem;
    padding: 0.4rem;
    z-index: 200;
    background: transparent;
}
/* Left 50%: logo + title + nav icons */
.gh-left {
    flex: 45;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1rem;
    background: linear-gradient(135deg, #2d3a4a, #3a4d62);
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
.gh-logo { height: 50px; width: 50px; border-radius: 6px; object-fit: contain; flex-shrink: 0; }
.gh-title {
    display: flex;
    flex-direction: column;
    font-size: 15px;
    font-weight: 800;
    color: white;
    line-height: 1.15;
    white-space: nowrap;
    flex-shrink: 0;
}
.gh-title span:nth-child(2) { color: rgba(255,255,255,0.45); font-weight: 600; font-size: 13px; }
.gh-nav {
    display: flex;
    align-items: center;
    gap: 3px;
    flex: 1;
    justify-content: center;
}
.gh-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    transition: background 0.15s;
    text-decoration: none;
}
.gh-nav-icon svg { width: 20px; height: 20px; stroke: rgba(255,255,255,0.6); }
.gh-nav-icon:hover { background: rgba(255,255,255,0.12); }
.gh-nav-icon:hover svg { stroke: white; }
.gh-nav-icon.active { background: rgba(255,255,255,0.18); }
.gh-nav-icon.active svg { stroke: white; }
.gh-nav-logout { margin-left: 4px; }
.gh-nav-logout svg { stroke: rgba(255,255,255,0.35); }
.gh-nav-logout:hover { background: rgba(220,38,38,0.2); }
.gh-nav-logout:hover svg { stroke: #fca5a5; }

/* Centre 15%: Scan Mode button */
.gh-scan {
    flex: 15;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #059669, #10b981);
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
.gh-scan:hover { background: linear-gradient(135deg, #047857, #059669); }
.gh-scan.active { background: linear-gradient(135deg, #065f46, #047857); }
.gh-scan-icon { width: 26px; height: 26px; stroke: white; flex-shrink: 0; }
.gh-scan-label { color: white; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }

/* Scan mode overlay */
.gh-scan-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Scan popup (centred modal) */
.gh-scan-popup {
    position: relative;
    width: 520px;
    max-height: 80vh;
    overflow-y: auto;
    background: linear-gradient(135deg, #2d3a4a, #3a4d62);
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.35);
    padding: 1.5rem;
    z-index: 301;
}
.gh-scan-popup-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}
.gh-scan-popup-header svg { width: 28px; height: 28px; stroke: #34d399; flex-shrink: 0; }
.gh-scan-popup-header h2 { margin: 0; font-size: 1.1rem; font-weight: 700; color: white; }
.gh-scan-popup-header .gh-scan-close {
    margin-left: auto;
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
}
.gh-scan-popup-header .gh-scan-close:hover { color: white; }
/* Scan groups inside popup — 2 column grid */
.gh-scan-groups {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.gh-scan-group-card {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 0.75rem;
}
.gh-scan-group-card h3 {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.gh-scan-group-card .sidebar-scan-buttons {
    gap: 0.35rem;
}
.gh-scan-group-card .scan-mode-btn {
    font-size: 13px;
    padding: 0.4rem 0.6rem;
    min-height: 32px;
    border-radius: 6px;
}
/* Operator section — full width below grid */
.gh-scan-operator {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.12);
}
.gh-scan-operator h3 {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.gh-scan-operator .sidebar-scan-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
}
.gh-scan-operator .sidebar-scan-buttons .btn.scan-mode-btn {
    text-align: center !important;
    justify-content: center !important;
    padding: 0.6rem 0.4rem !important;
    min-height: 42px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    border-radius: 6px !important;
    width: auto !important;
    display: flex !important;
    align-items: center !important;
}

/* Right 35%: Greeting + Clock */
.gh-right {
    flex: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    background: linear-gradient(135deg, #f97316, #facc15);
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
.gh-greeting { flex: 1; min-width: 0; }
.gh-right .welcome-greeting { font-size: 12px; color: rgba(255,255,255,0.85); margin-bottom: 1px; }
.gh-right .welcome-name { font-size: 1.2rem; font-weight: 700; color: white; line-height: 1.2; text-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.gh-right .welcome-quote { font-size: 11px; color: rgba(255,255,255,0.75); font-style: italic; margin-top: 2px; }
.gh-right-centre {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.gh-right-end { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }

/* Body layout with global header */
body.has-header .content { margin-left: 0; margin-top: var(--header-height); }
body.has-header .flash-messages { margin-left: 0; margin-top: var(--header-height); }

/* Hide old sidebar/topbar */
.sidebar { display: none !important; }
.topbar { display: none !important; }

/* ============================================================
   OLD TOP BAR (kept for compatibility, hidden)
   ============================================================ */
.topbar-old {
    position: fixed;
    top: 0;
    left: var(--sidebar-collapsed-width);
    right: 0;
    height: var(--topnav-height);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    z-index: 101;
    background: transparent;
    pointer-events: none;
    transition: left 0.2s ease;
}
.topbar > * { pointer-events: auto; }
body.has-sidebar:not(.sidebar-collapsed) .topbar { left: var(--sidebar-width); }
.topbar-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}
.topnav-logo { height: 48px; width: 48px; border-radius: 6px; object-fit: contain; flex-shrink: 0; }
.topnav-logo-text {
    display: flex;
    flex-direction: column;
    font-size: 14px;
    font-weight: 800;
    color: var(--gray-700);
    line-height: 1.15;
    white-space: nowrap;
}
.topnav-logo-text span:nth-child(2) {
    color: var(--gray-400);
    font-weight: 600;
}
.topbar-alerts {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}
/* Legacy topnav classes kept for alert tile compatibility */
.topnav {
    display: none; /* hidden — replaced by sidebar + topbar */
}
.topnav-old-hidden {
    position: fixed;
    top: 0.5rem;
    left: calc(var(--sidebar-width) + 1.5rem);
    right: 1.5rem;
    height: var(--topnav-height);
    background: linear-gradient(to right, #2d3a4a, #3a4d62);
    color: white;
    z-index: 101;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    gap: 1rem;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: left 0.2s ease;
}
/* Topnav stays fixed regardless of sidebar state */
.topnav-links { display: flex; align-items: center; gap: 0.25rem; flex: 1; overflow-x: auto; }
.topnav-link {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.topnav-link:hover { background: rgba(255,255,255,0.1); color: white; }
.topnav-link.active { background: rgba(255,255,255,0.15); color: white; }
.topnav-right { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.topnav-logout { color: rgba(255,255,255,0.7) !important; font-size: 12px; }
.topnav-logout:hover { color: white !important; }

/* ============================================================
   LEFT SIDEBAR — Scan Mode + Operators (collapsible)
   ============================================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: linear-gradient(to bottom, #2d3a4a, #3a4d62);
    border: none;
    border-radius: 0;
    z-index: 103;
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease;
    overflow: hidden;
    box-shadow: 2px 0 8px rgba(0,0,0,0.12);
}
.sidebar.collapsed { width: var(--sidebar-collapsed-width); }
/* Nav tiles */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0.4rem;
    flex-shrink: 0;
}
.sidebar-nav-tile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.5rem;
    border-radius: 4px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
}
.sidebar-nav-tile:hover { background: rgba(255,255,255,0.1); color: white; }
.sidebar-nav-tile.active {
    background: linear-gradient(to bottom, #d4d7dc, #c4c8ce);
    color: var(--gray-800);
}
.sidebar-nav-tile.active .sidebar-nav-icon { stroke: var(--gray-700); }
.sidebar-nav-icon { width: 18px; height: 18px; min-width: 18px; flex-shrink: 0; stroke: rgba(255,255,255,0.7); }
.sidebar-nav-label { overflow: hidden; text-overflow: ellipsis; transition: opacity 0.15s; }
.sidebar.collapsed .sidebar-nav-label { opacity: 0; width: 0; overflow: hidden; }
.sidebar.collapsed .sidebar-nav { padding: 0.4rem 0; }
.sidebar.collapsed .sidebar-nav-tile { justify-content: center; padding: 0.45rem 0; margin: 0; }
.sidebar.collapsed .sidebar-bottom { padding: 0.4rem 0; }
.sidebar.collapsed .sidebar-bottom .sidebar-nav-tile { justify-content: center; padding: 0.45rem 0; }
/* Scan mode panel */
.sidebar-scan-content {
    flex: 1;
    padding: 0.5rem 0.75rem 0.75rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.15);
}
.sidebar.collapsed .sidebar-scan-content { display: none !important; }
/* Bottom section (logout) */
.sidebar-bottom {
    margin-top: auto;
    padding: 0.4rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}
.sidebar-logout-tile { color: rgba(255,255,255,0.5) !important; font-size: 11px !important; }
.sidebar-logout-tile:hover { color: white !important; background: rgba(220,38,38,0.2) !important; }
.sidebar-logout-tile .sidebar-nav-icon { stroke: rgba(255,255,255,0.5); }
.sidebar-scan-group { display: flex; flex-direction: column; gap: 0.35rem; }
.sidebar-scan-label {
    font-weight: 700;
    font-size: 10px;
    color: rgba(255,255,255,0.6);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.sidebar-scan-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.sidebar-scan-buttons .scan-mode-btn {
    width: 100%;
    text-align: left;
    font-size: 12px;
    padding: 0.3rem 0.5rem;
    min-height: 28px;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.85);
    border-color: rgba(255,255,255,0.15);
}
.sidebar-scan-buttons .scan-mode-btn:hover {
    background: rgba(255,255,255,0.2);
    color: white;
}
.sidebar-scan-buttons .scan-mode-btn.active {
    background: #059669;
    color: white;
    border-color: #064e3b;
}
.sidebar-scan-divider {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.15);
    margin: 0.25rem 0;
}

/* Body layout — legacy sidebar rules (now handled by has-header) */
body.has-sidebar .content { margin-left: 0; margin-top: var(--header-height); }
body.has-sidebar.sidebar-collapsed .content { margin-left: 0; }
body.has-sidebar .flash-messages { margin-left: 0; margin-top: var(--header-height); }
body.has-sidebar.sidebar-collapsed .flash-messages { margin-left: 0; }

/* ============================================================
   ALERT BELL + PANEL (F10)
   ============================================================ */
.alert-tile {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    text-decoration: none;
    overflow: hidden;
    cursor: pointer;
    animation: alertPulse 4s ease-in-out infinite;
    white-space: nowrap;
    max-width: 300px;
    background: transparent;
    border: none;
}
.alert-tile:hover { background: rgba(0,0,0,0.03); }
.alert-tile-text {
    color: var(--gray-400);
    font-size: 11px;
    font-weight: 600;
    position: relative;
    z-index: 2;
}
@keyframes alertPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59,130,246,0); background: rgba(220,225,230,0.85); }
    25% { box-shadow: 0 0 14px 3px rgba(59,130,246,0.45); background: rgba(191,219,254,0.85); }
    50% { box-shadow: 0 0 0 0 rgba(239,68,68,0); background: rgba(220,225,230,0.85); }
    75% { box-shadow: 0 0 14px 3px rgba(239,68,68,0.45); background: rgba(254,202,202,0.85); }
}

/* Banner plane fly-by animation */
.banner-plane {
    position: absolute;
    left: -40px;
    top: 50%;
    transform: translateY(-50%) rotate(0deg);
    font-size: 30px;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    white-space: nowrap;
}
.plane-icon {
    color: #2563eb;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    filter: drop-shadow(0 0 4px rgba(37,99,235,0.5));
}
.plane-tail-banner {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 8px;
    background: #ef4444;
    color: white;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    line-height: 1.4;
}
.banner-plane.fly {
    animation: planeFlyBanner 3s ease-in-out forwards;
}
@keyframes planeFlyBanner {
    0%   { left: -60px; top: 50%; transform: translateY(-50%); opacity: 1; }
    85%  { left: 95%; top: 50%; transform: translateY(-50%); opacity: 1; }
    100% { left: calc(100% + 60px); top: 50%; transform: translateY(-50%); opacity: 0; }
}

/* Smoke trail canvas */
.smoke-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 199;
    pointer-events: none;
    display: none;
}

.alert-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.alert-panel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 360px;
    background: white;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    z-index: 200;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.alert-panel.open { transform: translateX(0); }
.alert-panel-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.alert-panel-overlay.open { opacity: 1; pointer-events: auto; }
.alert-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
}
.alert-panel-header h3 { font-size: 1rem; }
.alert-panel-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-400);
}
.alert-panel-body { flex: 1; padding: 0.75rem; }
.alert-panel-item {
    padding: 0.75rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    border-left: 4px solid var(--gray-300);
    background: var(--gray-50);
}
.alert-panel-critical { border-left-color: var(--danger); background: #fef2f2; }
.alert-panel-warning { border-left-color: var(--warning); background: #fffbeb; }
.alert-panel-info { border-left-color: var(--info); background: #eff6ff; }
.alert-panel-item-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.25rem; }
.alert-panel-title { font-weight: 600; font-size: 13px; }
.alert-panel-msg { font-size: 12px; color: var(--gray-500); margin-bottom: 0.5rem; }
.alert-panel-actions { display: flex; gap: 0.5rem; }

/* ============================================================
   SCAN TOGGLE BAR (F7 — fixed top, all pages)
   ============================================================ */
/* Scan mode buttons (used in sidebar) */
.scan-mode-btn {
    background: linear-gradient(180deg, #e8e8e8 0%, #c4c4c4 40%, #b0b0b0 60%, #c8c8c8 100%);
    color: white;
    border: 2px solid #888;
    padding: 0.3rem 0.5rem;
    font-size: 12px;
    font-weight: 800 !important;
    border-radius: var(--radius);
    text-shadow: 0 1px 3px rgba(0,0,0,0.6), 0 0 8px rgba(0,0,0,0.3);
    min-height: 28px;
}
.scan-mode-btn:hover { background: linear-gradient(180deg, #f0f0f0 0%, #d0d0d0 40%, #bcbcbc 60%, #d4d4d4 100%); }
.scan-mode-btn.active { background: #059669; color: white; border: 2px solid #064e3b; box-shadow: none; }
.scan-mode-btn.active:hover { background: #047857; }
.material-indicator {
    background: var(--success);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    white-space: nowrap;
    margin-top: 0.25rem;
}

/* ============================================================
   CONTENT
   ============================================================ */
.content {
    max-width: 100%;
    margin: 0 auto;
    padding: 1.5rem;
    overflow-anchor: none;
}
html, body { overflow-anchor: none; }
.data-table { overflow-anchor: none; }
.table-responsive { overflow-anchor: none; }

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.5rem; font-weight: 700; }
.form-ref {
    font-size: 0.75rem;
    background: var(--gray-200);
    color: var(--gray-600);
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    margin-left: 0.5rem;
    font-weight: 500;
    vertical-align: middle;
}

/* Flash Messages */
.flash-messages { max-width: 1400px; margin: 0 auto; padding: 0 1.5rem; }
.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
}
.flash-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.flash-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.flash-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.flash-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: inherit;
    opacity: 0.6;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
    white-space: nowrap;
}
.btn-primary { background: linear-gradient(to right, #2d3a4a, #3a4d62); color: white; }
.btn-primary:hover { background: linear-gradient(to right, #243040, #314258); }
.btn-secondary { background: white; color: var(--gray-700); border-color: var(--gray-300); }
.btn-secondary:hover { background: var(--gray-50); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.data-table th {
    background: var(--gray-50);
    color: var(--gray-600);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 2px solid var(--gray-200);
}
.data-table td {
    padding: 0.625rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13px;
}
.data-table tbody tr:hover { background: var(--gray-50); }
.data-table .empty {
    text-align: center;
    color: var(--gray-400);
    padding: 2rem;
    font-style: italic;
}
.row-inactive { opacity: 0.5; }
.mat-bulk-input { padding:0.2rem 0.4rem;font-size:12px;border:1px solid var(--gray-200);border-radius:3px;background:var(--white) }
.mat-bulk-input:focus { border-color:var(--primary);outline:none }
.table-responsive { overflow-x: auto; }

/* Active orders table column widths */
#active-orders-table th:nth-child(2),
#active-orders-table td:nth-child(2) { width: 22%; }  /* Customer — wider */
#active-orders-table th:nth-child(4),
#active-orders-table td:nth-child(4) { width: 4%; text-align: center; }  /* Batches — narrower */
#active-orders-table th:nth-child(5),
#active-orders-table td:nth-child(5) { width: 16%; }  /* Complete — wider */
#active-orders-table th:nth-child(6),
#active-orders-table td:nth-child(6) { width: 5%; text-align: center; }  /* Days Left — narrower */
#active-orders-table th:nth-child(7),
#active-orders-table td:nth-child(7) { width: 12%; }  /* Ship Date — wider */
#active-orders-table th:nth-child(9),
#active-orders-table td:nth-child(9) { width: 2%; text-align: center; }  /* Bin icon — narrower */

/* Badges */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.badge-pending, .badge-new, .badge-scheduled, .badge-open, .badge-draft { background: #dbeafe; color: #1e40af; }
.badge-in_production, .badge-printing, .badge-in_progress, .badge-investigating, .badge-monitoring { background: #fef3c7; color: #92400e; }
.badge-complete, .badge-completed, .badge-qc_pass, .badge-pass, .badge-approved, .badge-current, .badge-closed, .badge-verified, .badge-conforming { background: #d1fae5; color: #065f46; }
.badge-qc_fail, .badge-fail, .badge-rejected, .badge-critical, .badge-major_nc, .badge-suspended, .badge-obsolete { background: #fee2e2; color: #991b1b; }
.badge-rework, .badge-warning, .badge-minor, .badge-conditional, .badge-minor_nc, .badge-adjusted { background: #fef3c7; color: #92400e; }
.badge-reprint, .badge-cancelled, .badge-superseded, .badge-removed, .badge-archived { background: var(--gray-100); color: var(--gray-600); }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-major { background: #fed7aa; color: #9a3412; }
.badge-received { background: #e0e7ff; color: #3730a3; }
.badge-in_use, .badge-consumed { background: #fce7f3; color: #9d174d; }
.badge-expired { background: #fee2e2; color: #991b1b; }
.badge-active, .badge-stocked { background: #d1fae5; color: #065f46; }
.badge-used { background: var(--gray-100); color: var(--gray-600); }
.badge-post_processing, .badge-qc_pending { background: #f3e8ff; color: #6b21a8; }
.badge-assign_ready { background: #ccfbf1; color: #0f766e; }
.badge-assigned { background: #d1fae5; color: #065f46; }

/* Barcode type badges */
.badge-staff { background: #dbeafe; color: #1e40af; }
.badge-equipment { background: #fce7f3; color: #9d174d; }
.badge-material { background: #e0e7ff; color: #3730a3; }
.badge-qc-pass { background: #d1fae5; color: #065f46; }
.badge-action { background: #f3e8ff; color: #6b21a8; }

/* Archived order rows */
.archived-row { opacity: 0.5; }
.archived-row:hover { opacity: 0.7; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: var(--gray-700);
    margin-bottom: 0.25rem;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--gray-800);
    background: white;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
}
.form-group small { display: block; margin-top: 0.25rem; color: var(--gray-500); font-size: 12px; }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}
.form-group-full { grid-column: 1 / -1; }
.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}
.form-row .form-group { flex: 1; min-width: 150px; margin-bottom: 0; }
.form-actions { margin-top: 1rem; display: flex; gap: 0.5rem; }
.inline-form { background: white; padding: 1rem; border-radius: var(--radius); box-shadow: var(--shadow); }

/* Sections */
.section { margin-top: 1.5rem; }
.section h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.75rem; }
.section h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; }

/* Card tile */
.card { background: white; padding: 1rem; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1rem; }

/* Tile header — gradient banner for card/tile headings */
.tile-header {
    background: linear-gradient(to right, #2d3a4a, #3a4d62);
    color: rgba(255,255,255,0.92);
    padding: 0.5rem 1rem;
    margin: -1rem -1rem 0.75rem -1rem;
    border-radius: var(--radius) var(--radius) 0 0;
    font-size: 0.95rem;
    font-weight: 700;
}

/* Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.nav-card {
    background: white;
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--gray-800);
    border: 1px solid var(--gray-200);
    transition: box-shadow 0.15s, border-color 0.15s;
}
.nav-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}
.nav-card h3 { font-size: 1rem; margin-bottom: 0.25rem; color: var(--primary); }
.nav-card p { font-size: 13px; color: var(--gray-500); }

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.kpi-card {
    background: white;
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    border-left: 4px solid var(--primary);
}
.kpi-card.kpi-warning { border-left-color: var(--warning); }
.kpi-card.kpi-danger { border-left-color: var(--danger); }
.kpi-value { font-size: 2rem; font-weight: 700; color: var(--gray-900); }
.kpi-label { font-size: 13px; color: var(--gray-500); margin-top: 0.25rem; }

/* Charts */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 1rem;
}
.chart-card {
    background: white;
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.chart-card h3 { font-size: 0.9rem; color: var(--gray-600); margin-bottom: 0.75rem; }

/* Tabs */
.tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.tab {
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--gray-500);
    font-size: 13px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--gray-700); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-hint { color: var(--gray-400); font-style: italic; }

/* Docket View */
.docket-view { background: white; padding: 1.5rem; border-radius: var(--radius); box-shadow: var(--shadow); }
.docket-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.docket-header h2 { font-size: 1.25rem; }
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}
.detail-item label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--gray-400);
    font-weight: 600;
    letter-spacing: 0.05em;
}
.detail-item span { font-size: 14px; font-weight: 500; }
.docket-actions { margin-top: 1rem; display: flex; gap: 0.5rem; }

/* Search */
.search-bar { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; }
.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 15px;
}
.search-input:focus { outline: none; border-color: var(--primary); }

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}
.modal-content {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    max-width: 900px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-400);
}

/* Scanner */
.scanner-hidden {
    position: fixed;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
}
.scan-feedback {
    position: fixed;
    top: 60px;
    right: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 13px;
    z-index: 150;
    box-shadow: var(--shadow-md);
    transition: opacity 0.3s;
}
.scan-feedback.scan-success { background: #d1fae5; color: #065f46; }
.scan-feedback.scan-error { background: #fee2e2; color: #991b1b; }
.scan-feedback.scan-info { background: #dbeafe; color: #1e40af; }

/* Alerts */
.alert-panel-legacy { margin-top: 1rem; }
.alert-item {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    border-left: 4px solid;
}
.alert-warning { background: #fffbeb; border-color: var(--warning); }
.alert-critical { background: #fef2f2; border-color: var(--danger); }
.alert-info { background: #eff6ff; border-color: var(--info); }
.alert-header { display: flex; align-items: center; gap: 0.5rem; }
.alert-time { margin-left: auto; font-size: 12px; color: var(--gray-400); }

/* Info boxes */
.info-box { padding: 0.75rem 1rem; border-radius: var(--radius); font-size: 13px; }
.info-box.success { background: #d1fae5; color: #065f46; }
.info-box.error { background: #fee2e2; color: #991b1b; }

/* Login */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
}
.login-card {
    background: white;
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 380px;
}
.login-header { text-align: center; margin-bottom: 1.5rem; }
.login-header h1 { font-size: 1.5rem; color: var(--gray-900); }
.login-header p { color: var(--gray-500); font-size: 14px; }

/* Helpers */
.hidden { display: none !important; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.stock-low { color: var(--danger); font-weight: 600; }
.empty-state { text-align: center; color: var(--gray-400); padding: 2rem; font-style: italic; }
code { background: var(--gray-100); padding: 0.15rem 0.4rem; border-radius: 3px; font-size: 12px; }

/* ============================================================
   URGENT ALERTS BAR (legacy, now replaced by F10 panel)
   ============================================================ */
.urgent-alerts-bar {
    margin-bottom: 1rem;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.urgent-alerts-header {
    background: var(--danger);
    color: white;
    padding: 0.5rem 1rem;
    font-size: 13px;
}
.urgent-alert-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13px;
    background: white;
}
.urgent-alert-item:last-child { border-bottom: none; }
.urgent-alert-critical { border-left: 4px solid var(--danger); }
.urgent-alert-warning { border-left: 4px solid var(--warning); }
.urgent-alert-info { border-left: 4px solid var(--info); }
.urgent-alert-title { font-weight: 600; }
.urgent-alert-msg { color: var(--gray-500); flex: 1; }
.urgent-alert-action { white-space: nowrap; }

/* ============================================================
   KPI COMPACT ROW
   ============================================================ */
.kpi-row {
    display: flex;
    gap: 0.75rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}
.kpi-card-compact {
    flex: 1;
    min-width: 120px;
    background: white;
    padding: 0.75rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    border-left: 3px solid var(--primary);
}
.kpi-card-compact.kpi-warning { border-left-color: var(--warning); }
.kpi-card-compact.kpi-danger { border-left-color: var(--danger); }
.kpi-value-sm { font-size: 1.4rem; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.kpi-label-sm { font-size: 11px; color: var(--gray-500); }

/* ============================================================
   ORDER KPI CARDS ROW (F9)
   ============================================================ */
.order-kpi-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.order-kpi-card {
    background: white;
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    border-top: 4px solid var(--primary);
}
.order-kpi-blue { border-top-color: var(--info); }
.order-kpi-amber { border-top-color: var(--warning); }
.order-kpi-red { border-top-color: var(--danger); }
.order-kpi-grey { border-top-color: var(--gray-400); }
.order-kpi-green { border-top-color: #059669; background: #d1fae5; }
.order-kpi-value {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.1;
}
.order-kpi-label {
    font-size: 12px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

/* ============================================================
   COMPACT CHART GRID
   ============================================================ */
.chart-grid-compact {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 1rem;
}
.chart-card-sm {
    background: white;
    padding: 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.chart-card-sm h3 { font-size: 0.8rem; color: var(--gray-600); margin-bottom: 0.5rem; }

/* ============================================================
   DASHBOARD CLOCK (F6)
   ============================================================ */
.dashboard-clock {
    text-align: right;
    color: rgba(255,255,255,0.9);
}
.dashboard-clock .clock-time {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}
.dashboard-clock .clock-date {
    font-size: 12px;
    color: rgba(255,255,255,0.75);
}

/* ============================================================
   BATCH STATUS PROGRESSION (F2) — chevron block style
   ============================================================ */
.batch-title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.batch-title-row .batch-item-title {
    flex-shrink: 0;
    margin-bottom: 0;
}
.batch-progress {
    display: flex;
    gap: 3px;
    flex: 1;
    min-width: 0;
}
.batch-step {
    flex: 1;
    padding: 0.3rem 0.4rem;
    border-radius: var(--radius);
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s;
    line-height: 1.4;
    isolation: isolate;
    letter-spacing: 0.02em;
}
/* Per-stage sizing — narrow for static, wide for timed stages */
.batch-step-pending      { flex: 0.5; }
.batch-step-printing     { flex: 1.5; }
.batch-step-post_processing { flex: 1.5; }
.batch-step-qc_pending   { flex: 0.5; }
/* .batch-step-complete removed — completion now uses full-width bar */
.batch-step:hover { transform: scale(1.03); }
/* Chevron SVG background */
.batch-step::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background-repeat: repeat-x;
    background-size: 20px 100%;
    background-position: center;
}
/* Fade chevrons into bg colour around the text */
.batch-step::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

/* --- Per-stage colours --- */
/* Pending — blue */
.batch-step-pending.active, .batch-step-pending.done { background: #2563eb; color: white; }
.batch-step-pending.active::before, .batch-step-pending.done::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 40'%3E%3Cpolygon points='0,0 14,20 0,40 6,40 20,20 6,0' shape-rendering='geometricPrecision' fill='%233b82f6'/%3E%3C/svg%3E");
}
.batch-step-pending.active::after, .batch-step-pending.done::after {
    background: radial-gradient(ellipse at center, #2563eb 20%, transparent 65%);
}
/* Printing — amber (done=solid, active=grey bg with amber fill) */
.batch-step-printing.done { background: #d97706; color: white; }
.batch-step-printing.done::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 40'%3E%3Cpolygon points='0,0 14,20 0,40 6,40 20,20 6,0' shape-rendering='geometricPrecision' fill='%23f59e0b'/%3E%3C/svg%3E");
}
.batch-step-printing.done::after {
    background: radial-gradient(ellipse at center, #d97706 20%, transparent 65%);
}
.batch-step-printing.active { background: var(--gray-200); color: #92400e; }
.batch-step-printing.active::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 40'%3E%3Cpolygon points='0,0 14,20 0,40 6,40 20,20 6,0' shape-rendering='geometricPrecision' fill='%23d1d5db'/%3E%3C/svg%3E");
}
.batch-step-printing.active::after {
    background: radial-gradient(ellipse at center, var(--gray-200) 20%, transparent 65%);
}
.batch-step-printing.active .batch-step-fill { background: #fef3c7; }
.batch-step-printing.active .batch-step-fill::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 40'%3E%3Cpolygon points='0,0 14,20 0,40 6,40 20,20 6,0' shape-rendering='geometricPrecision' fill='%23fde68a'/%3E%3C/svg%3E");
}
.batch-step-printing.active .batch-step-fill::after {
    background: radial-gradient(ellipse at center, #fef3c7 20%, transparent 65%);
}
/* Post-Processing — purple (done=solid, active=grey bg with purple fill) */
.batch-step-post_processing.done { background: #7c3aed; color: white; }
.batch-step-post_processing.done::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 40'%3E%3Cpolygon points='0,0 14,20 0,40 6,40 20,20 6,0' shape-rendering='geometricPrecision' fill='%23a78bfa'/%3E%3C/svg%3E");
}
.batch-step-post_processing.done::after {
    background: radial-gradient(ellipse at center, #7c3aed 20%, transparent 65%);
}
.batch-step-post_processing.active { background: var(--gray-200); color: #5b21b6; }
.batch-step-post_processing.active::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 40'%3E%3Cpolygon points='0,0 14,20 0,40 6,40 20,20 6,0' shape-rendering='geometricPrecision' fill='%23d1d5db'/%3E%3C/svg%3E");
}
.batch-step-post_processing.active::after {
    background: radial-gradient(ellipse at center, var(--gray-200) 20%, transparent 65%);
}
.batch-step-post_processing.active .batch-step-fill { background: #ede9fe; }
.batch-step-post_processing.active .batch-step-fill::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 40'%3E%3Cpolygon points='0,0 14,20 0,40 6,40 20,20 6,0' shape-rendering='geometricPrecision' fill='%23c4b5fd'/%3E%3C/svg%3E");
}
.batch-step-post_processing.active .batch-step-fill::after {
    background: radial-gradient(ellipse at center, #ede9fe 20%, transparent 65%);
}
/* QC Pending — teal */
.batch-step-qc_pending.active, .batch-step-qc_pending.done { background: #0891b2; color: white; }
.batch-step-qc_pending.active::before, .batch-step-qc_pending.done::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 40'%3E%3Cpolygon points='0,0 14,20 0,40 6,40 20,20 6,0' shape-rendering='geometricPrecision' fill='%230e7490'/%3E%3C/svg%3E");
}
.batch-step-qc_pending.active::after, .batch-step-qc_pending.done::after {
    background: radial-gradient(ellipse at center, #0891b2 20%, transparent 65%);
}
/* Complete — green */
.batch-step-complete.active, .batch-step-complete.done { background: #059669; color: white; }
.batch-step-complete.active::before, .batch-step-complete.done::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 40'%3E%3Cpolygon points='0,0 14,20 0,40 6,40 20,20 6,0' shape-rendering='geometricPrecision' fill='%2334d399'/%3E%3C/svg%3E");
}
.batch-step-complete.active::after, .batch-step-complete.done::after {
    background: radial-gradient(ellipse at center, #059669 20%, transparent 65%);
}
/* Batch tile tinted backgrounds per status */
.batch-item[data-status="pending"]         { background: #dbeafe; }
.batch-item[data-status="printing"]        { background: #fef3c7; }
.batch-item[data-status="post_processing"] { background: #ede9fe; }
.batch-item[data-status="qc_pending"]      { background: #e0f7fa; }
.batch-item[data-status="complete"]        { background: #d1fae5; }
.batch-item[data-status="remade"]          { background: #f3f4f6; }

/* --- Batch status panel (left side) --- */
.batch-status-panel {
    width: 12.5%;
    min-width: 80px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    padding-left: 10px;
    transition: filter 0.15s;
}
.batch-status-panel:hover { filter: brightness(0.95); }
.batch-status-label {
    font-size: 11px;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-align: left;
    line-height: 1.2;
}
.batch-status-pct {
    font-size: 13px;
    font-weight: 800;
    color: rgba(255,255,255,0.9);
}

/* Pending — blue */
.batch-status-pending { background: linear-gradient(to right, #3b82f6 50%, #dbeafe 100%); }
/* Printing — amber */
.batch-status-printing { background: linear-gradient(to right, #f59e0b 50%, #fef3c7 100%); }
/* Post-Processing — purple */
.batch-status-post_processing { background: linear-gradient(to right, #8b5cf6 50%, #ede9fe 100%); }
/* QC Pending — teal */
.batch-status-qc_pending { background: linear-gradient(to right, #06b6d4 50%, #e0f7fa 100%); }
/* Complete — green (legacy) */
.batch-status-complete { background: linear-gradient(to right, #10b981 50%, #d1fae5 100%); }
/* Scheduled — blue (replaces pending) */
.batch-status-scheduled { background: linear-gradient(to right, #3b82f6 50%, #dbeafe 100%); }
/* Assign Ready — teal */
.batch-status-assign_ready { background: linear-gradient(to right, #14b8a6 50%, #ccfbf1 100%); }
/* Assigned — green (replaces complete) */
.batch-status-assigned { background: linear-gradient(to right, #10b981 50%, #d1fae5 100%); }
/* Batch Held — black */
.batch-status-batch_held { background: linear-gradient(to right, #1f2937 50%, #6b7280 100%); }
/* Discarded — red */
.batch-status-discarded { background: linear-gradient(to right, #dc2626 50%, #fecaca 100%); }
/* Remade — grey */
.batch-status-remade { background: linear-gradient(to right, #9ca3af 50%, #e5e7eb 100%); }

/* Status arrow buttons */
.batch-status-arrows {
    display: flex;
    gap: 4px;
    position: relative;
    z-index: 1;
    margin-top: 2px;
}
.batch-status-arrow {
    background: rgba(255,255,255,0.25);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    padding: 1px 6px;
    border-radius: 3px;
    transition: background 0.15s;
}
.batch-status-arrow:hover {
    background: rgba(255,255,255,0.45);
}
.batch-status-arrow-placeholder {
    width: 22px;
}

/* (undo button removed — status arrows handle revert) */

/* Future — fully greyed */
.batch-step.future { background: var(--gray-200); color: var(--gray-400); }
.batch-step.future::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 40'%3E%3Cpolygon points='0,0 14,20 0,40 6,40 20,20 6,0' shape-rendering='geometricPrecision' fill='%23d1d5db'/%3E%3C/svg%3E");
}
.batch-step.future::after {
    background: radial-gradient(ellipse at center, var(--gray-200) 20%, transparent 65%);
}
/* Batch step fill (progress bar within active chevrons) */
.batch-step-fill {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 0;
    border-radius: var(--radius) 0 0 var(--radius);
    overflow: hidden;
    transition: width 0.5s ease;
}
.batch-step-fill::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background-repeat: repeat-x;
    background-size: 20px 100%;
    background-position: center;
}
.batch-step-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}
.batch-step-text {
    position: relative;
    z-index: 1;
}

/* ============================================================
   PRINT DOCUMENTS DROPDOWN
   ============================================================ */
.print-docs-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    padding: 0.5rem;
    z-index: 100;
    min-width: 180px;
}
.print-docs-menu .btn {
    display: block;
    width: 100%;
    text-align: left;
    margin-bottom: 0.25rem;
}
.print-docs-menu .btn:last-child { margin-bottom: 0; }

/* Dropdown action button (options menus) */
.dropdown-action-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.75rem;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    background: none;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.15s;
}
.dropdown-action-btn:hover { background: var(--gray-100); }

/* ============================================================
   ORDER PROGRESS BAR
   ============================================================ */
.order-progress-bar {
    width: 100%;
    height: 28px;
    border-radius: var(--radius);
    background: var(--gray-200);
    overflow: hidden;
    position: relative;
}
.order-progress-fill {
    height: 100%;
    background: linear-gradient(to right, #10b981 calc(100% - 40px), transparent);
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 38px;
    border-radius: var(--radius) 0 0 var(--radius);
}
.order-progress-text {
    padding: 2px 8px;
    font-weight: 700;
    font-size: 11px;
    color: #fff;
    background: rgba(4, 70, 40, 0.3);
    border-radius: 4px;
    white-space: nowrap;
}
/* Inline edit pencil */
.edit-pencil {
    cursor: pointer;
    font-size: 13px;
    color: var(--gray-400);
    transition: color 0.15s;
    user-select: none;
    flex-shrink: 0;
}
.edit-pencil:hover { color: var(--primary); }
/* QC manual tick */
.qc-tick { width: 15px; height: 15px; cursor: pointer; accent-color: #059669; }

/* Archived stamp */
.archived-stamp {
    display: inline-block;
    background: var(--gray-100);
    color: var(--gray-500);
    font-size: 16px;
    font-weight: 800;
    padding: 0.4rem 1.25rem;
    border: 3px solid var(--gray-400);
    border-radius: 8px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    transform: rotate(-2deg);
    margin-top: 0.75rem;
}
/* Good Job rubber-stamp */
.good-job-stamp {
    display: inline-block;
    font-size: 42px;
    font-weight: 900;
    color: #dc2626;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border: 5px solid #dc2626;
    border-radius: 6px;
    padding: 0.2em 0.6em;
    white-space: nowrap;
    position: relative;
}
/* Ink-bleed glow on landing */
@keyframes stamp-land {
    0%   { box-shadow: 0 0 0 0 rgba(220,38,38,0.5); }
    50%  { box-shadow: 0 0 18px 6px rgba(220,38,38,0.3); }
    100% { box-shadow: 0 0 0 0 rgba(220,38,38,0); }
}

/* ============================================================
   SHIPPED STAMP (F4)
   ============================================================ */
.shipped-stamp {
    display: inline-block;
    background: #d1fae5;
    color: #065f46;
    font-size: 18px;
    font-weight: 800;
    padding: 0.5rem 1.5rem;
    border: 3px solid #059669;
    border-radius: 8px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    transform: rotate(-2deg);
}
.shipped-stamp-sm {
    font-size: 13px;
    padding: 0.3rem 0.9rem 0.35rem;
    border-width: 2px;
    border-radius: 5px;
    transform: rotate(-1deg);
    text-align: center;
}
.shipped-stamp-sub {
    display: block;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: none;
    color: #065f46;
    margin-top: 0.1rem;
    line-height: 1.3;
}
.shipped-stamp-detail {
    display: block;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: none;
    margin-top: 0.15rem;
    color: #065f46;
}

/* ============================================================
   MATERIAL EXPANDABLE ROWS (F3)
   ============================================================ */
.material-row { cursor: pointer; }
.material-row:hover { background: var(--gray-50); }
.material-row .expand-arrow {
    width: 30px;
    text-align: center;
    color: var(--gray-400);
    font-size: 10px;
    transition: transform 0.2s;
}
.lots-detail-row td { padding: 0 !important; }
.lots-detail-inner {
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
}

/* ============================================================
   DAYS-LEFT BADGES
   ============================================================ */
.days-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
}
.days-overdue { background: #fee2e2; color: #991b1b; }
.days-urgent { background: #fed7aa; color: #9a3412; }
.days-warning { background: #fef3c7; color: #92400e; }
.days-ok { background: #d1fae5; color: #065f46; }

/* Mini progress bar for active orders */
.pct-label { font-size: 12px; font-weight: 600; color: var(--gray-700); }
.mini-progress-bar {
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    background: var(--gray-200);
    margin-top: 4px;
    min-width: 60px;
}
.mini-progress-fill { height: 100%; background: #10b981; border-radius: 3px; transition: width 0.3s ease; }

/* ============================================================
   ORDER EXPAND ROWS
   ============================================================ */
.expand-arrow { width: 30px; text-align: center; color: var(--gray-400); font-size: 10px; }
.docket-expand-row td { padding: 0 !important; }
.docket-expand-inner {
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    background: var(--gray-50);
}
.docket-expand-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
    font-size: 13px;
    border-bottom: 1px solid var(--gray-200);
}
.docket-expand-item:last-child { border-bottom: none; }
.docket-pos { color: var(--gray-500); font-size: 12px; min-width: 80px; }

/* Print dropdown */
.print-dropdown { position: relative; display: inline-block; margin-left: auto; }
.print-dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 50;
    min-width: 140px;
}
.print-dropdown-menu a, .print-dropdown-menu span {
    display: block;
    padding: 0.5rem 0.75rem;
    font-size: 13px;
    text-decoration: none;
    color: var(--gray-700);
}
.print-dropdown-menu a:hover { background: var(--gray-50); }
.print-dropdown-docket {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13px;
}
.print-dropdown-docket:last-child { border-bottom: none; }
.print-dropdown-docket-label { flex: 1; font-weight: 500; white-space: nowrap; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
    .chart-grid-compact { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1100px) {
    .order-kpi-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
    .batch-info-grid { grid-template-columns: auto auto 1fr 0.7fr 0.6fr 0.5fr 0.5fr 0.6fr; }
    .order-kpi-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 750px) {
    .chart-grid-compact { grid-template-columns: 1fr; }
    .kpi-row { gap: 0.5rem; }
    .kpi-card-compact { min-width: 80px; }
    .order-kpi-row { grid-template-columns: 1fr 1fr; }
    /* Collapse sidebar on mobile */
    .sidebar { width: var(--sidebar-collapsed-width); }
    .sidebar.collapsed .sidebar-scan-content { opacity: 0; pointer-events: none; }
    body.has-sidebar .content { margin-left: var(--sidebar-collapsed-width); }
    body.has-sidebar .flash-messages { margin-left: var(--sidebar-collapsed-width); }
}
@media (max-width: 600px) {
    .batch-info-grid { grid-template-columns: auto auto 1fr 1fr; }
}

/* ============================================================
   ORDER DETAIL — GLOW ANIMATIONS
   ============================================================ */
@keyframes order-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(37,99,235,0); }
    50% { box-shadow: 0 0 20px 4px rgba(37,99,235,0.4); }
}
.glow-highlight {
    animation: order-glow 1.5s ease-in-out 3;
    border-radius: var(--radius);
}
@keyframes batch-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(37,99,235,0); }
    50% { box-shadow: 0 0 24px 6px rgba(37,99,235,0.5); }
}
.batch-glow {
    animation: batch-glow 1.2s ease-in-out 4;
    border-radius: var(--radius);
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
@keyframes batch-glow-green {
    0%, 100% { box-shadow: 0 0 0 0 rgba(5,150,105,0); }
    50% { box-shadow: 0 0 24px 6px rgba(5,150,105,0.5); }
}
.batch-glow-green {
    animation: batch-glow-green 1.2s ease-in-out 4;
    border-radius: var(--radius);
    outline: 2px solid var(--success);
    outline-offset: 2px;
}

/* ============================================================
   ORDER INFO GRID
   ============================================================ */
.order-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    background: white;
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.order-info-item label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--gray-400);
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 0.15rem;
}
.order-info-item span {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-800);
}

/* ============================================================
   BATCH ITEM CARDS
   ============================================================ */
.batch-item {
    display: flex;
    flex-direction: row;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 0.5rem;
    border: 1px solid var(--gray-300);
    overflow: hidden;
}
.batch-item[data-status="remade"] .batch-content,
.batch-item[data-status="batch_held"] .batch-content {
    opacity: 0.5;
}
.batch-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
}
/* batch-content-header removed — title now in info grid */
.batch-item-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--gray-500);
    letter-spacing: 0.05em;
}
.batch-info-grid {
    display: grid;
    column-gap: 0.6rem;
    /* Title | Docs | Batch | SKU | Product | Qty | Re-Cleaned | QC'd By */
    grid-template-columns: auto auto 0.8fr 0.6fr 0.55fr 0.3fr 0.5fr 0.6fr;
}
/* Compact mode: Title | Docs | Batch | SKU | Product | Qty (no Re-Cleaned/QC'd By) */
.batch-info-grid-compact {
    grid-template-columns: auto auto 0.8fr 0.6fr 0.55fr 0.3fr;
}
/* Setup mode: Title | SKU | Product | Qty | Printer+Actions */
.batch-info-grid-setup {
    grid-template-columns: auto 0.6fr 0.55fr 0.3fr auto;
}
.batch-setup-ctrl {
    height: 28px;
    display: inline-flex;
    align-items: center;
    padding: 0 0.5rem;
    font-size: 12px;
    white-space: nowrap;
}
    gap: 0.4rem 0.8rem;
    align-items: center;
}
.batch-info-title {
    padding-right: 0.5rem;
    display: flex;
    align-items: center;
    align-self: center;
}
.batch-info-title span {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    white-space: nowrap;
    border-radius: 4px;
    padding: 4px 8px;
    display: inline-block;
}
/* Title mini-tile colours per status */
.batch-item[data-status="pending"] .batch-info-title span         { background: #bfdbfe; color: #1e40af; border: 1px solid #93c5fd; }
.batch-item[data-status="printing"] .batch-info-title span        { background: #fde68a; color: #92400e; border: 1px solid #fcd34d; }
.batch-item[data-status="post_processing"] .batch-info-title span { background: #ddd6fe; color: #5b21b6; border: 1px solid #c4b5fd; }
.batch-item[data-status="qc_pending"] .batch-info-title span      { background: #a5f3fc; color: #155e75; border: 1px solid #67e8f9; }
.batch-item[data-status="complete"] .batch-info-title span        { background: #a7f3d0; color: #065f46; border: 1px solid #6ee7b7; }
.batch-item[data-status="remade"] .batch-info-title span          { background: #e5e7eb; color: #6b7280; border: 1px solid #d1d5db; }
.batch-info-docs {
    padding: 0 0.8rem;
}
.batch-info-actions {
    display: flex;
    gap: 0.3rem;
    align-items: center;
}
.batch-info-cell {
    min-width: 0;
    overflow: hidden;
}
.batch-info-cell label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    color: var(--gray-400);
    font-weight: 600;
    letter-spacing: 0.04em;
    margin-bottom: 0.1rem;
}
.batch-info-cell span {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-800);
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.batch-item-header {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.batch-item-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 13px;
    padding-top: 0.25rem;
    border-top: 1px solid var(--gray-100);
}

/* Remake form inside batch card */
.remake-form {
    border-top: 1px dashed var(--gray-200);
    margin-top: 0.25rem;
}

/* Badge for remade status */
.badge-remade { background: var(--gray-400); color: white; }
.badge-batch_held { background: #1f2937; color: white; }

/* Red REMAKE stamp on remake batches */
.remake-stamp {
    display: inline-block;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--danger);
    border: 2.5px solid var(--danger);
    border-radius: 4px;
    padding: 0.1rem 0.5rem;
    transform: rotate(-2deg);
    opacity: 0.85;
    margin-bottom: 0.15rem;
    width: fit-content;
}

/* Order tag stamps */
.tag-stamp {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-width: 2px;
    border-style: solid;
    border-radius: 3px;
    padding: 0.05rem 0.35rem;
    white-space: nowrap;
    width: fit-content;
}
.tag-stamp-fast_track { color: #d97706; border-color: #d97706; }
.tag-stamp-urgent_priority { color: var(--danger); border-color: var(--danger); }
.tag-stamp-new_customer { color: #2563eb; border-color: #2563eb; }

/* Lot status colours (simplified: approved, rejected, in_use, used) */
.lot-status-select.lot-status-approved { border-color: var(--info); background: #eff6ff; color: var(--info); }
.lot-status-select.lot-status-in_use { border-color: var(--warning); background: #fffbeb; color: #b45309; }
.lot-status-select.lot-status-used { border-color: var(--gray-400); background: var(--gray-100); color: var(--gray-500); }
.lot-status-select.lot-status-rejected { border-color: var(--danger); background: #fef2f2; color: var(--danger); }

/* Operator buttons use .scan-mode-btn styling — active state matches scan mode buttons */

/* Lot cards */
.lot-card { background: white; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1rem; margin-bottom: 0.75rem; }
.lot-card.lot-rejected { border-color: var(--danger); background: #fef2f2; }
.lot-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.lot-card-header h3 { margin: 0; font-size: 15px; font-weight: 600; }
.lot-card-details { display: flex; gap: 1.5rem; flex-wrap: wrap; font-size: 13px; color: var(--gray-600); margin-top: 0.5rem; }

/* Active lots 2-column grid */
.lot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
@media (max-width: 900px) { .lot-grid { grid-template-columns: 1fr; } }

/* Lot status block timeline — chevron road-sign style */
.lot-progress { display: flex; gap: 3px; margin-bottom: 0.75rem; }
.lot-step {
    flex: 1;
    padding: 0.3rem 0.4rem;
    border-radius: var(--radius);
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s;
    line-height: 1.4;
    isolation: isolate;
    letter-spacing: 0.02em;
}
.lot-step:hover { transform: scale(1.03); }
/* Fade chevrons into background colour around the title text */
.lot-step::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}
.lot-step-approved.active::after,
.lot-step-approved.done::after {
    background: radial-gradient(ellipse at center, #2563eb 20%, transparent 65%);
}
.lot-step-in_use.active::after,
.lot-step-in_use.done::after {
    background: radial-gradient(ellipse at center, #d97706 20%, transparent 65%);
}
.lot-step-used.active::after,
.lot-step-used.done::after {
    background: radial-gradient(ellipse at center, #6b7280 20%, transparent 65%);
}
.lot-step.future::after {
    background: radial-gradient(ellipse at center, var(--gray-200) 20%, transparent 65%);
}
/* Repeating chevron background using SVG — fills the block like the road sign */
.lot-step::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background-repeat: repeat-x;
    background-size: 20px 100%;
    background-position: center;
}

/* Approved — blue */
.lot-step-approved.active,
.lot-step-approved.done {
    background: #2563eb;
    color: white;
}
.lot-step-approved.active::before,
.lot-step-approved.done::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 40'%3E%3Cpolygon points='0,0 14,20 0,40 6,40 20,20 6,0' shape-rendering='geometricPrecision' fill='%233b82f6'/%3E%3C/svg%3E");
}
/* In Use — amber */
.lot-step-in_use.active,
.lot-step-in_use.done {
    background: #d97706;
    color: white;
}
.lot-step-in_use.active::before,
.lot-step-in_use.done::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 40'%3E%3Cpolygon points='0,0 14,20 0,40 6,40 20,20 6,0' shape-rendering='geometricPrecision' fill='%23f59e0b'/%3E%3C/svg%3E");
}
/* Used — dark gray */
.lot-step-used.active,
.lot-step-used.done {
    background: #6b7280;
    color: white;
}
.lot-step-used.active::before,
.lot-step-used.done::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 40'%3E%3Cpolygon points='0,0 14,20 0,40 6,40 20,20 6,0' shape-rendering='geometricPrecision' fill='%239ca3af'/%3E%3C/svg%3E");
}
/* Future — fully greyed out */
.lot-step.future {
    background: var(--gray-200);
    color: var(--gray-400);
}
.lot-step.future::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 40'%3E%3Cpolygon points='0,0 14,20 0,40 6,40 20,20 6,0' shape-rendering='geometricPrecision' fill='%23d1d5db'/%3E%3C/svg%3E");
}
.lot-edit-fields { display: none; margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--gray-200); }
.lot-edit-fields.visible { display: flex; gap: 1rem; align-items: flex-end; }
.lot-edit-fields input { font-size: 13px; padding: 0.3rem 0.5rem; border: 1px solid var(--gray-300); border-radius: var(--radius); }
.lot-edit-btn { background: none; border: none; cursor: pointer; font-size: 16px; padding: 0.2rem 0.4rem; color: var(--gray-400); }
.lot-edit-btn:hover { color: var(--primary); }

/* Lot action bar — fixed toggle buttons on material detail page */
.lot-action-bar { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.lot-action-label { font-weight: 600; font-size: 13px; color: var(--gray-600); margin-right: 0.25rem; }
.lot-action-btn {
    padding: 0.5rem 1rem; border: 2px solid var(--gray-300); border-radius: var(--radius);
    background: white; color: var(--gray-600); font-size: 14px; font-weight: 600; cursor: pointer;
    transition: all 0.15s;
}
.lot-action-btn:hover { border-color: var(--primary); color: var(--primary); }
.lot-action-btn.active#btn-add-stock { background: #eff6ff; color: var(--info); border-color: var(--info); }
.lot-action-btn.active#btn-use-stock { background: #fffbeb; color: #b45309; border-color: var(--warning); }
.lot-action-btn.active#btn-mark-used { background: var(--gray-100); color: var(--gray-500); border-color: var(--gray-400); }
.lot-scan-status { font-size: 13px; font-weight: 500; margin-left: 0.5rem; }

/* Lots detail table — better alignment */
.lots-detail-inner .data-table {
    font-size: 13px;
}
.lots-detail-inner .data-table th,
.lots-detail-inner .data-table td {
    text-align: center;
    vertical-align: middle;
    padding: 0.45rem 0.5rem;
}
.lots-detail-inner .data-table th:first-child,
.lots-detail-inner .data-table td:first-child {
    text-align: left;
}
.lots-detail-inner .data-table th:last-child,
.lots-detail-inner .data-table td:last-child {
    text-align: center;
}

/* Lot status dropdown styling (#5) */
.lot-status-select {
    font-size: 12px;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: var(--gray-50);
    color: var(--gray-700);
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.lot-status-select:hover { border-color: var(--primary); }
.lot-status-select:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(26,86,219,0.15); }

/* Clickable KPI cards hover effect (#4) */
.order-kpi-link {
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s, box-shadow 0.15s;
}
.order-kpi-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Up Next scrollable table — sticky header */
#up-next-section .table-responsive thead th {
    position: sticky;
    top: 0;
    background: white;
    z-index: 2;
    box-shadow: 0 1px 0 var(--gray-200);
}

/* ============================================================
   DASHBOARD HERO (logo+title | greeting)
   ============================================================ */
.dash-hero {
    display: flex;
    align-items: stretch;
    border-radius: var(--radius);
    overflow: hidden;
    margin: 0.75rem 0 1rem;
    box-shadow: var(--shadow-md);
    min-height: 100px;
}
.dash-hero-left {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #2d3a4a, #3a4d62);
}
.dash-hero-logo {
    height: 80px;
    width: 80px;
    border-radius: 8px;
    object-fit: contain;
    flex-shrink: 0;
}
.dash-hero-title {
    display: flex;
    flex-direction: column;
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    line-height: 1.2;
    white-space: nowrap;
}
.dash-hero-title span:nth-child(2) {
    color: rgba(255,255,255,0.5);
    font-weight: 600;
    font-size: 1.3rem;
}
.dash-hero-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #f97316, #facc15);
}

/* ============================================================
   WELCOME HEADER (reused inside dash-hero-right)
   ============================================================ */
.welcome-header {
    background: linear-gradient(135deg, #f97316, #facc15);
    color: white;
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-md);
}
.welcome-greeting {
    font-size: 14px;
    color: rgba(255,255,255,0.85);
    margin-bottom: 0.15rem;
}
.welcome-name {
    font-size: 1.6rem;
    font-weight: 700;
    color: white;
    line-height: 1.3;
    text-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.welcome-quote {
    font-size: 12px;
    color: rgba(255,255,255,0.8);
    font-style: italic;
    margin-top: 0.4rem;
}

/* ============================================================
   COLLAPSIBLE SECTIONS
   ============================================================ */
.section-toggle {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.section-toggle .toggle-arrow {
    font-size: 12px;
    transition: transform 0.2s;
    color: var(--gray-400);
}
.section-toggle.collapsed .toggle-arrow { transform: rotate(-90deg); }

/* ============================================================
   KPI SLIDESHOW OVERLAY (F5 — split screen)
   ============================================================ */
#slideshow-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #f8fafc;
    z-index: 10000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
#slideshow-overlay.active { display: flex; }
.slideshow-bg {
    position: absolute;
    top: 0; left: 0; width: 50%; height: 100%;
    background-size: cover;
    background-position: center;
    transition: opacity 0.8s ease;
    opacity: 0;
}
.slideshow-bg.active { opacity: 1; }
.slideshow-bg::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.15);
}
.slideshow-header {
    position: absolute;
    top: 1.5rem;
    left: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 3;
}
.slideshow-header img { height: 78px; border-radius: 8px; box-shadow: 0 2px 12px rgba(0,0,0,0.18); }
.slideshow-close {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: none;
    color: white;
    font-size: 1.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    z-index: 3;
}
.slideshow-close:hover { background: rgba(0,0,0,0.5); }
.slideshow-content {
    transition: opacity 0.5s;
    z-index: 2;
    position: absolute;
    right: 0;
    top: 0;
    width: 50%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.slideshow-split { text-align: center; }
.slideshow-kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding: 2rem;
    max-width: 500px;
}
.slideshow-kpi-item {
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    padding: 2rem 1.5rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.6);
}
.slideshow-kpi-value {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.1;
}
.slideshow-kpi-label {
    font-size: 0.85rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 0.25rem;
}
.slideshow-card {
    background: rgba(255,255,255,0.82);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    padding: 2.5rem 4rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.6);
}
.slideshow-value {
    font-size: 120px;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.1;
}
.slideshow-label {
    font-size: 1.5rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 0.5rem;
}
.slideshow-chart-wrap {
    width: 90%;
    max-width: 500px;
    height: 350px;
    margin: 0 auto;
    background: rgba(255,255,255,0.82);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.6);
}
.slideshow-dots {
    position: absolute;
    bottom: 2rem;
    right: 25%;
    transform: translateX(50%);
    display: flex;
    gap: 0.5rem;
    z-index: 3;
}
.slideshow-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: rgba(0,0,0,0.2);
    transition: background 0.3s;
    cursor: pointer;
}
.slideshow-dot.active { background: var(--primary); }

/* ============================================================
   ICON DELETE/ARCHIVE BUTTON
   ============================================================ */
.btn-icon-delete {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.3rem;
    border-radius: var(--radius);
    color: var(--gray-400);
    transition: color 0.15s, background 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-icon-delete:hover {
    color: var(--danger);
    background: #fee2e2;
}
.btn-icon-delete svg {
    width: 16px;
    height: 16px;
}

/* Confirmation Modal */
.confirm-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}
.confirm-modal-box {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-md);
    text-align: center;
}
.confirm-modal-box p {
    margin-bottom: 1.25rem;
    font-size: 14px;
    color: var(--gray-700);
    line-height: 1.5;
}
.confirm-modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
/* ============================================================
   PRINT TIMELINE
   ============================================================ */
.timeline-row {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-200);
}
.timeline-row:last-child { border-bottom: none; }

.timeline-printer-info {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 220px;
    flex-shrink: 0;
}
.timeline-printer-img {
    width: 48px;
    height: auto;
    border-radius: var(--radius);
}
.timeline-printer-meta { flex: 1; min-width: 0; }
.timeline-printer-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--gray-800);
}
.timeline-printer-status {
    font-size: 12px;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.timeline-pie { flex-shrink: 0; }

.timeline-track-wrap {
    flex: 1;
    min-width: 0;
    position: relative;
}
.timeline-hours {
    position: relative;
    height: 18px;
    font-size: 10px;
    color: var(--gray-400);
    user-select: none;
}
.timeline-hour-label {
    position: absolute;
    transform: translateX(-50%);
    white-space: nowrap;
}
.timeline-track {
    position: relative;
    height: 36px;
    background: var(--gray-100);
    border-radius: 4px;
    overflow: hidden;
}
.timeline-tick {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--gray-200);
    pointer-events: none;
}
.timeline-block {
    position: absolute;
    top: 2px;
    bottom: 2px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: default;
    transition: opacity 0.15s;
    z-index: 1;
}
.timeline-block:hover { opacity: 0.85; }
.timeline-block-label {
    font-size: 9px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
}

/* State colours */
.state-printing  { background: #10b981; }
.state-waiting   { background: #f59e0b; }
.state-cleaning  { background: #3b82f6; }
.state-ready     { background: var(--gray-300); }

/* Estimated stripe overlay */
.estimated {
    background-image: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 4px,
        rgba(255,255,255,0.25) 4px,
        rgba(255,255,255,0.25) 8px
    );
}
.estimated.state-printing { background-color: #10b981; }

/* Now line */
.timeline-now-line {
    position: absolute;
    top: -2px;
    bottom: -2px;
    width: 2px;
    background: #ef4444;
    z-index: 5;
    pointer-events: none;
}
.timeline-now-label {
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    font-weight: 700;
    color: #ef4444;
    white-space: nowrap;
}

/* Legend */
.timeline-legend {
    display: flex;
    justify-content: center;
    gap: 1.25rem;
    padding: 0.625rem 0 0.25rem;
    font-size: 12px;
    color: var(--gray-500);
}
.timeline-legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.timeline-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

@media (max-width: 768px) {
    .timeline-row { flex-direction: column; }
    .timeline-printer-info { min-width: unset; }
}

/* ============================================================
   KPI TICKER (conveyor belt)
   ============================================================ */
.kpi-ticker-wrap {
    overflow: hidden;
    position: relative;
    margin-top: 1.5rem;
    margin-bottom: 1.25rem;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.75rem 0;
}
.kpi-ticker-wrap::before,
.kpi-ticker-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 60px;
    z-index: 2;
    pointer-events: none;
}
.kpi-ticker-wrap::before {
    left: 0;
    background: linear-gradient(to right, white, transparent);
}
.kpi-ticker-wrap::after {
    right: 0;
    background: linear-gradient(to left, white, transparent);
}
.kpi-ticker {
    display: flex;
    animation: ticker-scroll 25s linear infinite;
    width: max-content;
}
.kpi-ticker:hover {
    animation-play-state: paused;
}
.kpi-ticker-item {
    flex-shrink: 0;
    width: 200px;
    text-align: center;
    padding: 0.5rem 1rem;
}
.kpi-ticker-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.2;
}
.kpi-ticker-label {
    font-size: 11px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.15rem;
}
@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ============================================================
   REPORTING PAGE
   ============================================================ */
.reporting-filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    background: white;
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.25rem;
    position: sticky;
    top: 48px;
    z-index: 10;
}
.reporting-filter-bar label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.reporting-filter-bar input,
.reporting-filter-bar select {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 13px;
    background: white;
    color: var(--gray-700);
}
.reporting-filter-bar input:focus,
.reporting-filter-bar select:focus {
    outline: none;
    border-color: var(--primary);
}
.reporting-summary-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.reporting-summary-card {
    background: white;
    padding: 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    border-top: 3px solid var(--primary);
}
.reporting-summary-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.2;
}
.reporting-summary-label {
    font-size: 11px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.15rem;
}
.reporting-chart-card {
    background: white;
    padding: 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.25rem;
}
.reporting-chart-card h3 {
    font-size: 0.9rem;
    color: var(--gray-700);
    margin-bottom: 0.75rem;
}
@media (max-width: 750px) {
    .reporting-summary-row { grid-template-columns: repeat(2, 1fr); }
    .reporting-filter-bar { flex-direction: column; align-items: stretch; }
}

/* ============================================================
   BATCHES PAGE — Tabs + Card Grid
   ============================================================ */
/* Tile tab switcher (order detail — batches/audit) */
.tile-tab {
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-400);
    cursor: pointer;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    background: none;
    transition: color 0.15s, border-color 0.15s;
}
.tile-tab:hover { color: var(--gray-600); }
.tile-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.batch-tabs {
    display: flex;
    gap: 0;
    align-items: center;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 1.25rem;
}
.batch-tab {
    padding: 0.6rem 1.2rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}
.batch-tab:hover { color: var(--gray-700); }
.batch-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.batch-tab .tab-count {
    display: inline-block;
    background: var(--gray-100);
    color: var(--gray-600);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 99px;
    margin-left: 0.3rem;
}
.batch-tab.active .tab-count { background: var(--primary); color: white; }

.batch-card-grid {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

/* Column heading row */
.batch-col-headings {
    display: flex;
    align-items: center;
    padding: 0.3rem 0 0.2rem;
}
.batch-col-headings > div {
    font-size: 11px;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.batch-col-header {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(to right, #2d3a4a, #3a4d62);
    border-radius: var(--radius) var(--radius) 0 0;
}
.batch-col-header > div {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255,255,255,0.85);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Barcode download button */
.barcode-dl-btn {
    padding: 0.35rem 0.5rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Fixed column widths */
.bch-status  { width: 100px; min-width: 100px; max-width: 100px; text-align: left; flex-shrink: 0; }
.bch-id      { width: 190px; padding: 0 0.75rem; flex-shrink: 0; }
.bch-qty     { width: 60px; text-align: center; flex-shrink: 0; }
.bch-product { flex: 1; padding: 0 0.5rem 0 0.75rem; min-width: 100px; }
.bch-hold-reason { width: 140px; padding: 0 0.4rem; flex-shrink: 0; overflow: hidden; }
.bch-printer { width: 45px; padding: 0 0.4rem; flex-shrink: 0; font-size: 11px; }
.bch-actions { display: flex; gap: 4px; padding: 0 0.25rem; align-items: center; flex-shrink: 0; }

.batch-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0;
    transition: box-shadow 0.15s;
}
.batch-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.batch-row {
    display: flex;
    align-items: stretch;
    gap: 0;
    overflow: hidden;
    min-height: 44px;
}
.batch-row > .bch-id,
.batch-row > .bch-qty,
.batch-row > .bch-product,
.batch-row > .bch-hold-reason,
.batch-row > .bch-printer,
.batch-row > .bch-actions {
    display: flex;
    align-items: center;
}
.batch-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.batch-card-header h3 { margin: 0; font-size: 15px; font-weight: 700; }
.batch-card-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 13px;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
}
.batch-card-details span { white-space: nowrap; }
.batch-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.printer-panel {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}
.printer-panel-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.printer-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.printer-img {
    width: 100px;
    height: auto;
    border-radius: 4px;
    flex-shrink: 0;
}
.printer-chip {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    flex: 1;
}
.printer-chip-line {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.printer-chip-sub {
    font-size: 13px;
    font-weight: 500;
    opacity: 0.8;
}
.printer-chip.printer-ready { background: #d1fae5; color: #065f46; }
.printer-chip.printer-printing { background: #fef3c7; color: #92400e; }
.printer-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.printer-dot.ready { background: #10b981; }
.printer-dot.printing { background: #f59e0b; animation: pulse 1.5s infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.demand-summary {
    display: flex;
    gap: 1.5rem;
    font-size: 13px;
    color: var(--gray-600);
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--gray-50);
    border-radius: var(--radius);
}
.demand-summary strong { color: var(--gray-800); }

/* ============================
   Batches page — 3-column layout
   ============================ */
/* Page title bar */
.page-title-bar {
    padding: 0.4rem 1rem;
    margin-bottom: 0.3rem;
}
.page-title-bar h1 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--gray-700);
}

.batches-3col {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    height: calc(100vh - 80px);
}
.b3-col { min-width: 0; display: flex; flex-direction: column; height: 100%; padding: 0 0.6rem; }
.b3-col:first-child { padding-left: 0; }
.b3-col:last-child { padding-right: 0; }
.b3-col + .b3-col { border-left: 1px solid var(--gray-200); }
.b3-orders { flex: 50; }
.b3-batches { flex: 32; }
.b3-create { flex: 18; }

/* Card wrapper (each column) */
.b3-card {
    background: transparent;
    border: none;
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.b3-card-header {
    padding: 0.5rem 0.75rem;
    background: transparent;
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    flex-shrink: 0;
}
.b3-card-header h3 {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    padding: 0.25rem 0.6rem;
    background: linear-gradient(to right, #2d3a4a, #3a4d62);
    border-radius: 4px;
}
.b3-header-btn {
    font-size: 11px;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    background: transparent;
    color: rgba(255,255,255,0.85);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}
.b3-header-btn:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}

/* Scrollable body */
.b3-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300) transparent;
}
.b3-scroll::-webkit-scrollbar { width: 6px; }
.b3-scroll::-webkit-scrollbar-track { background: transparent; }
.b3-scroll::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
.b3-scroll::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }
.b3-card-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.6rem;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300) transparent;
}
.b3-card-body::-webkit-scrollbar { width: 6px; }
.b3-card-body::-webkit-scrollbar-track { background: transparent; }
.b3-card-body::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
.b3-card-body::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }
/* Action tiles row */
.action-tiles-row {
    display: flex;
    gap: 0.3rem;
    padding: 0.3rem 0.5rem;
    flex-shrink: 0;
}
.action-tile {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.35rem 0.4rem;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}
.action-tile:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}
.action-tile.active {
    background: linear-gradient(135deg, #2d3a4a, #3a4d62);
    color: white;
    border-color: #2d3a4a;
}
.action-tile.active svg { stroke: white; }
.action-sub-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.4rem 0.6rem;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
    background: white;
    border: none;
    cursor: pointer;
    transition: background 0.1s;
    text-align: left;
}
.action-sub-btn:hover { background: var(--gray-50); color: var(--gray-800); }
.action-sub-btn + .action-sub-btn { border-top: 1px solid var(--gray-100); }

.b3-pool-border {
    border: 2px solid var(--gray-300);
    border-radius: var(--radius);
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.b3-empty {
    text-align: center;
    padding: 1.5rem 0.5rem;
    color: var(--gray-400);
    font-size: 12px;
}

/* Filters bar (batch column) */
.b3-filters-wrap {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.5rem;
    flex-shrink: 0;
    border-bottom: 1px solid var(--gray-100);
}
.b3-filters-tile {
    margin: 0.4rem 0.5rem;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    padding: 0.3rem;
    flex-shrink: 0;
}
.b3-filters-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.3rem;
}
.b3-filters-grid-orders {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.3rem;
}
/* Filter summary panel (below filter grid) */
.filter-summary-panel {
    margin: 0.3rem 0 0;
    padding: 0.35rem 0.3rem;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
}
.fsp-item {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    white-space: nowrap;
    padding: 0.1rem 0.5rem;
}
.fsp-item .fsp-val {
    font-weight: 800;
    color: var(--gray-800);
    margin-right: 3px;
}
.fsp-divider {
    width: 1px;
    height: 14px;
    background: var(--gray-300);
    flex-shrink: 0;
}
/* Keep old class for order filter tiles */
.b3-filters {
    display: flex;
    gap: 0.4rem;
    padding: 0.4rem 0.5rem;
    flex-shrink: 0;
    border-bottom: none;
}

/* ============================
   Order cards (left column)
   ============================ */
.ocard {
    padding: 0;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    margin-bottom: 0;
    cursor: pointer;
    transition: box-shadow 0.12s;
    background: white;
    display: flex;
    flex-direction: column;
}
.ocard .ocard-footer-btns { border-radius: 0 0 5px 5px; overflow: hidden; flex-shrink: 0; }
.ocard:hover {
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
/* Orders list: full-width stacked rows */
#orders-list {
    display: flex !important;
    flex-direction: column;
    gap: 0.35rem;
}
.ocard-split {
    display: flex;
    align-items: stretch;
    min-height: 100px;
}
.ocard-left {
    flex: 0 0 35%;
    padding: 0.5rem 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    overflow: visible;
}
.ocard-divider {
    width: 1px;
    background: var(--gray-200);
    flex-shrink: 0;
}
.ocard-right {
    display: flex;
    flex: 1.5;
    padding: 0.5rem 0.6rem;
    flex-direction: column;
    min-width: 0;
}
.ocard-right-batches {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.25rem;
    align-content: flex-start;
    width: 100%;
}
.ocard-row1 {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.ocard-num {
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-800);
}
.ocard-days {
    font-size: 14px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    margin-left: auto;
    flex-shrink: 0;
}
.ocard-days.overdue { background: #fee2e2; color: #dc2626; }
.ocard-days.urgent { background: #fef3c7; color: #92400e; }
.ocard-days.ok { background: #d1fae5; color: #065f46; }
.ocard-customer {
    font-size: 12px;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Qty + product on same row */
.ocard-info-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.1rem;
}
.ocard-info-divider {
    width: 1px;
    height: 12px;
    background: var(--gray-300);
    flex-shrink: 0;
}
.ocard-qty {
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-700);
    white-space: nowrap;
    display: inline-flex;
    align-items: baseline;
}
.ocard-product-tag {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-600);
    background: var(--gray-100);
    padding: 1px 6px;
    border-radius: 3px;
    white-space: nowrap;
}
.ocard-batch-tile {
    border: 1px solid #a7f3d0;
    border-radius: 4px;
    padding: 0.25rem 0.3rem;
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-height: 40px;
    justify-content: center;
}
.ocard-batch-tag {
    font-size: 9px;
    font-weight: 600;
    color: #065f46;
    background: #d1fae5;
    border: 1px solid #a7f3d0;
    padding: 0.2rem 0.3rem;
    border-radius: 4px;
    white-space: nowrap;
    text-align: center;
}
.ocard-no-batches {
    font-size: 10px;
    color: var(--gray-400);
    font-style: italic;
}
/* Progress bar in right column at bottom */
.ocard-progress-row {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: auto;
    padding-top: 0.3rem;
}
.ocard-progress {
    flex: 1;
    height: 5px;
    background: var(--gray-100);
    border-radius: 3px;
    overflow: hidden;
}
.ocard-progress-fill {
    height: 100%;
    background: #059669;
    border-radius: 3px;
    transition: width 0.3s;
}
.ocard-pct {
    font-size: 10px;
    font-weight: 700;
    color: var(--gray-500);
    min-width: 28px;
    text-align: right;
    flex-shrink: 0;
}
/* Drop zone inside right panel */
.ocard-dropzone {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
}
.ocard-batch-placeholder {
    border: 1.5px dashed var(--gray-200);
    border-radius: 4px;
    padding: 0.25rem 0.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--gray-300);
    transition: all 0.15s;
    min-height: 40px;
}
.ocard-drop-target .ocard-batch-placeholder {
    border-color: #10b981;
    background: #ecfdf5;
    color: #059669;
}
.ocard-drop-target {
    outline: none;
    background: inherit !important;
}
/* Batch absorb animation */
@keyframes batchAbsorb {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.8); opacity: 0.5; }
    100% { transform: scale(0); opacity: 0; }
}
.ocard-absorbing .ocard-dropzone-empty {
    border-color: #10b981;
    background: #d1fae5;
    color: #065f46;
    animation: none;
}
/* Assigned qty text green */
.ocard-qty-assigned { color: #059669; font-weight: 700; font-size: 13px; }
.ocard-qty-total { font-size: 10px; color: var(--gray-400); font-weight: 500; }
/* Progress bar in left panel */
.ocard-progress-inline {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.15rem;
}
.ocard-action-archive { outline: 2px solid #d97706; outline-offset: -2px; }
.ocard-action-archive:hover { background: #fffbeb !important; }
.ocard-action-ship { outline: 2px solid #059669; outline-offset: -2px; }
.ocard-action-ship:hover { background: #ecfdf5 !important; }
.ocard-action-delete { outline: 2px solid #dc2626; outline-offset: -2px; }
.ocard-action-delete:hover { background: #fef2f2 !important; }
/* Tag-based order card colours */
.ocard-tag-urgent { background: linear-gradient(to bottom, #fef2f2 0%, #fef2f2 65%, #fecaca 100%); border-color: #fca5a5; }
.ocard-tag-fast { background: linear-gradient(to bottom, #fffbeb 0%, #fffbeb 65%, #fed7aa 100%); border-color: #fdba74; }
.ocard-tag-newcust { background: linear-gradient(to bottom, #eff6ff 0%, #eff6ff 65%, #bfdbfe 100%); border-color: #93c5fd; }

/* ============================
   Batch cards (middle column)
   ============================ */
.bcard {
    display: block;
    padding: 0;
    border-radius: 4px;
    margin-bottom: 0.35rem;
    background: white;
    border: 1.5px solid var(--gray-200);
    transition: background 0.12s, border-color 0.12s;
}
.bcard-row {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    padding: 0.35rem 0.3rem;
    min-height: 0;
}
.bcard-top {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.3rem;
    width: 100%;
}
.bcard-mid {
    text-align: left;
    width: 100%;
}
.bcard-bot {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.3rem;
    width: 100%;
    margin-top: 0.15rem;
}
.bcard-pr {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-400);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bcard-header-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0.6rem;
    font-size: 10px;
    font-weight: 700;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.bcard-header-row span {
    flex-shrink: 0;
}
.bcard-header-row .bcard-hdr-product {
    flex: 1;
    min-width: 0;
}
.bcard-header-row .bcard-vdiv {
    min-height: 8px;
}
.bcard-product {
    font-size: 14px;
    font-weight: 800;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bcard-qty {
    font-size: 14px;
    font-weight: 800;
    color: var(--gray-800);
    white-space: nowrap;
}
/* Vertical divider (kept for other uses) */
.bcard-vdiv {
    display: none;
}
/* Arrows */
.bcard-arrows {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    flex-shrink: 0;
}
.bcard-arrow-bar {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 26px;
    font-weight: 900;
    color: inherit;
    width: 22px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: opacity 0.12s;
    flex-shrink: 0;
    line-height: 0.7;
    overflow: hidden;
}
.bcard-arrow-bar:hover {
    opacity: 0.7;
}
.bcard-arrow-disabled {
    color: var(--gray-300) !important;
    cursor: default;
    pointer-events: none;
}
.bcard-qc-wrap {
    width: 42px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bcard-qc-disabled {
    font-size: 10px;
    font-weight: 700;
    color: var(--gray-300);
    padding: 0.1rem 0.3rem;
}
.bcard-actions {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: auto;
}
.bcard-qc-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-600);
    cursor: pointer;
}
.bcard-qc-done {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 10px;
    font-weight: 700;
    color: #059669;
    cursor: pointer;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
}
.bcard-qc-done:hover {
    background: #d1fae5;
}
/* Barcode button — inline in row 2 */
.bcard-barcode-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    padding: 0;
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    transition: opacity 0.12s;
    border-radius: 3px;
}
.bcard-barcode-btn:hover {
    opacity: 0.6;
}
.bcard[draggable="true"] {
    cursor: grab;
}
.bcard[draggable="true"]:active {
    cursor: grabbing;
}
.bcard-dragging {
    opacity: 0.4;
    transform: scale(0.95);
}
.bcard-bc-selected {
    outline: 2px solid #059669;
    outline-offset: -2px;
    background: #ecfdf5 !important;
}
.barcode-active .bcard {
    cursor: pointer;
}
.barcode-active .bcard:hover {
    outline: 2px solid #059669;
    outline-offset: -2px;
    background: #f0fdf4 !important;
}
.bft-barcode {
    min-width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    flex-shrink: 0;
}

/* Batch grid: 3-column pool layout */
#batch-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.3rem;
    align-content: flex-start;
}
#batch-grid .bcard {
    margin-bottom: 0;
}
#batch-grid .b3-empty {
    width: 100%;
}
#batch-grid .batch-grid-fullrow {
    width: 100%;
}
/* Dummy tiles — aesthetic fillers */
.bcard-dummy {
    background: var(--gray-50) !important;
    border: 1.5px dashed var(--gray-200) !important;
    min-height: 60px;
    pointer-events: none;
}
.ocard-dummy {
    background: var(--gray-50) !important;
    border: 1.5px dashed var(--gray-200) !important;
    min-height: 50px;
    pointer-events: none;
    opacity: 0.5;
}
/* New order pulsating blue glow */
@keyframes newOrderGlow {
    0% { box-shadow: 0 0 4px 1px rgba(59,130,246,0.3); }
    50% { box-shadow: 0 0 12px 4px rgba(59,130,246,0.55); }
    100% { box-shadow: 0 0 4px 1px rgba(59,130,246,0.3); }
}
.ocard-new {
    animation: newOrderGlow 2s ease-in-out infinite;
}

/* Pool sections */
.batch-pool-section {
    padding: 0.5rem 0.75rem 0.75rem;
    border-top: none;
}
.batch-pool-section:first-of-type { border-top: none; }
.batch-pool-section-header {
    display: flex;
    align-items: center;
    font-size: 10px;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.4rem;
    padding: 0.3rem 0.4rem;
    background: var(--gray-50);
    border-radius: 3px;
}

/* Pool grids */
.batch-pool-grid { display: grid; gap: 0.4rem; }
.batch-pool-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.batch-pool-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.batch-pool-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Pool tiles (qty) */
.batch-pool-tile {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.5rem 0.6rem;
    background: linear-gradient(to bottom, #f0f1f3, #d8dbe0);
    border: 1px solid #b0b5bc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-800);
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.6);
    text-align: center;
}
.batch-pool-tile:hover {
    background: linear-gradient(to bottom, #e4e6ea, #cdd0d6);
    box-shadow: 0 2px 4px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.6);
}
.batch-pool-tile:active {
    background: linear-gradient(to bottom, #cdd0d6, #e4e6ea);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.15);
}
.batch-pool-tile.selected {
    background: linear-gradient(to right, #2d3a4a, #3a4d62);
    color: white;
    border-color: #2d3a4a;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.batch-pool-tile.disabled-tile {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Qty tile number */
.bpt-qty-num {
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
}
.qty-custom-tile {
    background: var(--gray-50);
    border-style: dashed;
}

/* Product cards (stacked layout) */
.bprod-card {
    border: 1px solid #b0b5bc;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.4rem;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    transition: all 0.15s;
}
.bprod-card:hover {
    border-color: #8a939e;
    box-shadow: 0 2px 4px rgba(0,0,0,0.12);
}
.bprod-card.selected .bprod-card-header {
    background: linear-gradient(to right, #2d3a4a, #3a4d62);
    color: white;
}
.bprod-card-header {
    padding: 0.4rem 0.6rem;
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-800);
    background: linear-gradient(to bottom, #f0f1f3, #d8dbe0);
    line-height: 1.2;
}

/* Batch filter tiles (tab replacement) */
.batch-filter-tile {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    padding: 0;
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    background: white;
    color: var(--gray-700);
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
    overflow: hidden;
    min-height: 32px;
}
.batch-filter-tile:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
}
/* Default active (for All and other uncoloured tiles) */
.batch-filter-tile.active {
    background: var(--gray-100);
    border-color: var(--gray-400);
    color: var(--gray-800);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.08);
}
.batch-filter-tile.active .bft-label { color: var(--gray-700); }
/* Per-status active colours — batch filters (light tinted) */
.bft-printing.active { background: #eff6ff; border-color: #3b82f6; }
.bft-printing.active .bft-label { color: #1d4ed8; }
.bft-postproc.active { background: #f5f3ff; border-color: #8b5cf6; }
.bft-postproc.active .bft-label { color: #6d28d9; }
.bft-qcpend.active { background: #fffbeb; border-color: #f59e0b; }
.bft-qcpend.active .bft-label { color: #92400e; }
.bft-ready.active { background: #ecfdf5; border-color: #10b981; }
.bft-ready.active .bft-label { color: #065f46; }
.bft-held.active { background: #fef2f2; border-color: #ef4444; }
.bft-held.active .bft-label { color: #991b1b; }
.bft-discarded.active { background: #f3f4f6; border-color: #6b7280; }
.bft-discarded.active .bft-label { color: #374151; }
/* Per-status active colours — order filters (light tinted) */
.bft-new-order.active { background: #eff6ff; border-color: #3b82f6; }
.bft-new-order.active .bft-label { color: #1d4ed8; }
.bft-fast-track.active { background: #fffbeb; border-color: #f59e0b; }
.bft-fast-track.active .bft-label { color: #92400e; }
.bft-urgent.active { background: #fef2f2; border-color: #ef4444; }
.bft-urgent.active .bft-label { color: #991b1b; }
.bft-soon.active { background: #fffbeb; border-color: #f59e0b; }
.bft-soon.active .bft-label { color: #92400e; }
.bft-unfulfilled.active { background: #f3f4f6; border-color: #6b7280; }
.bft-unfulfilled.active .bft-label { color: #374151; }
.bft-completed.active { background: #ecfdf5; border-color: #10b981; }
.bft-completed.active .bft-label { color: #065f46; }
.bft-count {
    font-size: 0.95rem; font-weight: 800; color: var(--gray-700); line-height: 1;
    padding: 0 0.5rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
}
.bft-label {
    font-size: 0.7rem; font-weight: 600; color: var(--gray-500);
    text-transform: uppercase; letter-spacing: 0.02em;
    padding: 0.35rem 0.5rem;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Colour-coded count text */
.bft-printing .bft-count { color: #3b82f6; }
.bft-postproc .bft-count { color: #8b5cf6; }
.bft-qcpend .bft-count { color: #d97706; }
.bft-ready .bft-count { color: #059669; }
.bft-held .bft-count { color: #dc2626; }
.bft-discarded .bft-count { color: #6b7280; }
/* Order filter count text */
.bft-new-order .bft-count { color: #3b82f6; }
.bft-fast-track .bft-count { color: #d97706; }
.bft-urgent .bft-count { color: #dc2626; }
.bft-soon .bft-count { color: #d97706; }
.bft-unfulfilled .bft-count { color: #6b7280; }
.bft-completed .bft-count { color: #059669; }
.bft-archived .bft-count { color: #6b7280; }

/* Printer tiles */
#printer-tiles {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.batch-printer-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem 0.6rem;
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
    background: linear-gradient(to bottom, #f0f1f3, #d8dbe0);
    border: 1px solid #b0b5bc;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.6);
}
.batch-printer-tile:hover {
    background: linear-gradient(to bottom, #e4e6ea, #cdd0d6);
    border-color: #8a939e;
    box-shadow: 0 2px 4px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.6);
}
.batch-printer-tile:active {
    background: linear-gradient(to bottom, #cdd0d6, #e4e6ea);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.15);
}
.batch-printer-tile.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.batch-printer-tile.disabled:hover {
    background: linear-gradient(to bottom, #f0f1f3, #d8dbe0);
    border-color: #b0b5bc;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.6);
}
.batch-printer-tile.held-tile {
    background: linear-gradient(180deg, #fef3c7 0%, #fde68a 40%, #fcd34d 100%);
    border: 1px solid #f59e0b;
}
.batch-printer-tile.held-tile:hover {
    background: linear-gradient(180deg, #fff8e1 0%, #fef08a 40%, #fde047 100%);
    border-color: #d97706;
}
.bpt-printer-img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    flex-shrink: 0;
}
.bpt-printer-info { flex: 1; min-width: 0; text-align: center; }
.bpt-printer-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-800);
}
.bpt-printer-status {
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}
.bpt-printer-status.ready { color: #059669; }
.bpt-printer-status.printing { color: #d97706; }
.bpt-printer-status.needs-clean { color: #dc2626; }
.bpt-printer-go {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    padding: 0.2rem 0.5rem;
    background: rgba(59,130,246,0.1);
    border-radius: 3px;
    flex-shrink: 0;
}

/* Batch detail panel (expandable, for held/discarded reasons) */
.batch-detail-panel {
    padding: 0.5rem 0.75rem;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
}
.bdp-item {
    display: flex;
    gap: 0.5rem;
    font-size: 12px;
    padding: 0.15rem 0;
}
.bdp-label {
    font-weight: 700;
    color: var(--gray-500);
    min-width: 50px;
    flex-shrink: 0;
}
.bdp-value {
    color: var(--gray-700);
    font-weight: 500;
}

/* Dropdown action button (options menu) */
.dropdown-action-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.4rem 0.6rem;
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-700);
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.12s;
}
.dropdown-action-btn:hover {
    background: var(--gray-50);
}

/* Assign modal */
.assign-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.assign-modal {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}
.assign-modal h3 { margin: 0 0 1rem 0; }
.assign-order-item {
    display: flex;
    flex-direction: column;
    padding: 0.75rem 1rem;
    border: 1px solid #b0b8c1;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.15s;
    background: linear-gradient(180deg, #e8ecf0 0%, #cdd4db 40%, #b8c1ca 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), 0 1px 2px rgba(0,0,0,0.1);
}
.assign-order-item:hover {
    background: linear-gradient(180deg, #f0f3f6 0%, #d5dbe2 40%, #c2cad3 100%);
    border-color: #8a939e;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 2px 4px rgba(0,0,0,0.15);
}
.assign-order-item:active {
    background: linear-gradient(180deg, #b8c1ca 0%, #cdd4db 60%, #e0e5ea 100%);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.15);
}
.assign-order-item strong { display: block; font-size: 14px; color: var(--gray-800); }
.assign-order-item small { color: var(--gray-600); font-size: 12px; }

/* Active Orders — quick-filter tiles */
.ao-filter-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.3rem 0.6rem;
    min-width: 80px;
    border: 1px solid #b0b8c1;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    background: linear-gradient(180deg, #e8ecf0 0%, #cdd4db 40%, #b8c1ca 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), 0 1px 2px rgba(0,0,0,0.1);
}
.ao-filter-tile:hover {
    background: linear-gradient(180deg, #f0f3f6 0%, #d5dbe2 40%, #c2cad3 100%);
    border-color: #8a939e;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 2px 4px rgba(0,0,0,0.15);
}
.ao-filter-tile.active {
    background: linear-gradient(180deg, #3a4d62 0%, #2d3a4a 100%);
    border-color: #2d3a4a;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}
.ao-filter-tile.active .ao-ft-value,
.ao-filter-tile.active .ao-ft-label { color: rgba(255,255,255,0.95); }
.ao-ft-value { font-size: 1rem; font-weight: 800; color: var(--gray-800); line-height: 1; }
.ao-ft-label { font-size: 0.55rem; font-weight: 600; color: var(--gray-500); text-transform: uppercase; margin-top: 0.1rem; letter-spacing: 0.02em; }

/* Date range picker dropdown */
.dp-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 0.5rem;
    width: 240px;
    margin-top: 4px;
}
.dp-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.4rem; }
.dp-month-label { font-size: 13px; font-weight: 700; color: var(--gray-800); }
.dp-nav { background: none; border: none; cursor: pointer; font-size: 18px; color: var(--gray-500); padding: 0 0.4rem; line-height: 1; }
.dp-nav:hover { color: var(--gray-800); }
.dp-days-header { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; margin-bottom: 0.2rem; }
.dp-days-header span { font-size: 10px; font-weight: 700; color: var(--gray-400); text-transform: uppercase; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.dp-cell { display: flex; align-items: center; justify-content: center; height: 28px; font-size: 12px; border-radius: 4px; }
.dp-empty { visibility: hidden; }
.dp-day { cursor: pointer; color: var(--gray-700); transition: all 0.1s; }
.dp-day:hover { background: var(--gray-100); }
.dp-today { font-weight: 700; color: var(--primary); }
.dp-selected { background: #2d3a4a !important; color: white !important; font-weight: 700; }
.dp-start { border-radius: 4px 0 0 4px; }
.dp-end { border-radius: 0 4px 4px 0; }
.dp-start.dp-end { border-radius: 4px; }
.dp-in-range { background: #e8ecf0; border-radius: 0; color: var(--gray-700); }
.dp-footer { display: flex; justify-content: flex-end; margin-top: 0.4rem; padding-top: 0.4rem; border-top: 1px solid var(--gray-100); }

@media (max-width: 900px) {
    .batches-3col { flex-direction: column; height: auto; }
    .b3-col { height: auto; max-height: 50vh; }
    .b3-orders, .b3-batches, .b3-create { flex: unset; width: 100%; }
}

/* ============================================================
   SCAN DROPDOWN GROUPS (sidebar accordion)
   ============================================================ */
.scan-group { margin-bottom: 0.25rem; }
.scan-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem 0.5rem;
    background: rgba(255,255,255,0.08);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    color: rgba(255,255,255,0.65);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    user-select: none;
    transition: background 0.15s;
}
.scan-group-header:hover { background: rgba(255,255,255,0.15); }
.scan-group-header.scan-group-active {
    background: rgba(5,150,105,0.25);
    color: rgba(255,255,255,0.95);
}
.scan-group-chevron {
    font-size: 10px;
    transition: transform 0.2s ease;
    color: rgba(255,255,255,0.45);
}
.scan-group.open .scan-group-chevron { transform: rotate(180deg); }
.scan-group-items {
    display: none;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.25rem 0 0.15rem 0.6rem;
}
.scan-group.open .scan-group-items { display: flex; }
.scan-group-items .scan-mode-btn {
    font-size: 11px;
    padding: 0.25rem 0.45rem;
    min-height: 24px;
}

/* ============================================================
   MATERIAL ACTION TILES (material traceability page)
   ============================================================ */
.mat-action-tile {
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.mat-action-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(30,58,95,0.35);
}
.mat-action-tile.mat-tile-active {
    outline: 3px solid #93c5fd;
    outline-offset: 2px;
    box-shadow: 0 4px 16px rgba(30,58,95,0.3);
}

/* Lot Number Register — flex layout */
.lot-reg-header,
.lot-reg-tile {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0 0.75rem;
}
.lot-reg-header {
    padding: 0.3rem 0.75rem;
    border-bottom: 1px solid var(--gray-200);
}
.lot-reg-header > div {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-400);
}
.lot-reg-row {
    border-bottom: 1px solid var(--gray-100);
}
.lot-reg-row:last-of-type { border-bottom: none; }
.lot-reg-tile {
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
    cursor: pointer;
    transition: background 0.12s;
    border-radius: 3px;
}
.lot-reg-tile:hover { background: var(--gray-50); }
.lot-reg-row.lot-expanded > .lot-reg-tile { background: var(--gray-50); }
/* Material column */
.lot-reg-material {
    font-weight: 600;
    font-size: 13px;
    color: var(--gray-800);
}
.lot-reg-code {
    font-size: 11px;
    color: var(--gray-400);
    margin-left: 0.25rem;
}
/* Lot number text */
.lot-reg-lot {
    display: block;
    font-size: 12px;
    color: var(--gray-600);
    font-family: monospace;
}
/* Internal / External lot columns */
.lot-reg-col-int,
.lot-reg-col-ext {
    font-size: 12px;
    color: var(--gray-600);
    font-family: monospace;
}
/* Qty column */
.lot-reg-col-qty {
    text-align: right;
}
.lot-reg-qty-val {
    font-size: 12px;
    color: var(--gray-600);
    font-weight: 600;
}
/* Audit trail material rows */
.audit-material-row:hover { background: var(--gray-50); }

/* Expandable detail panel */
.lot-detail-panel {
    padding: 0.6rem 0.75rem 0.75rem;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}
.lot-detail-loading {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--gray-400);
    font-size: 12px;
    padding: 0.5rem 0;
}
.lot-detail-col h4 {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--gray-500);
    margin: 0 0 0.35rem 0;
    padding-bottom: 0.2rem;
    border-bottom: 1px solid var(--gray-200);
}
.lot-detail-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.lot-detail-col li {
    font-size: 12px;
    color: var(--gray-700);
    padding: 0.15rem 0;
    line-height: 1.4;
}
.lot-detail-col li .lot-detail-sub {
    font-size: 10px;
    color: var(--gray-400);
    display: block;
}
.lot-detail-empty {
    font-size: 12px;
    color: var(--gray-400);
    font-style: italic;
}

/* Scan Modal Overlay */
.scan-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.scan-modal-card {
    background: white;
    border-radius: 12px;
    padding: 2.5rem 3rem;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    min-width: 340px;
    max-width: 420px;
    position: relative;
}
.sm-mode-title {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.35rem 0.85rem;
    border-radius: 4px;
    margin-bottom: 1.25rem;
}
.sm-mode-stock {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}
.sm-mode-in_use {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fde68a;
}
.sm-mode-used {
    background: #eef2ff;
    color: #4f46e5;
    border: 1px solid #c7d2fe;
}
.sm-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    line-height: 1;
}
.sm-icon-success { color: #059669; }
.sm-icon-error { color: #ef4444; }
.sm-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.4rem;
}
.sm-subtitle {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 1rem;
    line-height: 1.4;
}
.sm-dismiss {
    margin-top: 0.5rem;
}
.sm-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: sm-spin 0.7s linear infinite;
    margin: 0 auto 1rem;
}
@keyframes sm-spin { to { transform: rotate(360deg); } }

/* ============================================================
   PRINTER SLOT GRID
   ============================================================ */
.printer-slot-grid {
    display: -ms-grid;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-rows: 1fr 1fr;
    -ms-grid-columns: (1fr)[6];
    gap: 3px;
    padding: 4px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    contain: layout style;
}
.printer-slot {
    min-height: 58px;
    border-radius: 4px;
    padding: 4px 6px;
    display: flex;
    flex-direction: column;
    font-size: 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
    transition: box-shadow 0.15s, border-color 0.15s;
    -webkit-user-select: none;
    user-select: none;
    will-change: opacity;
}
.printer-slot-occupied {
    background: #ffffff;
    border: 1px solid var(--gray-200);
    cursor: grab;
    cursor: -webkit-grab;
}
.printer-slot-occupied:hover { box-shadow: 0 1px 4px rgba(0,0,0,0.12); }
.printer-slot-empty {
    background: var(--gray-50);
    border: 2px dashed var(--gray-300);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.printer-slot-empty:hover {
    background: #f0fdf4;
    border-color: #059669;
}
.printer-slot-support { border-left: 3px solid #6366f1; }
.printer-slot-dragging { opacity: 0.4; transform: scale(0.97); }
.printer-slot-drop-target {
    border-color: #3b82f6 !important;
    border-style: solid !important;
    box-shadow: inset 0 0 0 2px rgba(59,130,246,0.2);
}
.stock-pool-drop-target {
    background: rgba(5,150,105,0.08) !important;
    outline: 2px dashed #059669;
    outline-offset: -2px;
}
@keyframes slotConfirmIn {
    from { opacity: 0; transform: scale(0.9) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.slot-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
    line-height: 1;
}
.slot-material {
    font-weight: 600;
    font-size: 12px;
    color: var(--gray-700);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.slot-lot {
    color: var(--gray-600);
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.slot-qty {
    color: var(--gray-500);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
}
.slot-actions {
    display: flex;
    gap: 3px;
    margin-top: auto;
    padding-top: 3px;
}
.slot-btn-used, .slot-btn-replace {
    flex: 1;
    padding: 3px 0;
    border: none;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.4;
    font-family: inherit;
}
.slot-btn-used {
    background: var(--gray-100);
    color: var(--gray-600);
}
.slot-btn-used:hover { background: #fee2e2; color: #dc2626; }
.slot-btn-replace {
    background: #eff6ff;
    color: #2563eb;
}
.slot-btn-replace:hover { background: #dbeafe; color: #1d4ed8; }
.printer-slot-empty .slot-label {
    margin: auto;
    font-size: 12px;
    color: var(--gray-300);
}
.stock-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 500;
    color: var(--gray-700);
    max-width: 100%;
    box-sizing: border-box;
    cursor: grab;
    cursor: -webkit-grab;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    transition: background 0.15s, border-color 0.15s;
}
.stock-tag:hover {
    filter: brightness(0.95);
}

/* ── Slot expiry display ── */
.slot-expiry {
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-400);
    line-height: 1.2;
    margin-top: auto;
    padding-top: 2px;
}
.slot-add-exp-btn {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 5px;
    border: 1px dashed #059669;
    border-radius: 3px;
    background: rgba(16,185,129,0.08);
    color: #059669;
    cursor: pointer;
    white-space: nowrap;
}
.slot-add-exp-btn:hover { background: rgba(16,185,129,0.18); }

/* ── Mark as Used toggle button in printer header ── */
.slot-btn-mark-used-toggle {
    padding: 3px 10px;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 4px;
    background: transparent;
    color: rgba(255,255,255,0.85);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s;
}
.slot-btn-mark-used-toggle:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.6);
}
.slot-btn-mark-used-toggle.active {
    background: #dc2626;
    border-color: #dc2626;
    color: white;
}

/* ── Selection mode (Mark as Used) ── */
.printer-slot-selectable .printer-slot-occupied {
    cursor: pointer !important;
    transition: box-shadow 0.15s, outline 0.15s;
}
.printer-slot-selectable .printer-slot-occupied:hover {
    outline: 2px solid #dc2626;
    outline-offset: -2px;
    box-shadow: 0 0 8px rgba(220,38,38,0.3);
}

/* ── Stock slot grid (3 cols, auto rows, same tile size as printer) ── */
.stock-slot-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    grid-template-rows: unset !important;
}
.stock-slot-grid .printer-slot {
    min-height: 58px;
}

/* ── Add Lot bar (full-width compact bar above stock grid) ── */
.stock-add-lot-bar {
    transition: background 0.15s;
}
.stock-add-lot-bar:hover {
    background: #f0fdf4 !important;
}
.add-lot-label {
    font-size: 13px;
    font-weight: 700;
    color: #059669;
}

/* ── Material pastel backgrounds (slot tiles + stock tags) ── */
.mat-bg-1  { background: #fce4ec !important; border-color: #f8bbd0 !important; } /* MED620 — pink */
.mat-bg-2  { background: #e3f2fd !important; border-color: #bbdefb !important; } /* MED670 — blue */
.mat-bg-3  { background: #f5f5f5 !important; border-color: #e0e0e0 !important; } /* SUP705 — grey */
.mat-bg-4  { background: #e8f5e9 !important; border-color: #c8e6c9 !important; } /* IPA — green */
.mat-bg-5  { background: #f3e5f5 !important; border-color: #ce93d8 !important; } /* RGD852 — magenta */
.mat-bg-6  { background: #ede7f6 !important; border-color: #d1c4e9 !important; } /* MED610 — lavender */
.mat-bg-7  { background: #fffde7 !important; border-color: #fff9c4 !important; } /* DEN847 — cream */
.mat-bg-8  { background: #fff8e1 !important; border-color: #ffecb3 !important; } /* FLX934 — yellow */
.mat-bg-9  { background: #fff3e0 !important; border-color: #ffe0b2 !important; } /* RGD838 — peach */
.mat-bg-10 { background: #e0f2f1 !important; border-color: #b2dfdb !important; } /* MED625FLX — mint */
.mat-bg-11 { background: #efebe9 !important; border-color: #d7ccc8 !important; } /* SUP711S — warm grey */

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .topnav, .sidebar, .flash-messages, .scanner-hidden, .scan-feedback,
    .btn, .form-actions, .search-bar, .tabs, .no-print, .alert-panel, .alert-panel-overlay { display: none !important; }
    .content { max-width: 100%; padding: 0; margin-left: 0 !important; margin-top: 0 !important; }
    body { background: white; }
}
