/* ============================================================
   TokuKu — Global Stylesheet
   Tech-inspired Computer Store Inventory System
   Supports Light & Dark Mode
   ============================================================ */

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

/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
    /* Light Mode Colors */
    --bg-app:         #f1f5f9;
    --bg-surface:     #ffffff;
    --bg-surface-2:   #f8fafc;
    --bg-surface-3:   #f1f5f9;
    --bg-hover:       #f1f5f9;
    --bg-active:      #eff6ff;

    --border:         #e2e8f0;
    --border-strong:  #cbd5e1;

    --text-primary:   #0f172a;
    --text-secondary: #475569;
    --text-muted:     #94a3b8;
    --text-inverse:   #ffffff;

    --primary:        #2563eb;
    --primary-light:  #eff6ff;
    --primary-dark:   #1d4ed8;
    --primary-rgb:    37, 99, 235;

    --success:        #16a34a;
    --success-light:  #f0fdf4;
    --warning:        #d97706;
    --warning-light:  #fffbeb;
    --danger:         #dc2626;
    --danger-light:   #fef2f2;
    --info:           #0891b2;
    --info-light:     #f0f9ff;

    /* Sidebar */
    --sidebar-bg:     #0f172a;
    --sidebar-text:   #94a3b8;
    --sidebar-active: #2563eb;
    --sidebar-hover:  rgba(255,255,255,0.06);
    --sidebar-width:  240px;
    --sidebar-label:  #334155;

    /* Navbar */
    --navbar-bg:      #ffffff;
    --navbar-border:  #e2e8f0;
    --navbar-height:  60px;

    /* Shadows */
    --shadow-sm:      0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:      0 4px 12px rgba(0,0,0,.08);
    --shadow-lg:      0 10px 30px rgba(0,0,0,.12);
    --shadow-xl:      0 20px 40px rgba(0,0,0,.16);

    /* Radius */
    --radius-sm:      6px;
    --radius-md:      10px;
    --radius-lg:      14px;
    --radius-xl:      20px;
    --radius-full:    9999px;

    /* Transitions */
    --transition:     all 0.2s ease;
    --transition-slow:all 0.35s ease;

    /* Bottom nav */
    --bnav-height:    64px;
    --bnav-bg:        #ffffff;
}

/* ===== DARK MODE ===== */
[data-theme="dark"] {
    --bg-app:         #0a0f1e;
    --bg-surface:     #111827;
    --bg-surface-2:   #1a2234;
    --bg-surface-3:   #1e2a3a;
    --bg-hover:       #1e2a3a;
    --bg-active:      #1e3a5f;

    --border:         #1e2a3a;
    --border-strong:  #2d3748;

    --text-primary:   #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted:     #475569;
    --text-inverse:   #0f172a;

    --primary:        #3b82f6;
    --primary-light:  #1e3a5f;
    --primary-dark:   #2563eb;
    --primary-rgb:    59, 130, 246;

    --success:        #22c55e;
    --success-light:  #052e16;
    --warning:        #f59e0b;
    --warning-light:  #1c1206;
    --danger:         #ef4444;
    --danger-light:   #1c0606;
    --info:           #22d3ee;
    --info-light:     #032938;

    --sidebar-bg:     #070d1a;
    --sidebar-text:   #64748b;
    --sidebar-label:  #1e2a3a;

    --navbar-bg:      #111827;
    --navbar-border:  #1e2a3a;

    --shadow-sm:      0 1px 3px rgba(0,0,0,.3);
    --shadow-md:      0 4px 12px rgba(0,0,0,.4);
    --shadow-lg:      0 10px 30px rgba(0,0,0,.5);

    --bnav-bg:        #111827;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-app);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { opacity: 0.85; }
img { max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ===== NAVBAR ===== */
.navbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: var(--navbar-height);
    background: var(--navbar-bg);
    border-bottom: 1px solid var(--navbar-border);
    display: flex; align-items: center;
    padding: 0 1rem;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(12px);
}
.navbar-left { display: flex; align-items: center; gap: 0.75rem; }
.navbar-right { display: flex; align-items: center; gap: 0.75rem; }

.hamburger {
    width: 36px; height: 36px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 5px; background: none; border: none; border-radius: var(--radius-sm);
    padding: 6px; transition: var(--transition);
}
.hamburger:hover { background: var(--bg-hover); }
.hamburger span {
    display: block; width: 18px; height: 2px;
    background: var(--text-secondary); border-radius: 2px;
    transition: var(--transition);
}

.brand { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; }
.brand-icon { font-size: 1.3rem; }
.brand-name {
    font-size: 1.05rem; font-weight: 700; letter-spacing: -0.02em;
    color: var(--text-primary);
}

.theme-toggle {
    width: 36px; height: 36px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--bg-surface);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; transition: var(--transition);
}
.theme-toggle:hover { background: var(--bg-hover); border-color: var(--border-strong); }
[data-theme="light"] .theme-icon-dark  { display: none; }
[data-theme="dark"]  .theme-icon-light { display: none; }

