/* ============================================================
   WMS PRO - Premium Dark Theme
   Quản Lý Kho Nguyên Vật Liệu + Thành Phẩm
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

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

:root {
    --bg-primary: #f4f7fb;
    --bg-secondary: #eef3f8;
    --bg-card: #ffffff;
    --bg-card-hover: #f7faff;
    --bg-input: #ffffff;
    --bg-sidebar: #f8fbff;
    --border: #d7e1ee;
    --border-light: #c4d4e7;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    --accent: #0ea5e9;
    --accent-hover: #0284c7;
    --accent-glow: rgba(14, 165, 233, 0.12);
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --info: #6366f1;
    --info-bg: rgba(99, 102, 241, 0.12);
    --purple: #a855f7;
    --gradient-1: linear-gradient(135deg, #06b6d4, #6366f1);
    --gradient-2: linear-gradient(135deg, #10b981, #06b6d4);
    --gradient-3: linear-gradient(135deg, #f59e0b, #ef4444);
    --gradient-4: linear-gradient(135deg, #a855f7, #6366f1);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 10px 28px rgba(15, 23, 42, 0.10);
    --shadow-glow: 0 0 16px rgba(14, 165, 233, 0.10);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --sidebar-width: 270px;
    --header-height: 0px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html { font-size: 13px; }
body {
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ============ SIDEBAR ============ */
.sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    z-index: 1000;
    transition: var(--transition);
    backdrop-filter: blur(8px);
}

.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
    text-decoration: none;
}

.sidebar-brand .brand-icon {
    width: 44px; height: 44px;
    background: transparent;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
}

.sidebar-brand .brand-text {
    display: flex; flex-direction: column;
}

.sidebar-brand .brand-name {
    font-size: 16px; font-weight: 700; color: var(--text-primary);
    letter-spacing: -0.5px;
}

.sidebar-brand .brand-sub {
    font-size: 11px; color: var(--text-muted); letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }

.nav-section {
    margin-bottom: 8px;
}

.nav-section-title {
    font-size: 10px; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 1.5px;
    padding: 8px 12px 6px; margin-bottom: 2px;
}

.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; border-radius: var(--radius-sm);
    color: var(--text-secondary); text-decoration: none;
    font-size: 13px; font-weight: 500;
    transition: var(--transition); position: relative;
    margin-bottom: 2px;
}

.nav-link:hover {
    background: var(--accent-glow);
    color: var(--accent);
}

.nav-link.active {
    background: var(--accent-glow);
    color: var(--accent);
    font-weight: 600;
}

.nav-link.active::before {
    content: '';
    position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 20px;
    background: var(--accent);
    border-radius: 0 4px 4px 0;
}

.nav-link .nav-icon {
    width: 20px; text-align: center; font-size: 16px;
    flex-shrink: 0;
}

.nav-link .nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 10px; font-weight: 700;
    padding: 2px 7px; border-radius: 10px;
    min-width: 20px; text-align: center;
}

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

.user-info {
    display: flex; align-items: center; gap: 10px;
    padding: 8px; border-radius: var(--radius-sm);
    background: var(--bg-card);
}

.user-avatar {
    width: 36px; height: 36px;
    background: var(--gradient-4);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; color: #fff;
}

.user-details { flex: 1; min-width: 0; }
.user-name { font-size: 12px; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 10px; color: var(--text-muted); }

/* ============ MAIN CONTENT ============ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 12px 14px;
}

/* ============ PAGE HEADER ============ */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px; padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.page-title {
    font-size: 19px; font-weight: 700; color: var(--text-primary);
    letter-spacing: -0.5px;
}

.page-subtitle {
    font-size: 13px; color: var(--text-muted); margin-top: 4px;
}

.page-actions { display: flex; gap: 6px; align-items: center; }

