/* ==========================================================================
   WMS PERFECTED ZERO-OVERFLOW DESIGN SYSTEM (BEST ULTIMATE MOBILE FIX)
   ========================================================================== */

:root {
    --bg-main: #1e1f1d;
    --bg-sidebar: #272525;
    --bg-card: rgba(39, 37, 37, 0.75);
    --bg-card-hover: rgba(50, 48, 46, 0.85);
    --border-color: rgba(168, 187, 191, 0.15);
    --border-color-glow: rgba(112, 164, 171, 0.5);
    
    --text-primary: #f2e2ce;
    --text-muted: #b9cbd0;
    --text-main: #f2e2ce;
    
    --color-blue: #70a4ab;
    --color-green: #3fb950;
    --color-red: #f85149;
    --color-purple: #a68c3f;
    --color-orange: #ff9800;
    --color-accent: #a68c3f;

    --font-heading: 'Outfit', 'Sarabun', sans-serif;
    --font-body: 'Inter', 'Sarabun', sans-serif;
}

/* --------------------------------------------------------------------------
   1. GLOBAL ZERO-OVERFLOW & STRICT BOX-SIZING
   -------------------------------------------------------------------------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box !important;
    max-width: 100%;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary) !important;
}

.logo-text h2 {
    color: #ffffff !important;
}

.logo-text span {
    color: #a8bbbf !important;
}

.user-select {
    color: #f2e2ce !important;
}

html, body {
    width: 100% !important;
    max-width: 100vw !important;
    min-height: 100vh;
    overflow-x: hidden !important;
    position: relative !important;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    background-image: 
        radial-gradient(at 10% 20%, rgba(74, 134, 140, 0.1) 0px, transparent 50%),
        radial-gradient(at 90% 80%, rgba(166, 140, 63, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
}

img, video, canvas, svg {
    max-width: 100% !important;
    height: auto;
}

/* --------------------------------------------------------------------------
   2. APP CONTAINER & SIDEBAR LAYOUT
   -------------------------------------------------------------------------- */
.app-container {
    display: grid;
    grid-template-columns: 270px 1fr;
    min-height: 100vh;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
}

.sidebar {
    background: linear-gradient(180deg, #272525 0%, #1e1f1d 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(168, 187, 191, 0.12);
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.35);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 24px;
}

.btn-close-sidebar {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-close-sidebar:hover {
    color: #ffffff;
    background: rgba(248, 81, 73, 0.25);
    border-color: rgba(248, 81, 73, 0.4);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 4px;
    margin-bottom: 12px;
}

/* Custom Scrollbar for Sidebar Navigation */
.sidebar-nav::-webkit-scrollbar {
    width: 5px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(168, 187, 191, 0.2);
    border-radius: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(168, 187, 191, 0.4);
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    border: 1px solid transparent;
    border-left: 3px solid transparent;
    padding: 10px 14px;
    border-radius: 10px;
    color: #cbd5e1;
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
}

.nav-btn:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.06);
    transform: translateX(3px);
}

.nav-btn.active {
    background: linear-gradient(90deg, rgba(74, 134, 140, 0.22), rgba(74, 134, 140, 0.05));
    border-left-color: #4a868c;
    border-color: rgba(74, 134, 140, 0.35);
    color: #f2e2ce;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(74, 134, 140, 0.18);
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    margin-top: auto;
}

.active-user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 10px;
}

.active-user-badge i {
    font-size: 20px;
    color: var(--color-blue);
}

.user-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
}

.user-label {
    font-size: 10px;
    color: var(--text-muted);
}

.user-select {
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 12px;
    outline: none;
    cursor: pointer;
}

/* Main Content Workspace */
.main-content {
    padding: 20px 24px 80px 24px;
    overflow-y: auto;
    overflow-x: hidden !important;
    min-height: 100vh;
    width: 100% !important;
    max-width: 100% !important;
}