.navbar-user { display: flex; flex-direction: column; align-items: flex-end; }
.user-name-nav { font-size: 0.78rem; font-weight: 600; color: var(--text-primary); line-height: 1.2; }
.role-badge-nav {
    font-size: 0.65rem; font-weight: 500; color: var(--primary);
    background: var(--primary-light); padding: 1px 6px;
    border-radius: var(--radius-full); line-height: 1.6;
}
@media (max-width: 480px) { .navbar-user { display: none; } }

.user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff; font-weight: 700; font-size: 0.85rem;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; user-select: none; position: relative;
    box-shadow: 0 0 0 2px var(--primary-light);
}
.user-dropdown {
    position: absolute; top: calc(var(--navbar-height) + 4px); right: 1rem;
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    min-width: 200px; overflow: hidden; z-index: 200;
    opacity: 0; transform: translateY(-6px);
    pointer-events: none; transition: var(--transition);
}
.user-dropdown.open { opacity: 1; transform: translateY(0); pointer-events: all; }
.dropdown-header { display: flex; align-items: center; gap: 0.75rem; padding: 0.875rem 1rem; background: var(--bg-surface-2); }
.dropdown-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.dropdown-name { font-weight: 600; font-size: 0.875rem; color: var(--text-primary); }
.dropdown-role { font-size: 0.72rem; color: var(--text-muted); }
.dropdown-divider { height: 1px; background: var(--border); }
.dropdown-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.625rem 1rem; color: var(--text-secondary); font-size: 0.875rem; transition: var(--transition); }
.dropdown-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.dropdown-logout { color: var(--danger) !important; }

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed; top: var(--navbar-height); left: 0; bottom: 0; z-index: 90;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid rgba(255,255,255,0.04);
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; flex-direction: column;
    overflow: hidden;
}
.sidebar.open { transform: translateX(0); box-shadow: var(--shadow-xl); }
.sidebar-inner { display: flex; flex-direction: column; height: 100%; overflow-y: auto; }
.sidebar-inner::-webkit-scrollbar { width: 4px; }
.sidebar-inner::-webkit-scrollbar-track { background: transparent; }
.sidebar-inner::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.sidebar-nav { flex: 1; padding: 0.75rem 0; }
.nav-section-label {
    font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em;
    color: var(--sidebar-label); padding: 0.875rem 1.25rem 0.375rem;
    text-transform: uppercase;
}
.nav-item {
    display: flex; align-items: center; gap: 0.625rem;
    padding: 0.6rem 1.25rem; color: var(--sidebar-text);
    font-size: 0.85rem; font-weight: 500; border-radius: 0;
    transition: var(--transition); position: relative;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active {
    background: rgba(37,99,235,0.15); color: #fff;
    font-weight: 600;
}
.nav-item.active::before {
    content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 60%; background: var(--primary);
    border-radius: 0 2px 2px 0;
}
.nav-icon { font-size: 1rem; width: 1.25rem; text-align: center; flex-shrink: 0; }

.sidebar-footer {
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-logout {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.6rem 0.75rem; border-radius: var(--radius-md);
    color: var(--danger); font-size: 0.85rem; font-weight: 500;
    transition: var(--transition);
}
.sidebar-logout:hover { background: rgba(220,38,38,0.1); opacity: 1; }

.sidebar-overlay {
    position: fixed; inset: 0; z-index: 89;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity 0.28s ease;
}
.sidebar-overlay.active { opacity: 1; pointer-events: all; }

/* ===== MAIN LAYOUT ===== */
.main-wrapper {
    margin-top: var(--navbar-height);
    transition: margin-left 0.28s cubic-bezier(0.4,0,0.2,1);
    min-height: calc(100vh - var(--navbar-height));
}
@media (min-width: 961px) {
    .main-wrapper.sidebar-expanded { margin-left: var(--sidebar-width); }
}
.page-content {
    padding: 1.5rem 1.5rem calc(var(--bnav-height) + 1rem);
    max-width: 1400px;
}
@media (min-width: 769px) { .page-content { padding-bottom: 2rem; } }

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1.5rem; flex-wrap: wrap; gap: 0.75rem;
}
.page-title { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text-primary); }
.page-subtitle { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.125rem; }