/* ============ CARDS ============ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}

.card-title {
    font-size: 15px; font-weight: 600; color: var(--text-primary);
}

.card-body { padding: 8px 10px; }

.card-footer {
    padding: 8px 10px;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.1);
}

/* ============ STAT CARDS ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 8px; margin-bottom: 10px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    position: relative; overflow: hidden;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-light);
}

.stat-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 3px;
}

.stat-card.accent::before { background: var(--gradient-1); }
.stat-card.success::before { background: var(--gradient-2); }
.stat-card.warning::before { background: var(--gradient-3); }
.stat-card.purple::before { background: var(--gradient-4); }

.stat-card .stat-icon {
    width: 32px; height: 32px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; margin-bottom: 6px;
}

.stat-card.accent .stat-icon { background: var(--accent-glow); color: var(--accent); }
.stat-card.success .stat-icon { background: var(--success-bg); color: var(--success); }
.stat-card.warning .stat-icon { background: var(--warning-bg); color: var(--warning); }
.stat-card.purple .stat-icon { background: var(--info-bg); color: var(--info); }

.stat-value {
    font-size: 19px; font-weight: 800; color: var(--text-primary);
    letter-spacing: -1px; line-height: 1.2; margin-bottom: 4px;
}

.stat-label {
    font-size: 12px; color: var(--text-muted); font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.5px;
}

/* ============ TABLES ============ */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
}

.table-container.flat {
    border: none;
    border-radius: 0;
}

.table-container.scroll-y {
    margin: 0;
    max-height: 400px;
    overflow-y: auto;
}

/* ============ VOUCHER: LOCATION SUGGEST MODAL (Create) ============ */
.loc-suggest-modal {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 740px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    padding: 0;
    color: var(--text-primary);
}
.loc-suggest-header {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.loc-suggest-title { margin: 0; font-size: 17px; font-weight: 750; letter-spacing: -0.2px; }
.loc-suggest-sub { margin: 4px 0 0 0; font-size: 13px; color: var(--text-muted); }
.loc-suggest-body {
    padding: 16px 20px;
    overflow-y: auto;
    max-height: calc(80vh - 132px);
}
.loc-suggest-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.loc-suggest-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}
.loc-suggest-close:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }
.loc-suggest-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.loc-suggest-table thead th {
    padding: 10px;
    text-align: left;
    font-weight: 750;
    font-size: 11px;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255,255,255,0.10);
    background: rgba(0,0,0,0.08);
}
.loc-suggest-table tbody td { padding: 10px; border-bottom: 1px solid rgba(255,255,255,0.06); color: var(--text-secondary); }
.loc-suggest-table tbody tr:hover { background: rgba(255,255,255,0.04); }
.loc-suggest-kpi { font-weight: 800; color: var(--success); }

table {
    width: 100%; border-collapse: collapse;
}

thead th {
    padding: 6px 8px;
    text-align: left;
    font-size: 11px; font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.8px;
    background: rgba(0,0,0,0.15);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 6px 8px;
    font-size: 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    vertical-align: middle;
}

tbody tr { transition: var(--transition); }
tbody tr:hover { background: var(--bg-card-hover); }
tbody tr:last-child td { border-bottom: none; }

.td-code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px; font-weight: 600;
    color: var(--accent);
}

.td-name { color: var(--text-primary); font-weight: 500; }
.td-number { text-align: right; font-variant-numeric: tabular-nums; }
.td-actions { white-space: nowrap; }

/* ============ BADGES ============ */
.badge {
    display: inline-flex; align-items: center;
    padding: 4px 10px; border-radius: 6px;
    font-size: 11px; font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-accent { background: var(--accent-glow); color: var(--accent); }
.badge-purple { background: rgba(168, 85, 247, 0.12); color: var(--purple); }

/* Clean “soft” badge style (for dashboard chips) */
.badge-soft-info {
    background: rgba(6, 182, 212, 0.10);
    color: var(--accent);
    border: 1px solid rgba(6, 182, 212, 0.35);
}

/* Ghost icon button (subtle) */
.btn-ghost {
    background: rgba(255,255,255,0.06);
    color: var(--text-secondary);
    border: 1px solid rgba(255,255,255,0.08);
}
.btn-ghost:hover {
    background: rgba(255,255,255,0.10);
    color: var(--text-primary);
    transform: translateY(-1px);
}

/* ============ CHIP / PILL (subtle) ============ */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.04);
    color: var(--text-secondary);
}
.chip i { opacity: 0.9; }
.chip-success { background: rgba(16,185,129,0.10); border-color: rgba(16,185,129,0.25); color: #a7f3d0; }
.chip-warning { background: rgba(245,158,11,0.10); border-color: rgba(245,158,11,0.25); color: #fde68a; }
.chip-danger  { background: rgba(239,68,68,0.10); border-color: rgba(239,68,68,0.25); color: #fecaca; }
.chip-info    { background: rgba(99,102,241,0.10); border-color: rgba(99,102,241,0.25); color: #c7d2fe; }

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 5px 8px; border-radius: 7px;
    font-size: 11px; font-weight: 600; font-family: inherit;
    border: 1px solid transparent;
    cursor: pointer; transition: var(--transition);
    text-decoration: none; line-height: 1.4;
}

.btn-primary {
    background: var(--accent); color: #0a0e1a;
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.25);
}
.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-input); color: var(--text-secondary);
    border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg-card-hover); color: var(--text-primary); border-color: var(--border-light); }