/* Top Header */
.top-header {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 12px 18px;
    margin-bottom: 20px;
    width: 100% !important;
    max-width: 100% !important;
}

.top-header h1 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-success, .btn-danger, .btn-accent {
    font-family: var(--font-heading);
    font-weight: 600;
    padding: 9px 16px;
    border-radius: 9px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    border: 1px solid transparent;
    font-size: 13px;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #4a868c, #3a6f74);
    border-color: rgba(74, 134, 140, 0.45);
    color: #f2e2ce;
    box-shadow: 0 4px 12px rgba(74, 134, 140, 0.2);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(74, 134, 140, 0.35);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-success {
    background: linear-gradient(135deg, var(--color-green), #2c973e);
    border-color: rgba(63, 185, 80, 0.4);
    color: #fff;
    box-shadow: 0 4px 12px rgba(63, 185, 80, 0.2);
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(63, 185, 80, 0.35);
}

.btn-danger {
    background: linear-gradient(135deg, var(--color-red), #cf222e);
    border-color: rgba(248, 81, 73, 0.4);
    color: #fff;
    box-shadow: 0 4px 12px rgba(248, 81, 73, 0.2);
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(248, 81, 73, 0.35);
}

.btn-accent {
    background: linear-gradient(135deg, #a68c3f, #8a7433);
    border-color: rgba(166, 140, 63, 0.45);
    color: #272525;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(166, 140, 63, 0.25);
}

.btn-accent:hover:not(:disabled) {
    filter: brightness(1.1);
}

.btn-full {
    width: 100% !important;
    justify-content: center;
}

button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Page Panels & Glass Cards */
.page-panel {
    display: none !important;
    animation: fadeIn 0.25s ease forwards;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
}

.page-panel.active {
    display: block !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.panel-header {
    margin-bottom: 18px;
    width: 100% !important;
}

.panel-header h2 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
}

.panel-header p {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 2px;
}

.card-glass, .dashboard-card, .workflow-scan-panel, .workflow-form-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    margin-bottom: 18px;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
}

.margin-bottom-20 { margin-bottom: 18px !important; }
.margin-top-15 { margin-top: 14px !important; }

/* Live Thailand Clock & Date Widget */
.live-clock-widget {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(39, 37, 37, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 6px 14px;
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    white-space: nowrap;
}

.live-clock-widget .clock-divider {
    color: var(--border-color);
    margin: 0 2px;
}

.live-clock-widget .clock-time-glow {
    font-family: monospace;
    font-weight: 800;
    font-size: 14px;
    color: var(--color-accent);
    letter-spacing: 0.5px;
    text-shadow: 0 0 8px rgba(0, 242, 254, 0.4);
}

body.light-theme .live-clock-widget {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #0f172a;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

body.light-theme .live-clock-widget .clock-time-glow {
    color: #0284c7;
    text-shadow: none;
}

@media (max-width: 768px) {
    .live-clock-widget {
        padding: 4px 10px;
        font-size: 11px;
    }
    .live-clock-widget #clock-date-text {
        display: none;
    }
    .live-clock-widget .clock-divider {
        display: none;
    }
}
.global-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 15, 23, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease forwards;
}

.global-loading-card {
    background: rgba(22, 30, 49, 0.95);
    border: 1px solid rgba(0, 242, 254, 0.3);
    border-radius: 20px;
    padding: 28px 36px;
    text-align: center;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 24px rgba(0, 242, 254, 0.2);
    max-width: 90%;
    width: 320px;
}

.global-loading-spinner-wrapper {
    margin-bottom: 16px;
    position: relative;
    display: inline-block;
}

.global-loading-icon {
    font-size: 42px;
    color: var(--color-accent);
    filter: drop-shadow(0 0 10px rgba(0, 242, 254, 0.6));
}

.global-loading-text {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 15px;
    color: #ffffff;
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}

.global-loading-subtext {
    font-size: 11px;
    color: var(--text-muted);
}

body.light-theme .global-loading-overlay {
    background: rgba(255, 255, 255, 0.8);
}

body.light-theme .global-loading-card {
    background: #ffffff;
    border-color: #cbd5e1;
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.15);
}

body.light-theme .global-loading-text {
    color: #0f172a;
}

/* Button Loading & Anti-Bounce Lock */
.loading-btn {
    pointer-events: none !important;
    opacity: 0.7 !important;
    position: relative !important;
}
.instant-scan-option {
    margin-top: 10px;
    display: flex;
    align-items: center;
}

.checkbox-container {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    cursor: pointer !important;
    font-family: var(--font-heading) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    user-select: none !important;
    padding: 6px 14px !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 20px !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.checkbox-container:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(56, 139, 253, 0.4) !important;
}

.checkbox-container input[type="checkbox"] {
    display: none !important;
}

.checkmark {
    width: 36px !important;
    height: 20px !important;
    background-color: rgba(255, 255, 255, 0.15) !important;
    border-radius: 20px !important;
    position: relative !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    flex-shrink: 0 !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}

.checkmark::after {
    content: '' !important;
    position: absolute !important;
    top: 2px !important;
    left: 2px !important;
    width: 16px !important;
    height: 16px !important;
    background-color: #ffffff !important;
    border-radius: 50% !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3) !important;
}

.checkbox-container input[type="checkbox"]:checked + .checkmark {
    background: linear-gradient(135deg, var(--color-blue), var(--color-accent)) !important;
    box-shadow: 0 0 12px rgba(56, 139, 253, 0.4) !important;
}

.checkbox-container input[type="checkbox"]:checked + .checkmark::after {
    transform: translateX(16px) !important;
}

body.light-theme .checkbox-container {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

body.light-theme .checkmark {
    background-color: #cbd5e1 !important;
}

/* Premium Workflow Step Banners */
.workflow-step-banner {
    background: linear-gradient(135deg, rgba(22, 30, 49, 0.85), rgba(30, 41, 67, 0.65)) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 14px !important;
    padding: 14px 18px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25) !important;
    margin-bottom: 18px !important;
}

.step-banner-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.3px;
}