/* ===== CARDS ===== */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
    background: var(--bg-surface-2);
}
.card-title { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.card-body { padding: 1.25rem; }
.card-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--bg-surface-2);
    font-size: 0.8rem; color: var(--text-muted);
}

/* ===== STAT CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex; flex-direction: column; gap: 0.5rem;
    box-shadow: var(--shadow-sm);
    position: relative; overflow: hidden;
    transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-card::before {
    content: ''; position: absolute;
    top: 0; left: 0; right: 0; height: 3px;
    background: var(--stat-color, var(--primary));
}
.stat-icon { font-size: 1.5rem; }
.stat-value { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.03em; color: var(--text-primary); }
.stat-label { font-size: 0.75rem; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-change { font-size: 0.72rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.25rem; }

.stat-blue   { --stat-color: #2563eb; }
.stat-green  { --stat-color: #16a34a; }
.stat-orange { --stat-color: #d97706; }
.stat-red    { --stat-color: #dc2626; }
.stat-purple { --stat-color: #7c3aed; }
.stat-cyan   { --stat-color: #0891b2; }

/* ===== GRID LAYOUTS ===== */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 768px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

/* ===== FORMS ===== */
.form-group { margin-bottom: 1rem; }
.form-label {
    display: block; margin-bottom: 0.375rem;
    font-size: 0.8rem; font-weight: 600;
    color: var(--text-secondary); letter-spacing: 0.02em;
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-control {
    width: 100%; padding: 0.55rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: var(--transition);
    outline: none;
    -webkit-appearance: none;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:disabled { background: var(--bg-surface-3); color: var(--text-muted); cursor: not-allowed; }
textarea.form-control { min-height: 90px; resize: vertical; }
select.form-control { cursor: pointer; }

.input-group { position: relative; display: flex; }
.input-group .form-control { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.input-group-btn {
    padding: 0.55rem 0.875rem;
    border: 1px solid var(--border); border-left: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    background: var(--bg-surface-2); color: var(--text-secondary);
    font-size: 0.875rem; transition: var(--transition);
}
.input-group-btn:hover { background: var(--bg-hover); color: var(--primary); }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}
.form-hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.25rem; }
.form-error { font-size: 0.72rem; color: var(--danger); margin-top: 0.25rem; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex; align-items: center; gap: 0.375rem;
    padding: 0.5rem 1rem; border-radius: var(--radius-md);
    font-size: 0.825rem; font-weight: 600;
    border: 1px solid transparent; cursor: pointer;
    transition: var(--transition); text-decoration: none;
    white-space: nowrap; line-height: 1.4;
    -webkit-appearance: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 0.3rem 0.625rem; font-size: 0.75rem; }
.btn-lg { padding: 0.7rem 1.5rem; font-size: 0.95rem; }

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); opacity: 1; }
.btn-secondary { background: var(--bg-surface); color: var(--text-secondary); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-strong); color: var(--text-primary); opacity: 1; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { filter: brightness(0.9); opacity: 1; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { filter: brightness(0.9); opacity: 1; }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-warning:hover { filter: brightness(0.9); opacity: 1; }
.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); opacity: 1; }
.btn-outline-primary { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; opacity: 1; }

