/* ===== Universal Store POS - design tokens ===== */
:root {
    --pos-primary: #2563eb;
    --pos-primary-dark: #1d4ed8;
    --pos-primary-soft: #eaf1ff;
    --pos-bg: #f4f6fa;
    --pos-surface: #ffffff;
    --pos-border: #e5e9f0;
    --pos-text: #1f2937;
    --pos-muted: #6b7280;
    --pos-sidebar-w: 248px;
    --pos-sidebar-w-collapsed: 72px;
    --pos-radius: 12px;
    --pos-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);

    --bs-primary: var(--pos-primary);
    --bs-primary-rgb: 37, 99, 235;
    --bs-body-bg: var(--pos-bg);
    --bs-body-color: var(--pos-text);
    --bs-border-color: var(--pos-border);
    --bs-border-radius: 8px;
    --bs-link-color: var(--pos-primary);
    --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-body-font-size: .92rem;
}

body { background: var(--pos-bg); }
.min-w-0 { min-width: 0; }

.btn-primary {
    --bs-btn-bg: var(--pos-primary); --bs-btn-border-color: var(--pos-primary);
    --bs-btn-hover-bg: var(--pos-primary-dark); --bs-btn-hover-border-color: var(--pos-primary-dark);
    --bs-btn-active-bg: var(--pos-primary-dark); --bs-btn-active-border-color: var(--pos-primary-dark);
    --bs-btn-disabled-bg: var(--pos-primary); --bs-btn-disabled-border-color: var(--pos-primary);
}
.btn-light { --bs-btn-bg: #f1f4f9; --bs-btn-border-color: #f1f4f9; --bs-btn-hover-bg: #e5eaf2; --bs-btn-hover-border-color: #e5eaf2; }
.btn-icon { border: 0; background: transparent; padding: .25rem .5rem; color: var(--pos-text); }
.btn-icon:hover { background: #eef1f6; }
.form-control:focus, .form-select:focus { border-color: var(--pos-primary); box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .15); }
.form-check-input:checked { background-color: var(--pos-primary); border-color: var(--pos-primary); }
.form-label { font-weight: 500; font-size: .85rem; margin-bottom: .3rem; }

/* ===== App shell ===== */
.app-shell { min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--pos-sidebar-w); z-index: 1040;
    background: var(--pos-surface); border-right: 1px solid var(--pos-border);
    display: flex; flex-direction: column; transition: width .2s ease, transform .2s ease;
}
.app-main { margin-left: var(--pos-sidebar-w); min-height: 100vh; display: flex; flex-direction: column; transition: margin .2s ease; }
.sidebar-collapsed .sidebar { width: var(--pos-sidebar-w-collapsed); }
.sidebar-collapsed .app-main { margin-left: var(--pos-sidebar-w-collapsed); }

.sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: 1rem 1.1rem; height: 64px; text-decoration: none; color: var(--pos-text); font-weight: 700; border-bottom: 1px solid var(--pos-border); }
.brand-mark { flex: 0 0 38px; height: 38px; border-radius: 10px; background: var(--pos-primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem; }
.brand-mark-lg { width: 56px; height: 56px; font-size: 1.6rem; border-radius: 14px; }
.brand-logo { flex: 0 0 38px; width: 38px; height: 38px; object-fit: contain; border-radius: 8px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: .75rem .75rem 1rem; }
.nav-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #9aa3b2; font-weight: 600; padding: 1rem .75rem .35rem; white-space: nowrap; }
.nav-link-item {
    display: flex; align-items: center; gap: .75rem; padding: .55rem .75rem; margin-bottom: 2px;
    border-radius: 9px; color: #4b5563; text-decoration: none; font-weight: 500; white-space: nowrap;
}
.nav-link-item i { font-size: 1.1rem; flex: 0 0 22px; text-align: center; }
.nav-link-item:hover { background: #f1f4f9; color: var(--pos-text); }
.nav-link-item.active { background: var(--pos-primary-soft); color: var(--pos-primary); }
.nav-link-item.disabled { opacity: .55; cursor: not-allowed; }
.nav-link-item.disabled:hover { background: transparent; }
.soon-badge { margin-left: auto; background: #eef1f6; color: #6b7280; font-weight: 600; font-size: .62rem; }

.sidebar-collapsed .brand-text, .sidebar-collapsed .nav-label, .sidebar-collapsed .nav-section { display: none; }
.sidebar-collapsed .sidebar-brand { justify-content: center; padding-inline: 0; }
.sidebar-collapsed .nav-link-item { justify-content: center; padding-inline: 0; }

.topbar { position: sticky; top: 0; z-index: 1020; height: 64px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--pos-border); display: flex; align-items: center; gap: .75rem; padding: 0 1.25rem; }
.topbar-title { font-weight: 600; }
.user-chip { display: flex; align-items: center; gap: .6rem; border: 0; background: transparent; padding: .25rem .5rem; }
.user-chip::after { margin-left: .25rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--pos-primary-soft); color: var(--pos-primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.app-content { padding: 1.5rem; flex: 1; }

.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); width: var(--pos-sidebar-w) !important; }
    .app-main, .sidebar-collapsed .app-main { margin-left: 0; }
    .sidebar-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .15); }
    .sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(17, 24, 39, .4); z-index: 1030; }
    .sidebar-collapsed .brand-text, .sidebar-collapsed .nav-label, .sidebar-collapsed .nav-section { display: initial; }
    .app-content { padding: 1rem; }
}