.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: rgba(239,68,68,0.2); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-success {
    background: var(--success);
    color: #fff;
    border-color: rgba(16,185,129,0.5);
    box-shadow: 0 2px 10px rgba(16,185,129,0.18);
}
.btn-success:hover {
    background: #0ea371;
    transform: translateY(-1px);
    box-shadow: 0 4px 18px rgba(16,185,129,0.28);
}

.btn-warning { background: var(--warning-bg); color: var(--warning); border-color: rgba(245,158,11,0.2); }

.btn-info {
    background: var(--info);
    color: #fff;
    border-color: rgba(99,102,241,0.5);
    box-shadow: 0 2px 10px rgba(99,102,241,0.18);
}
.btn-info:hover {
    background: #4f46e5;
    transform: translateY(-1px);
    box-shadow: 0 4px 18px rgba(99,102,241,0.28);
}

.btn-outline-primary {
    background: transparent;
    color: var(--accent);
    border-color: rgba(6, 182, 212, 0.35);
}
.btn-outline-primary:hover {
    background: var(--accent-glow);
    border-color: rgba(6, 182, 212, 0.6);
    transform: translateY(-1px);
}

.btn-sm { padding: 4px 7px; font-size: 10px; border-radius: 6px; }
.btn-lg { padding: 6px 10px; font-size: 11px; }
.btn-icon { padding: 8px; width: 36px; height: 36px; justify-content: center; }

/* ============ FORMS ============ */
.form-group { margin-bottom: 10px; }

.form-label {
    display: block;
    font-size: 12px; font-weight: 600; color: var(--text-secondary);
    margin-bottom: 6px; letter-spacing: 0.3px;
}

.form-control {
    width: 100%; padding: 5px 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px; font-family: inherit;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-control.is-valid {
    border-color: var(--success) !important;
    box-shadow: 0 0 0 3px var(--success-bg) !important;
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b95b0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control { min-height: 80px; resize: vertical; }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
}

/* ============ USER-FRIENDLY GUIDE BLOCKS ============ */
.user-guide {
    background: rgba(6, 182, 212, 0.08);
    border: 1px solid rgba(6, 182, 212, 0.28);
    border-radius: var(--radius);
    padding: 8px 10px;
    margin-bottom: 10px;
}
.user-guide-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 8px;
}
.user-guide-text {
    font-size: 13px;
    color: var(--text-secondary);
}
.step-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.step-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid var(--border-light);
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 600;
}

.table-actions {
    display: flex;
    gap: 6px;
    align-items: end;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.table-pagination {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 6px;
}

/* ============ FILTER BAR ============ */
.filter-bar {
    display: flex; gap: 6px; align-items: end;
    flex-wrap: wrap; margin-bottom: 10px;
    padding: 8px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.filter-bar .form-group { margin-bottom: 0; }
.filter-bar .form-control { min-width: 160px; }

/* Slightly tighter filters for “professional” look */
.filter-bar .btn { height: 30px; }
.filter-bar .form-control { height: 30px; }

/* ============ ALERTS / TOASTS ============ */
.alert {
    padding: 14px 18px; border-radius: var(--radius-sm);
    margin-bottom: 20px;
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; font-weight: 500;
    animation: slideDown 0.3s ease;
}

.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16,185,129,0.2); }
.alert-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }
.alert-info { background: var(--info-bg); color: var(--info); border: 1px solid rgba(99,102,241,0.2); }

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

/* ============ GRID LAYOUTS ============ */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* ============ MODAL ============ */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center; justify-content: center;
}

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

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%; max-width: 520px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.25s ease;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}

.modal-title { font-size: 16px; font-weight: 700; }

.modal-close {
    background: none; border: none;
    color: var(--text-muted); font-size: 20px;
    cursor: pointer; padding: 4px;
}