.btn-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ===== TABLES ===== */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-surface);
}
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
thead { background: var(--bg-surface-2); }
th {
    padding: 0.75rem 1rem; text-align: left;
    font-size: 0.72rem; font-weight: 700;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: var(--bg-hover); }

.td-bold { font-weight: 600; color: var(--text-primary) !important; }
.td-mono { font-family: 'Courier New', monospace; font-size: 0.78rem; }
.td-nowrap { white-space: nowrap; }
.td-center { text-align: center; }
.td-right { text-align: right; }

/* ===== BADGES ===== */
.badge {
    display: inline-flex; align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-full);
    font-size: 0.7rem; font-weight: 600; letter-spacing: 0.03em;
    white-space: nowrap;
}
.badge-success  { background: var(--success-light); color: var(--success); }
.badge-danger   { background: var(--danger-light);  color: var(--danger); }
.badge-warning  { background: var(--warning-light); color: var(--warning); }
.badge-info     { background: var(--info-light);    color: var(--info); }
.badge-primary  { background: var(--primary-light); color: var(--primary); }
.badge-muted    { background: var(--bg-surface-3);  color: var(--text-muted); }

/* ===== FLASH MESSAGES ===== */
.flash-message {
    display: flex; align-items: center; gap: 0.625rem;
    padding: 0.75rem 1rem; border-radius: var(--radius-md);
    margin-bottom: 1rem; font-size: 0.875rem; font-weight: 500;
    transition: opacity 0.5s ease;
}
.flash-success { background: var(--success-light); color: var(--success); border: 1px solid rgba(22,163,74,.2); }
.flash-error   { background: var(--danger-light);  color: var(--danger);  border: 1px solid rgba(220,38,38,.2); }
.flash-warning { background: var(--warning-light); color: var(--warning); border: 1px solid rgba(217,119,6,.2); }
.flash-info    { background: var(--info-light);    color: var(--info);    border: 1px solid rgba(8,145,178,.2); }

