/* --- GLOBAL VARIABLES --- */
:root {
    --primary: #2d3748;
    --accent: #1e40af;
    --bg: #f3f4f6;
    --border: #d1d5db;
    --text-main: #111827;
    --text-muted: #6b7280;
}

/* --- LOGO STYLES --- */
.logo-img { height: 50px; vertical-align: middle; }
.mobile-logo { height: 75px; margin-bottom: 10px; }

/* --- MAIN DASHBOARD STYLES --- */
body { font-family: 'Inter', sans-serif; margin: 0; background: var(--bg); color: var(--text-main); }
.navbar { background: white; color: var(--primary); padding: 0.5rem 2rem; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.navbar h1 { margin: 0; font-size: 1rem; font-weight: 600; }
.content { padding: 1rem; max-width: 1600px; margin: auto; }
.card { background: white; border-radius: 6px; border: 1px solid var(--border); margin-bottom: 1rem; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.75rem; padding: 1rem; align-items: flex-end; }
label { display: block; font-size: 0.65rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; margin-bottom: 0.25rem; }
select, input[type="text"] { width: 100%; padding: 0.4rem; border: 1px solid var(--border); border-radius: 4px; font-size: 0.8rem; outline: none; box-sizing: border-box; }
table { width: 100%; border-collapse: collapse; }
th { background: #f9fafb; padding: 0.6rem 1rem; text-align: left; font-size: 0.7rem; color: var(--text-muted); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
td { padding: 0.6rem 1rem; border-bottom: 1px solid #f3f4f6; font-size: 0.8rem; }
tr:hover { background-color: #f9fafb; }

/* --- BUTTONS & BADGES --- */
.btn { padding: 0.4rem 0.8rem; border-radius: 4px; font-weight: 600; cursor: pointer; border: none; font-size: 0.8rem; background: var(--accent); color: white; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 4px; transition: 0.2s; }
.btn-reset { background: #ef4444; color: white; }
.btn-scan { background: #10b981; color: white; }
.btn-large { display: block; width: 100%; padding: 15px; border-radius: 8px; font-size: 1.2rem; margin-top: 20px; }
.btn-receive { background: #059669; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 99px; font-size: 0.7rem; font-weight: 600; }
.bg-green { background: #dcfce7; color: #166534; }
.bg-yellow { background: #fef08a; color: #854d0e; }
.bg-blue { background: #e0e7ff; color: #3730a3; }
.checkbox-col { width: 40px; text-align: center; }

/* --- WAREHOUSE SCANNER STYLES --- */
body.warehouse-mode { background: #1e293b; color: white; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; }
.warehouse-mode h1 { color: #94a3b8; font-weight: 300; margin-bottom: 30px; }

/* SYMMETRY FIX FOR SCANNER INPUT */
.scanner-input { 
    padding: 20px; 
    font-size: 1.5rem; 
    border-radius: 8px; 
    border: 2px solid #3b82f6; 
    width: 100%; 
    max-width: 800px;
    margin: 0 auto;
    display: block;
    text-align: center; 
    background: #0f172a; 
    color: white; 
    box-sizing: border-box;
}
.scanner-input:focus { border-color: #10b981; box-shadow: 0 0 15px rgba(16, 185, 129, 0.5); }

/* SYMMETRY FIX FOR ALERT BOX */
.alert { 
    padding: 20px; 
    border-radius: 8px; 
    font-size: 1.5rem; 
    margin: 30px auto 20px auto; 
    width: 100%; 
    max-width: 800px; 
    box-sizing: border-box; 
    text-align: center; 
}
.alert.success { background: #064e3b; color: #34d399; border: 1px solid #047857; }
.alert.error { background: #7f1d1d; color: #fca5a5; border: 1px solid #b91c1c; }
.back-link { position: absolute; top: 20px; left: 20px; color: #94a3b8; text-decoration: none; font-size: 1.2rem; }

/* --- MOBILE APP STYLES --- */
body.mobile-mode { padding: 20px; }
.mobile-card { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); margin-top: 10px; }
.mobile-detail { margin-bottom: 15px; font-size: 1.1rem; border-bottom: 1px solid #eee; padding-bottom: 10px; line-height: 1.4; }

/* --- PRINT STYLES --- */
@page { size: 3in 2in; margin: 0; }
.label-box { width: 3in; height: 2in; padding: 0.2in; box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; page-break-after: always; font-family: sans-serif; }
.text-side { width: 65%; font-size: 14px; }
.qr-side img { width: 1.1in; }

/* --- MOBILE RESPONSIVENESS FOR DASHBOARD --- */
@media (max-width: 768px) {
    .module-card {
        width: 100%;
        max-width: 350px;
    }
    .dashboard-container {
        padding: 10px;
        gap: 20px;
    }
}

/* =========================================
   LIVE REPORT DASHBOARD STYLES
   ========================================= */
.dashboard-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 20px; }

.kpi-card { background: white; border-radius: 12px; padding: 25px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); display: flex; flex-direction: column; border-top: 4px solid #cbd5e1; }
.kpi-title { font-size: 0.85rem; font-weight: 600; text-transform: uppercase; color: #64748b; letter-spacing: 1px; }
.kpi-value { font-size: 2.8rem; font-weight: 800; color: #0f172a; margin-top: 5px; }
.kpi-card.blue { border-top-color: #3b82f6; } .kpi-card.blue .kpi-value { color: #1d4ed8; }
.kpi-card.orange { border-top-color: #f59e0b; } .kpi-card.orange .kpi-value { color: #d97706; }
.kpi-card.green { border-top-color: #10b981; } .kpi-card.green .kpi-value { color: #047857; }

.chart-container { background: white; border-radius: 12px; padding: 20px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); margin-bottom: 20px; }
.chart-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; }

.feed-container { background: white; border-radius: 12px; padding: 20px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); max-height: 400px; overflow-y: auto; margin-bottom: 20px; }
.feed-container table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.feed-container th { text-align: left; padding: 12px; border-bottom: 2px solid #e2e8f0; color: #64748b; position: sticky; top: 0; background: white; z-index: 10; }
.feed-container td, .chart-container td { padding: 12px; border-bottom: 1px solid #f1f5f9; color: #334155; vertical-align: middle; }
.badge-loaded { background: #d1fae5; color: #059669; padding: 4px 8px; border-radius: 12px; font-weight: 600; font-size: 0.8rem; }
.badge-install { background: #eff6ff; color: #1d4ed8; padding: 4px 8px; border-radius: 12px; font-weight: 600; font-size: 0.8rem; }

/* Thumbnail & Modal Styles */
.thumb-img { height: 50px; width: 50px; object-fit: cover; border-radius: 6px; cursor: pointer; border: 2px solid #cbd5e1; transition: 0.2s; }
.thumb-img:hover { border-color: #3b82f6; transform: scale(1.1); }

.modal { display: none; position: fixed; z-index: 9999; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(15, 23, 42, 0.9); backdrop-filter: blur(4px); }
.modal-content { margin: 5% auto; display: block; max-width: 90%; max-height: 80vh; border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.5); }
.close-modal { position: absolute; top: 20px; right: 40px; color: white; font-size: 50px; font-weight: bold; cursor: pointer; transition: 0.2s; }
.close-modal:hover { color: #f87171; }

/* ==========================================
   SCANNER & JOBSITE STYLES
   ========================================== */
body { background-color: #f8fafc; font-family: sans-serif; padding: 20px; max-width: 600px; margin: auto; }
.header { text-align: center; color: #0f172a; margin-bottom: 20px; }

/* Layout & Cards */
.card { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); margin-bottom: 15px; }
.step-title { color: #3b82f6; font-weight: bold; margin-top: 0; font-size: 0.9rem; text-transform: uppercase; }
.step-title.danger { color: #ef4444; }

/* Buttons & Inputs */
.btn { width: 100%; padding: 15px; border: none; border-radius: 5px; font-weight: bold; font-size: 16px; cursor: pointer; text-align: center; display: block; }
.btn-dark { background: #0f172a; color: white; }
.btn-green { background: #22c55e; color: white; }
.btn-red { background: #ef4444; color: white; }
.form-select { width: 100%; padding: 12px; margin-bottom: 15px; border: 1px solid #cbd5e1; border-radius: 5px; font-size: 16px; }

/* Toggles & Radios */
.toggle-group { display: flex; gap: 10px; margin-bottom: 20px; }
.toggle-btn { padding: 12px; cursor: pointer; border: 2px solid #0f172a; background: white; color: #0f172a; font-weight: bold; border-radius: 5px; flex: 1; text-align: center; }
.toggle-btn.active { background: #0f172a; color: white; }

.radio-group { display: flex; gap: 10px; }
.radio-label { flex: 1; text-align: center; padding: 15px; border: 1px solid #cbd5e1; border-radius: 5px; cursor: pointer; background: white; transition: 0.2s; }
input[type="radio"] { display: none; }
input[type="radio"]:checked + span { color: #166534; font-weight: bold; }
.radio-label.active { border-color: #22c55e; background: #f0fdf4; }

/* Scanning History */
.history-item { background: #f8fafc; padding: 12px; border-radius: 5px; margin-bottom: 8px; border-left: 4px solid #3b82f6; font-size: 0.9rem; }
.history-item.success { border-left-color: #22c55e; background: #dcfce7; }
.history-item.error { border-left-color: #ef4444; background: #fee2e2; }