.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center; padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }
.empty-state .empty-text { font-size: 15px; margin-bottom: 8px; }
.empty-state .empty-sub { font-size: 12px; }

/* ============ DETAIL ITEMS ============ */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.detail-item {
    padding: 14px 16px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.detail-label {
    font-size: 11px; font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 15px; font-weight: 600;
    color: var(--text-primary);
}

/* ============ CHART WRAPPER ============ */
.chart-container {
    height: 300px; position: relative;
}

/* ============ SWEETALERT2 THEME (DARK) ============ */
.swal2-popup.swal-dark {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-lg) !important;
    color: var(--text-primary) !important;
}
.swal2-popup.swal-dark .swal2-title { color: var(--text-primary) !important; }
.swal2-popup.swal-dark .swal2-html-container { color: var(--text-secondary) !important; }
.swal2-popup.swal-dark .swal2-confirm,
.swal2-popup.swal-dark .swal2-cancel { border-radius: 10px !important; font-weight: 700 !important; }

/* ============ UTILITIES ============ */
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-accent { color: var(--accent) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

/* ============ LOGIN PAGE ============ */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-primary);
    background-image: radial-gradient(ellipse at 50% 0%, rgba(6,182,212,0.08) 0%, transparent 60%);
}

.login-card {
    width: 100%; max-width: 460px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center; margin-bottom: 20px;
}

.login-logo .logo-icon {
    width: 64px; height: 64px;
    background: transparent;
    border-radius: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.login-logo h1 {
    font-size: 24px; font-weight: 700; color: var(--text-primary);
}

.login-logo p {
    font-size: 12px; color: var(--text-muted); margin-top: 3px;
}

/* ============ AUDIT TRAILS ENHANCED ============ */
.audit-detail-table {
    width: 100%; border-collapse: separate; border-spacing: 0;
    margin-top: 10px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); overflow: hidden;
}

.audit-detail-table th {
    background: rgba(0,0,0,0.1); padding: 10px 14px;
    font-size: 11px; color: var(--text-muted);
    border-bottom: 1px solid var(--border); text-align: left;
}

.audit-detail-table td {
    padding: 10px 14px; font-size: 13px;
    border-bottom: 1px solid var(--border);
}

.audit-detail-table tr:last-child td { border-bottom: none; }

.audit-old-val { color: var(--danger); text-decoration: line-through; opacity: 0.7; font-size: 12px; }
.audit-new-val { color: var(--success); font-weight: 600; }
.audit-no-change { color: var(--text-muted); font-style: italic; }

.btn-audit {
    background: var(--gradient-1); color: #fff;
    border: none; padding: 6px 12px; border-radius: 6px;
    font-size: 11px; font-weight: 700; cursor: pointer;
    transition: var(--transition); text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-audit:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3); }

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ============ MOBILE NAVIGATION ============ */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1100;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--accent);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: var(--accent-glow);
    border-color: var(--accent);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); width: 280px; }
    .sidebar.open { transform: translateX(0); box-shadow: 20px 0 50px rgba(0,0,0,0.5); }
    .sidebar-toggle { display: flex; }
    .main-content { margin-left: 0; padding: 60px 16px 24px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .stats-grid { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* ============ WMS ADVANCED VISUALIZATION ============ */

/* Legend */
.wms-legend {
    display: flex; gap: 20px; margin-bottom: 24px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    flex-wrap: wrap; align-items: center;
}
.wms-legend-title {
    font-weight: 700; font-size: 12px;
    color: var(--text-muted); text-transform: uppercase;
    letter-spacing: 0.5px; margin-right: 10px;
}
.legend-item {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; color: var(--text-secondary);
}
.legend-color {
    width: 20px; height: 20px;
    border-radius: 4px; border: 1px solid var(--border);
}
.legend-empty { background: #4b5563; }
.legend-normal { background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); }
.legend-warning { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2); }
.legend-danger { background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2); }

/* Search & Filter Bar */
.wms-toolbar {
    display: flex; gap: 12px; margin-bottom: 20px;
    flex-wrap: wrap; align-items: center;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.wms-search-input {
    flex: 1; min-width: 250px;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    transition: var(--transition);
}
.wms-search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.wms-filter-btn {
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition);
}
.wms-filter-btn:hover,
.wms-filter-btn.active {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
}