/* ===== FILTER BAR ===== */
.filter-bar {
    display: flex; gap: 0.625rem; flex-wrap: wrap;
    align-items: flex-end; margin-bottom: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.filter-group { display: flex; flex-direction: column; gap: 0.25rem; min-width: 140px; flex: 1; }
.filter-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.filter-bar .form-control { font-size: 0.825rem; padding: 0.45rem 0.75rem; }
.filter-actions { display: flex; gap: 0.5rem; align-items: flex-end; }

/* ===== TOASTS ===== */
.toast-container {
    position: fixed; bottom: calc(var(--bnav-height) + 1rem); right: 1rem;
    z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem;
}
@media (min-width: 769px) { .toast-container { bottom: 1rem; } }
.toast {
    display: flex; align-items: center; gap: 0.625rem;
    padding: 0.75rem 1rem; border-radius: var(--radius-md);
    background: var(--bg-surface); border: 1px solid var(--border);
    box-shadow: var(--shadow-lg); font-size: 0.85rem; font-weight: 500;
    min-width: 260px; max-width: 340px;
    opacity: 0; transform: translateX(16px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: var(--text-primary);
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast-success { border-color: var(--success); }
.toast-error   { border-color: var(--danger); }
.toast-warning { border-color: var(--warning); }
.toast-info    { border-color: var(--info); }
.toast-icon { font-size: 1.1rem; flex-shrink: 0; }

/* ===== MODALS ===== */
.modal-overlay {
    position: fixed; inset: 0; z-index: 500;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
    opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius-xl); box-shadow: var(--shadow-xl);
    width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
    transform: scale(0.95); transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 1000px; }
.modal-header {
    padding: 1.125rem 1.375rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    background: var(--bg-surface-2);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.modal-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.modal-close {
    width: 30px; height: 30px; border: none; background: none;
    color: var(--text-muted); font-size: 1.25rem;
    border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-body { padding: 1.375rem; }
.modal-footer {
    padding: 0.875rem 1.375rem; border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 0.5rem;
    background: var(--bg-surface-2);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center; padding: 3rem 1rem;
    display: flex; flex-direction: column; align-items: center; gap: 0.75rem;
}
.empty-icon { font-size: 3rem; opacity: 0.4; }
.empty-title { font-size: 1rem; font-weight: 600; color: var(--text-secondary); }
.empty-desc { font-size: 0.825rem; color: var(--text-muted); max-width: 300px; }

/* ===== PAGINATION ===== */
.pagination { display: flex; align-items: center; gap: 0.375rem; flex-wrap: wrap; }
.page-btn {
    min-width: 32px; height: 32px; padding: 0 0.5rem;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg-surface); color: var(--text-secondary);
    font-size: 0.825rem; font-weight: 500; display: inline-flex;
    align-items: center; justify-content: center;
    transition: var(--transition); cursor: pointer; text-decoration: none;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); opacity: 1; }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== BOTTOM NAV (mobile) ===== */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 80;
    height: var(--bnav-height);
    background: var(--bnav-bg);
    border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-around;
    padding: 0 0.5rem;
    box-shadow: 0 -4px 20px rgba(0,0,0,.08);
}
@media (min-width: 769px) { .bottom-nav { display: none; } }
.bnav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 2px; padding: 0.5rem 0.25rem;
    text-decoration: none; color: var(--text-muted);
    transition: var(--transition); border-radius: var(--radius-md);
}
.bnav-item.active { color: var(--primary); }
.bnav-item:hover { color: var(--primary); opacity: 1; }
.bnav-icon { font-size: 1.25rem; line-height: 1; }
.bnav-label { font-size: 0.62rem; font-weight: 600; letter-spacing: 0.02em; }
.bnav-fab {
    background: var(--primary); color: #fff !important;
    border-radius: var(--radius-lg); min-width: 52px;
    box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.4);
}
.bnav-fab-btn { font-size: 1.4rem; }

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--bg-app); padding: 1rem;
    background-image: radial-gradient(ellipse at 20% 50%, rgba(var(--primary-rgb), 0.08) 0%, transparent 60%),
                      radial-gradient(ellipse at 80% 20%, rgba(var(--primary-rgb), 0.05) 0%, transparent 50%);
}
.login-card {
    width: 100%; max-width: 400px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}
.login-header {
    padding: 2rem 2rem 1.5rem;
    text-align: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}
