:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #0f172a;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 2px 16px rgba(0,0,0,0.08);
    --shadow-hover: 0 8px 32px rgba(37,99,235,0.15);
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ── NAVBAR ── */
.navbar {
    background: var(--secondary);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
.navbar-brand {
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.5px;
}
.navbar-brand span { color: var(--accent); }
.navbar-menu { display: flex; align-items: center; gap: 0.5rem; }
.navbar-menu a {
    color: #94a3b8;
    text-decoration: none;
    padding: 0.4rem 0.9rem;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 500;
    transition: all 0.2s;
}
.navbar-menu a:hover, .navbar-menu a.active {
    color: #fff;
    background: rgba(255,255,255,0.1);
}
.navbar-notif {
    position: relative;
    cursor: pointer;
    color: #94a3b8;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 1.1rem;
    transition: all 0.2s;
}
.navbar-notif:hover { color: #fff; background: rgba(255,255,255,0.1); }
.notif-badge {
    position: absolute;
    top: 2px; right: 2px;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 50%;
    width: 18px; height: 18px;
    display: flex; align-items: center; justify-content: center;
}
.navbar-user {
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    background: rgba(255,255,255,0.08);
    padding: 0.4rem 1rem;
    border-radius: 8px;
}

/* ── SIDEBAR ── */
.layout { display: flex; min-height: calc(100vh - 64px); }
.sidebar {
    width: 240px;
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    padding: 1.5rem 1rem;
    flex-shrink: 0;
}
.sidebar-section { margin-bottom: 1.5rem; }
.sidebar-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 0.5rem;
    margin-bottom: 0.5rem;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: 2px;
}
.sidebar-link:hover { background: var(--primary-light); color: var(--primary); }
.sidebar-link.active { background: var(--primary); color: #fff; }
.sidebar-link i { width: 18px; text-align: center; }

/* ── MAIN CONTENT ── */
.main-content { flex: 1; padding: 2rem; overflow-x: hidden; }
.page-header { margin-bottom: 1.5rem; }
.page-title { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.page-subtitle { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.2rem; }

/* ── CARDS ── */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    border: 1px solid var(--border);
}
.card-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
}
.stat-icon.blue  { background: #dbeafe; color: var(--primary); }
.stat-icon.green { background: #d1fae5; color: var(--success); }
.stat-icon.amber { background: #fef3c7; color: var(--accent); }
.stat-icon.red   { background: #fee2e2; color: var(--danger); }
.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--text); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead th {
    background: var(--bg);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}
tbody td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg); }

/* ── BADGES ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-primary { background: #dbeafe; color: #1e40af; }
.badge-info    { background: #e0f2fe; color: #0c4a6e; }
.badge-secondary { background: #f1f5f9; color: #475569; }

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover  { background: #dc2626; }
.btn-warning { background: var(--accent); color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #cbd5e1; }
.btn-wa { background: #25d366; color: #fff; }
.btn-wa:hover { background: #128c7e; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

/* ── FORMS ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 0.3rem; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 0.85rem; font-weight: 600; color: var(--text); }
input, select, textarea {
    padding: 0.6rem 0.9rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text);
    background: #fff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
input[readonly], input[disabled], select[disabled] {
    background: var(--bg);
    color: var(--text-muted);
    cursor: not-allowed;
}
textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1rem; }

/* ── LOGIN PAGE ── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--secondary) 0%, #1e3a8a 100%);
    padding: 2rem;
}
.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.25);
}
.login-logo { text-align: center; margin-bottom: 1.5rem; }
.login-logo h1 { font-size: 2rem; font-weight: 900; color: var(--secondary); }
.login-logo h1 span { color: var(--primary); }
.login-logo p { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.2rem; }
.login-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 1.25rem; color: var(--text); }

/* ── ALERT ── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: 1rem;
}
.alert-danger  { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--danger); }
.alert-success { background: #d1fae5; color: #065f46; border-left: 4px solid var(--success); }
.alert-info    { background: #e0f2fe; color: #0c4a6e; border-left: 4px solid var(--info); }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid var(--accent); }

/* ── COUNTDOWN ── */
.countdown {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 700;
    font-size: 0.85rem;
}
.countdown.danger { color: var(--danger); }
.countdown.warning { color: var(--accent); }
.countdown.ok { color: var(--success); }

/* ── MODAL ── */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: #fff;
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0,0,0,0.2);
    animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 1.25rem; display: flex; align-items: center; gap: 0.5rem; }
.modal-close { margin-left: auto; cursor: pointer; color: var(--text-muted); font-size: 1.2rem; background: none; border: none; }
.modal-close:hover { color: var(--danger); }

/* ── NOTIF DROPDOWN ── */
.notif-dropdown {
    display: none;
    position: absolute;
    right: 0; top: 50px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
    width: 320px;
    z-index: 200;
    border: 1px solid var(--border);
    overflow: hidden;
}
.notif-dropdown.show { display: block; }
.notif-header { padding: 0.75rem 1rem; font-weight: 700; font-size: 0.88rem; border-bottom: 1px solid var(--border); background: var(--bg); }
.notif-item {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.84rem;
    cursor: pointer;
    transition: background 0.15s;
}
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: var(--primary-light); }
.notif-item:last-child { border-bottom: none; }
.notif-time { color: var(--text-muted); font-size: 0.75rem; margin-top: 0.2rem; }

/* ── BARCODE RESULT ── */
.barcode-result {
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.5rem;
    font-size: 0.88rem;
    display: none;
}
.barcode-result.show { display: block; }
.barcode-result .spec-item { display: flex; gap: 0.5rem; margin-bottom: 0.3rem; }
.barcode-result .spec-label { font-weight: 600; min-width: 100px; color: var(--text-muted); }

/* ── EMPTY STATE ── */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 0.75rem; opacity: 0.3; }
.empty-state p { font-size: 0.9rem; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid.cols-3 { grid-template-columns: 1fr; }
    .main-content { padding: 1rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
