/* Inventory CRM - Stylesheet v2 */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --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;
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px 0 rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
}

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

.layout { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
    width: 240px;
    background: var(--gray-900);
    color: var(--gray-300);
    padding: 20px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}
.sidebar-brand {
    font-size: 18px;
    font-weight: 700;
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--gray-700);
    color: #fff;
}
.sidebar nav { padding: 16px 0; }
.sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: var(--gray-400);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.15s;
    font-size: 14px;
}
.sidebar a:hover { background: var(--gray-800); color: #fff; }
.sidebar a.active {
    background: var(--gray-800);
    border-left-color: var(--primary);
    color: #fff;
}
.sidebar a .badge-count {
    background: var(--danger);
    color: #fff;
    border-radius: 10px;
    font-size: 11px;
    padding: 2px 7px;
    margin-left: auto;
}
.sidebar-section {
    padding: 12px 20px 6px;
    color: var(--gray-500);
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* MAIN */
.main { flex: 1; margin-left: 240px; padding: 24px 32px; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
}
.topbar h2 { color: var(--gray-900); font-size: 22px; font-weight: 700; }
.topbar .user-info { display: flex; align-items: center; gap: 12px; }
.user-badge {
    background: var(--gray-100);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--gray-700);
}

/* STATS */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    border-left: 3px solid var(--primary);
    transition: transform 0.15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card.warn { border-left-color: var(--warning); }
.stat-card.danger { border-left-color: var(--danger); }
.stat-card.success { border-left-color: var(--success); }
.stat-card.info { border-left-color: var(--info); }
.stat-card .icon {
    font-size: 24px;
    margin-bottom: 8px;
    display: block;
}
.stat-card .label {
    color: var(--gray-500);
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 6px;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.stat-card .value {
    font-size: 26px;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
}
.stat-card .sub {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 4px;
}
.stat-card.clickable { cursor: pointer; }

/* CARDS & TABLES */
.card {
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    overflow: hidden;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.card-header h3 { font-size: 15px; font-weight: 600; color: var(--gray-900); }
.card-body { padding: 20px; }

table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 11px 20px;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13px;
    vertical-align: middle;
}
th {
    background: var(--gray-50);
    color: var(--gray-600);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
tbody tr:hover { background: var(--gray-50); }
tr.highlight { background: #fef3c7; }

/* BADGES */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.badge-new { background: #dbeafe; color: #1e40af; }
.badge-processing { background: #fef3c7; color: #92400e; }
.badge-packed { background: #fde68a; color: #78350f; }
.badge-shipped { background: #c7d2fe; color: #3730a3; }
.badge-delivered { background: #d1fae5; color: #065f46; }
.badge-rto-initiated, .badge-rto { background: #fee2e2; color: #991b1b; }
.badge-rto-received { background: #fed7aa; color: #7c2d12; }
.badge-cancelled { background: #e5e7eb; color: #374151; }
.badge-on-hold { background: #fde68a; color: #78350f; }
.badge-paid { background: #d1fae5; color: #065f46; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-failed { background: #fee2e2; color: #991b1b; }
.badge-fulfilled { background: #d1fae5; color: #065f46; }
.badge-unfulfilled { background: #e5e7eb; color: #374151; }
.badge-low { background: #fef3c7; color: #92400e; }
.badge-out { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-critical { background: #fee2e2; color: #991b1b; }

/* BUTTONS */
.btn {
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1.4;
}
.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-secondary { background: var(--gray-100); color: var(--gray-700); border-color: var(--gray-300); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 12px 20px; font-size: 15px; }

/* FORMS */
.form-group { margin-bottom: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--gray-700);
    font-size: 13px;
}
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.form-help { font-size: 12px; color: var(--gray-500); margin-top: 4px; }

/* ALERTS */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    border-left: 3px solid;
    font-size: 14px;
}
.alert-success { background: #d1fae5; color: #065f46; border-color: var(--success); }
.alert-error { background: #fee2e2; color: #991b1b; border-color: var(--danger); }
.alert-info { background: #dbeafe; color: #1e3a8a; border-color: var(--info); }
.alert-warning { background: #fef3c7; color: #92400e; border-color: var(--warning); }

/* MISC */
.low-stock { color: var(--danger); font-weight: 600; }
.muted { color: var(--gray-500); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.empty-state { padding: 60px 20px; text-align: center; color: var(--gray-400); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }

/* PAGINATION */
.pagination {
    display: flex;
    gap: 4px;
    padding: 16px 20px;
    justify-content: center;
}
.pagination a {
    padding: 6px 12px;
    border-radius: 5px;
    color: var(--gray-700);
    text-decoration: none;
    font-size: 13px;
    border: 1px solid var(--gray-200);
}
.pagination a:hover { background: var(--gray-100); }
.pagination a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* LOGIN */
.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}
.login-box {
    background: #fff;
    padding: 40px;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 420px;
}
.login-box h1 {
    text-align: center;
    margin-bottom: 8px;
    color: var(--gray-900);
}
.login-box .subtitle { text-align: center; color: var(--gray-500); margin-bottom: 28px; font-size: 14px; }

/* BARCODE SCAN INPUT */
.scan-input {
    font-size: 22px !important;
    padding: 18px !important;
    text-align: center;
    letter-spacing: 1px;
    font-family: 'Courier New', monospace;
    border: 2px solid var(--primary) !important;
}
.scan-input:focus { box-shadow: 0 0 0 4px rgba(79,70,229,0.2) !important; }

/* CHARTS */
.chart-container { position: relative; height: 300px; padding: 16px; }

/* RESPONSIVE */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-brand, .sidebar a span:not(.badge-count), .sidebar-section { display: none; }
    .main { margin-left: 60px; padding: 16px; }
    .form-row { grid-template-columns: 1fr; }
}

/* TABS */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 16px;
}
.tab {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--gray-600);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* PRODUCT IMAGE */
.product-thumb {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--gray-100);
}