.login-logo { font-size: 2.5rem; margin-bottom: 0.5rem; }
.login-app-name { font-size: 1.5rem; font-weight: 800; color: #fff; letter-spacing: -0.03em; }
.login-tagline { font-size: 0.8rem; color: rgba(255,255,255,0.75); margin-top: 0.25rem; }
.login-body { padding: 1.75rem 2rem 2rem; }
.login-title { font-size: 1rem; font-weight: 600; color: var(--text-primary); margin-bottom: 1.25rem; text-align: center; }

/* ===== CHART CONTAINER ===== */
.chart-container { position: relative; }
.chart-container canvas { max-height: 280px; }

/* ===== STOK INDICATORS ===== */
.stok-bar-wrap { background: var(--bg-surface-3); border-radius: var(--radius-full); height: 6px; width: 80px; overflow: hidden; }
.stok-bar { height: 100%; border-radius: var(--radius-full); transition: width 0.5s ease; }
.stok-bar.aman    { background: var(--success); }
.stok-bar.menipis { background: var(--warning); }
.stok-bar.habis   { background: var(--danger); }

/* ===== POS SPECIFIC ===== */
.pos-layout {
    display: grid; grid-template-columns: 1fr 360px; gap: 1rem;
    height: calc(100vh - var(--navbar-height) - 2rem);
}
@media (max-width: 900px) {
    .pos-layout { grid-template-columns: 1fr; height: auto; }
}
.pos-products { overflow-y: auto; }
.pos-cart {
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); display: flex; flex-direction: column;
    overflow: hidden;
}
.cart-header {
    padding: 1rem; border-bottom: 1px solid var(--border);
    background: var(--bg-surface-2);
}
.cart-title { font-size: 0.9rem; font-weight: 700; }
.cart-items { flex: 1; overflow-y: auto; padding: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }
.cart-item {
    display: flex; gap: 0.625rem; align-items: center;
    padding: 0.625rem; border-radius: var(--radius-md);
    background: var(--bg-surface-2); border: 1px solid var(--border);
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item-price { font-size: 0.72rem; color: var(--text-muted); }
.cart-qty { display: flex; align-items: center; gap: 0.375rem; flex-shrink: 0; }
.qty-btn {
    width: 24px; height: 24px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--bg-surface);
    color: var(--text-secondary); font-size: 0.875rem;
    display: flex; align-items: center; justify-content: center; transition: var(--transition);
}
.qty-btn:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.qty-num { font-size: 0.85rem; font-weight: 700; color: var(--text-primary); min-width: 20px; text-align: center; }
.cart-subtotal { font-size: 0.75rem; font-weight: 600; color: var(--primary); white-space: nowrap; }
.cart-remove { color: var(--danger); background: none; border: none; font-size: 1rem; line-height: 1; padding: 2px; cursor: pointer; opacity: 0.6; }
.cart-remove:hover { opacity: 1; }

.cart-empty {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 0.5rem; color: var(--text-muted); padding: 2rem;
}
.cart-empty-icon { font-size: 2.5rem; opacity: 0.3; }