.step-items-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    width: 100% !important;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.step-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.step-num {
    color: #ffffff !important;
    border-radius: 50% !important;
    width: 22px !important;
    height: 22px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 800 !important;
    font-size: 11px !important;
    flex-shrink: 0 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

.step-arrow {
    color: var(--color-accent) !important;
    font-weight: 800 !important;
    font-size: 14px !important;
}

body.light-theme .workflow-step-banner {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06) !important;
}

body.light-theme .step-item {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

/* Stats Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
    width: 100% !important;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform 0.2s, border-color 0.2s;
    width: 100% !important;
}

.stat-card:hover {
    border-color: var(--border-color-glow);
    transform: translateY(-2px);
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
    flex-shrink: 0;
}

.bg-blue { background-color: rgba(56, 139, 253, 0.15); color: var(--color-blue) !important; }
.bg-orange { background-color: rgba(255, 152, 0, 0.15); color: var(--color-orange) !important; }
.bg-green { background-color: rgba(63, 185, 80, 0.15); color: var(--color-green) !important; }
.bg-purple { background-color: rgba(188, 140, 255, 0.15); color: var(--color-purple) !important; }

.stat-info h3 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
}

.stat-info span {
    color: var(--text-muted);
    font-size: 11px;
}

/* Category & Filter Chips - ZERO OVERFLOW HORIZONTAL SCROLLING */
.swipe-pills-container, .category-filter-pills {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    padding-bottom: 6px;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.swipe-pills-container::-webkit-scrollbar,
.category-filter-pills::-webkit-scrollbar {
    display: none;
}

.pill-chip, .category-pill, .filter-chip {
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
    transition: all 0.2s;
    flex-shrink: 0 !important;
}

.pill-chip:hover, .category-pill:hover, .filter-chip:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.08);
}