/* ===== Cards, tables ===== */
.card { border: 1px solid var(--pos-border); border-radius: var(--pos-radius); box-shadow: var(--pos-shadow); background: var(--pos-surface); }
.card-header { background: transparent; border-bottom: 1px solid var(--pos-border); font-weight: 600; padding: .9rem 1.1rem; }
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }
.page-title { font-size: 1.35rem; font-weight: 700; margin: 0; }

.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table thead th { background: #f8fafc; color: var(--pos-muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; border-bottom: 1px solid var(--pos-border); padding: .75rem 1rem; white-space: nowrap; }
.table tbody td { padding: .75rem 1rem; border-color: #eef1f6; }
.card > .table-responsive > .table > :last-child > tr:last-child > td { border-bottom: 0; }
.card > .table-responsive:first-child > .table thead th:first-child { border-top-left-radius: var(--pos-radius); }
.card > .table-responsive:first-child > .table thead th:last-child { border-top-right-radius: var(--pos-radius); }

/* ===== Stat cards ===== */
.stat-card { display: flex; align-items: center; gap: 1rem; background: var(--pos-surface); border: 1px solid var(--pos-border); border-radius: var(--pos-radius); box-shadow: var(--pos-shadow); padding: 1.1rem 1.2rem; text-decoration: none; color: inherit; height: 100%; }
.stat-link:hover { border-color: #c7d6f5; transform: translateY(-1px); transition: all .15s; color: inherit; }
.stat-icon { flex: 0 0 48px; height: 48px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.35rem; }
.stat-label { font-size: .78rem; color: var(--pos-muted); font-weight: 500; }
.stat-value { font-size: 1.45rem; font-weight: 700; line-height: 1.25; }
.stat-hint { font-size: .75rem; color: var(--pos-muted); }
.tone-primary .stat-icon { background: #eaf1ff; color: #2563eb; }
.tone-indigo .stat-icon { background: #eceafe; color: #5b4bd8; }
.tone-teal .stat-icon { background: #e1f6f3; color: #0d9488; }
.tone-amber .stat-icon { background: #fff4de; color: #d97706; }
.tone-success .stat-icon { background: #e3f6ea; color: #16a34a; }
.tone-danger .stat-icon { background: #fde8e8; color: #dc2626; }

/* ===== Soft badges ===== */
.text-bg-success-soft { background: #e3f6ea; color: #15803d; }
.text-bg-warning-soft { background: #fff4de; color: #b45309; }
.text-bg-danger-soft { background: #fde8e8; color: #b91c1c; }
.text-bg-secondary-soft { background: #eef1f6; color: #6b7280; }
.text-bg-primary-soft { background: var(--pos-primary-soft); color: var(--pos-primary); }
.badge { font-weight: 600; }

/* ===== Settings tabs, modals, toasts ===== */
.settings-tabs { border-bottom: 1px solid var(--pos-border); gap: .25rem; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
.settings-tabs .nav-link { border: 0; color: var(--pos-muted); font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; }
.settings-tabs .nav-link.active { color: var(--pos-primary); background: transparent; border-bottom-color: var(--pos-primary); }
.modal-content { border: 0; border-radius: 14px; box-shadow: 0 20px 50px rgba(16, 24, 40, .2); }
.modal-header, .modal-footer { border-color: var(--pos-border); }
.confirm-icon { width: 52px; height: 52px; border-radius: 50%; background: #fde8e8; color: #dc2626; display: inline-flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.toast { border: 0; border-radius: 10px; box-shadow: 0 8px 24px rgba(16, 24, 40, .18); }
#toastContainer { z-index: 2000; }

/* ===== Login ===== */
.guest-body { background: linear-gradient(135deg, #eaf1ff 0%, #f4f6fa 55%, #ffffff 100%); }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem;
background: #1b4366;
background: linear-gradient(135deg, #1b4366 0%, #0a3779 50%, #052640 100%);}
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; padding: 2rem; box-shadow: 0 20px 50px rgba(16, 24, 40, .12); border: 1px solid var(--pos-border); }
.login-logo { max-height: 64px; max-width: 180px; object-fit: contain; }

@media print { .sidebar, .topbar, .page-header .btn, .sidebar-backdrop { display: none !important; } .app-main { margin: 0 !important; } }