.cart-footer {
    padding: 1rem; border-top: 1px solid var(--border);
    background: var(--bg-surface-2);
}
.cart-total-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.cart-total-label { font-size: 0.8rem; color: var(--text-muted); }
.cart-total-val { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.cart-grand { font-size: 1.1rem !important; font-weight: 800 !important; color: var(--primary) !important; }

.pos-search {
    display: flex; gap: 0.5rem; margin-bottom: 1rem;
    padding: 1rem; background: var(--bg-surface);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.pos-search .form-control { flex: 1; }

.pos-products-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.75rem;
}
.product-card {
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 0.875rem; cursor: pointer;
    transition: var(--transition); display: flex; flex-direction: column; gap: 0.375rem;
}
.product-card:hover { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1); transform: translateY(-1px); }
.product-card.out-of-stock { opacity: 0.45; cursor: not-allowed; }
.product-card-name { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.product-card-price { font-size: 0.75rem; font-weight: 700; color: var(--primary); }
.product-card-stok { font-size: 0.68rem; color: var(--text-muted); }

/* ===== RECEIPT / STRUK ===== */
.receipt {
    font-family: 'Courier New', monospace; font-size: 12px;
    width: 280px; margin: 0 auto; background: #fff; color: #000;
    padding: 12px; border-radius: 4px;
}
.receipt-title { text-align: center; font-weight: bold; font-size: 14px; }
.receipt-sub   { text-align: center; font-size: 11px; margin-bottom: 6px; }
.receipt-divider { border: none; border-top: 1px dashed #000; margin: 6px 0; }
.receipt-row { display: flex; justify-content: space-between; }
.receipt-total { font-weight: bold; font-size: 13px; }
@media print {
    /* Umum */
    @page { margin: 0; }
    body { background: #fff !important; margin: 0; padding: 0; }
    .sidebar, .navbar, .btn, .filter-bar, .page-header button { display: none !important; }
    .main-wrapper { margin-left: 0 !important; padding: 0 !important; }
    .page-content { margin: 0 !important; padding: 1cm !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd; }
    
    /* Khusus Struk Kasir POS */
    body.printing-pos { padding: 0 !important; }
    body.printing-pos .pos-layout, body.printing-pos .page-content, body.printing-pos .main-wrapper { display: none !important; }
    .receipt-wrapper {
        visibility: visible !important;
        position: absolute;
        top: 0; left: 0;
        width: 80mm; /* Standar Thermal 80mm */
        margin: 0; padding: 0 5mm 5mm 5mm;
        font-family: monospace;
        font-size: 12px;
        color: #000;
        page-break-after: always;
    }
}

/* ===== BARCODE SCANNER ===== */
#scanner-container { position: relative; overflow: hidden; border-radius: var(--radius-md); background: #000; }
#scanner-container video { width: 100%; display: block; }
#scanner-container canvas { display: none; }
.scanner-overlay {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
}
.scanner-line {
    position: absolute; left: 15%; right: 15%; height: 2px;
    background: var(--primary); box-shadow: 0 0 8px rgba(var(--primary-rgb), 0.8);
    animation: scanLine 2s infinite alternate ease-in-out;
}
@keyframes scanLine { from { top: 25%; } to { top: 75%; } }
.scanner-frame {
    width: 70%; aspect-ratio: 1.5; border: 2px solid rgba(255,255,255,0.4);
    border-radius: 8px; position: relative;
}
.scanner-frame::before, .scanner-frame::after,
.scanner-frame span::before, .scanner-frame span::after {
    content: ''; position: absolute; width: 20px; height: 20px;
    border-color: var(--primary); border-style: solid;
}
.scanner-frame::before  { top: -2px; left: -2px; border-width: 3px 0 0 3px; border-radius: 4px 0 0 0; }
.scanner-frame::after   { top: -2px; right: -2px; border-width: 3px 3px 0 0; border-radius: 0 4px 0 0; }
.scanner-frame span::before { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; border-radius: 0 0 0 4px; }
.scanner-frame span::after  { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; border-radius: 0 0 4px 0; }

/* ===== UTILITIES ===== */
.text-primary   { color: var(--primary) !important; }
.text-success   { color: var(--success) !important; }
.text-danger    { color: var(--danger) !important; }
.text-warning   { color: var(--warning) !important; }
.text-muted     { color: var(--text-muted) !important; }
.text-center    { text-align: center; }
.text-right     { text-align: right; }
.text-sm        { font-size: 0.8rem; }
.text-xs        { font-size: 0.72rem; }
.fw-600         { font-weight: 600; }
.fw-700         { font-weight: 700; }
.fw-800         { font-weight: 800; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex-wrap { flex-wrap: wrap; }
.w-100 { width: 100%; }
.d-none { display: none; }
.hidden { display: none !important; }

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    .page-content { padding: 1rem 0.875rem calc(var(--bnav-height) + 0.75rem); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-value { font-size: 1.25rem; }
    .filter-bar { flex-direction: column; }
    .filter-group { min-width: 100%; }
    .btn-group { gap: 0.375rem; }
}
/* ===== DATATABLES CUSTOM STYLE ===== */
.dataTables_wrapper { padding: 1rem; }
.dataTables_filter { margin-bottom: 1rem; }
.dataTables_filter input {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.4rem 0.8rem;
    outline: none;
    margin-left: 0.5rem;
}
.dataTables_filter input:focus { border-color: var(--primary); }
.dataTables_length select {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.2rem 0.5rem;
    margin: 0 0.5rem;
}
.dataTables_info { margin-top: 1rem; color: var(--text-muted); font-size: 0.9rem; }
.dataTables_paginate { margin-top: 1rem; }
.dataTables_paginate .paginate_button {
    padding: 0.3rem 0.8rem !important;
    margin: 0 0.2rem !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-md) !important;
    background: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    cursor: pointer;
}
.dataTables_paginate .paginate_button:hover {
    background: var(--bg-surface-2) !important;
    border-color: var(--border) !important;
    color: var(--text-primary) !important;
}
.dataTables_paginate .paginate_button.current {
    background: var(--primary) !important;
    color: #fff !important;
    border-color: var(--primary) !important;
}
table.dataTable thead th, table.dataTable tbody td {
    border-bottom: 1px solid var(--border) !important;
}
table.dataTable.no-footer { border-bottom: none !important; }