.pill-chip.active, .category-pill.active, .filter-chip.active {
    background-color: var(--color-blue);
    border-color: var(--color-blue);
    color: #fff;
    box-shadow: 0 2px 8px rgba(56, 139, 253, 0.3);
}

/* Tables & Containers */
.table-responsive {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100% !important;
    min-width: 480px;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
}

.table th, .table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: rgba(255, 255, 255, 0.02);
}

.table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

/* Forms */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 14px;
    width: 100% !important;
}

.form-group label {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 12px;
    color: var(--text-muted);
}

input[type="text"], input[type="number"], input[type="password"], input[type="date"], select, textarea {
    background-color: rgba(11, 15, 23, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 9px;
    padding: 9px 12px;
    color: #fff;
    font-family: var(--font-body);
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
    width: 100% !important;
    box-sizing: border-box !important;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--color-blue);
    box-shadow: 0 0 0 3px rgba(56, 139, 253, 0.2);
}

.form-row-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    width: 100% !important;
}

.form-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    width: 100% !important;
}

.form-row-2-1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 14px;
    width: 100% !important;
}

/* Badges */
.status-badge, .badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.status-badge.success, .badge-fresh { background: rgba(63, 185, 80, 0.2); color: #8eff9d; border: 1px solid rgba(63, 185, 80, 0.45); }
.status-badge.warning, .badge-dry { background: rgba(255, 152, 0, 0.2); color: #ffca6c; border: 1px solid rgba(255, 152, 0, 0.45); }
.status-badge.danger { background: rgba(248, 81, 73, 0.2); color: #ff938d; border: 1px solid rgba(248, 81, 73, 0.45); }
.status-badge.info, .badge-beverage { background: rgba(74, 134, 140, 0.2); color: #a4e1e8; border: 1px solid rgba(74, 134, 140, 0.4); }
.badge-supply { background: rgba(166, 140, 63, 0.2); color: #ffd666; border: 1px solid rgba(166, 140, 63, 0.4); }

.badge-count-red {
    background-color: var(--color-red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
}

/* Workflows Grid */
.workflow-grid, .stocktake-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    width: 100% !important;
}

/* Barcode Simulation Buttons */
.simulator-groups {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 340px;
    overflow-y: auto;
    padding-right: 4px;
    width: 100% !important;
}

.sim-product-group {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    width: 100% !important;
}

.sim-product-title {
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 700;
    color: var(--color-blue);
    margin-bottom: 8px;
}

.sim-barcode-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
    width: 100% !important;
}

.btn-sim-scan {
    background: rgba(56, 139, 253, 0.08);
    border: 1px solid rgba(56, 139, 253, 0.25);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    transition: all 0.2s ease;
    word-break: break-word;
    width: 100% !important;
}

.btn-sim-scan:hover {
    background: var(--color-blue);
    color: #ffffff;
    border-color: var(--color-blue);
    box-shadow: 0 4px 12px rgba(56, 139, 253, 0.3);
}

.btn-sim-scan .bc {
    font-family: monospace;
    font-size: 11px;
    opacity: 0.85;
}

/* Toast Notifications */
.toast-container {
    position: fixed !important;
    z-index: 999999 !important;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-sizing: border-box !important;
}

@media (min-width: 577px) {
    .toast-container {
        top: 20px !important;
        right: 20px !important;
        max-width: 380px !important;
        width: 90% !important;
    }
}

@media (max-width: 576px) {
    .toast-container {
        top: 10px !important;
        left: 10px !important;
        right: 10px !important;
        width: calc(100vw - 20px) !important;
        max-width: calc(100vw - 20px) !important;
    }
}

.toast {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color-glow);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    width: 100% !important;
    box-sizing: border-box !important;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.toast.error, .toast.danger {
    border-left: 4px solid var(--color-red);
    background: #1c1015;
    color: #ffffff;
}

.toast.success {
    border-left: 4px solid var(--color-green);
    background: #0f1c15;
    color: #ffffff;
}

.toast.info {
    border-left: 4px solid var(--color-blue);
    background: #101828;
    color: #ffffff;
}

/* Activity Feed Timeline */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100% !important;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.2s ease;
    width: 100% !important;
}

.activity-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(56, 139, 253, 0.3);
}

.activity-badge {
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    flex-shrink: 0;
}

.activity-badge.badge-in {
    background: rgba(63, 185, 80, 0.15);
    color: var(--color-green);
    border: 1px solid rgba(63, 185, 80, 0.3);
}

.activity-badge.badge-out {
    background: rgba(56, 139, 253, 0.15);
    color: var(--color-blue);
    border: 1px solid rgba(56, 139, 253, 0.3);
}

.activity-badge.badge-adjust {
    background: rgba(188, 140, 255, 0.15);
    color: var(--color-purple);
    border: 1px solid rgba(188, 140, 255, 0.3);
}

.activity-details {
    flex-grow: 1;
}

.activity-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.activity-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* --------------------------------------------------------------------------
   3. PRODUCT CATALOG GRID & CARDS (ZERO OVERFLOW PERFECT FIT)
   -------------------------------------------------------------------------- */
.product-catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
}

.catalog-card {
    background: rgba(11, 15, 23, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

.catalog-card:hover {
    border-color: var(--color-blue);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.catalog-img-container {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    background: #fff;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.catalog-img-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.catalog-title, .catalog-card-name {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
    line-height: 1.3;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    max-width: 100% !important;
}

/* Quantity Steppers */
.qty-control {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    overflow: hidden;
}

.qty-btn {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.06);
    border: none;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.qty-control input {
    border: none !important;
    border-radius: 0 !important;
    text-align: center;
    font-weight: 700;
}

.quick-presets {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.preset-btn {
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
}

/* Modals & Dialogs */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box !important;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 20px 24px;
    max-width: 500px;
    width: 100% !important;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    box-sizing: border-box !important;
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    word-break: break-word;
    color: var(--text-primary);
}

.modal-header .close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.modal-header .close-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.modal-body {
    padding: 4px 0 16px 0;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}

/* Override Browser Autofill Yellow Background */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #1e1f1d inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    transition: background-color 5000s ease-in-out 0s;
}

body.light-theme input:-webkit-autofill,
body.light-theme input:-webkit-autofill:hover,
body.light-theme input:-webkit-autofill:focus,
body.light-theme input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #ffffff inset !important;
    -webkit-text-fill-color: #0f172a !important;
}

/* Desktop Requisition Tab Bar */
#requester-desktop-tab-bar {
    display: flex;
}

.req-desktop-tab.active {
    background: linear-gradient(135deg, #4a868c, #3a6f74) !important;
    color: #f2e2ce !important;
    border-color: rgba(74, 134, 140, 0.4) !important;
}

/* Role Isolation Settings */
body.requester-mode .sidebar {
    display: none !important;
}

body.requester-mode .app-container {
    grid-template-columns: 1fr !important;
}

body.requester-mode .main-content {
    padding: 12px 14px 90px 14px !important;
}

body.requester-mode .staff-admin-btn,
body.requester-mode .admin-only,
body.requester-mode .admin-only-panel,
body.requester-mode #btn-seed-demo {
    display: none !important;
}

body.requester-mode .sidebar-footer {
    display: block !important;
}

body.requester-mode .page-panel:not(#panel-outbound) {
    display: none !important;
}

body.requester-mode #panel-outbound.active {
    display: block !important;
}