/* Rack Container */
.wms-rack-section {
    margin-bottom: 32px;
}
.wms-rack-title {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 16px; padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
    font-size: 16px; font-weight: 700;
    color: var(--text-primary);
}
.wms-rack-title i {
    font-size: 20px; color: var(--accent);
}

/* Grid Container - 6×10 */
.wms-grid-container {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 8px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

/* Grid Cell / Location */
.wms-grid-cell {
    background: #4b5563;
    border: 1px solid #374060;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    padding: 8px 12px;
    font-size: 11px;
    overflow: hidden;
}
.wms-grid-cell:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border-color: var(--text-secondary);
}

/* Cell Status - Empty (0%) */
.wms-grid-cell.empty {
    background: #4b5563;
    color: #8b95b0;
}
.wms-grid-cell.empty:hover {
    background: #556273;
    border-color: #8b95b0;
}

/* Cell Status - Normal (1-70%) */
.wms-grid-cell.normal {
    background: #10b981;
    color: #e8ecf4;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}
.wms-grid-cell.normal:hover {
    background: #059669;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.4), 0 4px 12px rgba(16, 185, 129, 0.15);
}

/* Cell Status - Warning (70-90%) */
.wms-grid-cell.warning {
    background: #f59e0b;
    color: #1a1f35;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}
.wms-grid-cell.warning:hover {
    background: #d97706;
    color: #e8ecf4;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.4), 0 4px 12px rgba(245, 158, 11, 0.15);
}

/* Cell Status - Danger (>90%) */
.wms-grid-cell.danger {
    background: #ef4444;
    color: #e8ecf4;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
    animation: pulse-danger 2s infinite;
}
.wms-grid-cell.danger:hover {
    background: #dc2626;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.4), 0 4px 12px rgba(239, 68, 68, 0.15);
}

/* Cell Content */
.wms-cell-code {
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 2px;
}
.wms-cell-qty {
    font-size: 10px;
    opacity: 0.8;
}
.wms-cell-percent {
    font-size: 9px;
    opacity: 0.7;
    margin-top: 2px;
}
.wms-cell-icon {
    font-size: 14px;
    margin-bottom: 2px;
}
.wms-cell-highlight {
    border: 2px solid #06b6d4;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.3), inset 0 0 0 3px rgba(6, 182, 212, 0.1);
}

.wms-custom-area-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    min-width: 220px;
    font-size: 13px;
    color: var(--text-secondary);
}
.wms-custom-area-title {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.wms-custom-area-detail {
    margin-top: 2px;
}

/* Tooltip */
.wms-tooltip {
    position: absolute;
    bottom: 105%;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1f35;
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    border: 1px solid var(--border);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 100;
}
.wms-grid-cell:hover .wms-tooltip {
    opacity: 1;
}

/* Liquid Storage Area */
.wms-liquid-section {
    margin-top: 32px;
}
.wms-tanks-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

/* Tank Card */
.wms-tank-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: var(--transition);
    cursor: pointer;
}
.wms-tank-card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-md);
}

