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

body { font-family: ui-sans-serif, system-ui, sans-serif; background: #020617; color: #e2e8f0; min-height: 100vh; }

/* Layout */
.sidebar { position: fixed; inset-y: 0; left: 0; width: 256px; background: #0f172a; border-right: 1px solid #1e293b; display: flex; flex-direction: column; z-index: 30; }
.main-content { margin-left: 256px; min-height: 100vh; padding: 2rem; }
@media (max-width: 1023px) { .sidebar { display: none; } .main-content { margin-left: 0; padding: 1rem; } }

/* Nav links */
.nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; font-size: 14px; font-weight: 500; text-decoration: none; color: #94a3b8; transition: background 0.15s, color 0.15s; }
.nav-link:hover { background: #1e293b; color: #f8fafc; }
.nav-link.active { background: #2563eb; color: #fff; }
.nav-link svg { width: 20px; height: 20px; flex-shrink: 0; }

/* Cards */
.card { background: #0f172a; border: 1px solid #1e293b; border-radius: 16px; }
.card-p { padding: 20px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; border: none; cursor: pointer; transition: background 0.15s; }
.btn-blue { background: #2563eb; color: #fff; }
.btn-blue:hover { background: #3b82f6; }
.btn-slate { background: #1e293b; color: #cbd5e1; }
.btn-slate:hover { background: #334155; color: #f8fafc; }
.btn-red { background: transparent; color: #64748b; }
.btn-red:hover { color: #f87171; }

/* Inputs */
.input { background: #1e293b; border: 1px solid #334155; border-radius: 8px; padding: 12px 16px; color: #f8fafc; font-size: 14px; width: 100%; outline: none; }
.input:focus { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,0.2); }
.input::placeholder { color: #475569; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead tr { background: #0f172a; border-bottom: 1px solid #1e293b; }
th { padding: 12px 16px; text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: #64748b; }
td { padding: 12px 16px; color: #e2e8f0; white-space: nowrap; }
tbody tr { border-bottom: 1px solid rgba(30,41,59,0.5); transition: background 0.1s; }
tbody tr:hover { background: rgba(30,41,59,0.3); }
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid #1e293b; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 8px; font-size: 12px; font-weight: 500; }
.badge-green { background: rgba(6,78,59,0.5); color: #6ee7b7; border: 1px solid #065f46; }
.badge-amber { background: rgba(120,53,15,0.5); color: #fcd34d; border: 1px solid #92400e; }
.badge-slate { background: #1e293b; color: #94a3b8; border: 1px solid #334155; }
.badge-blue { background: rgba(30,58,138,0.5); color: #93c5fd; border: 1px solid #1e3a8a; }

/* Modal overlay */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(4px); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { background: #0f172a; border: 1px solid #334155; border-radius: 16px; width: 100%; max-width: 384px; padding: 24px; }

/* Spinner */
.spinner { width: 24px; height: 24px; border: 2px solid #1e293b; border-top-color: #3b82f6; border-radius: 50%; animation: spin 0.6s linear infinite; margin: 48px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (min-width: 1024px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }

/* Progress bar */
.progress-track { background: #1e293b; border-radius: 9999px; height: 12px; }
.progress-fill { background: #2563eb; border-radius: 9999px; height: 12px; transition: width 0.5s; }

/* Scanner */
#reader { width: 100%; max-height: 300px; overflow: hidden; }
#reader video { width: 100% !important; height: auto !important; border-radius: 12px; max-height: 300px; object-fit: cover; }
#reader img { display: none; }

/* Bottom nav (operator) */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: #0f172a; border-top: 1px solid #1e293b; z-index: 20; display: flex; }
.bottom-nav a, .bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 4px; font-size: 12px; font-weight: 500; color: #64748b; background: none; border: none; cursor: pointer; text-decoration: none; transition: color 0.15s; }
.bottom-nav a:hover, .bottom-nav button:hover { color: #cbd5e1; }
.bottom-nav a.active-scan { color: #60a5fa; }
.bottom-nav a.active-pending { color: #fbbf24; }
.bottom-nav svg { width: 24px; height: 24px; }

/* Mobile topbar */
.mobile-topbar { display: none; }
@media (max-width: 1023px) { .mobile-topbar { display: flex; align-items: center; padding: 12px 16px; background: #0f172a; border-bottom: 1px solid #1e293b; position: fixed; top: 0; left: 0; right: 0; z-index: 30; } .page-offset { height: 56px; } }

/* Flash animations */
@keyframes flash-green { 0%,100%{background:transparent} 50%{background:rgba(16,185,129,0.15)} }
@keyframes flash-red { 0%,100%{background:transparent} 50%{background:rgba(239,68,68,0.15)} }
.flash-success { animation: flash-green 0.8s ease; }

/* Operator result card */
.action-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; border-radius: 16px; font-size: 18px; font-weight: 700; border: none; cursor: pointer; transition: transform 0.1s, filter 0.1s; width: 100%; }
.action-btn:active { transform: scale(0.96); }
.btn-confirm { background: #059669; color: #fff; box-shadow: 0 8px 24px rgba(5,150,105,0.3); }
.btn-confirm:hover { background: #10b981; }
.btn-discrepancy { background: #d97706; color: #fff; box-shadow: 0 8px 24px rgba(217,119,6,0.3); }
.btn-discrepancy:hover { background: #f59e0b; }
.action-btn svg { width: 32px; height: 32px; }

/* Misc */
svg { display: block; }
a { color: inherit; }
button { font-family: inherit; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-danger { color: #f87171; }
.text-success { color: #34d399; }
.text-warning { color: #fbbf24; }