/* Responsive Mobile Navigation */
.btn-mobile-menu {
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 12px; left: 12px; right: 12px;
    height: 58px;
    background: rgba(39, 37, 37, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    z-index: 99999;
    padding: 4px 8px;
    align-items: center;
    justify-content: space-around;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

.mobile-nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    flex: 1;
    height: 46px;
    border-radius: 11px;
}

.mobile-nav-btn i { font-size: 17px; }

.mobile-nav-btn.active {
    color: #4a868c;
    background: rgba(74, 134, 140, 0.15);
}

.mobile-fab-container {
    display: none;
    position: fixed;
    bottom: 80px; right: 16px;
    z-index: 99998;
}

.mobile-fab {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4a868c, #3a6f74);
    color: #f2e2ce;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    box-shadow: 0 8px 24px rgba(74, 134, 140, 0.4);
    cursor: pointer;
}

/* --------------------------------------------------------------------------
   4. MEDIA QUERIES & MOBILE BREAKPOINTS (STRICT FIT < 992px & < 576px)
   -------------------------------------------------------------------------- */
@media (max-width: 992px) {
    .app-container {
        grid-template-columns: 1fr !important;
    }

    .sidebar {
        position: fixed !important;
        left: -300px !important;
        top: 0 !important; bottom: 0 !important;
        width: 280px !important;
        max-width: 85vw !important;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 999999 !important;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.6) !important;
    }

    .sidebar.sidebar-open, .sidebar.active {
        left: 0 !important;
    }

    .btn-close-sidebar {
        display: flex !important;
    }

    .btn-mobile-menu {
        display: flex !important;
    }

    .main-content {
        padding: 10px 10px 85px 10px !important;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .workflow-grid, .stocktake-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .sim-barcode-buttons {
        grid-template-columns: 1fr !important;
    }

    .form-row-2, .form-row-3, .form-row-2-1 {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    input[type="text"], input[type="number"], select {
        min-height: 44px;
        font-size: 14px;
    }

    .mobile-bottom-nav {
        display: flex !important;
    }

    .mobile-fab-container {
        display: flex !important;
    }

    body.requester-mode #requester-desktop-tab-bar {
        display: none !important;
    }
}

@media (max-width: 576px) {
    .main-content {
        padding: 8px 8px 90px 8px !important;
    }

    .card-glass, .dashboard-card, .workflow-scan-panel, .workflow-form-panel {
        padding: 10px 8px !important;
        margin-bottom: 12px !important;
        border-radius: 12px !important;
    }

    .step-items-wrapper {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 6px !important;
    }

    .step-arrow {
        display: none !important;
    }

    .product-catalog-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 6px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    .catalog-card {
        min-width: 0 !important;
        padding: 8px 4px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    .catalog-title, .catalog-card-name {
        font-size: 11px !important;
        word-break: break-word !important;
        overflow-wrap: break-word !important;
    }

    .catalog-img-container {
        width: 48px !important;
        height: 48px !important;
    }

    .modal-card {
        width: calc(100vw - 16px) !important;
        max-width: calc(100vw - 16px) !important;
        margin: 8px auto !important;
        padding: 12px !important;
    }

    .panel-header h2 { font-size: 16px !important; }
    .panel-header p { font-size: 11px !important; }
}

/* Light Theme Overrides */
body.light-theme {
    --bg-main: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --border-color: #cbd5e1;
    --text-primary: #0f172a;
    --text-muted: #475569;
    --text-main: #0f172a;
    background-image: none;
}

body.light-theme .sidebar {
    background: #ffffff !important;
    border-right: 1px solid #cbd5e1 !important;
    box-shadow: 4px 0 24px rgba(15, 23, 42, 0.06) !important;
}

body.light-theme .top-header,
body.light-theme .card-glass,
body.light-theme .dashboard-card {
    background: #ffffff;
    border-color: #cbd5e1;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
}

body.light-theme input,
body.light-theme select,
body.light-theme textarea {
    background: #ffffff;
    border-color: #94a3b8;
    color: #0f172a;
}

body.light-theme .table th {
    background: #e2e8f0;
    color: #0f172a;
}

body.light-theme .mobile-bottom-nav {
    background: rgba(255, 255, 255, 0.95);
    border-color: #cbd5e1;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

body.light-theme .mobile-nav-btn {
    color: #475569;
}

body.light-theme .mobile-nav-btn.active {
    color: #4a868c !important;
    background: rgba(74, 134, 140, 0.12) !important;
}

body.light-theme h1, 
body.light-theme h2, 
body.light-theme h3, 
body.light-theme h4, 
body.light-theme h5, 
body.light-theme h6 {
    color: #0f172a !important;
}

body.light-theme .logo-text h2 {
    color: #0f172a !important;
}

body.light-theme .logo-text span {
    color: #475569 !important;
}

body.light-theme .user-select {
    color: #0f172a !important;
}

body.light-theme .nav-btn {
    color: #475569 !important;
}

body.light-theme .nav-btn:hover {
    color: #0f172a !important;
    background-color: rgba(15, 23, 42, 0.08) !important;
}

body.light-theme .nav-btn.active {
    background: rgba(74, 134, 140, 0.15) !important;
    border-left-color: #4a868c !important;
    border-color: rgba(74, 134, 140, 0.3) !important;
    color: #1e3a3a !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 8px rgba(74, 134, 140, 0.1) !important;
}

body.light-theme .active-user-badge {
    background-color: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
}

body.light-theme .active-user-badge i {
    color: #4a868c !important;
}

body.light-theme .btn-secondary {
    background-color: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

body.light-theme .btn-secondary:hover:not(:disabled) {
    background-color: #e2e8f0 !important;
}

body.light-theme .btn-accent {
    background: linear-gradient(135deg, #a68c3f, #8a7433) !important;
    color: #ffffff !important;
}

/* Light Theme Badges Contrast Fix */
body.light-theme .status-badge.success, 
body.light-theme .badge-fresh { 
    background: rgba(34, 197, 94, 0.18) !important; 
    color: #15803d !important; 
    border: 1px solid rgba(34, 197, 94, 0.35) !important; 
}
body.light-theme .status-badge.warning, 
body.light-theme .badge-dry { 
    background: rgba(249, 115, 22, 0.18) !important; 
    color: #c2410c !important; 
    border: 1px solid rgba(249, 115, 22, 0.35) !important; 
}
body.light-theme .status-badge.danger { 
    background: rgba(239, 68, 68, 0.18) !important; 
    color: #b91c1c !important; 
    border: 1px solid rgba(239, 68, 68, 0.35) !important; 
}
body.light-theme .status-badge.info, 
body.light-theme .badge-beverage { 
    background: rgba(74, 134, 140, 0.18) !important; 
    color: #1e3a3a !important; 
    border: 1px solid rgba(74, 134, 140, 0.35) !important; 
}
body.light-theme .badge-supply { 
    background: rgba(166, 140, 63, 0.18) !important; 
    color: #71581e !important; 
    border: 1px solid rgba(166, 140, 63, 0.35) !important; 
}

/* Global Disabled Button Contrast Override */
button:disabled {
    opacity: 0.6 !important;
    background: #cbd5e1 !important;
    color: #475569 !important;
    border-color: #cbd5e1 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Requisition Card Item Styles */
.req-card-item {
    padding: 12px 14px;
    margin-bottom: 10px;
    border-radius: 12px;
    width: 100%;
    box-sizing: border-box;
    background: rgba(39, 37, 37, 0.65) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    transition: all 0.25s ease;
}

body.light-theme .req-card-item {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04) !important;
}

.req-card-id {
    font-family: monospace;
    font-weight: 700;
    font-size: 13px;
    color: #82c3c9 !important;
}

body.light-theme .req-card-id {
    color: #0f766e !important;
}

.req-card-audit {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #cbd5e1 !important;
    margin-bottom: 8px;
    flex-wrap: wrap;
    background: rgba(0, 0, 0, 0.25) !important;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
}

body.light-theme .req-card-audit {
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    color: #334155 !important;
}