/* Tank Visualization */
.wms-tank-visual {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: flex-end;
}
.wms-tank-cylinder {
    flex: 1;
    height: 120px;
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid var(--border);
    border-radius: 8px 8px 0 0;
    position: relative;
    overflow: hidden;
}
.wms-tank-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to right, #06b6d4 0%, #0891b2 100%);
    width: 100%;
    transition: height 0.3s ease;
    opacity: 0.8;
}
.wms-tank-fill.warning {
    background: linear-gradient(to right, #f59e0b 0%, #d97706 100%);
}
.wms-tank-fill.danger {
    background: linear-gradient(to right, #ef4444 0%, #dc2626 100%);
    animation: pulse-danger 2s infinite;
}

.wms-tank-label {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 10px;
    color: var(--text-muted);
    align-self: flex-end;
    height: 120px;
    display: flex;
    align-items: flex-end;
    padding: 4px;
}

/* Tank Info */
.wms-tank-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.wms-tank-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.wms-tank-id {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
}
.wms-tank-badge {
    background: var(--accent-glow);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

/* Progress Bar */
.wms-progress-bar {
    display: flex;
    gap: 8px;
    align-items: center;
}
.wms-progress-track {
    flex: 1;
    height: 6px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.wms-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #06b6d4 100%);
    border-radius: 3px;
    transition: width 0.3s ease;
}
.wms-progress-fill.warning {
    background: linear-gradient(90deg, #f59e0b 0%, #f97316 100%);
}
.wms-progress-fill.danger {
    background: linear-gradient(90deg, #ef4444 0%, #ea580c 100%);
}
.wms-progress-percent {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 35px;
    text-align: right;
}

.wms-tank-detail {
    font-size: 12px;
    color: var(--text-secondary);
}
.wms-tank-detail strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Room Label - Levels */
.wms-level-labels {
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    letter-spacing: 0.5px;
}
.wms-level-label {
    padding: 0;
}

/* Modal Details */
.wms-modal-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.wms-detail-item {
    padding: 12px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.wms-detail-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 4px;
}
.wms-detail-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 600;
}

/* Animations */
@keyframes pulse-danger {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Responsive */
@media (max-width: 1400px) {
    .wms-grid-container {
        grid-template-columns: repeat(8, 1fr);
    }
}
@media (max-width: 1000px) {
    .wms-grid-container {
        grid-template-columns: repeat(6, 1fr);
    }
}
@media (max-width: 768px) {
    .wms-grid-container {
        grid-template-columns: repeat(4, 1fr);
    }
    .wms-toolbar {
        flex-direction: column;
    }
    .wms-search-input {
        min-width: 100%;
    }
}
@media (max-width: 480px) {
    .wms-grid-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Hide spinner arrows for number inputs */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* ============ PRINT STYLESHEET ============ */
@media print {
    /* Hide non-content elements */
    .sidebar,
    .sidebar-overlay,
    .sidebar-toggle,
    .alert,
    .filter-bar,
    .page-header .btn,
    .table-actions,
    .btn-group,
    .no-print,
    form[action*="Logout"],
    nav,
    footer {
        display: none !important;
    }

    /* Full-width main content */
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    /* White background for paper */
    body,
    html,
    .main-content,
    .card {
        background: #fff !important;
        color: #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Clean table styling for print */
    .table {
        border: 1px solid #ccc !important;
    }
    .table th {
        background: #e5e7eb !important;
        color: #000 !important;
        border: 1px solid #ccc !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .table td {
        border: 1px solid #ccc !important;
        color: #000 !important;
    }

    /* Keep page header title visible */
    .page-header {
        border: none !important;
        padding-bottom: 8px !important;
        margin-bottom: 16px !important;
    }
    .page-title {
        color: #000 !important;
        font-size: 20px !important;
    }

    /* Badge colors for print */
    .badge {
        border: 1px solid #999 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Detail grid clean print */
    .detail-item {
        background: #f9fafb !important;
        border: 1px solid #d1d5db !important;
    }
    .detail-label { color: #6b7280 !important; }
    .detail-value { color: #111827 !important; }

    /* Card styling */
    .card {
        border: 1px solid #d1d5db !important;
        box-shadow: none !important;
    }

    /* Remove animations */
    * {
        animation: none !important;
        transition: none !important;
    }

    /* Page break control */
    .card, .table { page-break-inside: avoid; }
    h1, h2, h3 { page-break-after: avoid; }

    /* ===== PRINT VOUCHER: Company Header ===== */
    .print-header {
        display: flex !important;
        justify-content: space-between;
        align-items: flex-start;
        border-bottom: 2px solid #000;
        padding-bottom: 12px;
        margin-bottom: 16px;
    }
    .print-company-name {
        font-size: 18px;
        font-weight: 800;
        color: #000;
    }
    .print-company-info {
        font-size: 11px;
        color: #555;
        margin-top: 2px;
    }
    .print-voucher-title {
        text-align: right;
    }
    .print-title {
        font-size: 20px;
        font-weight: 800;
        color: #000;
        text-transform: uppercase;
    }
    .print-code {
        font-size: 13px;
        font-weight: 600;
        color: #333;
        margin-top: 2px;
    }
    .print-date {
        font-size: 12px;
        color: #555;
    }

    /* ===== PRINT VOUCHER: Signature Block ===== */
    .print-signatures {
        display: block !important;
        page-break-inside: avoid;
    }
    .print-signatures table {
        border: none !important;
    }
    .print-signatures td {
        border: none !important;
        color: #000 !important;
    }

    /* Hide user-guide blocks when printing */
    .user-guide,
    .step-list {
        display: none !important;
    }
}

/* ===== ON-SCREEN: Hide print-only elements ===== */
.print-header {
    display: none;
}
.print-signatures {
    display: none;
}